Home›Java›Mods›Protocol
Protocol
ModsJava

Protocol

Minecraft Java mod. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
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.
Spoiler: Creating a basic listener
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");
            }
        }
    }
}
 
Spoiler: Changing the player count
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.
PingReply: A class that stores the data to send to the client
ServerInfoPacket: Represents a PacketStatusOutServerInfo instance
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]

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Protocol is a free Minecraft Java mod. Downloaded 456 times (via Spigot). Download it and open it directly in the game.

Explore more