From 05b827d265c248b88ad86107569a71ee8f17de94 Mon Sep 17 00:00:00 2001 From: taoneill Date: Sat, 6 Aug 2011 16:14:21 -0400 Subject: [PATCH] Changed command handling so that we print the command usage string ourselves. Cleaned up plugin.yml so usage help doesn't look awful. Brought back 'bad' messages formatted in red which where torn out by Tim. Added warning when console tries to use player-only command. Now matching the start of the name of a warzone instead of the exact name, because that's how it worked and how it should continue to work. --- .../main/java/bukkit/tommytony/war/War.java | 25 +- .../tommytony/war/WarCommandHandler.java | 37 ++- .../war/command/AbstractWarCommand.java | 21 +- .../war/command/AbstractZoneMakerCommand.java | 7 +- .../war/command/DeleteMonumentCommand.java | 13 +- .../war/command/DeleteTeamCommand.java | 11 +- .../war/command/DeleteWarhubCommand.java | 5 +- .../war/command/DeleteZoneCommand.java | 9 +- .../tommytony/war/command/JoinCommand.java | 14 +- .../tommytony/war/command/LeaveCommand.java | 5 +- .../tommytony/war/command/LoadWarCommand.java | 3 +- .../war/command/NextBattleCommand.java | 9 +- .../war/command/NotZoneMakerException.java | 10 + .../war/command/ResetZoneCommand.java | 9 +- .../war/command/SetMonumentCommand.java | 8 +- .../tommytony/war/command/SetTeamCommand.java | 10 +- .../war/command/SetTeamFlagCommand.java | 8 +- .../war/command/SetWarConfigCommand.java | 8 +- .../war/command/SetWarHubCommand.java | 8 +- .../tommytony/war/command/SetZoneCommand.java | 10 +- .../war/command/SetZoneLobbyCommand.java | 12 +- .../tommytony/war/command/TeamCommand.java | 5 +- .../tommytony/war/command/TeamsCommand.java | 6 +- .../war/command/UnloadWarCommand.java | 3 +- .../tommytony/war/command/WarhubCommand.java | 9 +- .../tommytony/war/command/WarzoneCommand.java | 11 +- .../war/command/WarzonesCommand.java | 2 +- .../war/command/ZoneMakerCommand.java | 13 +- .../main/java/com/tommytony/war/Warzone.java | 2 +- .../com/tommytony/war/utils/ChatFixUtil.java | 22 +- war/src/main/java/plugin.yml | 274 ++++++++++-------- war/target/classes/plugin.yml | 272 +++++++++-------- 32 files changed, 468 insertions(+), 393 deletions(-) create mode 100644 war/src/main/java/bukkit/tommytony/war/command/NotZoneMakerException.java diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index c4b0a7a..11be5ef 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -505,27 +505,36 @@ public class War extends JavaPlugin { return this.warzones; } - public void msg(Player player, String str) { - String out = ChatColor.GRAY + "War> " + ChatColor.WHITE + this.colorTeams(str, ChatColor.WHITE) + " "; - ChatFixUtil.sendMessage(player, out); + public void msg(CommandSender sender, String str) { + if(sender instanceof Player) { + String out = ChatColor.GRAY + "War> " + ChatColor.WHITE + this.colorKnownTokens(str, ChatColor.WHITE) + " "; + ChatFixUtil.sendMessage(sender, out); + } else { + sender.sendMessage("War> " + str); + } } - public void badMsg(Player player, String str) { - String out = ChatColor.GRAY + "War> " + ChatColor.RED + this.colorTeams(str, ChatColor.RED) + " "; - ChatFixUtil.sendMessage(player, out); + public void badMsg(CommandSender sender, String str) { + if(sender instanceof Player) { + String out = ChatColor.GRAY + "War> " + ChatColor.RED + this.colorKnownTokens(str, ChatColor.RED) + " "; + ChatFixUtil.sendMessage(sender, out); + } else { + sender.sendMessage("War> " + str); + } } /** - * Colors the teams in messages + * Colors the teams and examples in messages * * @param String str message-string * @param String msgColor current message-color * @return String Message with colored teams */ - private String colorTeams(String str, ChatColor msgColor) { + private String colorKnownTokens(String str, ChatColor msgColor) { for (TeamKind kind : TeamKinds.getTeamkinds()) { str = str.replaceAll(" " + kind.getDefaultName(), " " + kind.getColor() + kind.getDefaultName() + msgColor); } + str = str.replaceAll("Ex -", ChatColor.GRAY + "Ex -"); return str; } diff --git a/war/src/main/java/bukkit/tommytony/war/WarCommandHandler.java b/war/src/main/java/bukkit/tommytony/war/WarCommandHandler.java index 299133f..ddfa3eb 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarCommandHandler.java +++ b/war/src/main/java/bukkit/tommytony/war/WarCommandHandler.java @@ -1,5 +1,7 @@ package bukkit.tommytony.war; +import java.util.logging.Level; + import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -32,12 +34,14 @@ public class WarCommandHandler { arguments[i - 1] = args[i]; } if (arguments.length == 1 && (arguments[0].equals("help") || arguments[0].equals("h"))) { - // show help - return false; + // show /war help + War.war.badMsg(sender, cmd.getUsage()); + return true; } } else if (command.equals("war") || command.equals("War")) { - // show help - return false; + // show /war help + War.war.msg(sender, cmd.getUsage()); + return true; } else { arguments = args; } @@ -88,19 +92,24 @@ public class WarCommandHandler { commandObj = new SetWarConfigCommand(this, sender, arguments); } else if (command.equals("zonemaker") || command.equals("zm")) { commandObj = new ZoneMakerCommand(this, sender, arguments); - } else { - // we are not responsible for this command - return true; - } + } + // we are not responsible for any other command } - catch (NoZoneMakerException e) { - sender.sendMessage("You can't do this if you are not a warzone maker."); - return true; + catch (NotZoneMakerException e) { + War.war.badMsg(sender, "You can't do this if you are not a warzone maker."); } catch (Exception e) { - return true; + War.war.log("An error occured while handling command " + cmd.getName() + ". Exception:" + e.getClass().toString() + " " + e.getMessage(), Level.WARNING); + e.printStackTrace(); } - - return commandObj.handle(); + + if(commandObj != null) { + boolean handled = commandObj.handle(); + if(!handled) { + War.war.badMsg(sender, cmd.getUsage()); + } + } + + return true; } } diff --git a/war/src/main/java/bukkit/tommytony/war/command/AbstractWarCommand.java b/war/src/main/java/bukkit/tommytony/war/command/AbstractWarCommand.java index 214a710..59cfee0 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/AbstractWarCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/AbstractWarCommand.java @@ -1,23 +1,38 @@ package bukkit.tommytony.war.command; import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; +import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public abstract class AbstractWarCommand { - protected CommandSender sender; + private CommandSender sender; protected String[] args; protected WarCommandHandler handler; public AbstractWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) { this.handler = handler; - this.sender = sender; + this.setSender(sender); this.args = args; } abstract public boolean handle(); public void msg(String message) { - this.sender.sendMessage(message); + War.war.msg(getSender(), message); + } + + public void badMsg(String message) { + War.war.badMsg(getSender(), message); + } + + public void setSender(CommandSender sender) { + this.sender = sender; + } + + public CommandSender getSender() { + return sender; } } diff --git a/war/src/main/java/bukkit/tommytony/war/command/AbstractZoneMakerCommand.java b/war/src/main/java/bukkit/tommytony/war/command/AbstractZoneMakerCommand.java index 8dc4e4d..a4aca04 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/AbstractZoneMakerCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/AbstractZoneMakerCommand.java @@ -4,21 +4,20 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public abstract class AbstractZoneMakerCommand extends AbstractWarCommand { - public AbstractZoneMakerCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public AbstractZoneMakerCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); if (sender instanceof Player) { if (!War.war.isZoneMaker((Player) sender)) { - throw new NoZoneMakerException(); + throw new NotZoneMakerException(); } } else if (!(sender instanceof ConsoleCommandSender)) { - throw new NoZoneMakerException(); + throw new NotZoneMakerException(); } } } diff --git a/war/src/main/java/bukkit/tommytony/war/command/DeleteMonumentCommand.java b/war/src/main/java/bukkit/tommytony/war/command/DeleteMonumentCommand.java index af1548a..407538b 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/DeleteMonumentCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/DeleteMonumentCommand.java @@ -8,11 +8,10 @@ import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.WarCommandHandler; public class DeleteMonumentCommand extends AbstractZoneMakerCommand { - public DeleteMonumentCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public DeleteMonumentCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -25,12 +24,12 @@ public class DeleteMonumentCommand extends AbstractZoneMakerCommand { zone = Warzone.getZoneByName(this.args[0]); this.args[0] = this.args[1]; } else if (this.args.length == 1) { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { return false; } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } @@ -40,7 +39,7 @@ public class DeleteMonumentCommand extends AbstractZoneMakerCommand { return false; } if (zone == null) { - return false; + return true; } Monument monument = zone.getMonument(this.args[0]); @@ -50,7 +49,7 @@ public class DeleteMonumentCommand extends AbstractZoneMakerCommand { WarzoneMapper.save(zone, false); this.msg("Monument " + monument.getName() + " removed."); } else { - this.msg("No such monument."); + this.badMsg("No such monument."); } return true; diff --git a/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamCommand.java b/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamCommand.java index 496d3ce..064b6a8 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/DeleteTeamCommand.java @@ -9,11 +9,10 @@ import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.WarCommandHandler; public class DeleteTeamCommand extends AbstractZoneMakerCommand { - public DeleteTeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public DeleteTeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -26,12 +25,12 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand { zone = Warzone.getZoneByName(this.args[0]); this.args[0] = this.args[1]; } else if (this.args.length == 1) { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { return false; } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } @@ -57,7 +56,7 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand { WarzoneMapper.save(zone, false); this.msg("Team " + team.getName() + " removed."); } else { - this.msg("No such team."); + this.badMsg("No such team."); } return true; diff --git a/war/src/main/java/bukkit/tommytony/war/command/DeleteWarhubCommand.java b/war/src/main/java/bukkit/tommytony/war/command/DeleteWarhubCommand.java index f37734b..897809f 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/DeleteWarhubCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/DeleteWarhubCommand.java @@ -8,12 +8,11 @@ import com.tommytony.war.WarHub; import com.tommytony.war.mappers.VolumeMapper; import com.tommytony.war.mappers.WarMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class DeleteWarhubCommand extends AbstractZoneMakerCommand { - public DeleteWarhubCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public DeleteWarhubCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -36,7 +35,7 @@ public class DeleteWarhubCommand extends AbstractZoneMakerCommand { this.msg("War hub removed."); } else { - this.msg("No War hub to delete."); + this.badMsg("No War hub to delete."); } WarMapper.save(); diff --git a/war/src/main/java/bukkit/tommytony/war/command/DeleteZoneCommand.java b/war/src/main/java/bukkit/tommytony/war/command/DeleteZoneCommand.java index 8a3f5cd..393a3df 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/DeleteZoneCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/DeleteZoneCommand.java @@ -10,12 +10,11 @@ import com.tommytony.war.ZoneLobby; import com.tommytony.war.mappers.WarMapper; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class DeleteZoneCommand extends AbstractZoneMakerCommand { - public DeleteZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public DeleteZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -26,12 +25,12 @@ public class DeleteZoneCommand extends AbstractZoneMakerCommand { if (this.args.length == 1) { zone = Warzone.getZoneByName(this.args[0]); } else if (this.args.length == 0) { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { return false; } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/JoinCommand.java b/war/src/main/java/bukkit/tommytony/war/command/JoinCommand.java index e27134d..bbab211 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/JoinCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/JoinCommand.java @@ -21,13 +21,14 @@ public class JoinCommand extends AbstractWarCommand { @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (!War.war.canPlayWar(player)) { - this.msg("Cannot play war"); + this.badMsg("Cannot play war. You need the war.player permission."); return true; } @@ -40,12 +41,9 @@ public class JoinCommand extends AbstractWarCommand { // move the team-name to first place :) this.args[0] = this.args[1]; } else if (this.args.length == 1) { - if (!(this.sender instanceof Player)) { - return false; - } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/LeaveCommand.java b/war/src/main/java/bukkit/tommytony/war/command/LeaveCommand.java index 4052560..bd4ed78 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/LeaveCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/LeaveCommand.java @@ -14,7 +14,8 @@ public class LeaveCommand extends AbstractWarCommand { @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } @@ -22,7 +23,7 @@ public class LeaveCommand extends AbstractWarCommand { return false; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); Warzone zone = Warzone.getZoneByPlayerName(player.getName()); if (zone == null) { return false; diff --git a/war/src/main/java/bukkit/tommytony/war/command/LoadWarCommand.java b/war/src/main/java/bukkit/tommytony/war/command/LoadWarCommand.java index 6a627eb..3dd674f 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/LoadWarCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/LoadWarCommand.java @@ -2,12 +2,11 @@ package bukkit.tommytony.war.command; import org.bukkit.command.CommandSender; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class LoadWarCommand extends AbstractZoneMakerCommand { - public LoadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public LoadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } diff --git a/war/src/main/java/bukkit/tommytony/war/command/NextBattleCommand.java b/war/src/main/java/bukkit/tommytony/war/command/NextBattleCommand.java index 4fe293d..f0f0c78 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/NextBattleCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/NextBattleCommand.java @@ -7,11 +7,10 @@ import com.tommytony.war.Team; import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.WarCommandHandler; public class NextBattleCommand extends AbstractZoneMakerCommand { - public NextBattleCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public NextBattleCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -21,12 +20,12 @@ public class NextBattleCommand extends AbstractZoneMakerCommand { if (this.args.length == 1) { zone = Warzone.getZoneByName(this.args[0]); } else if (this.args.length == 0) { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { return false; } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/NotZoneMakerException.java b/war/src/main/java/bukkit/tommytony/war/command/NotZoneMakerException.java new file mode 100644 index 0000000..d93a266 --- /dev/null +++ b/war/src/main/java/bukkit/tommytony/war/command/NotZoneMakerException.java @@ -0,0 +1,10 @@ +package bukkit.tommytony.war.command; + +public class NotZoneMakerException extends Exception { + + /** + * + */ + private static final long serialVersionUID = -5412011034665080340L; + +} diff --git a/war/src/main/java/bukkit/tommytony/war/command/ResetZoneCommand.java b/war/src/main/java/bukkit/tommytony/war/command/ResetZoneCommand.java index e59e1cb..4d8a4b5 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/ResetZoneCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/ResetZoneCommand.java @@ -7,12 +7,11 @@ import com.tommytony.war.Team; import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class ResetZoneCommand extends AbstractZoneMakerCommand { - public ResetZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public ResetZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -22,12 +21,12 @@ public class ResetZoneCommand extends AbstractZoneMakerCommand { if (this.args.length == 1) { zone = Warzone.getZoneByName(this.args[0]); } else if (this.args.length == 0) { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { return false; } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetMonumentCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetMonumentCommand.java index 4efcb1a..ce9dd11 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetMonumentCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetMonumentCommand.java @@ -7,21 +7,21 @@ import com.tommytony.war.Monument; import com.tommytony.war.Warzone; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.WarCommandHandler; public class SetMonumentCommand extends AbstractZoneMakerCommand { - public SetMonumentCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetMonumentCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (this.args.length != 1) { return false; diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetTeamCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetTeamCommand.java index bd39806..f9cfb3a 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetTeamCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetTeamCommand.java @@ -9,21 +9,21 @@ import com.tommytony.war.TeamKinds; import com.tommytony.war.Warzone; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.WarCommandHandler; public class SetTeamCommand extends AbstractZoneMakerCommand { - public SetTeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetTeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (this.args.length != 1) { return false; @@ -47,8 +47,6 @@ public class SetTeamCommand extends AbstractZoneMakerCommand { zone.getTeams().add(newTeam); if (zone.getLobby() != null) { zone.getLobby().getVolume().resetBlocks(); - // warzone.getVolume().resetWallBlocks(warzone.getLobby().getWall()); - // warzone.addZoneOutline(warzone.getLobby().getWall()); zone.getLobby().initialize(); } newTeam.setTeamSpawn(player.getLocation()); diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetTeamFlagCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetTeamFlagCommand.java index 149cc4b..24526fc 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetTeamFlagCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetTeamFlagCommand.java @@ -10,21 +10,21 @@ import com.tommytony.war.TeamKinds; import com.tommytony.war.Warzone; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.WarCommandHandler; public class SetTeamFlagCommand extends AbstractZoneMakerCommand { - public SetTeamFlagCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetTeamFlagCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (this.args.length != 1) { return false; diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetWarConfigCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetWarConfigCommand.java index 43173f4..c3f76f6 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetWarConfigCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetWarConfigCommand.java @@ -5,13 +5,12 @@ import org.bukkit.entity.Player; import com.tommytony.war.mappers.WarMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class SetWarConfigCommand extends AbstractZoneMakerCommand { - public SetWarConfigCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetWarConfigCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @@ -20,14 +19,13 @@ public class SetWarConfigCommand extends AbstractZoneMakerCommand { if (this.args.length == 0) { return false; } - if (!(this.sender instanceof Player)) - { + if (!(this.getSender() instanceof Player)) { return true; // TODO: Maybe move rallypoint to warzone setting // TODO: The rallypoint is the only thing that prevents this from being used from cli } - if (War.war.updateFromNamedParams((Player) this.sender, this.args)) { + if (War.war.updateFromNamedParams((Player) this.getSender(), this.args)) { WarMapper.save(); this.msg("War config saved."); } else { diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetWarHubCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetWarHubCommand.java index e094110..27c8209 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetWarHubCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetWarHubCommand.java @@ -7,25 +7,25 @@ import com.tommytony.war.WarHub; import com.tommytony.war.Warzone; import com.tommytony.war.mappers.WarMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class SetWarHubCommand extends AbstractZoneMakerCommand { - public SetWarHubCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetWarHubCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } if (this.args.length != 0) { return false; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (War.war.getWarzones().size() > 0) { if (War.war.getWarHub() != null) { diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetZoneCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetZoneCommand.java index 1295627..04897a1 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetZoneCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetZoneCommand.java @@ -5,23 +5,23 @@ import org.bukkit.entity.Player; import com.tommytony.war.ZoneSetter; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class SetZoneCommand extends AbstractZoneMakerCommand { - public SetZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { - return false; + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); + return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (this.args.length == 0) { return false; diff --git a/war/src/main/java/bukkit/tommytony/war/command/SetZoneLobbyCommand.java b/war/src/main/java/bukkit/tommytony/war/command/SetZoneLobbyCommand.java index 8c8606c..c28c850 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/SetZoneLobbyCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/SetZoneLobbyCommand.java @@ -8,28 +8,28 @@ import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; import com.tommytony.war.mappers.WarzoneMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class SetZoneLobbyCommand extends AbstractZoneMakerCommand { - public SetZoneLobbyCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public SetZoneLobbyCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } if (this.args.length != 1) { return false; } - Player player = (Player) this.sender; - Warzone zone = Warzone.getZoneByLocation((Player) this.sender); + Player player = (Player) this.getSender(); + Warzone zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/TeamCommand.java b/war/src/main/java/bukkit/tommytony/war/command/TeamCommand.java index bd8c7cc..f5e2b4e 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/TeamCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/TeamCommand.java @@ -20,11 +20,12 @@ public class TeamCommand extends AbstractWarCommand { @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); Team playerTeam = Team.getTeamByPlayerName(player.getName()); if (playerTeam == null) { return false; diff --git a/war/src/main/java/bukkit/tommytony/war/command/TeamsCommand.java b/war/src/main/java/bukkit/tommytony/war/command/TeamsCommand.java index 527ac40..2b09a04 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/TeamsCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/TeamsCommand.java @@ -19,12 +19,12 @@ public class TeamsCommand extends AbstractWarCommand { if (this.args.length == 1) { zone = Warzone.getZoneByName(this.args[0]); } else if (this.args.length == 0) { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { return false; } - zone = Warzone.getZoneByLocation((Player) this.sender); + zone = Warzone.getZoneByLocation((Player) this.getSender()); if (zone == null) { - ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender); + ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.getSender()); if (lobby == null) { return false; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/UnloadWarCommand.java b/war/src/main/java/bukkit/tommytony/war/command/UnloadWarCommand.java index 6993a6b..5d1b735 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/UnloadWarCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/UnloadWarCommand.java @@ -2,12 +2,11 @@ package bukkit.tommytony.war.command; import org.bukkit.command.CommandSender; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class UnloadWarCommand extends AbstractZoneMakerCommand { - public UnloadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public UnloadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); } diff --git a/war/src/main/java/bukkit/tommytony/war/command/WarhubCommand.java b/war/src/main/java/bukkit/tommytony/war/command/WarhubCommand.java index 0df1146..8ba15c5 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/WarhubCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/WarhubCommand.java @@ -15,17 +15,18 @@ public class WarhubCommand extends AbstractWarCommand { @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } if (this.args.length != 0) { return false; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (War.war.getWarHub() == null) { - this.msg("No warhub on this War server. Try /zones and /zone."); + this.badMsg("No warhub on this War server. Try /zones and /zone."); } else if (!War.war.canWarp(player)) { - this.msg("Can't warp to warhub. You need the 'war.warp' permission."); + this.badMsg("Can't warp to warhub. You need the 'war.warp' permission."); } else { Warzone playerWarzone = Warzone.getZoneByPlayerName(player.getName()); if (playerWarzone != null) { // was in zone diff --git a/war/src/main/java/bukkit/tommytony/war/command/WarzoneCommand.java b/war/src/main/java/bukkit/tommytony/war/command/WarzoneCommand.java index 3b16486..3bc43f3 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/WarzoneCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/WarzoneCommand.java @@ -15,20 +15,21 @@ public class WarzoneCommand extends AbstractWarCommand { @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } if (this.args.length != 1) { return false; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (!War.war.canWarp(player)) { - this.msg("Can't warp to zone. You need the 'war.warp' permission."); + this.badMsg("Can't warp to zone. You need the 'war.warp' permission."); } else { Warzone warzone = Warzone.getZoneByName(this.args[0]); - if (warzone.getTeleport() != null) { + if (warzone != null && warzone.getTeleport() != null) { Warzone playerWarzone = Warzone.getZoneByPlayerName(player.getName()); if (playerWarzone != null) { playerWarzone.handlePlayerLeave(player, warzone.getTeleport(), true); @@ -38,7 +39,7 @@ public class WarzoneCommand extends AbstractWarCommand { return true; } - this.msg("No such warzone."); + this.badMsg("No such warzone."); } return true; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/WarzonesCommand.java b/war/src/main/java/bukkit/tommytony/war/command/WarzonesCommand.java index 1f9a737..2860305 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/WarzonesCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/WarzonesCommand.java @@ -39,7 +39,7 @@ public class WarzonesCommand extends AbstractWarCommand { } } - this.msg(warzonesMessage + ((this.sender instanceof Player) ? " Use /zone to teleport to a warzone." : "")); + this.msg(warzonesMessage + ((this.getSender() instanceof Player) ? " Use /zone to teleport to a warzone." : "")); return true; } diff --git a/war/src/main/java/bukkit/tommytony/war/command/ZoneMakerCommand.java b/war/src/main/java/bukkit/tommytony/war/command/ZoneMakerCommand.java index c0aa2d7..decd579 100644 --- a/war/src/main/java/bukkit/tommytony/war/command/ZoneMakerCommand.java +++ b/war/src/main/java/bukkit/tommytony/war/command/ZoneMakerCommand.java @@ -5,17 +5,13 @@ import org.bukkit.entity.Player; import com.tommytony.war.mappers.WarMapper; -import bukkit.tommytony.war.NoZoneMakerException; import bukkit.tommytony.war.War; import bukkit.tommytony.war.WarCommandHandler; public class ZoneMakerCommand extends AbstractWarCommand { - public ZoneMakerCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException { + public ZoneMakerCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException { super(handler, sender, args); - // ffffuuuu java, fffuuu! - // Just because you want the invoking of super-constructor as the very first statement - // I had to rewrite the complete NoZoneMakerException thingy :( if (sender instanceof Player) { if (!War.war.isZoneMaker((Player) sender)) { for (String name : War.war.getZoneMakersImpersonatingPlayers()) { @@ -23,17 +19,18 @@ public class ZoneMakerCommand extends AbstractWarCommand { return; } } - throw new NoZoneMakerException(); + throw new NotZoneMakerException(); } } } @Override public boolean handle() { - if (!(this.sender instanceof Player)) { + if (!(this.getSender() instanceof Player)) { + this.badMsg("You can't do this if you are not in-game."); return true; } - Player player = (Player) this.sender; + Player player = (Player) this.getSender(); if (War.war.isZoneMaker(player)) { if (this.args.length == 0) { diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index 9259cf4..c21d325 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -86,7 +86,7 @@ public class Warzone { public static Warzone getZoneByName(String name) { for (Warzone warzone : War.war.getWarzones()) { - if (warzone.getName().toLowerCase().equals(name.toLowerCase())) { + if (warzone.getName().toLowerCase().startsWith(name.toLowerCase())) { return warzone; } } diff --git a/war/src/main/java/com/tommytony/war/utils/ChatFixUtil.java b/war/src/main/java/com/tommytony/war/utils/ChatFixUtil.java index 01b702b..361c98c 100644 --- a/war/src/main/java/com/tommytony/war/utils/ChatFixUtil.java +++ b/war/src/main/java/com/tommytony/war/utils/ChatFixUtil.java @@ -2,7 +2,7 @@ package com.tommytony.war.utils; import java.util.*; -import org.bukkit.entity.Player; +import org.bukkit.command.CommandSender; /** * The purpose of this tool is twofold: 1: Avoid client crashes due to bad color formating. 2: Make color continue on word wrapping @@ -123,7 +123,7 @@ public class ChatFixUtil { // ----------------------------------------------// // One player // ----------------------------------------------// - public static void sendMessage(Player player, String message, boolean fix) { + public static void sendMessage(CommandSender player, String message, boolean fix) { if (fix) { List messages = ChatFixUtil.fix(message); ChatFixUtil.sendMessage(player, messages, false); @@ -134,7 +134,7 @@ public class ChatFixUtil { } } - public static void sendMessage(Player player, List messages, boolean fix) { + public static void sendMessage(CommandSender player, List messages, boolean fix) { if (fix) { messages = ChatFixUtil.fix(messages); } @@ -143,29 +143,29 @@ public class ChatFixUtil { } } - public static void sendMessage(Player player, String message) { + public static void sendMessage(CommandSender player, String message) { ChatFixUtil.sendMessage(player, message, true); } - public static void sendMessage(Player player, List messages) { + public static void sendMessage(CommandSender player, List messages) { ChatFixUtil.sendMessage(player, messages, true); } // ----------------------------------------------// - // Many Players + // Many CommandSenders // ----------------------------------------------// - public static void sendMessage(Collection players, String message, boolean fix) { + public static void sendMessage(Collection players, String message, boolean fix) { if (fix) { List messages = ChatFixUtil.fix(message); ChatFixUtil.sendMessage(players, messages, false); } else { - for (Player player : players) { + for (CommandSender player : players) { ChatFixUtil.sendMessage(player, message, false); } } } - public static void sendMessage(Collection players, List messages, boolean fix) { + public static void sendMessage(Collection players, List messages, boolean fix) { if (fix) { messages = ChatFixUtil.fix(messages); } @@ -175,11 +175,11 @@ public class ChatFixUtil { } } - public static void sendMessage(Collection players, String message) { + public static void sendMessage(Collection players, String message) { ChatFixUtil.sendMessage(players, message, true); } - public static void sendMessage(Collection players, List messages) { + public static void sendMessage(Collection players, List messages) { ChatFixUtil.sendMessage(players, messages, true); } } diff --git a/war/src/main/java/plugin.yml b/war/src/main/java/plugin.yml index 2e5c528..ab0580d 100644 --- a/war/src/main/java/plugin.yml +++ b/war/src/main/java/plugin.yml @@ -7,166 +7,188 @@ main: bukkit.tommytony.war.War commands: # Player commands warzones: - description: (War) Lists the warzones on the server. Each warzone is an independent arena. - usage: /warzones + description: War> Lists the warzones on the server. Each warzone is an independent arena. + usage: Lists the warzones on the server. Each warzone is an independent arena. + Ex - /warzones zones: - description: (War) Shortcut for /warzones. - usage: /zones + description: War> Shortcut for /warzones. + usage: Lists the warzones on the server. Each warzone is an independent arena. + Ex - /zones warzone: - description: (War) Teleports you to the specified warzone's lobby. - usage: /warzone + description: War> Teleports you to the specified warzone's lobby. + usage: Teleports you to the specified warzone's lobby. + Ex - /warzone zone: - description: (War) Shortcut for /warzone. - usage: /zone + description: War> Shortcut for /warzone. + usage: Teleports you to the specified warzone's lobby. + Ex - /zone warhub: - description: (War) Teleports you to the warhub, if it exists. The warhub offers portals to reach each warzone on the server. - usage: /warhub + description: War> Teleports you to the warhub, if it exists. The warhub offers portals to reach each warzone on the server. + usage: Teleports you to the warhub, if it exists. + Ex - /warhub teams: - description: (War) Lists the teams in the warzone. - usage: - - /teams [zone-name] + description: War> Lists the teams in the warzone. + usage: Lists the teams in the warzone. Use zone name when outside warzone. + Ex - /teams [zone-name] join: - description: (War) Use to change teams. Also used instead of walking in the team gate in the lobby. - usage: - - Must be standing in warzone or lobby. - - /join + description: War> Use to change teams. Also used instead of walking in the team gate in the lobby. + usage: Use to change teams. Also used instead of walking in the team gate in the lobby. Must be standing in warzone or lobby. + Ex - /join leave: - description: (War) Use to leave a warzone. Teleports you back to the lobby. - usage: - - Must be in team already. - - /leave + description: War> Use to leave a warzone. Teleports you back to the lobby. + usage: Use to leave a warzone. Teleports you back to the lobby. Must be in team already. + Ex - /leave team: - description: (War) Team chat. - usage: /team + description: War> Team chat. + usage: Team chat. + Ex - /team # Warzone maker commands (must have the 'war.*' permission or be added as a zone-maker in /plugins/War/war.txt # 1- Battle-related commands nextbattle: - description: (War) Warzone blocks are restored (from memory). Teams are respawned. - usage: - - Must be standing in warzone or lobby - - /nextbattle [zone-name] + description: War> Warzone blocks are restored, teams are respawned but score remains unaffected. + usage: Warzone blocks are restored, teams are respawned but score remains unaffected. Provide a zone name if not standing in warzone or lobby. + Ex - /nextbattle [zone-name] # 2- Warzone creation commands setzone: - description: (War) Use to create a warzone. Lobby is created and blocks are saved when the second corner is set. - usage: - - == - - /setzone - - ex: first, /setzone ziggy se, then, /setzone ziggy nw - - In classic mode, corner1 defaults to the topmost block (127) in the northwest and corner2 to the bottommost block (0) in the southeast. - - == - - 1) /setzone wand - - 2) Left-click to select or move corner1 - - 3) Right-click to select or move corner2 - - Turn off wand by dropping the wooden sword. - - == - - /setzone - - The three modes can be mixed and matched. - - Warzones must be at least 10 blocks wide in all directions. + description: War> Use to create a warzone. Lobby is created and blocks are saved when the second corner is set. + usage: Use to create a warzone. Lobby is created and blocks are saved when the second corner is set. Warzones must be at least 10 blocks wide in all directions. + Ex - + ==Wand Cuboid mode==> + 1) /setzone to get wooden sword, + 2) Left-click to select or move corner1, + 3) Right-click to select or move corner2. + Turn off wand by dropping the wooden sword. + ==Wandless Cuboid mode==> + /setzone savezone: - description: (War) Persists changes made to the warzone since the last save. Config can be set with named parameters. - usage: - - Must be standing in warzone or lobby - - /savezone => Basic save - - /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - - /savezone loadout:default => sets the respawn inventory to your current items - - /savezone reward:default => sets the winner's reward to your current items + description: War> Persists changes made to the warzone since the last save. Config can be set with named parameters. + usage: Persists changes made to the warzone since the last save. Config can be set with named parameters. Provide a zone name if not standing in warzone or lobby. + Ex - + /savezone => Basic save, + /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on, + /savezone loadout:default => sets the respawn inventory to your current items, + /savezone reward:default => sets the winner's reward to your current items. setzonelobby: - description: (War) Creates or changes the position of the warzone lobby. - usage: - - = - - Must be standing in warzone or lobby. - - /setzonelobby - - = - - /setzonelobby + description: War> Creates or changes the position of the warzone lobby. + usage: Creates or changes the position of the warzone lobby. + Ex - + ==Attached lobby==> + Must be standing in warzone or lobby. + /setzonelobby + ==Detached lobby==> + Must be standing outside warzone or lobby. + /setzonelobby setteam: - description: (War) Creates or moves a team spawn. The lobby is updated. Teams are diamond, iron or gold etc. - usage: - - Must be standing in warzone. - - /setteam + description: War> Creates or moves a team spawn. The lobby is updated. + usage: Creates or moves a team spawn. The lobby is updated. Must be standing in warzone. + Ex - + /setteam setmonument: - description: (War) Creates or moves a monument. - usage: - - Must be standing in warzone. - - /setmonument + description: War> Creates or moves a monument. + usage: Creates or moves a monument. Must be standing in warzone. + Ex - + /setmonument setteamflag: - description: (War) Creates/moves a team flag post for CTF. - usage: - - Must be standing in warzone. - - /setteamflag + description: War> Creates/moves a team flag post for CTF. + usage: Creates/moves a team flag post for CTF. Must be standing in warzone. + Ex - + /setteamflag resetzone: - description: (War) Reloads zone blocks from disks. Everyone is ported back to the lobby. - usage: - - Must be standing in warzone or lobby, or provide name - - /resetzone [zone-name] + description: War> Reloads zone blocks from disk. Everyone is teleported back to the lobby. + usage: Reloads zone blocks from disk. Everyone is teleported back to the lobby. Provide a zone name if not standing in warzone or lobby. + Ex - + /resetzone [zone-name] deletezone: - description: (War) Deletes the zone, resets all blocks. - usage: - - Must be standing in warzone or lobby, or provide name - - /deletezone [zone-name] + description: War> Deletes the zone, resets all blocks. + usage: Deletes the zone after resetting all blocks. Provide a zone name if not standing in warzone or lobby. + Ex - + /deletezone [zone-name] deleteteam: - description: (War) Deletes the team. Team must exist. - usage: - - Must be standing in warzone or lobby, or provide warzone-name - - /deleteteam [zone-name] + description: War> Deletes the team. Team must exist. + usage: Deletes the team. Team must exist. Provide a zone name if not standing in warzone or lobby. + Ex - + /deleteteam [zone-name] deletemonument: - description: (War) Deletes the monument. - usage: - - Must be standing in warzone or lobby, or provide warzone-name - - /deletemonument [zone-name] + description: War> Deletes the monument. + usage: Deletes the monument. Provide a zone name if not standing in warzone or lobby. + Ex - + /deletemonument [zone-name] setzoneconfig: - description: (War) Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. - usage: - - Must be standing in warzone or lobby, or provide warzone-name - - /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - - /setzoneconfig loadout:default => sets the respawn inventory to your current items - - /setzoneconfig reward:default => sets the winner's reward to your current items + description: War> Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. + usage: Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby. + Ex - + /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on, + /setzoneconfig loadout:default => sets the respawn inventory to your current items, + /setzoneconfig reward:default => sets the winner's reward to your current items zonecfg: - description: (War) Alias for /setzoneconfig - usage: + description: War> Alias for /setzoneconfig + usage: Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby. + Ex - + /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on, + /setzoneconfig loadout:default => sets the respawn inventory to your current items, + /setzoneconfig reward:default => sets the winner's reward to your current items zonemaker: - description: (War) Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. - usage: - - /zonemaker - - /zonemaker + description: War> Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. + usage: Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. + Ex - + /zonemaker + /zonemaker zm: - description: (War) Alias for /zonemaker - usage: + description: War> Alias for /zonemaker + usage: Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. + Ex - + /zonemaker + /zonemaker # 3- War hub setwarhub: - description: (War) Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub. - usage: /setwarhub + description: War> Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub. + usage: Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub. + Ex - + /setwarhub deletewarhub: - description: (War) Deletes the warhub if it exists. Resets all warzone lobbies. - usage: /deletewarhub + description: War> Deletes the warhub if it exists. Resets all warzone lobbies. + usage: Deletes the warhub if it exists. Resets all warzone lobbies. + Ex - + /deletewarhub # 4- Defaults and server configuration unloadwar: - description: (War) Disables the War plugin. - usage: /unloadwar + description: War> Disables the War plugin. + usage: Disables the War plugin. + Ex - + /unloadwar loadwar: - description: (War) Enables the War plugin. - usage: /loadwar + description: War> Enables the War plugin. + usage: Enables the War plugin. + Ex - + /loadwar setwarconfig: - description: (War) Change gobal settings and the default warzone configuration values. - usage: - - /setwarconfig pvpinzonesonly:on buildinzonesonly:on => Global settings - - /setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on => Warzone defaults - - /setwarconfig loadout:default => sets the respawn inventory to your current items - - /setwarconfig reward:default => sets the winner's reward to your current items - - /setwarconfig rallypoint: => changes when players get teleported at the end of a match for that zone, useful for chaining warzones together in a sequence, or preventing players from rejoining immediately + description: War> Change gobal settings and the default warzone configuration values. + usage: Change gobal settings and the default warzone configuration values. + Ex - + /setwarconfig pvpinzonesonly:on buildinzonesonly:on => Global settings, + /setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on => Warzone defaults, + /setwarconfig loadout:default => sets the respawn inventory to your current items, + /setwarconfig reward:default => sets the winner's reward to your current items, + /setwarconfig rallypoint: => changes when players get teleported at the end of a match for that zone, useful for chaining warzones together in a sequence, or preventing players from rejoining immediately warcfg: - description: (War) Alias for /setwarconfig - usage: + description: War> Alias for /setwarconfig + usage: Change gobal settings and the default warzone configuration values. + Ex - + /setwarconfig pvpinzonesonly:on buildinzonesonly:on => Global settings, + /setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on => Warzone defaults, + /setwarconfig loadout:default => sets the respawn inventory to your current items, + /setwarconfig reward:default => sets the winner's reward to your current items, + /setwarconfig rallypoint: => changes when players get teleported at the end of a match for that zone, useful for chaining warzones together in a sequence, or preventing players from rejoining immediately + # Fallback war: - description: (War) Short War help. Can also be used as a prefix for all War commands as a fallback if they conflict with other plugins. - usage: - - /war - - /war setzone ziggy northwest - - /war warhub - - /war zone ziggy - - etc. + description: War> Short War help. Can also be used as a prefix for all War commands as a fallback if they conflict with other plugins. + usage: War is on. Please pick your battle. Try /warhub, /zones and /zone. Further instructions at war.tommytony.com/instructions. + The /war command can be used as a prefix to all other command as a fallback if they conflict with other plugins. Ex - + /war, + /war setzone , + /war warhub, + /war zone War: - description: (War) Same as /war. Used as fallback. - usage: See /war. -#Note: When you /disable War with Essentials, or at shutdown, all warzone blocks will be reset and artifacts will disappear. -# When you /enable War, all blocks will be loaded from disk and the War-related artifacts will reappear. \ No newline at end of file + description: War> Same as /war. Used as fallback. + usage: See /war. \ No newline at end of file diff --git a/war/target/classes/plugin.yml b/war/target/classes/plugin.yml index a3713a9..ab0580d 100644 --- a/war/target/classes/plugin.yml +++ b/war/target/classes/plugin.yml @@ -7,164 +7,188 @@ main: bukkit.tommytony.war.War commands: # Player commands warzones: - description: (War) Lists the warzones on the server. Each warzone is an independent arena. - usage: /warzones + description: War> Lists the warzones on the server. Each warzone is an independent arena. + usage: Lists the warzones on the server. Each warzone is an independent arena. + Ex - /warzones zones: - description: (War) Shortcut for /warzones. - usage: /zones + description: War> Shortcut for /warzones. + usage: Lists the warzones on the server. Each warzone is an independent arena. + Ex - /zones warzone: - description: (War) Teleports you to the specified warzone's lobby. - usage: /warzone ziggy + description: War> Teleports you to the specified warzone's lobby. + usage: Teleports you to the specified warzone's lobby. + Ex - /warzone zone: - description: (War) Shortcut for /warzone. - usage: /zone ziggy + description: War> Shortcut for /warzone. + usage: Teleports you to the specified warzone's lobby. + Ex - /zone warhub: - description: (War) Teleports you to the warhub, if it exists. The warhub offers portals to reach each warzone on the server. - usage: /warhub + description: War> Teleports you to the warhub, if it exists. The warhub offers portals to reach each warzone on the server. + usage: Teleports you to the warhub, if it exists. + Ex - /warhub teams: - description: (War) Lists the teams in the warzone. - usage: - - Must be standing in warzone or lobby. - - /teams + description: War> Lists the teams in the warzone. + usage: Lists the teams in the warzone. Use zone name when outside warzone. + Ex - /teams [zone-name] join: - description: (War) Use to change teams. Also used instead of walking in the team gate in the lobby. - usage: - - Must be standing in warzone or lobby. - - /join + description: War> Use to change teams. Also used instead of walking in the team gate in the lobby. + usage: Use to change teams. Also used instead of walking in the team gate in the lobby. Must be standing in warzone or lobby. + Ex - /join leave: - description: (War) Use to leave a warzone. Teleports you back to the lobby. - usage: - - Must be in team already. - - /leave + description: War> Use to leave a warzone. Teleports you back to the lobby. + usage: Use to leave a warzone. Teleports you back to the lobby. Must be in team already. + Ex - /leave team: - description: (War) Team chat. - usage: /team Leeeroooy!!! + description: War> Team chat. + usage: Team chat. + Ex - /team # Warzone maker commands (must have the 'war.*' permission or be added as a zone-maker in /plugins/War/war.txt # 1- Battle-related commands nextbattle: - description: (War) Warzone blocks are restored (from memory). Teams are respawned. - usage: - - Must be standing in warzone or lobby - - /nextbattle + description: War> Warzone blocks are restored, teams are respawned but score remains unaffected. + usage: Warzone blocks are restored, teams are respawned but score remains unaffected. Provide a zone name if not standing in warzone or lobby. + Ex - /nextbattle [zone-name] # 2- Warzone creation commands setzone: - description: (War) Use to create a warzone. Lobby is created and blocks are saved when the second corner is set. - usage: - - == - - /setzone - - ex: first, /setzone ziggy se, then, /setzone ziggy nw - - In classic mode, corner1 defaults to the topmost block (127) in the northwest and corner2 to the bottommost block (0) in the southeast. - - == - - 1) /setzone wand - - 2) Left-click to select or move corner1 - - 3) Right-click to select or move corner2 - - Turn off wand by dropping the wooden sword. - - == - - /setzone - - The three modes can be mixed and matched. - - Warzones must be at least 10 blocks wide in all directions. + description: War> Use to create a warzone. Lobby is created and blocks are saved when the second corner is set. + usage: Use to create a warzone. Lobby is created and blocks are saved when the second corner is set. Warzones must be at least 10 blocks wide in all directions. + Ex - + ==Wand Cuboid mode==> + 1) /setzone to get wooden sword, + 2) Left-click to select or move corner1, + 3) Right-click to select or move corner2. + Turn off wand by dropping the wooden sword. + ==Wandless Cuboid mode==> + /setzone savezone: - description: (War) Persists changes made to the warzone since the last save. Config can be set with named parameters. - usage: - - Must be standing in warzone or lobby - - /savezone => Basic save - - /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - - /savezone loadout:default => sets the respawn inventory to your current items - - /savezone reward:default => sets the winner's reward to your current items + description: War> Persists changes made to the warzone since the last save. Config can be set with named parameters. + usage: Persists changes made to the warzone since the last save. Config can be set with named parameters. Provide a zone name if not standing in warzone or lobby. + Ex - + /savezone => Basic save, + /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on, + /savezone loadout:default => sets the respawn inventory to your current items, + /savezone reward:default => sets the winner's reward to your current items. setzonelobby: - description: (War) Creates or changes the position of the warzone lobby. - usage: - - Must be standing in warzone or lobby. - - /setzonelobby + description: War> Creates or changes the position of the warzone lobby. + usage: Creates or changes the position of the warzone lobby. + Ex - + ==Attached lobby==> + Must be standing in warzone or lobby. + /setzonelobby + ==Detached lobby==> + Must be standing outside warzone or lobby. + /setzonelobby setteam: - description: (War) Creates or moves a team spawn. The lobby is updated. Teams are diamond, iron or gold etc. - usage: - - Must be standing in warzone. - - /setteam + description: War> Creates or moves a team spawn. The lobby is updated. + usage: Creates or moves a team spawn. The lobby is updated. Must be standing in warzone. + Ex - + /setteam setmonument: - description: (War) Creates or moves a monument. - usage: - - Must be standing in warzone. - - /setmonument + description: War> Creates or moves a monument. + usage: Creates or moves a monument. Must be standing in warzone. + Ex - + /setmonument setteamflag: - description: (War) Creates/moves a team flag post for CTF. - usage: - - Must be standing in warzone. - - /setteamflag + description: War> Creates/moves a team flag post for CTF. + usage: Creates/moves a team flag post for CTF. Must be standing in warzone. + Ex - + /setteamflag resetzone: - description: (War) Reloads zone blocks from disks. Everyone is ported back to the lobby. - usage: - - Must be standing in warzone or lobby. - - /resetzone + description: War> Reloads zone blocks from disk. Everyone is teleported back to the lobby. + usage: Reloads zone blocks from disk. Everyone is teleported back to the lobby. Provide a zone name if not standing in warzone or lobby. + Ex - + /resetzone [zone-name] deletezone: - description: (War) Deletes the zone, resets all blocks. - usage: - - Must be standing in warzone or lobby, or provide name - - /deletezone, /deletezone + description: War> Deletes the zone, resets all blocks. + usage: Deletes the zone after resetting all blocks. Provide a zone name if not standing in warzone or lobby. + Ex - + /deletezone [zone-name] deleteteam: - description: (War) Deletes the team. Team must exist. - usage: - - Must be standing in warzone or lobby, or provide warzone-name - - /deleteteam + description: War> Deletes the team. Team must exist. + usage: Deletes the team. Team must exist. Provide a zone name if not standing in warzone or lobby. + Ex - + /deleteteam [zone-name] deletemonument: - description: (War) Deletes the monument. - usage: - - Must be standing in warzone or lobby, or provide warzone-name - - /deletemonument + description: War> Deletes the monument. + usage: Deletes the monument. Provide a zone name if not standing in warzone or lobby. + Ex - + /deletemonument [zone-name] setzoneconfig: - description: (War) Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. - usage: - - Must be standing in warzone or lobby, or provide warzone-name - - /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - - /setzoneconfig loadout:default => sets the respawn inventory to your current items - - /setzoneconfig reward:default => sets the winner's reward to your current items + description: War> Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. + usage: Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby. + Ex - + /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on, + /setzoneconfig loadout:default => sets the respawn inventory to your current items, + /setzoneconfig reward:default => sets the winner's reward to your current items zonecfg: - description: (War) Alias for /setzoneconfig - usage: + description: War> Alias for /setzoneconfig + usage: Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. Provide a zone name if not standing in warzone or lobby. + Ex - + /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on, + /setzoneconfig loadout:default => sets the respawn inventory to your current items, + /setzoneconfig reward:default => sets the winner's reward to your current items zonemaker: - description: (War) Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. - usage: - - /zonemaker - - /zonemaker + description: War> Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. + usage: Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. + Ex - + /zonemaker + /zonemaker zm: - description: (War) Alias for /zonemaker - usage: + description: War> Alias for /zonemaker + usage: Toggles between player mode and zone maker mode. Or gives/removes access to zonemaker commands for another player. + Ex - + /zonemaker + /zonemaker # 3- War hub setwarhub: - description: (War) Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub. - usage: /setwarhub + description: War> Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub. + usage: Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub. + Ex - + /setwarhub deletewarhub: - description: (War) Deletes the warhub if it exists. Resets all warzone lobbies. - usage: /deletewarhub + description: War> Deletes the warhub if it exists. Resets all warzone lobbies. + usage: Deletes the warhub if it exists. Resets all warzone lobbies. + Ex - + /deletewarhub # 4- Defaults and server configuration unloadwar: - description: (War) Disables the War plugin. - usage: /unloadwar + description: War> Disables the War plugin. + usage: Disables the War plugin. + Ex - + /unloadwar loadwar: - description: (War) Enables the War plugin. - usage: /loadwar + description: War> Enables the War plugin. + usage: Enables the War plugin. + Ex - + /loadwar setwarconfig: - description: (War) Change gobal settings and the default warzone configuration values. - usage: - - /setwarconfig pvpinzonesonly:on buildinzonesonly:on => Global settings - - /setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on => Warzone defaults - - /setwarconfig loadout:default => sets the respawn inventory to your current items - - /setwarconfig reward:default => sets the winner's reward to your current items - - /setwarconfig rallypoint: => changes when players get teleported at the end of a match for that zone, useful for chaining warzones together in a sequence, or preventing players from rejoining immediately + description: War> Change gobal settings and the default warzone configuration values. + usage: Change gobal settings and the default warzone configuration values. + Ex - + /setwarconfig pvpinzonesonly:on buildinzonesonly:on => Global settings, + /setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on => Warzone defaults, + /setwarconfig loadout:default => sets the respawn inventory to your current items, + /setwarconfig reward:default => sets the winner's reward to your current items, + /setwarconfig rallypoint: => changes when players get teleported at the end of a match for that zone, useful for chaining warzones together in a sequence, or preventing players from rejoining immediately warcfg: - description: (War) Alias for /setwarconfig - usage: + description: War> Alias for /setwarconfig + usage: Change gobal settings and the default warzone configuration values. + Ex - + /setwarconfig pvpinzonesonly:on buildinzonesonly:on => Global settings, + /setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on => Warzone defaults, + /setwarconfig loadout:default => sets the respawn inventory to your current items, + /setwarconfig reward:default => sets the winner's reward to your current items, + /setwarconfig rallypoint: => changes when players get teleported at the end of a match for that zone, useful for chaining warzones together in a sequence, or preventing players from rejoining immediately + # Fallback war: - description: (War) Short War help. Can also be used as a prefix for all War commands as a fallback if they conflict with other plugins. - usage: - - /war - - /war setzone ziggy northwest - - /war warhub - - /war zone ziggy - - etc. + description: War> Short War help. Can also be used as a prefix for all War commands as a fallback if they conflict with other plugins. + usage: War is on. Please pick your battle. Try /warhub, /zones and /zone. Further instructions at war.tommytony.com/instructions. + The /war command can be used as a prefix to all other command as a fallback if they conflict with other plugins. Ex - + /war, + /war setzone , + /war warhub, + /war zone War: - description: (War) Same as /war. Used as fallback. - usage: See /war. -#Note: When you /disable War with Essentials, or at shutdown, all warzone blocks will be reset and artifacts will disappear. -# When you /enable War, all blocks will be loaded from disk and the War-related artifacts will reappear. \ No newline at end of file + description: War> Same as /war. Used as fallback. + usage: See /war. \ No newline at end of file