Cuberite Forum
Limit blocks and items to specific client version - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Requests (https://forum.cuberite.org/forum-3.html)
+--- Thread: Limit blocks and items to specific client version (/thread-2316.html)



Limit blocks and items to specific client version - xoft - 01-15-2016

I'd like a plugin that would limit the players to only have access to blocks and items available in a specific client version. That is, any client version is allowed to connect, but when they try to put a "too new" item in a chest, or place a "too new" block, the action is refused, while possibly losing the item / block.

Example 1:
Plugin configured to allow only 1.2 blocks / items.
Player connects using a 1.8 client.
Player tries to place granite.
The granite block turns into regular stone.

Example 2:
Plugin configured to allow only 1.2 blocks / items.
Player in creative mode grabs an emerald (1.3 item) into their inventory
Plugin removes the item from the player's inventory (if possible)
If not possible, the following happens:
The player takes the emerald from their inventory and places it into a chest.
Plugin removes the item from the chest.
Alternate:
Player drops the emerald (Q key)
Plugin deletes the pickup.


RE: Limit blocks and items to specific client version - xoft - 01-15-2016

Such a plugin may need some new hooks, especially on the inventory handling; I can add those upon request.


RE: Limit blocks and items to specific client version - tonibm19 - 01-15-2016

Wouldnt it be better (but more difficult) to send different blocks to each minecraft version?
But that would require lua protocol api.


RE: Limit blocks and items to specific client version - xoft - 01-15-2016

That's not a solution to my problem. My problem is that I want to allow 1.9 (snapshot) clients onto the Gallery server, but I don't want them to be able to place or wield 1.9-specific blocks and items - I want 1.8 clients to be able to connect and play on the Gallery server, too.


RE: Limit blocks and items to specific client version - sphinxc0re - 01-15-2016

What about creating a cBlockFilter class to filter the protocol?

And of course exporting it to the API would be good.


RE: Limit blocks and items to specific client version - NiLSPACE - 01-15-2016

I'd like to give it a try. Could you add a OnWindowSlotChanging(a_Window, a_SlotNum, a_ChangedItem) hook?

Also, what would be preferred, a whitelist or a blacklist?