Skip to content
This repository was archived by the owner on Jul 20, 2020. It is now read-only.

Commit 416fb60

Browse files
committed
Add default permissions
1 parent 0a3f0c1 commit 416fb60

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package tc.oc.api.minecraft.servers;
2+
3+
import java.util.Map;
4+
5+
import com.google.common.collect.ImmutableMap;
6+
7+
/**
8+
* This is a hard-coded list of permissions, that add the basic functionality.
9+
* To be replaced when a proper rank/group & permission system
10+
*
11+
* The list of permissions have been copied from what they used to be on ocn, removing blatantly outdated ones.
12+
*/
13+
public class DefaultPermissions {
14+
15+
public static final Map<String, Boolean> PARTICIPANT_PERMISSIONS;
16+
public static final Map<String, Boolean> OBSERVER_PERMISSIONS;
17+
public static final Map<String, Boolean> MAPMAKER_PERMISSIONS;
18+
19+
static {
20+
PARTICIPANT_PERMISSIONS = new ImmutableMap.Builder<String, Boolean>()
21+
// Global
22+
.put("worldedit.navigation.jumpto.tool", false)
23+
.put("worldedit.navigation.thru.tool" , false)
24+
// Untourney
25+
.put("bukkit.command.kill" , false)
26+
.put("bukkit.command.me" , false)
27+
.put("bukkit.command.tell" , false)
28+
.put("commandbook.pong" , false)
29+
.put("commandbook.speed.flight", false)
30+
.put("commandbook.speed.walk" , false)
31+
.put("chat.global.receive" , true)
32+
.put("commandbook.motd" , true)
33+
.put("commandbook.msg" , true)
34+
.put("commandbook.rules" , true)
35+
.put("commandbook.time.check" , true)
36+
.put("commandbook.who" , true)
37+
.put("pgm.chat.report" , true)
38+
.put("pgm.class" , true)
39+
.put("pgm.class.list" , true)
40+
.put("pgm.class.select" , true)
41+
.put("pgm.join" , true)
42+
.put("pgm.myteam" , true)
43+
.build();
44+
45+
OBSERVER_PERMISSIONS = new ImmutableMap.Builder<String, Boolean>()
46+
// Untourney
47+
.put("bukkit.command.kill" , false)
48+
.put("bukkit.command.me" , false)
49+
.put("bukkit.command.tell" , false)
50+
.put("commandbook.pong" , false)
51+
.put("worldedit.navigation.ceiling", false)
52+
.put("worldedit.navigation.up" , false)
53+
.put("commandbook.motd" , true)
54+
.put("commandbook.msg" , true)
55+
.put("commandbook.rules" , true)
56+
.put("commandbook.teleport" , true)
57+
.put("commandbook.time.check" , true)
58+
.put("commandbook.who" , true)
59+
.put("ocn.teleport" , true)
60+
.put("pgm.chat.report" , true)
61+
.put("pgm.class" , true)
62+
.put("pgm.class.list" , true)
63+
.put("pgm.class.select" , true)
64+
.put("pgm.inventory" , true)
65+
.put("pgm.join" , true)
66+
.put("pgm.myteam" , true)
67+
.put("worldedit.navigation.*" , true)
68+
.build();
69+
70+
71+
MAPMAKER_PERMISSIONS = new ImmutableMap.Builder<String, Boolean>()
72+
// Public
73+
.put("map.rating.view.live", true)
74+
.put("pgm.fullserver" , true)
75+
.put("pgm.join.choose" , true)
76+
.put("pgm.join.full" , true)
77+
.build();
78+
}
79+
80+
}

API/minecraft/src/main/java/tc/oc/api/minecraft/servers/LocalServerDocument.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,17 @@ public Set<UUID> participant_uuids() {
180180

181181
@Override
182182
public Map<String, Boolean> participant_permissions() {
183-
return Collections.emptyMap();
183+
return DefaultPermissions.PARTICIPANT_PERMISSIONS;
184184
}
185185

186186
@Override
187187
public Map<String, Boolean> observer_permissions() {
188-
return Collections.emptyMap();
188+
return DefaultPermissions.OBSERVER_PERMISSIONS;
189189
}
190190

191191
@Override
192192
public Map<String, Boolean> mapmaker_permissions() {
193-
return Collections.emptyMap();
193+
return DefaultPermissions.MAPMAKER_PERMISSIONS;
194194
}
195195

196196
@Override

0 commit comments

Comments
 (0)