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
@@ -13,25 +13,27 @@ public class BungeeCordMessage implements PluginMessageListener {
public AuthMe plugin;
public BungeeCordMessage(AuthMe plugin)
{
public BungeeCordMessage(AuthMe plugin) {
this.plugin = plugin;
}
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
public void onPluginMessageReceived(String channel, Player player,
byte[] message) {
if (!channel.equals("BungeeCord")) {
return;
}
try {
final DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
final DataInputStream in = new DataInputStream(
new ByteArrayInputStream(message));
String subchannel = in.readUTF();
if (subchannel.equals("IP")) { //We need only the IP channel
String ip = in.readUTF();
plugin.realIp.put(player.getName().toLowerCase(), ip); //Put the IP (only the ip not the port) in the hashmap
if (subchannel.equals("IP")) { // We need only the IP channel
String ip = in.readUTF();
plugin.realIp.put(player.getName().toLowerCase(), ip);
// Put the IP (only the ip not the port) in the hashmap
}
} catch (IOException ex) {
}
}
}
}
@@ -12,22 +12,22 @@ public class CitizensCommunicator {
public AuthMe instance;
public CitizensCommunicator(AuthMe instance) {
this.instance = instance;
this.instance = instance;
}
public boolean isNPC(final Entity player, AuthMe instance) {
try {
if (instance.CitizensVersion == 1) {
return CitizensManager.isNPC(player);
} else if (instance.CitizensVersion == 2) {
return CitizensAPI.getNPCRegistry().isNPC(player);
} else {
return false;
}
} catch (NoClassDefFoundError ncdfe) {
return false;
} catch (Exception npe) {
return false;
}
try {
if (instance.CitizensVersion == 1) {
return CitizensManager.isNPC(player);
} else if (instance.CitizensVersion == 2) {
return CitizensAPI.getNPCRegistry().isNPC(player);
} else {
return false;
}
} catch (NoClassDefFoundError ncdfe) {
return false;
} catch (Exception npe) {
return false;
}
}
}
@@ -12,13 +12,15 @@ public abstract class CombatTagComunicator {
/**
* Returns if the entity is an NPC
*
* @param player
* @return true if the player is an NPC
*/
public static boolean isNPC(Entity player) {
try {
if(Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null){
combatApi = new CombatTagApi((CombatTag) Bukkit.getServer().getPluginManager().getPlugin("CombatTag"));
if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) {
combatApi = new CombatTagApi((CombatTag) Bukkit.getServer()
.getPluginManager().getPlugin("CombatTag"));
try {
combatApi.getClass().getMethod("isNPC");
} catch (Exception e) {
@@ -9,32 +9,39 @@ import fr.xephi.authme.settings.CustomConfiguration;
public class EssSpawn extends CustomConfiguration {
private static EssSpawn spawn;
private static EssSpawn spawn;
public EssSpawn() {
super(new File("./plugins/Essentials/spawn.yml"));
spawn = this;
load();
}
public EssSpawn() {
super(new File("./plugins/Essentials/spawn.yml"));
spawn = this;
load();
}
public static EssSpawn getInstance() {
public static EssSpawn getInstance() {
if (spawn == null) {
spawn = new EssSpawn();
}
}
return spawn;
}
public Location getLocation() {
try {
if (!this.contains("spawns.default.world")) return null;
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world") == "") return null;
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
return location;
} catch (NullPointerException npe) {
return null;
} catch (NumberFormatException nfe) {
return null;
}
}
public Location getLocation() {
try {
if (!this.contains("spawns.default.world")) return null;
if (this.getString("spawns.default.world").isEmpty()
|| this.getString("spawns.default.world") == "") return null;
Location location = new Location(Bukkit.getWorld(this
.getString("spawns.default.world")),
this.getDouble("spawns.default.x"),
this.getDouble("spawns.default.y"),
this.getDouble("spawns.default.z"), Float.parseFloat(this
.getString("spawns.default.yaw")),
Float.parseFloat(this.getString("spawns.default.pitch")));
return location;
} catch (NullPointerException npe) {
return null;
} catch (NumberFormatException nfe) {
return null;
}
}
}