Move from /game set add/remove to just /game add/remove

This commit is contained in:
UnknownShadow200 2018-07-09 23:11:09 +10:00
parent 0458010040
commit 451f131888
7 changed files with 22 additions and 54 deletions

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands.Fun {
get { return new[] { new CommandPerm(LevelPermission.Operator, "can manage CTF") }; }
}
protected override void HandleSetCore(Player p, RoundsGame game, string[] args) {
protected override void HandleSet(Player p, RoundsGame game, string[] args) {
string prop = args[1];
CTFMapConfig cfg = RetrieveConfig(p);
@ -119,7 +119,7 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "%T/CTF start <map> %H- Starts CTF game");
Player.Message(p, "%T/CTF stop %H- Stops CTF game");
Player.Message(p, "%T/CTF end %H- Ends current round of CTF");
Player.Message(p, "%T/CTF set add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/CTF add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/CTF set [property] %H- Sets a property. See %T/Help CTF set");
Player.Message(p, "%T/CTF status %H- View stats of both teams");
Player.Message(p, "%T/CTF go %H- Moves you to the current CTF map");

View File

@ -32,22 +32,13 @@ namespace MCGalaxy.Commands.Fun {
}
public override void Use(Player p, string message) {
if (message.CaselessEq("rules")) {
HandleRules(p);
} else if (message.CaselessEq("join")) {
if (message.CaselessEq("join")) {
HandleJoin(p, CountdownGame.Instance);
} else {
base.Use(p, message);
}
}
void HandleRules(Player p) {
Player.Message(p, "The aim of the game is to stay alive the longest.");
Player.Message(p, "Don't fall in the lava!");
Player.Message(p, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappearing.");
Player.Message(p, "The last person alive wins!");
}
void HandleJoin(Player p, CountdownGame game) {
if (!game.Running) {
Player.Message(p, "Cannot join as countdown is not running.");
@ -78,7 +69,6 @@ namespace MCGalaxy.Commands.Fun {
CountdownGame game = (CountdownGame)game_;
game.GenerateMap(p, x, y, z);
}
protected override void HandleSetCore(Player p, RoundsGame game, string[] args) { }
protected override void HandleStart(Player p, RoundsGame game_, string[] args) {
if (game_.Running) { Player.Message(p, "{0} is already running", game_.GameName); return; }
@ -114,7 +104,6 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "%T/CD end %H- Ends current round of Countdown");
Player.Message(p, "%T/CD join %H- joins the game");
Player.Message(p, "%T/CD status %H- lists players currently playing");
Player.Message(p, "%T/CD rules %H- view the rules of countdown");
}
}
}

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands.Fun {
get { return new[] { new CommandPerm(LevelPermission.Operator, "can manage lava survival") }; }
}
protected override void HandleSetCore(Player p, RoundsGame game, string[] args) {
protected override void HandleSet(Player p, RoundsGame game, string[] args) {
string prop = args[1];
if (prop.CaselessEq("spawn")) {
HandleSetSpawn(p, args);
@ -239,7 +239,7 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "%T/LS start <map> %H- Starts Lava Survival");
Player.Message(p, "%T/LS stop %H- Stops Lava Survival");
Player.Message(p, "%T/LS end %H- Ends current round of Lava Survival");
Player.Message(p, "%T/LS set add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/LS add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/LS set [property] %H- Sets a property. See %T/Help LS set");
Player.Message(p, "%T/LS status %H- View current round info and time");
Player.Message(p, "%T/LS go %H- Moves you to the current Lava Survival map");

View File

@ -32,23 +32,12 @@ namespace MCGalaxy.Commands.Fun {
}
public override void Use(Player p, string message) {
if (message.CaselessEq("rules")) {
HandleRules(p);
} else if (message.CaselessEq("scores")) {
if (message.CaselessEq("scores")) {
HandleScores(p);
} else {
base.Use(p, message);
}
}
void HandleRules(Player p) {
Player.Message(p, "TNT Wars Rules:");
Player.Message(p, "The aim of the game is to blow up people using TNT!");
Player.Message(p, "To place tnt simply place a TNT block and after a short delay it shall explode!");
Player.Message(p, "During the game the amount of TNT placable at one time may be limited!");
Player.Message(p, "You are not allowed to use hacks of any sort during the game!");
}
void HandleScores(Player p) {
TWGame game = (TWGame)Game;
@ -65,7 +54,7 @@ namespace MCGalaxy.Commands.Fun {
}
}
protected override void HandleSetCore(Player p, RoundsGame game_, string[] args) {
protected override void HandleSet(Player p, RoundsGame game_, string[] args) {
TWGame game = (TWGame)game_;
TWMapConfig cfg = RetrieveConfig(p);
TWConfig gameCfg = TWGame.Config;
@ -353,11 +342,10 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "%T/TW start <map> %H- Starts TNT wars");
Player.Message(p, "%T/TW stop %H- Stops TNT wars");
Player.Message(p, "%T/TW end %H- Ends current round of TNT wars");
Player.Message(p, "%T/TW set add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/TW add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/TW set [property] %H- Sets a property. See %T/Help TW set");
Player.Message(p, "%T/TW status %H- View your current score and health");
Player.Message(p, "%T/TW go %H- Moves you to the current TNT wars map");
Player.Message(p, "%T/TW rules %H- view the rules of TNT wars");
Player.Message(p, "%T/TW scores %H- lists players with highest scores");
}
}

View File

@ -28,20 +28,23 @@ namespace MCGalaxy.Commands.Fun {
public override void Use(Player p, string message) {
RoundsGame game = Game;
if (message.CaselessEq("go")) {
HandleGo(p, game);
HandleGo(p, game); return;
} else if (IsInfoCommand(message)) {
HandleStatus(p, game);
} else if (message.CaselessEq("start") || message.CaselessStarts("start ")) {
if (!CheckExtraPerm(p, 1)) return;
HandleStatus(p, game); return;
}
if (!CheckExtraPerm(p, 1)) return;
if (message.CaselessEq("start") || message.CaselessStarts("start ")) {
HandleStart(p, game, message.SplitSpaces());
} else if (message.CaselessEq("end")) {
if (!CheckExtraPerm(p, 1)) return;
HandleEnd(p, game);
} else if (message.CaselessEq("stop")) {
if (!CheckExtraPerm(p, 1)) return;
HandleStop(p, game);
} else if (message.CaselessEq("add")) {
RoundsGameConfig.AddMap(p, p.level.name, p.level.Config, game);
} else if (IsDeleteCommand(message)) {
RoundsGameConfig.RemoveMap(p, p.level.name, p.level.Config, game);
} else if (message.CaselessStarts("set ") || message.CaselessStarts("setup ")) {
if (!CheckExtraPerm(p, 1)) return;
HandleSet(p, game, message.SplitSpaces());
} else {
Help(p);
@ -89,19 +92,6 @@ namespace MCGalaxy.Commands.Fun {
}
}
protected virtual void HandleSet(Player p, RoundsGame game, string[] args) {
if (args.Length < 2) { Help(p, "set"); return; }
string prop = args[1];
if (prop.CaselessEq("add")) {
RoundsGameConfig.AddMap(p, p.level.name, p.level.Config, game);
} else if (IsDeleteCommand(prop)) {
RoundsGameConfig.RemoveMap(p, p.level.name, p.level.Config, game);
} else {
HandleSetCore(p, game, args);
}
}
protected abstract void HandleSetCore(Player p, RoundsGame game, string[] args);
protected abstract void HandleSet(Player p, RoundsGame game, string[] args);
}
}

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands.Fun {
get { return new[] { new CommandPerm(LevelPermission.Operator, "can manage zombie survival") }; }
}
protected override void HandleSetCore(Player p, RoundsGame game, string[] args) {
protected override void HandleSet(Player p, RoundsGame game, string[] args) {
ZSConfig cfg = ZSGame.Config;
string prop = args[1];
LevelConfig lCfg = p.level.Config;
@ -112,6 +112,7 @@ namespace MCGalaxy.Commands.Fun {
Player.Message(p, "%T/ZS start <map> %H- Starts Zombie Survival");
Player.Message(p, "%T/ZS stop %H- Stops Zombie Survival");
Player.Message(p, "%T/ZS end %H- Ends current round of Zombie Survival");
Player.Message(p, "%T/ZS add/remove %H- Adds/removes current map from map list");
Player.Message(p, "%T/ZS set [property] %H- Sets a property. See %T/Help ZS set");
Player.Message(p, "%T/ZS status %H- Outputs current status of Zombie Survival");
Player.Message(p, "%T/ZS go %H- Moves you to the current Zombie Survival map");

View File

@ -44,7 +44,7 @@ namespace MCGalaxy.Games {
public VolatileArray<Player> Remaining = new VolatileArray<Player>();
public static CountdownConfig Config = new CountdownConfig();
public override string GameName { get { return "Countfown"; } }
public override string GameName { get { return "Countdown"; } }
public override RoundsGameConfig GetConfig() { return Config; }
public bool FreezeMode;