Potentiall fix NPE on server shutdown

This commit is contained in:
Jesse Boyd 2018-07-21 15:06:04 +10:00
parent efef7bcc00
commit 7501eabd2e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -589,11 +589,12 @@ public class FaweBukkit implements IFawe, Listener {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
FawePlayer fp = FawePlayer.wrap(player); String name = player.getName();
FawePlayer fp = Fawe.get().getCachedPlayer(name);
if (fp != null) { if (fp != null) {
fp.unregister(); fp.unregister();
Fawe.get().unregister(name);
} }
Fawe.get().unregister(event.getPlayer().getName());
} }
@Override @Override