Code-Style

This commit is contained in:
Tim Düsterhus 2011-09-10 17:49:12 +02:00
parent bcfa109944
commit 8788c9c4b6
28 changed files with 116 additions and 107 deletions

View File

@ -866,7 +866,7 @@ public class War extends JavaPlugin {
} }
public TeamSpawnStyle getDefaultSpawnStyle() { public TeamSpawnStyle getDefaultSpawnStyle() {
return defaultSpawnStyle; return this.defaultSpawnStyle;
} }
public void setDefaultSpawnStyle(TeamSpawnStyle defaultSpawnStyle) { public void setDefaultSpawnStyle(TeamSpawnStyle defaultSpawnStyle) {
@ -878,7 +878,7 @@ public class War extends JavaPlugin {
} }
public FlagReturn getDefaultFlagReturn() { public FlagReturn getDefaultFlagReturn() {
return defaultFlagReturn; return this.defaultFlagReturn;
} }
public HashMap<String, InventoryStash> getDisconnected() { public HashMap<String, InventoryStash> getDisconnected() {

View File

@ -376,7 +376,9 @@ public class WarPlayerListener extends PlayerListener {
boolean inFlag = (playerTeam.getFlagVolume() != null && playerTeam.getFlagVolume().contains(player.getLocation())); boolean inFlag = (playerTeam.getFlagVolume() != null && playerTeam.getFlagVolume().contains(player.getLocation()));
if (playerWarzone.getFlagReturn() == FlagReturn.BOTH) { if (playerWarzone.getFlagReturn() == FlagReturn.BOTH) {
if (!inSpawn && !inFlag) return; if (!inSpawn && !inFlag) {
return;
}
} else if (playerWarzone.getFlagReturn() == FlagReturn.SPAWN) { } else if (playerWarzone.getFlagReturn() == FlagReturn.SPAWN) {
if (inFlag) { if (inFlag) {
War.war.badMsg(player, "You have to capture the enemy flag at your team's spawn."); War.war.badMsg(player, "You have to capture the enemy flag at your team's spawn.");

View File

@ -52,6 +52,7 @@ public enum TeamKind {
return this.material; return this.material;
} }
@Override
public String toString() { public String toString() {
return super.toString().toLowerCase(); return super.toString().toLowerCase();
} }

View File

@ -265,9 +265,13 @@ public class Warzone {
// nom drops // nom drops
for(Entity entity : (this.getWorld().getEntities())) { for(Entity entity : (this.getWorld().getEntities())) {
if (!(entity instanceof Item) && !(entity instanceof CraftItem)) continue; if (!(entity instanceof Item) && !(entity instanceof CraftItem)) {
continue;
}
// validate position // validate position
if (!this.getVolume().contains(entity.getLocation())) continue; if (!this.getVolume().contains(entity.getLocation())) {
continue;
}
// omnomnomnom // omnomnomnom
entity.remove(); entity.remove();

View File

@ -23,7 +23,9 @@ public class HelmetProtectionTask implements Runnable {
* @see Runnable.run() * @see Runnable.run()
*/ */
public void run() { public void run() {
if (!War.war.isLoaded()) return; if (!War.war.isLoaded()) {
return;
}
for (Warzone zone : War.war.getWarzones()) { for (Warzone zone : War.war.getWarzones()) {
for (Team team : zone.getTeams()) { for (Team team : zone.getTeams()) {
for (Player player : team.getPlayers()) { for (Player player : team.getPlayers()) {
@ -33,7 +35,7 @@ public class HelmetProtectionTask implements Runnable {
teamBlockMaterial = team.getKind().getMaterial(); teamBlockMaterial = team.getKind().getMaterial();
// 1) Replace missing block head // 1) Replace missing block head
if (playerInv.getHelmet().getType() != teamBlockMaterial) { if (playerInv.getHelmet().getType() != teamBlockMaterial) {
playerInv.setHelmet(createBlockHead(team)); playerInv.setHelmet(this.createBlockHead(team));
} }
// 2) Get rid of extra blocks in inventory: only keep one // 2) Get rid of extra blocks in inventory: only keep one
HashMap<Integer, ? extends ItemStack> blocks = playerInv.all(teamBlockMaterial); HashMap<Integer, ? extends ItemStack> blocks = playerInv.all(teamBlockMaterial);
@ -48,7 +50,7 @@ public class HelmetProtectionTask implements Runnable {
} }
i++; i++;
} }
playerInv.setItem(playerInv.firstEmpty(), createBlockHead(team)); playerInv.setItem(playerInv.firstEmpty(), this.createBlockHead(team));
if (removed > 1) { if (removed > 1) {
War.war.badMsg(player, "All that " + team.getName() + " wool must have been heavy!"); War.war.badMsg(player, "All that " + team.getName() + " wool must have been heavy!");
} }

View File

@ -20,7 +20,7 @@ public class LoadoutResetJob implements Runnable {
public void run() { public void run() {
this.zone.resetInventory(this.team, this.player); this.zone.resetInventory(this.team, this.player);
// Stop fire here, since doing it in the same tick as death doesn't extinguish it // Stop fire here, since doing it in the same tick as death doesn't extinguish it
player.setFireTicks(0); this.player.setFireTicks(0);
} }
} }