PocketMine-MP
5.39.2 git-7ad037014ecec1ddc7a9bba215beb03e659ea931
Loading...
Searching...
No Matches
CommandPermissions.php
1
<?php
2
3
/*
4
* This file is part of BedrockProtocol.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6
*
7
* BedrockProtocol is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*/
12
13
declare(strict_types=1);
14
15
namespace
pocketmine\network\mcpe\protocol\types\command;
16
17
use
function
array_flip;
18
19
final
class
CommandPermissions
{
20
private
function
__construct(){
21
//NOOP
22
}
23
24
public
const
NORMAL = 0;
25
public
const
OPERATOR = 1;
26
public
const
AUTOMATION = 2;
//command blocks
27
public
const
HOST = 3;
//hosting player on LAN multiplayer
28
public
const
OWNER = 4;
//server terminal on BDS
29
public
const
INTERNAL = 5;
30
31
private
const
PERMISSION_NAMES = [
32
0 =>
"any"
,
33
1 =>
"gamedirectors"
,
34
2 =>
"admin"
,
35
3 =>
"host"
,
36
4 =>
"owner"
,
37
5 =>
"internal"
,
38
];
39
40
public
static
function
toName(
int
$value) :
string
{
41
return
self::PERMISSION_NAMES[$value] ??
throw
new \InvalidArgumentException(
"Invalid raw value \"$value\" for CommandPermission"
);
42
}
43
44
public
static
function
fromName(
string
$name) :
int
{
45
static
$cache =
null
;
46
if
($cache ===
null
){
47
$cache = array_flip(self::PERMISSION_NAMES);
48
}
49
50
return
$cache[$name] ??
throw
new \InvalidArgumentException(
"Invalid raw value \"$name\" for CommandPermission"
);
51
}
52
}
pocketmine\network\mcpe\protocol\types\command\CommandPermissions
Definition
CommandPermissions.php:19
vendor
pocketmine
bedrock-protocol
src
types
command
CommandPermissions.php
Generated by
1.12.0