From ddfcc5b077d35f417a074499d039eb2867ff8b82 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 10 Apr 2017 09:06:44 +1000 Subject: [PATCH] Player login tweaks --- .../com/plotsquared/bukkit/listeners/PlayerEvents.java | 10 +++------- .../intellectualcrafters/plot/object/PlotPlayer.java | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 1a8000ff0..5b6ea8251 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -15,8 +15,6 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotInventory; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.StringWrapper; -import com.intellectualcrafters.plot.object.worlds.PlotAreaManager; -import com.intellectualcrafters.plot.object.worlds.SinglePlotAreaManager; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MathMan; @@ -31,7 +29,6 @@ import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitVersion; import com.plotsquared.listener.PlayerBlockEventType; import com.plotsquared.listener.PlotListener; -import java.io.File; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -106,7 +103,6 @@ import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerChangedWorldEvent; @@ -115,7 +111,6 @@ import org.bukkit.event.player.PlayerEggThrowEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; @@ -451,10 +446,11 @@ public class PlayerEvents extends PlotListener implements Listener { } } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onConnect(PlayerJoinEvent event) { final Player player = event.getPlayer(); - BukkitUtil.getPlayer(event.getPlayer()).unregister(); + UUIDHandler.getPlayers().remove(player.getName()); + BukkitUtil.removePlayer(player.getName()); final PlotPlayer pp = BukkitUtil.getPlayer(player); // Now String name = pp.getName(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java index 125b16f48..88d145d68 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java @@ -496,7 +496,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { if (manager instanceof SinglePlotAreaManager) { PlotArea area = ((SinglePlotAreaManager) manager).getArea(); byte[] arr = PlotPlayer.this.getPersistentMeta("quitLoc"); - if (arr != null) { + if (arr != null && getMeta("teleportOnLogin", true)) { ByteBuffer quitWorld = ByteBuffer.wrap(arr); PlotId id = new PlotId(quitWorld.getShort(), quitWorld.getShort()); int x = quitWorld.getInt();