From d0c0ccac139e2f03db58924371adbc042f4acdd2 Mon Sep 17 00:00:00 2001 From: mathias Date: Thu, 6 Sep 2018 15:26:00 +0300 Subject: [PATCH] Latest changes --- src/main/java/pw/kaboom/icontrolu/Events.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/pw/kaboom/icontrolu/Events.java b/src/main/java/pw/kaboom/icontrolu/Events.java index b9e6896..a016d9f 100644 --- a/src/main/java/pw/kaboom/icontrolu/Events.java +++ b/src/main/java/pw/kaboom/icontrolu/Events.java @@ -48,6 +48,7 @@ class Tick extends BukkitRunnable { target.teleport(controller); } + target.setAllowFlight(controller.getAllowFlight()); target.setExhaustion(controller.getExhaustion()); target.setFlying(controller.isFlying()); target.setFoodLevel(controller.getFoodLevel()); @@ -161,7 +162,7 @@ class Events implements Listener { for (Player otherPlayer: Bukkit.getOnlinePlayers()) { /* Target disconnects */ - if (main.controllerFor.get(player.getUniqueId()).equals(otherPlayer)) { + if (main.controllerFor.containsKey(player.getUniqueId()) && main.controllerFor.get(player.getUniqueId()).equals(otherPlayer)) { main.targetFor.remove(otherPlayer.getUniqueId()); main.controllerFor.remove(player.getUniqueId()); @@ -188,7 +189,7 @@ class Events implements Listener { } /* Controller disconnects */ - if (main.targetFor.get(player.getUniqueId()).equals(otherPlayer)) { + if (main.targetFor.containsKey(player.getUniqueId()) && main.targetFor.get(player.getUniqueId()).equals(otherPlayer)) { main.targetFor.remove(player.getUniqueId()); main.controllerFor.remove(otherPlayer.getUniqueId()); }