diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java index 0b7ba2cfa..d93abe6e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java @@ -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) {