JavaDoc for commands and War

This commit is contained in:
Tim Düsterhus 2011-08-14 12:57:16 +02:00
parent 7fef7c9649
commit 0019e7e107
25 changed files with 238 additions and 50 deletions

View File

@ -111,10 +111,10 @@ public class War extends JavaPlugin {
if(!loadedOnce) {
loadedOnce = true; // This prevented multiple hookups of the same listener
// Register hooks
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Priority.Normal, this);
@ -123,17 +123,17 @@ public class War extends JavaPlugin {
pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, this.playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, this.playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_INTERACT, this.playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_EXPLODE, this.entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGE, this.entityListener, Priority.High, this);
pm.registerEvent(Event.Type.ENTITY_COMBUST, this.entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.CREATURE_SPAWN, this.entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Priority.Normal, this);
}
// Load files from disk or create them (using these defaults)
this.getDefaultLoadout().put(0, new ItemStack(Material.STONE_SWORD, 1, (byte) 8));
this.getDefaultLoadout().put(1, new ItemStack(Material.BOW, 1, (byte) 8));
@ -141,7 +141,7 @@ public class War extends JavaPlugin {
this.getDefaultLoadout().put(3, new ItemStack(Material.IRON_PICKAXE, 1, (byte) 8));
this.getDefaultLoadout().put(4, new ItemStack(Material.STONE_SPADE, 1, (byte) 8));
this.getDefaultReward().put( 0, new ItemStack(Material.CAKE, 1));
WarMapper.load();
this.log("War v" + this.desc.getVersion() + " is on.", Level.INFO);
}
@ -154,7 +154,7 @@ public class War extends JavaPlugin {
warzone.unload();
}
this.warzones.clear();
PluginManager pm = this.getServer().getPluginManager();
if (this.warHub != null) {
@ -180,7 +180,7 @@ public class War extends JavaPlugin {
}
/**
* Handles war commands
* @see JavaPlugin.onCommand()
*/
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
return this.commandHandler.handle(sender, cmd, args);
@ -280,7 +280,7 @@ public class War extends JavaPlugin {
String onOff = namedParams.get("nocreatures");
warzone.setNoCreatures(onOff.equals("on") || onOff.equals("true"));
}
if (namedParams.containsKey("resetonempty")) {
String onOff = namedParams.get("resetonempty");
warzone.setResetOnEmpty(onOff.equals("on") || onOff.equals("true"));
@ -374,7 +374,7 @@ public class War extends JavaPlugin {
String onOff = namedParams.get("nocreatures");
this.setDefaultNoCreatures(onOff.equals("on") || onOff.equals("true"));
}
if (namedParams.containsKey("resetonempty")) {
String onOff = namedParams.get("resetonempty");
this.setDefaultResetOnEmpty(onOff.equals("on") || onOff.equals("true"));
@ -405,10 +405,10 @@ public class War extends JavaPlugin {
return false;
}
}
public String printConfig(Warzone zone) {
return "Warzone " + zone.getName() + " config - "
+ "lifepool:" + zone.getLifePool() + " "
+ "lifepool:" + zone.getLifePool() + " "
+ "teamsize:" + zone.getTeamCap() + " "
+ "maxscore:" + zone.getScoreCap() + " "
+ "ff:" + onOffStr(zone.getFriendlyFire())
@ -423,14 +423,14 @@ public class War extends JavaPlugin {
+ "resetonload:" + onOffStr(zone.isResetOnLoad())
+ "resetonunload:" + onOffStr(zone.isResetOnUnload());
}
public String printConfig() {
return "War config - "
+ "pvpinzonesonly:" + onOffStr(War.war.isPvpInZonesOnly())
+ "disablepvpmessage:" + onOffStr(War.war.isDisablePvpMessage())
+ "buildinzonesonly:" + onOffStr(War.war.isBuildInZonesOnly())
+ "- Warzone defaults - "
+ "lifepool:" + War.war.getDefaultLifepool() + " "
+ "lifepool:" + War.war.getDefaultLifepool() + " "
+ "teamsize:" + War.war.getDefaultTeamCap() + " "
+ "maxscore:" + War.war.getDefaultScoreCap() + " "
+ "ff:" + onOffStr(War.war.isDefaultFriendlyFire())
@ -444,14 +444,14 @@ public class War extends JavaPlugin {
+ "resetonload:" + onOffStr(War.war.isDefaultResetOnLoad())
+ "resetonunload:" + onOffStr(War.war.isDefaultResetOnUnload());
}
private String onOffStr(boolean makeThisAString) {
if(makeThisAString) {
return "on ";
} else {
return "off ";
}
}
private void setZoneRallyPoint(String warzoneName, Player player) {
@ -512,11 +512,11 @@ public class War extends JavaPlugin {
}
/**
* Colors the teams and examples 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
* @param str message-string
* @param msgColor current message-color
* @return Message with colored teams
*/
private String colorKnownTokens(String str, ChatColor msgColor) {
for (TeamKind kind : TeamKinds.getTeamkinds()) {
@ -529,8 +529,8 @@ public class War extends JavaPlugin {
/**
* Logs a specified message with a specified level
*
* @param String str message to log
* @param Level lvl level to use
* @param str message to log
* @param lvl level to use
*/
public void log(String str, Level lvl) {
this.getLogger().log(lvl, "War> " + str);
@ -551,6 +551,12 @@ public class War extends JavaPlugin {
return null;
}
/**
* Checks whether the given player is allowed to play war.
*
* @param player Player to check
* @return true if the player may play war
*/
public boolean canPlayWar(Player player) {
if (War.permissionHandler != null && (War.permissionHandler.has(player, "war.player") || War.permissionHandler.has(player, "War.player"))) {
return true;
@ -562,6 +568,12 @@ public class War extends JavaPlugin {
return false;
}
/**
* Checks whether the given player is allowed to warp.
*
* @param player Player to check
* @return true if the player may warp
*/
public boolean canWarp(Player player) {
if (War.permissionHandler != null && (War.permissionHandler.has(player, "war.warp") || War.permissionHandler.has(player, "War.warp"))) {
return true;
@ -573,6 +585,12 @@ public class War extends JavaPlugin {
return false;
}
/**
* Checks whether the given player is allowed to build outside zones
*
* @param player Player to check
* @return true if the player may build outside zones
*/
public boolean canBuildOutsideZone(Player player) {
if (this.isBuildInZonesOnly()) {
if (War.permissionHandler != null && (War.permissionHandler.has(player, "war.build") || War.permissionHandler.has(player, "War.build"))) {
@ -585,6 +603,12 @@ public class War extends JavaPlugin {
}
}
/**
* Checks whether the given player is allowed to pvp outside zones
*
* @param player Player to check
* @return true if the player may pvp outside zones
*/
public boolean canPvpOutsideZones(Player player) {
if (this.isPvpInZonesOnly()) {
if (War.permissionHandler != null && (War.permissionHandler.has(player, "war.pvp") || War.permissionHandler.has(player, "War.pvp"))) {
@ -597,7 +621,14 @@ public class War extends JavaPlugin {
}
}
/**
* Checks whether the given player is a zone maker
*
* @param player Player to check
* @return true if the player is a zone maker
*/
public boolean isZoneMaker(Player player) {
// sort out disguised first
for (String disguised : this.zoneMakersImpersonatingPlayers) {
if (disguised.equals(player.getName())) {
return false;
@ -612,6 +643,7 @@ public class War extends JavaPlugin {
if (War.permissionHandler != null && (War.permissionHandler.has(player, "war.*") || War.permissionHandler.has(player, "War.*"))) {
return true;
} else {
// default to op, if no permissions are found
return player.isOp();
}
}

View File

@ -21,26 +21,28 @@ public class WarCommandHandler {
* @param sender The sender of the command
* @param cmd The command
* @param args The arguments
* @return Success
* @see War.onCommand()
*/
public boolean handle(CommandSender sender, Command cmd, String[] args) {
String command = cmd.getName();
String[] arguments = null;
// parse prefixed commands
if ((command.equals("war") || command.equals("War")) && args.length > 0) {
command = args[0];
arguments = new String[args.length - 1];
for (int i = 1; i <= arguments.length; i++) {
arguments[i - 1] = args[i];
}
if (arguments.length == 1 && (arguments[0].equals("help") || arguments[0].equals("h"))) {
// show /war help
War.war.badMsg(sender, cmd.getUsage());
War.war.badMsg(sender, cmd.getUsage());
return true;
}
} else if (command.equals("war") || command.equals("War")) {
// show /war help
War.war.msg(sender, cmd.getUsage());
War.war.msg(sender, cmd.getUsage());
return true;
} else {
arguments = args;
@ -98,24 +100,26 @@ public class WarCommandHandler {
commandObj = new SetWarConfigCommand(this, sender, arguments);
} else if (command.equals("zonemaker") || command.equals("zm")) {
commandObj = new ZoneMakerCommand(this, sender, arguments);
}
}
// we are not responsible for any other command
}
catch (NotZoneMakerException e) {
// user is no zonemaker -> flame him :D
War.war.badMsg(sender, "You can't do this if you are not a warzone maker.");
}
catch (Exception e) {
// generally catch exceptions and log them
War.war.log("An error occured while handling command " + cmd.getName() + ". Exception:" + e.getClass().toString() + " " + e.getMessage(), Level.WARNING);
e.printStackTrace();
}
if(commandObj != null) {
boolean handled = commandObj.handle();
if(!handled) {
War.war.badMsg(sender, cmd.getUsage());
War.war.badMsg(sender, cmd.getUsage());
}
}
return true;
}
}

View File

@ -138,6 +138,7 @@ public class WarEntityListener extends EntityListener {
@Override
public void onEntityExplode(EntityExplodeEvent event) {
if (!War.war.isLoaded()) return;
// protect zones elements, lobbies and warhub from creepers
List<Block> explodedBlocks = event.blockList();
for (Block block : explodedBlocks) {
@ -242,7 +243,10 @@ public class WarEntityListener extends EntityListener {
*/
@Override
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (!War.war.isLoaded() || event.getRegainReason() != RegainReason.REGEN) return;
if (!War.war.isLoaded()) return;
// break if reason was not regen
if (event.getRegainReason() != RegainReason.REGEN) return;
Entity entity = event.getEntity();
if (!(entity instanceof Player)) return;

View File

@ -5,32 +5,80 @@ import org.bukkit.command.CommandSender;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Represents a war command
*
* @author Tim Düsterhus
*/
public abstract class AbstractWarCommand {
/**
* The sender of this command
*
* @var sender
*/
private CommandSender sender;
/**
* The arguments of this command
*
* @var args
*/
protected String[] args;
/**
* Instance of WarCommandHandler
*
* @var handler
*/
protected WarCommandHandler handler;
public AbstractWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
this.handler = handler;
this.setSender(sender);
this.args = args;
}
/**
* Handles the command
*
* @return true if command was used the right way
*/
abstract public boolean handle();
/**
* Sends a success message
*
* @param message message to send
*/
public void msg(String message) {
War.war.msg(getSender(), message);
}
/**
* Sends a failure message
*
* @param message message to send
*/
public void badMsg(String message) {
War.war.badMsg(getSender(), message);
}
/**
* Changes the command-sender
*
* @param sender new sender
*/
public void setSender(CommandSender sender) {
this.sender = sender;
}
/**
* Gets the command-sender
*
* @return Command-Sender
*/
public CommandSender getSender() {
return sender;
return this.sender;
}
}

View File

@ -7,16 +7,24 @@ import org.bukkit.entity.Player;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Represents a command that may only be used by zone makers
*
* @author Tim Düsterhus
*/
public abstract class AbstractZoneMakerCommand extends AbstractWarCommand {
public AbstractZoneMakerCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
if (sender instanceof Player) {
// for players check War.isZoneMaker()
if (!War.war.isZoneMaker((Player) sender)) {
throw new NotZoneMakerException();
}
}
else if (!(sender instanceof ConsoleCommandSender)) {
// otherwise only the console is a legimate sender
throw new NotZoneMakerException();
}
}

View File

@ -10,6 +10,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Deletes a monument.
*
* @author Tim Düsterhus
*/
public class DeleteMonumentCommand extends AbstractZoneMakerCommand {
public DeleteMonumentCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
@ -18,6 +23,7 @@ public class DeleteMonumentCommand extends AbstractZoneMakerCommand {
@Override
public boolean handle() {
Warzone zone;
if (this.args.length == 0) {
return false;
} else if (this.args.length == 2) {
@ -38,6 +44,7 @@ public class DeleteMonumentCommand extends AbstractZoneMakerCommand {
} else {
return false;
}
if (zone == null) {
return true;
}

View File

@ -11,6 +11,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Deletes a team.
*
* @author Tim Düsterhus
*/
public class DeleteTeamCommand extends AbstractZoneMakerCommand {
public DeleteTeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
@ -19,6 +24,7 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand {
@Override
public boolean handle() {
Warzone zone;
if (this.args.length == 0) {
return false;
} else if (this.args.length == 2) {
@ -39,6 +45,7 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand {
} else {
return false;
}
if (zone == null) {
return false;
}

View File

@ -11,6 +11,11 @@ import com.tommytony.war.mappers.WarMapper;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Deletes the warhub.
*
* @author Tim Düsterhus
*/
public class DeleteWarhubCommand extends AbstractZoneMakerCommand {
public DeleteWarhubCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
@ -21,6 +26,7 @@ public class DeleteWarhubCommand extends AbstractZoneMakerCommand {
if (this.args.length != 0) {
return false;
}
if (War.war.getWarHub() != null) {
// reset existing hub
War.war.getWarHub().getVolume().resetBlocks();

View File

@ -13,6 +13,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Deletes a warzone.
*
* @author Tim Düsterhus
*/
public class DeleteZoneCommand extends AbstractZoneMakerCommand {
public DeleteZoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
@ -39,6 +44,7 @@ public class DeleteZoneCommand extends AbstractZoneMakerCommand {
} else {
return false;
}
if (zone == null) {
return false;
}

View File

@ -14,6 +14,11 @@ import com.tommytony.war.TeamKinds;
import com.tommytony.war.Warzone;
import com.tommytony.war.ZoneLobby;
/**
* Joins a team.
*
* @author Tim Düsterhus
*/
public class JoinCommand extends AbstractWarCommand {
public JoinCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
super(handler, sender, args);

View File

@ -7,6 +7,11 @@ import bukkit.tommytony.war.WarCommandHandler;
import com.tommytony.war.Warzone;
/**
* Leaves a game.
*
* @author Tim Düsterhus
*/
public class LeaveCommand extends AbstractWarCommand {
public LeaveCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
super(handler, sender, args);

View File

@ -5,6 +5,11 @@ import org.bukkit.command.CommandSender;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Loads war.
*
* @author Tim Düsterhus
*/
public class LoadWarCommand extends AbstractZoneMakerCommand {
public LoadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
@ -15,7 +20,7 @@ public class LoadWarCommand extends AbstractZoneMakerCommand {
if (this.args.length != 0) {
return false;
}
War.war.loadWar();
this.msg("War loaded.");
return true;

View File

@ -1,10 +1,10 @@
package bukkit.tommytony.war.command;
/**
* NotZoneMakerException is thrown when a player is no zonemaker.
*
* @author Tim Düsterhus
*/
public class NotZoneMakerException extends Exception {
/**
*
*/
private static final long serialVersionUID = -5412011034665080340L;
}

View File

@ -21,7 +21,7 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
Warzone zone = null;
CommandSender commandSender = this.getSender();
boolean isFirstParamWarzone = false;
if(this.args.length > 0 && !this.args[0].contains(":")) {
// warzone name maybe in first place
Warzone zoneByName = Warzone.getZoneByName(this.args[0]);
@ -30,10 +30,10 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
isFirstParamWarzone = true;
}
}
if (this.getSender() instanceof Player) {
Player player = (Player)commandSender;
Warzone zoneByLoc = Warzone.getZoneByLocation(player);
ZoneLobby lobbyByLoc = ZoneLobby.getLobbyByLocation(player);
if(zoneByLoc == null && lobbyByLoc != null) {
@ -41,14 +41,14 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
}
if(zoneByLoc != null) {
zone = zoneByLoc;
}
}
}
if (zone == null) {
// No warzone found, whatever the mean, escape
return false;
}
if (isFirstParamWarzone) {
if(this.args.length > 1) {
// More than one param: the arguments need to be shifted
@ -56,13 +56,13 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
for (int i = 1; i < this.args.length; i++) {
newargs[i-1] = args[i];
}
this.args = newargs;
this.args = newargs;
}
}
// We have a warzone and indexed-from-0 arguments, let's updatethis.msg(player, "Saving warzone " + warzone.getName() + ".");
int savedBlocks = zone.saveState(true);
// changed settings: must reinitialize with new settings
War.war.updateZoneFromNamedParams(zone, commandSender, args);
WarzoneMapper.save(zone, true);
@ -82,7 +82,7 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
this.msg("Warzone " + zone.getName() + " initial state changed. Saved " + savedBlocks + " blocks.");
return true;
}
}

View File

@ -9,6 +9,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Places a monument
*
* @author Tim Düsterhus
*/
public class SetMonumentCommand extends AbstractZoneMakerCommand {
public SetMonumentCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);

View File

@ -11,6 +11,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Places a soawn
*
* @author Tim Düsterhus
*/
public class SetTeamCommand extends AbstractZoneMakerCommand {
public SetTeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);

View File

@ -12,6 +12,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Places a teamflag
*
* @author Tim Düsterhus
*/
public class SetTeamFlagCommand extends AbstractZoneMakerCommand {
public SetTeamFlagCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);

View File

@ -10,6 +10,11 @@ import com.tommytony.war.mappers.WarMapper;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Places the warhub
*
* @author Tim Düsterhus
*/
public class SetWarHubCommand extends AbstractZoneMakerCommand {
public SetWarHubCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);

View File

@ -11,6 +11,11 @@ import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Places the zonelobby
*
* @author Tim Düsterhus
*/
public class SetZoneLobbyCommand extends AbstractZoneMakerCommand {
public SetZoneLobbyCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {

View File

@ -10,8 +10,8 @@ import com.tommytony.war.Team;
/**
* Sends a message to all team-members
* @author das-schaf
*
* @author Tim Düsterhus
*/
public class TeamCommand extends AbstractWarCommand {
public TeamCommand(WarCommandHandler handler, CommandSender sender, String[] args) {

View File

@ -8,6 +8,11 @@ import bukkit.tommytony.war.WarCommandHandler;
import com.tommytony.war.Warzone;
import com.tommytony.war.ZoneLobby;
/**
* Shows team information
*
* @author Tim Düsterhus
*/
public class TeamsCommand extends AbstractWarCommand {
public TeamsCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
super(handler, sender, args);

View File

@ -5,6 +5,11 @@ import org.bukkit.command.CommandSender;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Unloads war.
*
* @author Tim Düsterhus
*/
public class UnloadWarCommand extends AbstractZoneMakerCommand {
public UnloadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);

View File

@ -8,6 +8,11 @@ import bukkit.tommytony.war.WarCommandHandler;
import com.tommytony.war.Warzone;
/**
* Warps the player to the warhub.
*
* @author Tim Düsterhus
*/
public class WarhubCommand extends AbstractWarCommand {
public WarhubCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
super(handler, sender, args);

View File

@ -8,6 +8,11 @@ import bukkit.tommytony.war.WarCommandHandler;
import com.tommytony.war.Warzone;
/**
* Warps the player to the given warzone.
*
* @author Tim Düsterhus
*/
public class WarzoneCommand extends AbstractWarCommand {
public WarzoneCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
super(handler, sender, args);

View File

@ -8,11 +8,17 @@ import com.tommytony.war.mappers.WarMapper;
import bukkit.tommytony.war.War;
import bukkit.tommytony.war.WarCommandHandler;
/**
* Makes a player zonemaker and other way round.
*
* @author Tim Düsterhus
*/
public class ZoneMakerCommand extends AbstractWarCommand {
public ZoneMakerCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotZoneMakerException {
super(handler, sender, args);
if (sender instanceof Player) {
if (sender instanceof Player) { // i hate java for this.
if (!War.war.isZoneMaker((Player) sender)) {
for (String name : War.war.getZoneMakersImpersonatingPlayers()) {
if (((Player) sender).getName().equals(name)) {