diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-11 21:43:19 +0100 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-11 21:43:19 +0100 |
commit | 657559729222da25f3990a0f4874cb5a05b8a029 (patch) | |
tree | a939b4ffe69315b8b15d8452c45adc768030a783 /src/main/java/org/bukkit | |
parent | b13fd35165a71762111e239c1b3a7501dc457c86 (diff) | |
parent | 33af6fbbbf1c1a8fee3ecc8d4cf79b4a2ba17c16 (diff) | |
download | craftbukkit-657559729222da25f3990a0f4874cb5a05b8a029.tar craftbukkit-657559729222da25f3990a0f4874cb5a05b8a029.tar.gz craftbukkit-657559729222da25f3990a0f4874cb5a05b8a029.tar.lz craftbukkit-657559729222da25f3990a0f4874cb5a05b8a029.tar.xz craftbukkit-657559729222da25f3990a0f4874cb5a05b8a029.zip |
Merge pull request #43 in SPIGOT/craftbukkit from ~FEARTHE1337/craftbukkit:perm to master
* commit '33af6fbbbf1c1a8fee3ecc8d4cf79b4a2ba17c16':
Add the new minecraft command permission nodes.
Diffstat (limited to 'src/main/java/org/bukkit')
3 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 075a7fd4..5582e0b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -67,6 +67,7 @@ import org.bukkit.craftbukkit.util.CraftIconCache; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.craftbukkit.util.DatFileFilter; import org.bukkit.craftbukkit.util.Versioning; +import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerChatTabCompleteEvent; @@ -318,6 +319,7 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); loadCustomPermissions(); DefaultPermissions.registerCorePermissions(); + CraftDefaultPermissions.registerCorePermissions(); helpMap.initializeCommands(); } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java new file mode 100644 index 00000000..d0377466 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java @@ -0,0 +1,35 @@ +package org.bukkit.craftbukkit.util.permissions;
+
+import org.bukkit.permissions.Permission;
+import org.bukkit.permissions.PermissionDefault;
+import org.bukkit.util.permissions.DefaultPermissions;
+
+public final class CommandPermissions {
+ private static final String ROOT = "minecraft.command";
+ private static final String PREFIX = ROOT + ".";
+
+ private CommandPermissions() {}
+
+ public static Permission registerPermissions(Permission parent) {
+ Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla minecraft commands", parent);
+
+ DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
+ DefaultPermissions.registerPermission(PREFIX + "tell", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
+ DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
+
+ commands.recalculatePermissibles();
+ return commands;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java new file mode 100644 index 00000000..84826ee0 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java @@ -0,0 +1,16 @@ +package org.bukkit.craftbukkit.util.permissions;
+
+import org.bukkit.permissions.Permission;
+import org.bukkit.util.permissions.DefaultPermissions;
+
+public final class CraftDefaultPermissions {
+ private static final String ROOT= "minecraft";
+
+ private CraftDefaultPermissions() {}
+
+ public static void registerCorePermissions() {
+ Permission parent = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla utilities and commands");
+ CommandPermissions.registerPermissions(parent);
+ parent.recalculatePermissibles();
+ }
+}
|