mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
NPE Fix
This commit is contained in:
parent
6e4705d0bc
commit
4ef2e12287
1 changed files with 30 additions and 31 deletions
|
@ -124,6 +124,7 @@ public class Methods {
|
|||
|
||||
public static boolean isBender(String player, Element element) {
|
||||
BendingPlayer bPlayer = getBendingPlayer(player);
|
||||
if (bPlayer == null) return false;
|
||||
if (bPlayer.hasElement(element)) return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -270,34 +271,32 @@ public class Methods {
|
|||
|
||||
public static void deserializeFile() {
|
||||
File readFile = new File(".", "bendingPlayers.yml");
|
||||
File writeFile = new File(".", "converted.yml");
|
||||
if (readFile.exists()) {
|
||||
// plugin.log.info("File exists");
|
||||
try {
|
||||
DataInputStream input = new DataInputStream(new FileInputStream(readFile));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
|
||||
File writeFile = new File(".", "converted.yml");
|
||||
if (readFile.exists()) {
|
||||
// plugin.log.info("File exists");
|
||||
try {
|
||||
DataInputStream input = new DataInputStream(new FileInputStream(readFile));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
|
||||
|
||||
DataOutputStream output = new DataOutputStream(new FileOutputStream(writeFile));
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (!line.trim().contains("==: BendingPlayer")) {
|
||||
writer.write(line + "\n");
|
||||
}
|
||||
}
|
||||
DataOutputStream output = new DataOutputStream(new FileOutputStream(writeFile));
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (!line.trim().contains("==: BendingPlayer")) {
|
||||
writer.write(line + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
reader.close();
|
||||
input.close();
|
||||
writer.close();
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
input.close();
|
||||
writer.close();
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void stopBending() {
|
||||
List<AbilityModule> abilities = AbilityModuleManager.ability;
|
||||
for (AbilityModule ab: abilities) {
|
||||
|
|
Loading…
Reference in a new issue