Skip to content

Commit e46d918

Browse files
committed
Update CLAUDE.md
1 parent ae4267c commit e46d918

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,92 @@ public class MyCommand extends AbstractPlayerCommand {
252252
}
253253
```
254254

255+
## Permissions System
256+
257+
### Adding Permission Requirements to Commands
258+
Use `requirePermission()` in command constructors to require a permission:
259+
```java
260+
public class MyCommand extends AbstractPlayerCommand {
261+
public MyCommand() {
262+
super("mycommand", "Description");
263+
requirePermission("myplugin.use"); // Players need this permission to use the command
264+
}
265+
}
266+
```
267+
268+
### Checking Permissions Manually
269+
```java
270+
// On Player object (in command execute methods)
271+
Player player = store.getComponent(playerRef, Player.getComponentType());
272+
if (player.hasPermission("myplugin.admin")) {
273+
// Do admin stuff
274+
}
275+
276+
// Via PermissionsModule (when you only have UUID)
277+
import com.hypixel.hytale.server.core.permissions.PermissionsModule;
278+
279+
if (PermissionsModule.get().hasPermission(playerData.getUuid(), "myplugin.admin")) {
280+
// Do admin stuff
281+
}
282+
```
283+
284+
### Managing Permissions (Server Console Commands)
285+
```bash
286+
# Add permission to a group
287+
perm group add <GroupName> <permission>
288+
perm group add Adventure easyclaims.use
289+
perm group add Adventure easyclaims.admin
290+
291+
# Remove permission from a group
292+
perm group remove <GroupName> <permission>
293+
294+
# List group permissions
295+
perm group list <GroupName>
296+
297+
# Add user to a group
298+
perm user group add <username> <GroupName>
299+
300+
# Add permission directly to user
301+
perm user add <username> <permission>
302+
303+
# Test if you have a permission
304+
perm test <permission>
305+
```
306+
307+
### Permission Format & Wildcards
308+
```
309+
myplugin.use # Exact permission
310+
myplugin.* # Wildcard - grants all myplugin.* permissions
311+
* # All permissions (admin/OP)
312+
-myplugin.use # Negates/denies a specific permission
313+
-* # Denies all permissions
314+
```
315+
316+
### permissions.json Structure
317+
Located at `Server/permissions.json`:
318+
```json
319+
{
320+
"users": {
321+
"uuid-here": {
322+
"groups": ["Adventure", "Builder"]
323+
}
324+
},
325+
"groups": {
326+
"Default": [],
327+
"Adventure": ["easyclaims.use"],
328+
"OP": ["*"]
329+
}
330+
}
331+
```
332+
333+
**Important:** Group names are case-sensitive!
334+
335+
### EasyClaims Permissions
336+
| Permission | Description |
337+
|------------|-------------|
338+
| `easyclaims.use` | Basic access to /easyclaims command |
339+
| `easyclaims.admin` | Admin commands (config, set, reload) |
340+
255341
## Messages (No Minecraft Color Codes!)
256342
```java
257343
import com.hypixel.hytale.server.core.Message;
@@ -332,4 +418,7 @@ import com.hypixel.hytale.math.vector.Vector3i;
332418

333419
// Messages
334420
import com.hypixel.hytale.server.core.Message;
421+
422+
// Permissions
423+
import com.hypixel.hytale.server.core.permissions.PermissionsModule;
335424
```

0 commit comments

Comments
 (0)