Hello everyone, I’m here again. I have a question, I want to create a plugin that limits the blocks that the person can put based on the permissions.
if the player has the permission placedirt. * he can put as many dirt as he wants (This is part of what I already know)
But if the player has permission placedirt.3 he can only put 3 dirt in the world. (This I do not know how to do).
To do this I thought about getting the permissions of the player and make a regex to identify where is the number of blocks that can put, but I did not find any method that gives me the permission of the player. If you can help me
A before I forget, I came up with another question, have blocks that have several values like the glass, have an id and several “date” example 273/10 would I have how to get this “date” of the block?
This I will use on server with forge
Sorry for the english of google translate
Getting all permissions a user has… Your best of looking at this Permissions — Sponge 7.2.0 documentation (you can have the docs set in your language by clicking the flag at the bottom left corner if your on pc).
As for the “Date”. Im assuming you mean block IDs. This is being removed from minecraft and has started being removed since 1.8. Therefore Sponge never included it in the API. So you will need to do some NMS manipulation to get it however it is not recommended.
Not the id itself, but what characterizes that glass is blue for example, in bukkit I get the durability of the item. I wanted to know what this is like here.
For that, use
It is a bad idea to use maximum quantities in a permission. You would have to check for
placedirt.2, etc., all the way up to a predetermined maximum number. But the permission API also allows you to get certain options, via
Subject#getOption. So you could support the option
myplugin:placeable_dirt, and then to get the number of dirt blocks the player can place, you would call
Thanks to all who helped, I developed a better method to do these things, thank you all.
What was your solution Vitor?
Actually I changed the way the plugin worked, no longer use the permission to set how many blocks will be the maximum, but rather at the time of limiting the block and in the part of the date I took the ITEM_BLOCKSTATE and I am storing them, but I do not know if It works, I’m just testing.