This commit is contained in:
MistPhizzle 2014-07-19 20:18:14 -04:00
parent 6e4705d0bc
commit 4ef2e12287

View file

@ -124,6 +124,7 @@ public class Methods {
public static boolean isBender(String player, Element element) { public static boolean isBender(String player, Element element) {
BendingPlayer bPlayer = getBendingPlayer(player); BendingPlayer bPlayer = getBendingPlayer(player);
if (bPlayer == null) return false;
if (bPlayer.hasElement(element)) return true; if (bPlayer.hasElement(element)) return true;
return false; return false;
} }
@ -265,39 +266,37 @@ public class Methods {
DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = 'false' WHERE uuid = '" + uuid + "'"); DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = 'false' WHERE uuid = '" + uuid + "'");
} }
} }
public static void deserializeFile() { public static void deserializeFile() {
File readFile = new File(".", "bendingPlayers.yml"); File readFile = new File(".", "bendingPlayers.yml");
File writeFile = new File(".", "converted.yml"); File writeFile = new File(".", "converted.yml");
if (readFile.exists()) { if (readFile.exists()) {
// plugin.log.info("File exists"); // plugin.log.info("File exists");
try { try {
DataInputStream input = new DataInputStream(new FileInputStream(readFile)); DataInputStream input = new DataInputStream(new FileInputStream(readFile));
BufferedReader reader = new BufferedReader(new InputStreamReader(input)); BufferedReader reader = new BufferedReader(new InputStreamReader(input));
DataOutputStream output = new DataOutputStream(new FileOutputStream(writeFile)); DataOutputStream output = new DataOutputStream(new FileOutputStream(writeFile));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
if (!line.trim().contains("==: BendingPlayer")) { if (!line.trim().contains("==: BendingPlayer")) {
writer.write(line + "\n"); writer.write(line + "\n");
} }
} }
reader.close(); reader.close();
input.close(); input.close();
writer.close(); writer.close();
output.close(); output.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
public static void stopBending() { public static void stopBending() {
List<AbilityModule> abilities = AbilityModuleManager.ability; List<AbilityModule> abilities = AbilityModuleManager.ability;
for (AbilityModule ab: abilities) { for (AbilityModule ab: abilities) {
@ -531,7 +530,7 @@ public class Methods {
} }
} }
public static boolean hasPermission(Player player, String ability) { public static boolean hasPermission(Player player, String ability) {
if (player.hasPermission("bending.ability." + ability)) return true; if (player.hasPermission("bending.ability." + ability)) return true;
return false; return false;
@ -580,7 +579,7 @@ public class Methods {
public static ChatColor getEarthColor() { public static ChatColor getEarthColor() {
return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Earth")); return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Earth"));
} }
public static ChatColor getMetalbendingColor() { public static ChatColor getMetalbendingColor() {
return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Metalbending")); return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Metalbending"));
} }
@ -614,7 +613,7 @@ public class Methods {
public static String getBoundAbility(Player player) { public static String getBoundAbility(Player player) {
BendingPlayer bPlayer = getBendingPlayer(player.getName()); BendingPlayer bPlayer = getBendingPlayer(player.getName());
if (bPlayer == null) return null; if (bPlayer == null) return null;
int slot = player.getInventory().getHeldItemSlot() + 1; int slot = player.getInventory().getHeldItemSlot() + 1;
return bPlayer.abilities.get(slot); return bPlayer.abilities.get(slot);
} }
@ -1699,12 +1698,12 @@ public class Methods {
return false; return false;
} }
public static boolean canMetalbend(Player player) { public static boolean canMetalbend(Player player) {
if (player.hasPermission("bending.earth.metalbending")) return true; if (player.hasPermission("bending.earth.metalbending")) return true;
return false; return false;
} }
public static boolean isMetalBlock(Block block) { public static boolean isMetalBlock(Block block) {
if (block.getType() == Material.GOLD_BLOCK if (block.getType() == Material.GOLD_BLOCK
|| block.getType() == Material.IRON_BLOCK || block.getType() == Material.IRON_BLOCK