Code Refactor - Whitespace Refactor

This commit is contained in:
Xephi
2014-08-08 23:14:56 +02:00
parent ec7ac60340
commit afc1ea9111
114 changed files with 8277 additions and 7103 deletions
+57 -51
View File
@@ -15,7 +15,6 @@ import fr.xephi.authme.events.ResetInventoryEvent;
import fr.xephi.authme.events.StoreInventoryEvent;
import fr.xephi.authme.settings.Settings;
public class LimboCache {
private static LimboCache singleton = null;
@@ -24,7 +23,7 @@ public class LimboCache {
public AuthMe plugin;
private LimboCache(AuthMe plugin) {
this.plugin = plugin;
this.plugin = plugin;
this.cache = new HashMap<String, LimboPlayer>();
}
@@ -39,63 +38,70 @@ public class LimboCache {
boolean flying;
if (playerData.doesCacheExist(name)) {
StoreInventoryEvent event = new StoreInventoryEvent(player, playerData);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) {
inv = event.getInventory();
arm = event.getArmor();
} else {
inv = null;
arm = null;
}
playerGroup = playerData.readCache(name).getGroup();
operator = playerData.readCache(name).getOperator();
flying = playerData.readCache(name).isFlying();
StoreInventoryEvent event = new StoreInventoryEvent(player,
playerData);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getInventory() != null
&& event.getArmor() != null) {
inv = event.getInventory();
arm = event.getArmor();
} else {
inv = null;
arm = null;
}
playerGroup = playerData.readCache(name).getGroup();
operator = playerData.readCache(name).getOperator();
flying = playerData.readCache(name).isFlying();
} else {
StoreInventoryEvent event = new StoreInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) {
inv = event.getInventory();
arm = event.getArmor();
} else {
inv = null;
arm = null;
}
if(player.isOp())
operator = true;
StoreInventoryEvent event = new StoreInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getInventory() != null
&& event.getArmor() != null) {
inv = event.getInventory();
arm = event.getArmor();
} else {
inv = null;
arm = null;
}
if (player.isOp()) operator = true;
else operator = false;
if(player.isFlying())
flying = true;
if (player.isFlying()) flying = true;
else flying = false;
if (plugin.permission != null) {
try {
playerGroup = plugin.permission.getPrimaryGroup(player);
} catch (UnsupportedOperationException e) {
ConsoleLogger.showError("Your permission system (" + plugin.permission.getName() + ") do not support Group system with that config... unhook!");
plugin.permission = null;
}
try {
playerGroup = plugin.permission.getPrimaryGroup(player);
} catch (UnsupportedOperationException e) {
ConsoleLogger
.showError("Your permission system ("
+ plugin.permission.getName()
+ ") do not support Group system with that config... unhook!");
plugin.permission = null;
}
}
}
if(Settings.isForceSurvivalModeEnabled) {
if(Settings.isResetInventoryIfCreative && player.getGameMode() == GameMode.CREATIVE ) {
ResetInventoryEvent event = new ResetInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
player.getInventory().clear();
player.sendMessage("Your inventory has been cleaned!");
}
if (Settings.isForceSurvivalModeEnabled) {
if (Settings.isResetInventoryIfCreative
&& player.getGameMode() == GameMode.CREATIVE) {
ResetInventoryEvent event = new ResetInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
player.getInventory().clear();
player.sendMessage("Your inventory has been cleaned!");
}
}
gameMode = GameMode.SURVIVAL;
}
if(player.isDead()) {
loc = plugin.getSpawnLocation(player);
if (player.isDead()) {
loc = plugin.getSpawnLocation(player);
}
cache.put(player.getName().toLowerCase(), new LimboPlayer(name, loc, inv, arm, gameMode, operator, playerGroup, flying));
cache.put(player.getName().toLowerCase(), new LimboPlayer(name, loc,
inv, arm, gameMode, operator, playerGroup, flying));
}
public void addLimboPlayer(Player player, String group) {
cache.put(player.getName().toLowerCase(), new LimboPlayer(player.getName().toLowerCase(), group));
cache.put(player.getName().toLowerCase(), new LimboPlayer(player
.getName().toLowerCase(), group));
}
public void deleteLimboPlayer(String name) {
@@ -117,11 +123,11 @@ public class LimboCache {
return singleton;
}
public void updateLimboPlayer(Player player) {
if (this.hasLimboPlayer(player.getName().toLowerCase())) {
this.deleteLimboPlayer(player.getName().toLowerCase());
}
this.addLimboPlayer(player);
}
public void updateLimboPlayer(Player player) {
if (this.hasLimboPlayer(player.getName().toLowerCase())) {
this.deleteLimboPlayer(player.getName().toLowerCase());
}
this.addLimboPlayer(player);
}
}
+22 -19
View File
@@ -17,7 +17,9 @@ public class LimboPlayer {
private String group = "";
private boolean flying = false;
public LimboPlayer(String name, Location loc, ItemStack[] inventory, ItemStack[] armour, GameMode gameMode, boolean operator, String group, boolean flying) {
public LimboPlayer(String name, Location loc, ItemStack[] inventory,
ItemStack[] armour, GameMode gameMode, boolean operator,
String group, boolean flying) {
this.name = name;
this.loc = loc;
this.inventory = inventory;
@@ -28,7 +30,8 @@ public class LimboPlayer {
this.flying = flying;
}
public LimboPlayer(String name, Location loc, GameMode gameMode, boolean operator, String group, boolean flying) {
public LimboPlayer(String name, Location loc, GameMode gameMode,
boolean operator, String group, boolean flying) {
this.name = name;
this.loc = loc;
this.gameMode = gameMode;
@@ -59,11 +62,11 @@ public class LimboPlayer {
}
public void setArmour(ItemStack[] armour) {
this.armour = armour;
this.armour = armour;
}
public void setInventory(ItemStack[] inventory) {
this.inventory = inventory;
this.inventory = inventory;
}
public GameMode getGameMode() {
@@ -78,24 +81,24 @@ public class LimboPlayer {
return group;
}
public void setTimeoutTaskId(int i) {
this.timeoutTaskId = i;
}
public void setTimeoutTaskId(int i) {
this.timeoutTaskId = i;
}
public int getTimeoutTaskId() {
return timeoutTaskId;
}
public int getTimeoutTaskId() {
return timeoutTaskId;
}
public void setMessageTaskId(int messageTaskId) {
this.messageTaskId = messageTaskId;
}
public void setMessageTaskId(int messageTaskId) {
this.messageTaskId = messageTaskId;
}
public int getMessageTaskId() {
return messageTaskId;
}
public int getMessageTaskId() {
return messageTaskId;
}
public boolean isFlying() {
return flying;
}
public boolean isFlying() {
return flying;
}
}