Forcing the code style we agreed on

- Trimming whitespace
- Using qualifier whenever possible
- Space between if/for/while/switch and (
This commit is contained in:
Tim Düsterhus 2011-08-14 13:15:55 +02:00
parent e9f56967cb
commit 174126209b
35 changed files with 337 additions and 293 deletions

View File

@ -74,7 +74,9 @@ public class War extends JavaPlugin {
private boolean defaultAutoAssignOnly = false;
private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false;
private boolean defaultResetOnEmpty = false, defaultResetOnLoad = false, defaultResetOnUnload = false;
private boolean defaultResetOnEmpty = false,
defaultResetOnLoad = false,
defaultResetOnUnload = false;
private String defaultSpawnStyle = TeamSpawnStyles.BIG;
private final HashMap<Integer, ItemStack> defaultReward = new HashMap<Integer, ItemStack>();
@ -108,8 +110,8 @@ public class War extends JavaPlugin {
this.logger = this.getServer().getLogger();
this.setupPermissions();
if (!loadedOnce) {
loadedOnce = true; // This prevented multiple hookups of the same listener
if (!War.loadedOnce) {
War.loadedOnce = true; // This prevented multiple hookups of the same listener
// Register hooks
PluginManager pm = this.getServer().getPluginManager();
@ -139,7 +141,7 @@ public class War extends JavaPlugin {
this.getDefaultLoadout().put(2, new ItemStack(Material.ARROW, 7));
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));
this.getDefaultReward().put(0, new ItemStack(Material.CAKE, 1));
WarMapper.load();
this.log("War v" + this.desc.getVersion() + " is on.", Level.INFO);
@ -186,8 +188,10 @@ public class War extends JavaPlugin {
/**
* Converts the player-inventory to a loadout hashmap
*
* @param inv inventory to get the items from
* @param loadout the hashmap to save to
* @param inv
* inventory to get the items from
* @param loadout
* the hashmap to save to
*/
private void inventoryToLoadout(PlayerInventory inv, HashMap<Integer, ItemStack> loadout) {
loadout.clear();
@ -213,8 +217,10 @@ public class War extends JavaPlugin {
/**
* Converts the player-inventory to a loadout hashmap
*
* @param player player to get the inventory to get the items from
* @param loadout the hashmap to save to
* @param player
* player to get the inventory to get the items from
* @param loadout
* the hashmap to save to
*/
private void inventoryToLoadout(Player player, HashMap<Integer, ItemStack> loadout) {
this.inventoryToLoadout(player.getInventory(), loadout);
@ -385,7 +391,7 @@ public class War extends JavaPlugin {
this.setDefaultResetOnUnload(onOff.equals("on") || onOff.equals("true"));
}
if (commandSender instanceof Player) {
Player player = (Player)commandSender;
Player player = (Player) commandSender;
if (namedParams.containsKey("loadout")) {
this.inventoryToLoadout(player, this.getDefaultLoadout());
}
@ -408,42 +414,42 @@ public class War extends JavaPlugin {
+ "lifepool:" + zone.getLifePool() + " "
+ "teamsize:" + zone.getTeamCap() + " "
+ "maxscore:" + zone.getScoreCap() + " "
+ "ff:" + onOffStr(zone.getFriendlyFire())
+ "autoassign:" + onOffStr(zone.getAutoAssignOnly())
+ "blockheads:" + onOffStr(zone.isBlockHeads())
+ "ff:" + this.onOffStr(zone.getFriendlyFire())
+ "autoassign:" + this.onOffStr(zone.getAutoAssignOnly())
+ "blockheads:" + this.onOffStr(zone.isBlockHeads())
+ "spawnstyle:" + zone.getSpawnStyle() + " "
+ "monumentheal:" + zone.getMonumentHeal() + " "
+ "unbreakable:" + onOffStr(zone.isUnbreakableZoneBlocks())
+ "disabled:" + onOffStr(zone.isDisabled())
+ "nocreatures:" + onOffStr(zone.isNoCreatures())
+ "resetonempty:" + onOffStr(zone.isResetOnEmpty())
+ "resetonload:" + onOffStr(zone.isResetOnLoad())
+ "resetonunload:" + onOffStr(zone.isResetOnUnload());
+ "unbreakable:" + this.onOffStr(zone.isUnbreakableZoneBlocks())
+ "disabled:" + this.onOffStr(zone.isDisabled())
+ "nocreatures:" + this.onOffStr(zone.isNoCreatures())
+ "resetonempty:" + this.onOffStr(zone.isResetOnEmpty())
+ "resetonload:" + this.onOffStr(zone.isResetOnLoad())
+ "resetonunload:" + this.onOffStr(zone.isResetOnUnload());
}
public String printConfig() {
return "War config - "
+ "pvpinzonesonly:" + onOffStr(War.war.isPvpInZonesOnly())
+ "disablepvpmessage:" + onOffStr(War.war.isDisablePvpMessage())
+ "buildinzonesonly:" + onOffStr(War.war.isBuildInZonesOnly())
+ "pvpinzonesonly:" + this.onOffStr(War.war.isPvpInZonesOnly())
+ "disablepvpmessage:" + this.onOffStr(War.war.isDisablePvpMessage())
+ "buildinzonesonly:" + this.onOffStr(War.war.isBuildInZonesOnly())
+ "- Warzone defaults - "
+ "lifepool:" + War.war.getDefaultLifepool() + " "
+ "teamsize:" + War.war.getDefaultTeamCap() + " "
+ "maxscore:" + War.war.getDefaultScoreCap() + " "
+ "ff:" + onOffStr(War.war.isDefaultFriendlyFire())
+ "autoassign:" + onOffStr(War.war.isDefaultAutoAssignOnly())
+ "blockheads:" + onOffStr(War.war.isDefaultBlockHeads())
+ "ff:" + this.onOffStr(War.war.isDefaultFriendlyFire())
+ "autoassign:" + this.onOffStr(War.war.isDefaultAutoAssignOnly())
+ "blockheads:" + this.onOffStr(War.war.isDefaultBlockHeads())
+ "spawnstyle:" + War.war.getDefaultSpawnStyle() + " "
+ "monumentheal:" + War.war.getDefaultMonumentHeal() + " "
+ "unbreakable:" + onOffStr(War.war.isDefaultUnbreakableZoneBlocks())
+ "nocreatures:" + onOffStr(War.war.isDefaultNoCreatures())
+ "resetonempty:" + onOffStr(War.war.isDefaultResetOnEmpty())
+ "resetonload:" + onOffStr(War.war.isDefaultResetOnLoad())
+ "resetonunload:" + onOffStr(War.war.isDefaultResetOnUnload());
+ "unbreakable:" + this.onOffStr(War.war.isDefaultUnbreakableZoneBlocks())
+ "nocreatures:" + this.onOffStr(War.war.isDefaultNoCreatures())
+ "resetonempty:" + this.onOffStr(War.war.isDefaultResetOnEmpty())
+ "resetonload:" + this.onOffStr(War.war.isDefaultResetOnLoad())
+ "resetonunload:" + this.onOffStr(War.war.isDefaultResetOnUnload());
}
private String onOffStr(boolean makeThisAString) {
if(makeThisAString) {
if (makeThisAString) {
return "on ";
} else {
return "off ";
@ -470,7 +476,7 @@ public class War extends JavaPlugin {
}
public void msg(CommandSender sender, String str) {
if(sender instanceof Player) {
if (sender instanceof Player) {
String out = ChatColor.GRAY + "War> " + ChatColor.WHITE + this.colorKnownTokens(str, ChatColor.WHITE) + " ";
ChatFixUtil.sendMessage(sender, out);
} else {
@ -479,7 +485,7 @@ public class War extends JavaPlugin {
}
public void badMsg(CommandSender sender, String str) {
if(sender instanceof Player) {
if (sender instanceof Player) {
String out = ChatColor.GRAY + "War> " + ChatColor.RED + this.colorKnownTokens(str, ChatColor.RED) + " ";
ChatFixUtil.sendMessage(sender, out);
} else {
@ -490,8 +496,10 @@ public class War extends JavaPlugin {
/**
* Colors the teams and examples in messages
*
* @param String str message-string
* @param String msgColor current message-color
* @param String
* str message-string
* @param String
* msgColor current message-color
* @return String Message with colored teams
*/
private String colorKnownTokens(String str, ChatColor msgColor) {
@ -505,8 +513,10 @@ 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 String
* str message to log
* @param Level
* lvl level to use
*/
public void log(String str, Level lvl) {
this.getLogger().log(lvl, "War> " + str);
@ -694,7 +704,7 @@ public class War extends JavaPlugin {
}
public boolean isLoaded() {
return loaded;
return this.loaded;
}
public void setLoaded(boolean loaded) {
@ -702,7 +712,7 @@ public class War extends JavaPlugin {
}
public boolean isPvpInZonesOnly() {
return pvpInZonesOnly;
return this.pvpInZonesOnly;
}
public void setPvpInZonesOnly(boolean pvpInZonesOnly) {
@ -710,7 +720,7 @@ public class War extends JavaPlugin {
}
public boolean isDisablePvpMessage() {
return disablePvpMessage;
return this.disablePvpMessage;
}
public void setDisablePvpMessage(boolean disablePvpMessage) {
@ -718,7 +728,7 @@ public class War extends JavaPlugin {
}
public boolean isBuildInZonesOnly() {
return buildInZonesOnly;
return this.buildInZonesOnly;
}
public void setBuildInZonesOnly(boolean buildInZonesOnly) {
@ -726,7 +736,7 @@ public class War extends JavaPlugin {
}
public int getDefaultLifepool() {
return defaultLifepool;
return this.defaultLifepool;
}
public void setDefaultLifepool(int defaultLifepool) {
@ -734,7 +744,7 @@ public class War extends JavaPlugin {
}
public int getDefaultTeamCap() {
return defaultTeamCap;
return this.defaultTeamCap;
}
public void setDefaultTeamCap(int defaultTeamCap) {
@ -742,7 +752,7 @@ public class War extends JavaPlugin {
}
public int getDefaultScoreCap() {
return defaultScoreCap;
return this.defaultScoreCap;
}
public void setDefaultScoreCap(int defaultScoreCap) {
@ -750,7 +760,7 @@ public class War extends JavaPlugin {
}
public int getDefaultMonumentHeal() {
return defaultMonumentHeal;
return this.defaultMonumentHeal;
}
public void setDefaultMonumentHeal(int defaultMonumentHeal) {
@ -758,7 +768,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultBlockHeads() {
return defaultBlockHeads;
return this.defaultBlockHeads;
}
public void setDefaultBlockHeads(boolean defaultBlockHeads) {
@ -766,7 +776,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultFriendlyFire() {
return defaultFriendlyFire;
return this.defaultFriendlyFire;
}
public void setDefaultFriendlyFire(boolean defaultFriendlyFire) {
@ -774,7 +784,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultAutoAssignOnly() {
return defaultAutoAssignOnly;
return this.defaultAutoAssignOnly;
}
public void setDefaultAutoAssignOnly(boolean defaultAutoAssignOnly) {
@ -782,7 +792,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultUnbreakableZoneBlocks() {
return defaultUnbreakableZoneBlocks;
return this.defaultUnbreakableZoneBlocks;
}
public void setDefaultUnbreakableZoneBlocks(boolean defaultUnbreakableZoneBlocks) {
@ -790,7 +800,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultNoCreatures() {
return defaultNoCreatures;
return this.defaultNoCreatures;
}
public void setDefaultNoCreatures(boolean defaultNoCreatures) {
@ -798,7 +808,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultResetOnEmpty() {
return defaultResetOnEmpty;
return this.defaultResetOnEmpty;
}
public void setDefaultResetOnEmpty(boolean defaultResetOnEmpty) {
@ -806,7 +816,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultResetOnLoad() {
return defaultResetOnLoad;
return this.defaultResetOnLoad;
}
public void setDefaultResetOnLoad(boolean defaultResetOnLoad) {
@ -814,7 +824,7 @@ public class War extends JavaPlugin {
}
public boolean isDefaultResetOnUnload() {
return defaultResetOnUnload;
return this.defaultResetOnUnload;
}
public void setDefaultResetOnUnload(boolean defaultResetOnUnload) {
@ -822,7 +832,7 @@ public class War extends JavaPlugin {
}
public String getDefaultSpawnStyle() {
return defaultSpawnStyle;
return this.defaultSpawnStyle;
}
public void setDefaultSpawnStyle(String defaultSpawnStyle) {

View File

@ -29,11 +29,15 @@ public class WarBlockListener extends BlockListener {
*/
@Override
public void onBlockPlace(BlockPlaceEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
Player player = event.getPlayer();
Block block = event.getBlock();
if (player == null || block == null) return;
if (player == null || block == null) {
return;
}
Team team = Team.getTeamByPlayerName(player.getName());
Warzone zone = Warzone.getZoneByLocation(player);
@ -114,7 +118,9 @@ public class WarBlockListener extends BlockListener {
*/
@Override
public void onBlockBreak(BlockBreakEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
Player player = event.getPlayer();
Block block = event.getBlock();
if (player != null && block != null) {

View File

@ -18,9 +18,12 @@ public class WarCommandHandler {
/**
* Handles a command
*
* @param sender The sender of the command
* @param cmd The command
* @param args The arguments
* @param sender
* The sender of the command
* @param cmd
* The command
* @param args
* The arguments
* @return Success
*/
public boolean handle(CommandSender sender, Command cmd, String[] args) {
@ -100,18 +103,16 @@ public class WarCommandHandler {
commandObj = new ZoneMakerCommand(this, sender, arguments);
}
// we are not responsible for any other command
}
catch (NotZoneMakerException e) {
} catch (NotZoneMakerException e) {
War.war.badMsg(sender, "You can't do this if you are not a warzone maker.");
}
catch (Exception e) {
} catch (Exception e) {
War.war.log("An error occured while handling command " + cmd.getName() + ". Exception:" + e.getClass().toString() + " " + e.getMessage(), Level.WARNING);
e.printStackTrace();
}
if(commandObj != null) {
if (commandObj != null) {
boolean handled = commandObj.handle();
if(!handled) {
if (!handled) {
War.war.badMsg(sender, cmd.getUsage());
}
}

View File

@ -34,7 +34,8 @@ public class WarEntityListener extends EntityListener {
/**
* Handles PVP-Damage
*
* @param event fired event
* @param event
* fired event
*/
private void handlerAttackDefend(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
@ -137,7 +138,9 @@ public class WarEntityListener extends EntityListener {
*/
@Override
public void onEntityExplode(EntityExplodeEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
// protect zones elements, lobbies and warhub from creepers
List<Block> explodedBlocks = event.blockList();
for (Block block : explodedBlocks) {
@ -168,7 +171,9 @@ public class WarEntityListener extends EntityListener {
*/
@Override
public void onEntityDamage(EntityDamageEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof Player)) {
@ -201,7 +206,9 @@ public class WarEntityListener extends EntityListener {
@Override
public void onEntityCombust(EntityCombustEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
Entity entity = event.getEntity();
if (entity instanceof Player) {
Player player = (Player) entity;
@ -225,7 +232,9 @@ public class WarEntityListener extends EntityListener {
*/
@Override
public void onCreatureSpawn(CreatureSpawnEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
Location location = event.getLocation();
Warzone zone = Warzone.getZoneByLocation(location);
@ -242,9 +251,13 @@ public class WarEntityListener extends EntityListener {
*/
@Override
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (!War.war.isLoaded() || event.getRegainReason() != RegainReason.REGEN) return;
if (!War.war.isLoaded() || event.getRegainReason() != RegainReason.REGEN) {
return;
}
Entity entity = event.getEntity();
if (!(entity instanceof Player)) return;
if (!(entity instanceof Player)) {
return;
}
Player player = (Player) entity;
Warzone zone = Warzone.getZoneByLocation(player);

View File

@ -215,7 +215,9 @@ public class WarPlayerListener extends PlayerListener {
@Override
public void onPlayerMove(PlayerMoveEvent event) {
if (!War.war.isLoaded()) return;
if (!War.war.isLoaded()) {
return;
}
Player player = event.getPlayer();
Location playerLoc = event.getFrom(); // same as player.getLoc. Don't call again we need same result.
Warzone locZone = Warzone.getZoneByLocation(playerLoc);

View File

@ -10,6 +10,7 @@ public abstract class AbstractWarCommand {
private CommandSender sender;
protected String[] args;
protected WarCommandHandler handler;
public AbstractWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) {
this.handler = handler;
this.setSender(sender);
@ -19,11 +20,11 @@ public abstract class AbstractWarCommand {
abstract public boolean handle();
public void msg(String message) {
War.war.msg(getSender(), message);
War.war.msg(this.getSender(), message);
}
public void badMsg(String message) {
War.war.badMsg(getSender(), message);
War.war.badMsg(this.getSender(), message);
}
public void setSender(CommandSender sender) {
@ -31,6 +32,6 @@ public abstract class AbstractWarCommand {
}
public CommandSender getSender() {
return sender;
return this.sender;
}
}

View File

@ -15,8 +15,7 @@ public abstract class AbstractZoneMakerCommand extends AbstractWarCommand {
if (!War.war.isZoneMaker((Player) sender)) {
throw new NotZoneMakerException();
}
}
else if (!(sender instanceof ConsoleCommandSender)) {
} else if (!(sender instanceof ConsoleCommandSender)) {
throw new NotZoneMakerException();
}
}

View File

@ -22,7 +22,7 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
CommandSender commandSender = this.getSender();
boolean isFirstParamWarzone = false;
if(this.args.length > 0 && !this.args[0].contains(":")) {
if (this.args.length > 0 && !this.args[0].contains(":")) {
// warzone name maybe in first place
Warzone zoneByName = Warzone.getZoneByName(this.args[0]);
if (zoneByName != null) {
@ -32,14 +32,14 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
}
if (this.getSender() instanceof Player) {
Player player = (Player)commandSender;
Player player = (Player) commandSender;
Warzone zoneByLoc = Warzone.getZoneByLocation(player);
ZoneLobby lobbyByLoc = ZoneLobby.getLobbyByLocation(player);
if(zoneByLoc == null && lobbyByLoc != null) {
if (zoneByLoc == null && lobbyByLoc != null) {
zoneByLoc = lobbyByLoc.getZone();
}
if(zoneByLoc != null) {
if (zoneByLoc != null) {
zone = zoneByLoc;
}
}
@ -50,11 +50,11 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
}
if (isFirstParamWarzone) {
if(this.args.length > 1) {
if (this.args.length > 1) {
// More than one param: the arguments need to be shifted
String[] newargs = new String[this.args.length - 1];
for (int i = 1; i < this.args.length; i++) {
newargs[i-1] = args[i];
newargs[i - 1] = this.args[i];
}
this.args = newargs;
}
@ -64,9 +64,9 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
int savedBlocks = zone.saveState(true);
// changed settings: must reinitialize with new settings
War.war.updateZoneFromNamedParams(zone, commandSender, args);
War.war.updateZoneFromNamedParams(zone, commandSender, this.args);
WarzoneMapper.save(zone, true);
if(this.args.length > 0) {
if (this.args.length > 0) {
// the config may have changed, requiring a reset for spawn styles etc.
zone.getVolume().resetBlocks();
}
@ -80,7 +80,6 @@ public class SaveZoneCommand extends AbstractZoneMakerCommand {
War.war.getWarHub().initialize();
}
this.msg("Warzone " + zone.getName() + " initial state changed. Saved " + savedBlocks + " blocks.");
return true;

View File

@ -33,20 +33,20 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
if (zoneByName != null) {
zone = zoneByName;
isFirstParamWarzone = true;
} else if (this.args[0].equals("-p") || this.args[0].equals("print")){
} else if (this.args[0].equals("-p") || this.args[0].equals("print")) {
wantsToPrint = true;
}
}
if (this.getSender() instanceof Player) {
player = (Player)commandSender;
player = (Player) commandSender;
Warzone zoneByLoc = Warzone.getZoneByLocation(player);
ZoneLobby lobbyByLoc = ZoneLobby.getLobbyByLocation(player);
if(zoneByLoc == null && lobbyByLoc != null) {
if (zoneByLoc == null && lobbyByLoc != null) {
zoneByLoc = lobbyByLoc.getZone();
}
if(zoneByLoc != null) {
if (zoneByLoc != null) {
zone = zoneByLoc;
}
}
@ -57,29 +57,29 @@ public class SetZoneConfigCommand extends AbstractZoneMakerCommand {
}
if (isFirstParamWarzone) {
if(this.args.length == 1) {
if (this.args.length == 1) {
// Only one param: the warzone name - default to usage
return false;
}
// More than one param: the arguments need to be shifted
String[] newargs = new String[this.args.length - 1];
for (int i = 1; i < this.args.length; i++) {
newargs[i-1] = args[i];
newargs[i - 1] = this.args[i];
}
this.args = newargs;
}
// args have been shifted if needed
if(this.args.length > 0 && (this.args[0].equals("-p") || this.args[0].equals("print"))) {
if (this.args.length > 0 && (this.args[0].equals("-p") || this.args[0].equals("print"))) {
// only printing
if(this.args.length == 1) {
if (this.args.length == 1) {
this.msg(War.war.printConfig(zone));
return true;
} else {
// first param was to print, shift again
String[] newargs = new String[this.args.length - 1];
for (int i = 1; i < this.args.length; i++) {
newargs[i-1] = args[i];
newargs[i - 1] = this.args[i];
}
this.args = newargs;
}

View File

@ -10,6 +10,7 @@ import com.tommytony.war.Team;
/**
* Sends a message to all team-members
*
* @author das-schaf
*
*/

View File

@ -27,8 +27,7 @@ public class WarzonesCommand extends AbstractWarCommand {
String warzonesMessage = "Warzones: ";
if (War.war.getWarzones().isEmpty()) {
warzonesMessage += "none.";
}
else {
} else {
for (Warzone warzone : War.war.getWarzones()) {
warzonesMessage += warzone.getName() + " (" + warzone.getTeams().size() + " teams, ";
int playerTotal = 0;

View File

@ -193,7 +193,8 @@ public class WarHub {
/**
* Resets the sign of the given warzone
*
* @param Warzone zone
* @param Warzone
* zone
*/
public void resetZoneSign(Warzone zone) {
BlockFace left;

View File

@ -147,8 +147,7 @@ public class Warzone {
String teamsMessage = "Teams: ";
if (this.getTeams().isEmpty()) {
teamsMessage += "none.";
}
else {
} else {
for (Team team : this.getTeams()) {
teamsMessage += team.getName() + " (" + team.getPoints() + " points, " + team.getRemainingLifes() + "/" + this.getLifePool() + " lives left. ";
for (Player member : team.getPlayers()) {
@ -950,7 +949,7 @@ public class Warzone {
public void setSpawnStyle(String spawnStyle) {
this.spawnStyle = spawnStyle;
for(Team team : this.teams) {
for (Team team : this.teams) {
team.setTeamSpawn(team.getTeamSpawn());
}
}

View File

@ -243,7 +243,7 @@ public class ZoneLobby {
private void calculateLobbyWidth() {
int noOfTeams = this.warzone.getTeams().size();
if(this.warzone.isAutoAssignOnly()) {
if (this.warzone.isAutoAssignOnly()) {
noOfTeams = 1;
}
int lobbyWidth = noOfTeams * 4 + 5;
@ -477,7 +477,7 @@ public class ZoneLobby {
Block autoAssignGateBlock = BlockInfo.getBlock(this.warzone.getWorld(), this.autoAssignGate);
this.setBlock(autoAssignGateBlock.getFace(BlockFace.DOWN), (Material.GLOWSTONE));
int size = teams.size();
if(size > 0) {
if (size > 0) {
TeamKind[] doorBlockKinds = new TeamKind[7];
for (int i = 0; i < 7; i++) {
doorBlockKinds[i] = teams.get(i % size).getKind();

View File

@ -32,7 +32,7 @@ public class RestoreWarhubJob implements Runnable {
if (hubStrSplit.length > 3) {
worldName = hubStrSplit[3];
world = War.war.getServer().getWorld(worldName);
if(hubStrSplit.length > 4) {
if (hubStrSplit.length > 4) {
hubOrientation = hubStrSplit[4];
}
} else {

View File

@ -43,9 +43,12 @@ public class ZoneVolumeMapper {
/**
* Loads the given volume
*
* @param ZoneVolume volume Volume to load
* @param String zoneName Zone to load the volume from
* @param World world The world the zone is located
* @param ZoneVolume
* volume Volume to load
* @param String
* zoneName Zone to load the volume from
* @param World
* world The world the zone is located
* @param boolean onlyLoadCorners Should only the corners be loaded
* @return integer Changed blocks
*/
@ -275,7 +278,8 @@ public class ZoneVolumeMapper {
/**
* Parses an inventory string
*
* @param String invString string to parse
* @param String
* invString string to parse
* @return List<ItemStack> Parsed items
*/
private static List<ItemStack> readInventoryString(String invString) {
@ -306,8 +310,10 @@ public class ZoneVolumeMapper {
/**
* Saves the given volume
*
* @param Volume volume Volume to save
* @param String zoneName The warzone the volume is located
* @param Volume
* volume Volume to save
* @param String
* zoneName The warzone the volume is located
* @return integer Number of written blocks
*/
public static int save(Volume volume, String zoneName) {
@ -473,9 +479,12 @@ public class ZoneVolumeMapper {
/**
* Saves the Volume as a background-job
*
* @param ZoneVolme volume volume to save
* @param String zoneName The zone the volume is located
* @param War war Instance of war
* @param ZoneVolme
* volume volume to save
* @param String
* zoneName The zone the volume is located
* @param War
* war Instance of war
* @param long tickDelay delay before beginning the task
*/
private static void saveAsJob(ZoneVolume volume, String zoneName, long tickDelay) {
@ -486,8 +495,10 @@ public class ZoneVolumeMapper {
/**
* Deletes the given volume
*
* @param Volume volume volume to delete
* @param War war Instance of war
* @param Volume
* volume volume to delete
* @param War
* war Instance of war
*/
public static void delete(Volume volume) {
ZoneVolumeMapper.deleteFile("War/dat/volume-" + volume.getName() + ".dat");
@ -500,8 +511,10 @@ public class ZoneVolumeMapper {
/**
* Deletes a volume file
*
* @param String path path of file
* @param War war Instance of war
* @param String
* path path of file
* @param War
* war Instance of war
*/
private static void deleteFile(String path) {
File volFile = new File(path);