Cuberite Forum

Full Version: Simple version limit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I will need a plugin that can limit the server to specific client version. For example to only allow 1.7.4 clients to join and every other version that tries to join gets kicked with custom configurable message (so it can be translated).

I have been told be xoft that this is easy to code but i'm not really good at this programming. I hope someone can do this in their free time.
Thanks!
I'll do this. Give me a minute Smile

Here you go, My first version.: See Edit

In the Config.ini you can set what protocols are allowed. By default only 1.7 is allowed. In the config this is '4'. You can find the protocol versions when you start Cuberite.
Code:
[16:05:36] Compatible clients: 1.8.x, 1.9.x, 1.10.x, 1.11.x, 1.12.x
[16:05:36] Compatible protocol versions 47, 107, 108, 109, 110, 210, 315, 316, 335, 338, 340

Now gonna do the custom message.

Xoft there is a cRoot:GetProtocolVersionTextFromInt function, but is there a function that does the opposite?

Done: See Edit

EDIT:
Download here:  [attachment=801]
Thanks!! This is exactly what i need. You should maybe put it in Plugin Releases so everyone can find it there.
Maybe later. I should go back to my homework now Wink
STR, sorry, we don't have such a function. Of course you could write it if you want, but it's one more place to update when a new protocol is added, and those places tend to get forgotten.

Why does the plugin use the OnTick() function? Can't it just kick the player (or schedule the kick) directly in the OnLogin()?
Schedule.. good call.

I tried the OnLogin, OnPlayerJoined and OnPlayerSpawned hook, but when I kicked the player you woudn't get the kick message but an error so I used the OnTick hook.

Update. Now it's using a schedule task. It should be a little bit better performance wise: See first comment
Why would you want to do that Sad - All the big servers are making custom jars for their servers to allow more clients. More clients = more players = more people eating pie!
Are there really enough people still on <1.7 clients for limiting client versions to make a difference?

If so, this is like the Windows 8 situation, except worse, because updates are free! Rolleyes
Actually all the members of my community have either 1.7.2 or 1.7.4 clients already installed. I don't want them to connect with clients with missing features or worst crash the server with bad packets of some old client due to the networking layer of MCS (I don't know if the deadlock was fully fixed).
Hm, well, we could just get xoft to cut away all of the old protocols, he promised to do it sometime Wink
Pages: 1 2