mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Simplify help /cd, remove /cd tutorial, add /delay for usage in MBs
This commit is contained in:
parent
321e1da599
commit
e1eb6295bb
@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
public override CommandPerm[] ExtraPerms {
|
public override CommandPerm[] ExtraPerms {
|
||||||
get { return new[] {
|
get { return new[] {
|
||||||
new CommandPerm(LevelPermission.Operator, "+ can send the countdown rules to everybody"),
|
new CommandPerm(LevelPermission.Operator, "+ can send the countdown rules to everybody"),
|
||||||
new CommandPerm(LevelPermission.Operator, "+ can setup countdown (generate/start/restart/enable/disable/cancel)"),
|
new CommandPerm(LevelPermission.Operator, "+ can setup and manage countdown"),
|
||||||
}; }
|
}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +78,6 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
case "reset":
|
case "reset":
|
||||||
HandleReset(p, game, arg1); return;
|
HandleReset(p, game, arg1); return;
|
||||||
|
|
||||||
case "tutorial":
|
|
||||||
HandleTutorial(p); return;
|
|
||||||
default:
|
default:
|
||||||
Help(p); break;
|
Help(p); break;
|
||||||
}
|
}
|
||||||
@ -276,30 +274,22 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HandleTutorial(Player p) {
|
|
||||||
Player.Message(p, "First, generate the map using /cd generate");
|
|
||||||
Player.Message(p, "Next, type /cd enable to enable countdown");
|
|
||||||
Player.Message(p, "Next, type /cd join to join countdown, and tell other players to join");
|
|
||||||
Player.Message(p, "When some people have joined, type /cd start [speed] to start it");
|
|
||||||
Player.Message(p, "[speed] can be 'ultimate', 'extreme', 'fast', 'normal' or 'slow'");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "%T/cd joins/leave %H- joins/leaves the game");
|
Player.Message(p, "%T/cd joins/leave %H- joins/leaves the game");
|
||||||
Player.Message(p, "%T/cd players %H- lists players currently playing");
|
Player.Message(p, "%T/cd players %H- lists players currently playing");
|
||||||
Player.Message(p, "%T/cd rules %H- view the rules of countdown");
|
Player.Message(p, "%T/cd rules %H- view the rules of countdown");
|
||||||
if (CheckExtraPerm(p, 1)) {
|
if (CheckExtraPerm(p, 1)) {
|
||||||
Player.Message(p, "%T/cd rules [player] %H- sends rules of countdown to that player.");
|
Player.Message(p, "%T/cd rules [player] %H- sends rules to that player.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CheckExtraPerm(p, 2)) return;
|
if (!CheckExtraPerm(p, 2)) return;
|
||||||
Player.Message(p, "%T/cd generate [width] [height] [length] %H- generates the countdown map (default is 32x32x32)");
|
Player.Message(p, "%T/cd generate [width] [height] [length] %H- generates the countdown map (default is 32x32x32)");
|
||||||
Player.Message(p, "%T/cd enable/disable %H- enables/disables countdown");
|
Player.Message(p, "%T/cd enable/disable %H- enables/disables countdown");
|
||||||
Player.Message(p, "%T/cd start <speed> <mode> %H- starts a round of countdown");
|
Player.Message(p, "%T/cd start <speed> <mode> %H- starts a round of countdown");
|
||||||
Player.Message(p, "%H speed can be: slow/normal/fast/extreme/ultimate, mode can be: normal/freeze");
|
Player.Message(p, "%H speed can be: slow, normal, fast, extreme or ultimate");
|
||||||
|
Player.Message(p, "%H mode can be: normal or freeze");
|
||||||
Player.Message(p, "%T/cd end %H- force ends current round of countdown");
|
Player.Message(p, "%T/cd end %H- force ends current round of countdown");
|
||||||
Player.Message(p, "%T/cd reset %H- resets countdown map. Note %T/cd start %Hautomatically does this.");
|
Player.Message(p, "%T/cd reset %H- resets the map. Note %T/cd start %Hauto does this.");
|
||||||
Player.Message(p, "%T/cd tutorial %H- a tutorial on how to setup countdown");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
55
MCGalaxy/Commands/other/CmdDelay.cs
Normal file
55
MCGalaxy/Commands/other/CmdDelay.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 MCGalaxy
|
||||||
|
|
||||||
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
|
not use this file except in compliance with the Licenses. You may
|
||||||
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
|
http://www.osedu.org/licenses/ECL-2.0
|
||||||
|
http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
or implied. See the Licenses for the specific language governing
|
||||||
|
permissions and limitations under the Licenses.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace MCGalaxy.Commands.World {
|
||||||
|
public sealed class CmdDelay : Command {
|
||||||
|
public override string name { get { return "delay"; } }
|
||||||
|
public override string type { get { return CommandTypes.Other; } }
|
||||||
|
public override bool museumUsable { get { return true; } }
|
||||||
|
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||||
|
public override bool SuperUseable { get { return false; } }
|
||||||
|
|
||||||
|
public override void Use(Player p, string message) {
|
||||||
|
TimeSpan duration = TimeSpan.Zero;
|
||||||
|
if (!CommandParser.GetTimespan(p, message, ref duration, "wait for", 's')) return;
|
||||||
|
|
||||||
|
if (duration.TotalSeconds > 60) {
|
||||||
|
Player.Message(p, "Can only wait for a minute at most."); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Interlocked.CompareExchange(ref p.UsingDelay, 1, 0) == 1) {
|
||||||
|
Player.Message(p, "You are already using /delay."); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.Sleep((int)duration.TotalMilliseconds);
|
||||||
|
} finally {
|
||||||
|
Interlocked.Exchange(ref p.UsingDelay, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Help(Player p) {
|
||||||
|
Player.Message(p, "%T/delay [timespan]");
|
||||||
|
Player.Message(p, "%HWaits for a certain amount of time.");
|
||||||
|
Player.Message(p, "%HThis is mainly designed for use in %T/mb%H, to run a command after a certain delay.");
|
||||||
|
Player.Message(p, "%H e.g. %T/mb air /delay 10 |/help me");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -335,6 +335,7 @@
|
|||||||
<Compile Include="Commands\other\CmdBack.cs" />
|
<Compile Include="Commands\other\CmdBack.cs" />
|
||||||
<Compile Include="Commands\other\CmdChain.cs" />
|
<Compile Include="Commands\other\CmdChain.cs" />
|
||||||
<Compile Include="Commands\other\cmdCTFADSFD.cs" />
|
<Compile Include="Commands\other\cmdCTFADSFD.cs" />
|
||||||
|
<Compile Include="Commands\other\CmdDelay.cs" />
|
||||||
<Compile Include="Commands\other\CmdDescend.cs" />
|
<Compile Include="Commands\other\CmdDescend.cs" />
|
||||||
<Compile Include="Commands\other\CmdFakerank.cs" />
|
<Compile Include="Commands\other\CmdFakerank.cs" />
|
||||||
<Compile Include="Commands\other\CmdFly.cs" />
|
<Compile Include="Commands\other\CmdFly.cs" />
|
||||||
|
@ -219,7 +219,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
public Level level = Server.mainLevel;
|
public Level level = Server.mainLevel;
|
||||||
public bool Loading = true; //True if player is loading a map.
|
public bool Loading = true; //True if player is loading a map.
|
||||||
internal int UsingGoto = 0, GeneratingMap = 0, LoadingMuseum = 0;
|
internal int UsingGoto = 0, GeneratingMap = 0, LoadingMuseum = 0, UsingDelay = 0;
|
||||||
public Vec3U16 lastClick = Vec3U16.Zero;
|
public Vec3U16 lastClick = Vec3U16.Zero;
|
||||||
public Position beforeTeleportPos = default(Position);
|
public Position beforeTeleportPos = default(Position);
|
||||||
public string lastTeleportMap = "";
|
public string lastTeleportMap = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user