Fix memory leak in Teleport

This commit is contained in:
samczsun 2016-09-30 19:28:21 -04:00 committed by Shaun Bennett
parent dbd5203e9d
commit 0cbd4a9de2

View File

@ -25,6 +25,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
@ -117,6 +118,12 @@ public class Teleport extends MiniPlugin
_tpHistory.remove(event.GetName());
}
@EventHandler
public void on(WorldUnloadEvent event)
{
_tpHistory.values().forEach(list -> list.removeIf(location -> location.getWorld() == event.getWorld()));
}
@EventHandler
public void update(UpdateEvent event)
{