Open Corvonn opened 1 year ago
I don't have much experience with plug in message channel, but I suppose this is doable on at least some servers.
It's easy to spoof this data on clients though so any displays for this data should describe where it comes from and such - since bad actors are unlikely to send a "hello I'm here" message
Yes, that you can not detect hack clients about it, I realize xD But you can see if someone uses Forge, for example, which would be quite an advantage. But that was not my main reason. It was more about the fact that with such a function you can easily learn the preferences of your players and adjust the server accordingly.
With Velocity, for example, PluginMessageChannel are actually very simple. You just have to create a PluginMessageEvent (like any other event) and then register the required channels that should trigger this event. This is easily done with
getServer().getChannelRegistrar().register(MinecraftChannelIdentifier.create("minecraft", "brand"));
With Paper (and probably Bukkit), you need to register each channel as some kind of event. It goes like this:
Bukkit.getServer().getMessenger().registerIncomingPluginChannel(plugin, "minecraft:brand", OnPluginMessage.pluginMessageListener);
And then in the OnPluginMessage class:
public static final PluginMessageListener pluginMessageListener = new PluginMessageListener() {
@Override
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, @NotNull byte[] message) {
//do sth
}
};
You only get byte[] as return, but you can convert it to a string with a few lines. If that helps you, I can send you my class for it over Discord.
To add on to this. Would be cool to also display the players client version. If the server is running ViaVersion or any of the other Via plugins which allows players on different versions connect. Would be nice to see insights on how many of your players play on what version. Via has placeholderapi support Not sure the integration plan has with papi yet, if any. But here's the expansion for Via https://api.extendedclip.com/expansions/viaversion/
Viaversion and Protocolsupport as well as Placeholderapi are all supported by Plan
Yes, I was more specifically looking for Via Version to tie together with the sessions. So when looking at a players session I could see what version/client brand they were on. Would then also be able to see how many hours players spent on a specific version/client.
Currently Via just gives a raw total number.
I would like to be able to..
Hi :D I've been experimenting a bit with clients (Badlion, Fabric, Lunar, LabyMod, etc) the last few days and came across that for most clients it's relatively easy to find out which client is being used. For example, under Velocity you can get this information a few seconds after join with
player.getClientBrand()
. Alternatively, you can subscribe to the PluginMessageChannel minecraft:brand, which sends this information.Long story short: I suggest that Plan displays the MinecraftClient used - perhaps even saving it for each join, so that you can track the client for individual sessions.
I would like to note, however, that
player.getClientBrand()
does not work for LabyMod, nor for Badlion. LabyMod instead sends messages in the PluginMessageChannellabymod3:main
when joining, so it can be queried if the client is LabyMod. For Badlion, unfortunately, I have not yet found a solution, this client "hides" downright.Is your feature request related to a problem? Please describe.
I would find this feature very handy to better customize your server to your players. For example, you could regularly check which client is used by how many players and then add support for the client if necessary or drop the support for a client. In addition, it is easier to check whether individual players use clients that bring game advantages.