Remove player from cache on logout to ensure they are reloaded on relog
This commit is contained in:
parent
2fe8b0d367
commit
8db6b1fa63
14
src/main/java/com/alttd/listeners/PlayerQuitListener.java
Normal file
14
src/main/java/com/alttd/listeners/PlayerQuitListener.java
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.alttd.listeners;
|
||||||
|
|
||||||
|
import com.alttd.storage.PlayerSettings;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
public class PlayerQuitListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerLeave(PlayerQuitEvent event) {
|
||||||
|
PlayerSettings.removePlayer(event.getPlayer().getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,14 @@ public class PlayerSettings {
|
||||||
playerSettingsMap.put(uuid, this);
|
playerSettingsMap.put(uuid, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlayerSettings getPlayer(UUID uuid) {
|
||||||
|
return playerSettingsMap.get(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removePlayer(UUID uuid) {
|
||||||
|
playerSettingsMap.remove(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasActiveParticles() {
|
public boolean hasActiveParticles() {
|
||||||
return particlesActive;
|
return particlesActive;
|
||||||
}
|
}
|
||||||
|
|
@ -59,8 +67,4 @@ public class PlayerSettings {
|
||||||
public ParticleSet getParticles(APartType aPartType) {
|
public ParticleSet getParticles(APartType aPartType) {
|
||||||
return particles.get(aPartType);
|
return particles.get(aPartType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerSettings getPlayer(UUID uuid) {
|
|
||||||
return playerSettingsMap.get(uuid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user