orangeadam3 / terra121

A Minecraft Terrain Generating Mod for Cubic Chunks 1.12.2. attempting to generate real terrain, biomes, and features on a 1:1 scale
MIT License
282 stars 40 forks source link

Forge permissions API #122

Open Themainsandwich opened 4 years ago

Themainsandwich commented 4 years ago

I am trying to make it a set permission with a essentials mod but because something in the code isn't set right I cant.

Thutmose commented 4 years ago

This issue is related to trying to control permissions for using the commands in this mod.

Here you do a vanilla check for canUseCommand: https://github.com/orangeadam3/terra121/blob/master/src/main/java/io/github/terra121/control/TerraTeleport.java#L90-L93

If instead, you used a forge permissions api check, then permissions would be able to interact with this mod, for controlling usage.

Here is an example of how to register a default OP permission with the API: https://github.com/Thutmose/ThutEssentials/blob/1.12/src/main/java/thut/essentials/land/LandEventsHandler.java#L1125

and here is an example of checking a permission for a player: https://github.com/Thutmose/ThutEssentials/blob/1.12/src/main/java/thut/essentials/land/LandEventsHandler.java#L861

This example is for players, so you might also want to do a check for if the sender is a player, and if not, continue to use your current method

orangeadam3 commented 4 years ago

There is a Pull Request for this for /tpll. #106 but no one has tested it.

Saghetti0 commented 4 years ago

106 has been merged, this should be closed now. The permission node is terra121.commands.tpll