82 lines
2.3 KiB
Go
82 lines
2.3 KiB
Go
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
|
|
//
|
|
// This code was generated from the following packages:
|
|
// pumpkin:plugin@0.1.0
|
|
|
|
package pumpkin_plugin_permission
|
|
|
|
import ()
|
|
|
|
const (
|
|
PermissionLevelZero uint8 = 0
|
|
PermissionLevelOne uint8 = 1
|
|
PermissionLevelTwo uint8 = 2
|
|
PermissionLevelThree uint8 = 3
|
|
PermissionLevelFour uint8 = 4
|
|
)
|
|
|
|
// Represents the player's permission level
|
|
//
|
|
// Permission levels determine the player's access to commands and server operations.
|
|
// Each numeric level corresponds to a specific role:
|
|
// - `Zero`: `normal`: Player can use basic commands.
|
|
// - `One`: `moderator`: Player can bypass spawn protection.
|
|
// - `Two`: `gamemaster`: Player or executor can use more commands and player can use command blocks.
|
|
// - `Three`: `admin`: Player or executor can use commands related to multiplayer management.
|
|
// - `Four`: `owner`: Player or executor can use all of the commands, including commands related to server management.
|
|
type PermissionLevel = uint8
|
|
|
|
const (
|
|
// Permission is not granted by default
|
|
PermissionDefaultDeny uint8 = 0
|
|
// Permission is granted by default
|
|
PermissionDefaultAllow uint8 = 1
|
|
// Permission is granted by default to operators
|
|
PermissionDefaultOp uint8 = 2
|
|
)
|
|
|
|
// Describes the default behavior for permissions
|
|
type PermissionDefault struct {
|
|
tag uint8
|
|
value any
|
|
}
|
|
|
|
func (self PermissionDefault) Tag() uint8 {
|
|
return self.tag
|
|
}
|
|
|
|
func (self PermissionDefault) Op() PermissionLevel {
|
|
if self.tag != PermissionDefaultOp {
|
|
panic("tag mismatch")
|
|
}
|
|
return self.value.(PermissionLevel)
|
|
}
|
|
|
|
func MakePermissionDefaultDeny() PermissionDefault {
|
|
return PermissionDefault{PermissionDefaultDeny, nil}
|
|
}
|
|
func MakePermissionDefaultAllow() PermissionDefault {
|
|
return PermissionDefault{PermissionDefaultAllow, nil}
|
|
}
|
|
func MakePermissionDefaultOp(value PermissionLevel) PermissionDefault {
|
|
return PermissionDefault{PermissionDefaultOp, value}
|
|
}
|
|
|
|
// A child permission entry
|
|
type PermissionChild struct {
|
|
Node string
|
|
Value bool
|
|
}
|
|
|
|
// Defines a permission node in the system
|
|
type Permission struct {
|
|
// The full node name (e.g., "minecraft:command.gamemode")
|
|
Node string
|
|
// Description of what this permission does
|
|
Description string
|
|
// The default value of this permission
|
|
Default PermissionDefault
|
|
// Children nodes that are affected by this permission
|
|
Children []PermissionChild
|
|
}
|