From 30f00af6997b848f91156c7c1b397110b778c07b Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 21 Jul 2015 23:03:44 +1000 Subject: [PATCH] @Sauilitired Prevent any reserved accounts from joining. --- .../plot/listeners/PlayerEvents.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index 1452a27dc..6f35c2e48 100644 --- a/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -74,6 +74,8 @@ 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.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; @@ -90,6 +92,7 @@ import org.bukkit.util.Vector; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.listeners.worldedit.WEManager; @@ -396,6 +399,18 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onConnect(final PlayerLoginEvent event) { + Player player = event.getPlayer(); + String name = player.getName(); + PlotPlayer pp = BukkitUtil.getPlayer(player); + if (name.equals("PlotSquared") || pp.getUUID().equals(DBFunc.everyone)) { + event.disallow(Result.KICK_WHITELIST, "This account is reserved"); + BukkitUtil.removePlayer(pp.getName()); + return; + } + } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onJoin(final PlayerJoinEvent event) {