Protocol v1.1.5

A plugin which allows you to block or allow multiple protocols

  1. TheySeeMeRolling
    Contributors:
    TheySeeMeRolling
    Protocol gives you more control over how you reply to client ping requests.

    NOTE: This is an API as well! Use it to your advantage

    What can it do?
    - Modify the online player count and the max players
    - Change the player sample (list of players shown when hovering over the player count)
    - Fake the protocol name and version to display text instead of the player count
    - Create server list 'animations'
    - Hide the player count

    Tutorials: For each mutator featured in these tutorials there is a corresponding accessor method.
    To use Protocol to it's full potential you have to create a Listener. This is done similar to registering a Bukkit listener. Before we actually register it we need to create it. You can either create a new class that implements 'PingListener,' or just an anonymous inner class which is my method of choice. Here is a simple example of a PingListener
    Code (Text):

    public class TestListener implements PingListener {
        public void onPing(PingEvent event) {
            event.getReply().setMOTD("This is an MOTD");
        }
    }
     
    Now that we have created the PingListener we need to actually register it. You can do so by invoking the static method 'Protocol.registerListener(PingListener).' Here is an example using an anonymous inner class.
    Code (Text):

    public class MyPlugin extends JavaPlugin {
       public void onEnable() {
            Protocol.registerListener(new PingListener() {
                public void onPing(PingEvent event) {
                    event.getReply().setMOTD("This is an MOTD");
                }
            }
        }
    }
     
    Bukkit does not support changing the online player count with the ServerListPingEvent due to obvious reasons, but Protocol does. You can easily do this by invoking PingReply#setOnlinePlayers(int). Here is an example:
    Code (Text):

    public class TestListener implements PingListener {
        public void onPing(PingEvent event) {
            event.getReply().setOnlinePlayers(5000);
        }
    }
     
    Spoiler: Changing the player count to text
    Spoiler: Changing the player sample (hover message)

    Documentation
    PingEvent
    : Stores the PingReply and defines whether the event is cancelled or not.
    • getReply() - PingReply
    • createNewPacket(PingReply) - ServerInfoPacket
    • isCancelled() - boolean
    • setCancelled(boolean) - void
    PingReply: A class that stores the data to send to the client
    • getOnlinePlayers() - int
    • getMaxPlayers() - int
    • getMOTD() - String
    • getProtocolVersion() - int
    • getProtocolName() - String
    • getPlayerSample() - GameProfile[]
    • arePlayersHidden() - boolean
    • setOnlinePlayers(int) - void
    • setMaxPlayers(int) - void
    • setMOTD(String) - void
    • setProtocolVersion(int) - void
    • setProtocolName(String) - void
    • setPlayerSample(GameProfile[]) - void
    • hidePlayers(boolean) - void
    ServerInfoPacket: Represents a PacketStatusOutServerInfo instance
    • send() - void
    • setPingReply() - void
    • getPingReply() - PingReply
    Configuration:
    Code (Text):

    Whitelist: false
    Message: "&c&lPlease use 1.7!"
    Protocols:
    - 47

    // 4 = 1.7.1 - 1.7.5
    // 5 = 1.7.6 - 1.7.10
    // 47 = 1.8
     
    [/spoiler]

Recent Updates

  1. v1.1.5 HUGE UPDATE!