Fix memory leak in Teleport
This commit is contained in:
parent
dbd5203e9d
commit
0cbd4a9de2
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user