Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/forge/fix/clear_cache_between_ga…
Browse files Browse the repository at this point in the history
…me_instances' into forge/fix/clear_cache_between_game_instances
  • Loading branch information
KevinDaGame committed Aug 6, 2023
2 parents a742190 + d324857 commit 2087312
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -140,6 +141,11 @@ public void onPlayerLeave(PlayerQuitEvent event) {
this.players.remove(event.getPlayer().getUniqueId());
}

@EventHandler
public void onWorldUnload(WorldUnloadEvent event) {
this.worlds.remove(event.getWorld().getName());
}

@NotNull
public SpigotPlayer getPlayer(Player player) {
if (this.players.get(player.getUniqueId()) != null) return this.players.get(player.getUniqueId());
Expand Down

0 comments on commit 2087312

Please sign in to comment.