mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
Cleanup/Prevent Memory leak
This commit is contained in:
parent
27f9173626
commit
1b66842974
5 changed files with 7 additions and 17 deletions
|
@ -75,9 +75,6 @@ import com.palmergames.bukkit.towny.object.WorldCoord;
|
|||
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
|
||||
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
|
||||
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
|
||||
import com.projectkorra.ProjectKorra.Element;
|
||||
import com.projectkorra.ProjectKorra.Information;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
import com.projectkorra.ProjectKorra.Ability.AbilityModule;
|
||||
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||
|
@ -442,23 +439,20 @@ public class Methods {
|
|||
File readFile = new File(".", "bendingPlayers.yml");
|
||||
File writeFile = new File(".", "converted.yml");
|
||||
if (readFile.exists()) {
|
||||
try {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
reader.close();
|
||||
input.close();
|
||||
writer.close();
|
||||
output.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -882,7 +876,7 @@ public class Methods {
|
|||
}
|
||||
}
|
||||
if(target != null) {
|
||||
List <Block> blklist = new ArrayList();
|
||||
List <Block> blklist = new ArrayList<Block>();
|
||||
blklist = Methods.getBlocksAlongLine(player.getLocation(), target.getLocation(), player.getWorld());
|
||||
for(Block isair:blklist)
|
||||
{
|
||||
|
@ -2349,7 +2343,8 @@ public class Methods {
|
|||
PrintWriter pw = new PrintWriter(fw);
|
||||
pw.println(message);
|
||||
pw.flush();
|
||||
|
||||
pw.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.bukkit.event.block.BlockFadeEvent;
|
|||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.projectkorra.ProjectKorra;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
|
|
@ -70,8 +70,7 @@ public class AbilityLoader <T extends AbilityLoadable> implements Listener {
|
|||
|
||||
public final List<T> load(Class<? extends AbilityLoadable> classType) {
|
||||
for (File file: files) {
|
||||
try {
|
||||
final JarFile jarFile = new JarFile(file);
|
||||
try (final JarFile jarFile = new JarFile(file)) {
|
||||
String mainClass = null;
|
||||
|
||||
if (jarFile.getEntry("path.yml") != null) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.projectkorra.ProjectKorra.Utilities;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -12,7 +11,6 @@ import java.util.Map.Entry;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
|
Loading…
Reference in a new issue