Bypassing Player Slot Limits

Jan 8, 2018
Bypassing Player Slot Limits
  • Bypassing Player Slot Limits




    The following example will shows the concept of bypassing the servers player slot limit. This could be used to allow staff access to the server even if its full.

    Note: If Spigot Staff see a resource that intentionally circumvents the limitations put in place by hosts, we consider those malicious and delete them.

    First, let us create our main and only class for this example:

    Code (Java):
    package me.web.playerlimitbypass;

    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;

    public class PlayerBypass extends JavaPlugin implements Listener {

        @Override
        public void onEnable() {

        }
    }

    Pretty simple.
    Next, we will create our Event Handler and register the event:

    Code (Java):
        @EventHandler
        public void onPlayerLoginEvent(PlayerLoginEvent event){

        }
    Code (Java):
        @Override
        public void onEnable() {
            // Registering the events
            getServer().getPluginManager().registerEvents(this, this);
        }

    The following code is the very base of this concept:
    Code (Java):
        @EventHandler
        public void onPlayerLoginEvent(PlayerLoginEvent event){
            // Checking if the reason we are being kicked is a full server
            if (event.getResult() == PlayerLoginEvent.Result.KICK_FULL) {
                // If the condition above is true, we execute the following code, that is allow the player on the server
                event.allow();
            }
        }

    You can tweak the base any way you want. For instance, check if the player has permissions to bypass the player limit:
    Code (Java):
        @EventHandler
        public void onPlayerLoginEvent(PlayerLoginEvent event) {
            // Checking if the reason we are being kicked is a full server
            if (event.getResult() == PlayerLoginEvent.Result.KICK_FULL) {
                // Checking if the player has the specified permission node
                if (event.getPlayer().hasPermission("playerlimit.bypass"))
                    // If the condition above is true, we execute the following code, that is allow the player on the server
                    event.allow();
            }

        }
  • Loading...
  • Loading...