@Sauilitired Prevent any reserved accounts from joining.

This commit is contained in:
boy0001 2015-07-21 23:03:44 +10:00
parent 8c4e1571e8
commit 30f00af699

View File

@ -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;
@ -397,6 +400,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) {
final Player player = event.getPlayer();