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.

This commit is contained in:
taoneill 2011-08-06 16:14:21 -04:00
parent 8891b97a9d
commit 05b827d265
32 changed files with 468 additions and 393 deletions

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -0,0 +1,10 @@
package bukkit.tommytony.war.command;
public class NotZoneMakerException extends Exception {
/**
*
*/
private static final long serialVersionUID = -5412011034665080340L;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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());

View File

@ -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;

View File

@ -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 {

View File

@ -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) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}

View File

@ -39,7 +39,7 @@ public class WarzonesCommand extends AbstractWarCommand {
}
}
this.msg(warzonesMessage + ((this.sender instanceof Player) ? " Use /zone <zone-name> to teleport to a warzone." : ""));
this.msg(warzonesMessage + ((this.getSender() instanceof Player) ? " Use /zone <zone-name> to teleport to a warzone." : ""));
return true;
}

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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<String> messages = ChatFixUtil.fix(message);
ChatFixUtil.sendMessage(player, messages, false);
@ -134,7 +134,7 @@ public class ChatFixUtil {
}
}
public static void sendMessage(Player player, List<String> messages, boolean fix) {
public static void sendMessage(CommandSender player, List<String> 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<String> messages) {
public static void sendMessage(CommandSender player, List<String> messages) {
ChatFixUtil.sendMessage(player, messages, true);
}
// ----------------------------------------------//
// Many Players
// Many CommandSenders
// ----------------------------------------------//
public static void sendMessage(Collection<Player> players, String message, boolean fix) {
public static void sendMessage(Collection<CommandSender> players, String message, boolean fix) {
if (fix) {
List<String> 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<Player> players, List<String> messages, boolean fix) {
public static void sendMessage(Collection<CommandSender> players, List<String> messages, boolean fix) {
if (fix) {
messages = ChatFixUtil.fix(messages);
}
@ -175,11 +175,11 @@ public class ChatFixUtil {
}
}
public static void sendMessage(Collection<Player> players, String message) {
public static void sendMessage(Collection<CommandSender> players, String message) {
ChatFixUtil.sendMessage(players, message, true);
}
public static void sendMessage(Collection<Player> players, List<String> messages) {
public static void sendMessage(Collection<CommandSender> players, List<String> messages) {
ChatFixUtil.sendMessage(players, messages, true);
}
}

View File

@ -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 <zone-name>
description: War> Teleports you to the specified warzone's lobby.
usage: Teleports you to the specified warzone's lobby.
Ex - /warzone <zone-name>
zone:
description: (War) Shortcut for /warzone.
usage: /zone <zone-name>
description: War> Shortcut for /warzone.
usage: Teleports you to the specified warzone's lobby.
Ex - /zone <zone-name>
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 <team-color>
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 <team-color>
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 <Message>
description: War> Team chat.
usage: Team chat.
Ex - /team <message>
# 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:
- =<Classic/Northwest-Southeast mode>=
- /setzone <zone-name> <northwest/southeast/nw/se>
- 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.
- =<Wand Cuboid mode>=
- 1) /setzone <zone-name> 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.
- =<Wandless Cuboid mode>=
- /setzone <zone-name> <corner1/corner2/c1/c2/pos1/pos2>
- 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 <zone-name> 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 <zone-name> <corner1/corner2/c1/c2/pos1/pos2>
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:<big/flat/small> 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:<big/flat/small> 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:
- =<Attached lobby>
- Must be standing in warzone or lobby.
- /setzonelobby <north/east/south/west/n/e/s/w>
- =<External lobby>
- /setzonelobby <zone-name>
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 <north/east/south/west/n/e/s/w>
==Detached lobby==>
Must be standing outside warzone or lobby.
/setzonelobby <zone-name>
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 <diamond/iron/gold/white/orange/magenta/blue/green/pink/gray/purple/navy/brown/darkgreen/red/black>
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 <diamond/iron/gold/white/orange/magenta/blue/green/pink/gray/purple/navy/brown/darkgreen/red/black>
setmonument:
description: (War) Creates or moves a monument.
usage:
- Must be standing in warzone.
- /setmonument <monument-name>
description: War> Creates or moves a monument.
usage: Creates or moves a monument. Must be standing in warzone.
Ex -
/setmonument <monument-name>
setteamflag:
description: (War) Creates/moves a team flag post for CTF.
usage:
- Must be standing in warzone.
- /setteamflag <team-color>
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 <team-color>
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] <team-color>
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] <team-color>
deletemonument:
description: (War) Deletes the monument.
usage:
- Must be standing in warzone or lobby, or provide warzone-name
- /deletemonument [zone-name] <monument-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] <monument-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:<big/flat/small> 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:<big/flat/small/invisible> 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:<big/flat/small/invisible> 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 <new-or-kicked-zone-maker-name>
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 <new-or-kicked-zone-maker-name>
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 <new-or-kicked-zone-maker-name>
# 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:<big/flat/small> 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:<warzone-name> => 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:<big/flat/small/invisible> 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:<warzone-name> => 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:<big/flat/small/invisible> 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:<warzone-name> => 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 <zone-name>,
/war warhub,
/war zone <zone-name>
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.
description: War> Same as /war. Used as fallback.
usage: See /war.

View File

@ -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-name>
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 <zone-name>
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 <team color>
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 <team-color>
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 <message>
# 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:
- =<Classic/Northwest-Southeast mode>=
- /setzone <zonename> <northwest/southeast/nw/se>
- 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.
- =<Wand Cuboid mode>=
- 1) /setzone <name> 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.
- =<Wandless Cuboid mode>=
- /setzone <name> <corner1/corner2/c1/c2/pos1/pos2>
- 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 <zone-name> 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 <zone-name> <corner1/corner2/c1/c2/pos1/pos2>
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:<big/flat/small> 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:<big/flat/small> 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 <north/east/south/west/n/e/s/w>
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 <north/east/south/west/n/e/s/w>
==Detached lobby==>
Must be standing outside warzone or lobby.
/setzonelobby <zone-name>
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 <diamond/iron/gold/white/orange/magenta/blue/green/pink/gray/purple/navy/brown/darkgreen/red/black>
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 <diamond/iron/gold/white/orange/magenta/blue/green/pink/gray/purple/navy/brown/darkgreen/red/black>
setmonument:
description: (War) Creates or moves a monument.
usage:
- Must be standing in warzone.
- /setmonument <monument-name>
description: War> Creates or moves a monument.
usage: Creates or moves a monument. Must be standing in warzone.
Ex -
/setmonument <monument-name>
setteamflag:
description: (War) Creates/moves a team flag post for CTF.
usage:
- Must be standing in warzone.
- /setteamflag <team-color>
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 <team-color>
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 <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 <team-color>
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] <team-color>
deletemonument:
description: (War) Deletes the monument.
usage:
- Must be standing in warzone or lobby, or provide warzone-name
- /deletemonument <monument-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] <monument-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:<big/flat/small> 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:<big/flat/small/invisible> 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:<big/flat/small/invisible> 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 <new-or-kicked-zone-maker-name>
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 <new-or-kicked-zone-maker-name>
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 <new-or-kicked-zone-maker-name>
# 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:<big/flat/small> 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:<warzone-name> => 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:<big/flat/small/invisible> 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:<warzone-name> => 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:<big/flat/small/invisible> 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:<warzone-name> => 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 <zone-name>,
/war warhub,
/war zone <zone-name>
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.
description: War> Same as /war. Used as fallback.
usage: See /war.