Player login tweaks

This commit is contained in:
Jesse Boyd 2017-04-10 09:06:44 +10:00
parent 9f6bf14649
commit ddfcc5b077
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 4 additions and 8 deletions

View File

@ -15,8 +15,6 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotInventory; import com.intellectualcrafters.plot.object.PlotInventory;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper; 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.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan; 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.bukkit.util.BukkitVersion;
import com.plotsquared.listener.PlayerBlockEventType; import com.plotsquared.listener.PlayerBlockEventType;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.io.File;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; 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.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent; 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.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; 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) { public void onConnect(PlayerJoinEvent event) {
final Player player = event.getPlayer(); 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); final PlotPlayer pp = BukkitUtil.getPlayer(player);
// Now // Now
String name = pp.getName(); String name = pp.getName();

View File

@ -496,7 +496,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
if (manager instanceof SinglePlotAreaManager) { if (manager instanceof SinglePlotAreaManager) {
PlotArea area = ((SinglePlotAreaManager) manager).getArea(); PlotArea area = ((SinglePlotAreaManager) manager).getArea();
byte[] arr = PlotPlayer.this.getPersistentMeta("quitLoc"); byte[] arr = PlotPlayer.this.getPersistentMeta("quitLoc");
if (arr != null) { if (arr != null && getMeta("teleportOnLogin", true)) {
ByteBuffer quitWorld = ByteBuffer.wrap(arr); ByteBuffer quitWorld = ByteBuffer.wrap(arr);
PlotId id = new PlotId(quitWorld.getShort(), quitWorld.getShort()); PlotId id = new PlotId(quitWorld.getShort(), quitWorld.getShort());
int x = quitWorld.getInt(); int x = quitWorld.getInt();