2.7.0_Snapshot-3 | Perm Update
Removed permissiond regestration from plugin.yml and regestred via code. - The Slot See and Use Permissions are now included in OP and commandgui.admin
This commit is contained in:
parent
8e90aee0ca
commit
520df8dc97
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
<version>2.7.0_Snapshot-2</version>
|
<version>2.7.0_Snapshot-3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandGUI</name>
|
<name>CommandGUI</name>
|
||||||
|
@ -31,9 +31,6 @@ public class Help {
|
|||||||
if (sender.hasPermission("commandgui.command.info")) {
|
if (sender.hasPermission("commandgui.command.info")) {
|
||||||
send.sender(sender, Prefix + " " + SelectMessages.HelpInfo);
|
send.sender(sender, Prefix + " " + SelectMessages.HelpInfo);
|
||||||
}
|
}
|
||||||
// if (sender.hasPermission("commandgui.command.give")) {
|
|
||||||
// send.sender(sender, Prefix + " " + Select_msg.HelpGive);
|
|
||||||
// }
|
|
||||||
if (sender.hasPermission("commandgui.admin")) {
|
if (sender.hasPermission("commandgui.admin")) {
|
||||||
send.sender(sender, Prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath()+ "\\GUIs\\default.yml"));
|
send.sender(sender, Prefix + " " + SelectMessages.HelpCreateDefaultGUI.replace("[directory]", Main.getPath()+ "\\GUIs\\default.yml"));
|
||||||
send.sender(sender, Prefix + " " + SelectMessages.HelpReload);
|
send.sender(sender, Prefix + " " + SelectMessages.HelpReload);
|
||||||
|
@ -4,22 +4,76 @@ import de.jatitv.commandguiv2.Spigot.Main;
|
|||||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
||||||
|
import net.t2code.lib.Spigot.Lib.register.Register;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class RegisterPermissions {
|
public class RegisterPermissions {
|
||||||
|
private static final Plugin plugin = Main.plugin;
|
||||||
|
|
||||||
|
public static final String key = "commandgui.";
|
||||||
|
public static final String command = key + "command";
|
||||||
|
public static final String info = key + "command.info";
|
||||||
|
public static final String bypass = key + "bypass";
|
||||||
|
public static final String useitemToggle = key + "useitem.toggle";
|
||||||
|
public static final String useitem = key + "useitem";
|
||||||
|
public static final String getGuiItemAtLogin = key + "get.guiitem.at.login";
|
||||||
|
public static final String updatemsg = key + "updatemsgupdatemsg";
|
||||||
|
|
||||||
|
public static final String player = key + "player";
|
||||||
|
public static final String admin = key + "admin";
|
||||||
|
|
||||||
|
public static final PermissionDefault op = PermissionDefault.OP;
|
||||||
|
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||||
|
|
||||||
public static void onPermRegister() {
|
public static void onPermRegister() {
|
||||||
|
Register.permission(command, op, plugin);
|
||||||
|
Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
||||||
|
|
||||||
|
Register.permission(getGuiItemAtLogin, op, plugin);
|
||||||
|
Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
||||||
|
|
||||||
|
Register.permission(useitem, op, plugin);
|
||||||
|
Register.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
||||||
|
|
||||||
|
Register.permission(useitemToggle, op, plugin);
|
||||||
|
Register.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
|
||||||
|
|
||||||
|
Register.permission(updatemsg, op, plugin);
|
||||||
|
Register.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
|
||||||
|
|
||||||
|
Register.permission(bypass, op, plugin);
|
||||||
|
Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
||||||
|
|
||||||
|
Register.permission(info, notOp, plugin);
|
||||||
|
Register.permissionDescription(info, "Permission to view CommandGUI info", plugin);
|
||||||
|
|
||||||
|
Register.permission(player, op, command, true, plugin);
|
||||||
|
Register.permission(player, op, getGuiItemAtLogin, true, plugin);
|
||||||
|
Register.permission(player, op, useitem, true, plugin);
|
||||||
|
Register.permission(player, op, useitemToggle, true, plugin);
|
||||||
|
Register.permissionDescription(player, "All permissions from CommandGUI for Player", plugin);
|
||||||
|
|
||||||
|
Register.permission(admin, op, command, true, plugin);
|
||||||
|
Register.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
||||||
|
Register.permission(admin, op, useitem, true, plugin);
|
||||||
|
Register.permission(admin, op, useitemToggle, true, plugin);
|
||||||
|
Register.permission(admin, op, updatemsg, true, plugin);
|
||||||
|
Register.permission(admin, op, bypass, true, plugin);
|
||||||
|
Register.permission(admin, op, info, true, plugin);
|
||||||
|
Register.permissionDescription(admin, "All permissions from CommandGUI", plugin);
|
||||||
|
|
||||||
|
|
||||||
for (Gui gui : Main.guiHashMap.values()) {
|
for (Gui gui : Main.guiHashMap.values()) {
|
||||||
if (Bukkit.getPluginManager().getPermission("commandgui.command." + gui.Command_Command) == null) {
|
Register.permission("commandgui.command." + gui.Command_Command, op, plugin);
|
||||||
Bukkit.getPluginManager().addPermission(new Permission("commandgui.command." + gui.Command_Command));
|
Register.permission(admin, op, "commandgui.command." + gui.Command_Command, true, plugin);
|
||||||
}
|
|
||||||
for (Slot slot : gui.slots) {
|
for (Slot slot : gui.slots) {
|
||||||
if (Bukkit.getPluginManager().getPermission(slot.permissionToUse) == null) {
|
Register.permission(slot.permissionToUse, op, plugin);
|
||||||
Bukkit.getPluginManager().addPermission(new Permission(slot.permissionToUse));
|
Register.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||||
}
|
Register.permission(slot.permissionToSee, op, plugin);
|
||||||
if (Bukkit.getPluginManager().getPermission(slot.permissionToSee) == null) {
|
Register.permission(admin, op, slot.permissionToSee, true, plugin);
|
||||||
Bukkit.getPluginManager().addPermission(new Permission(slot.permissionToSee));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,56 +19,54 @@ commands:
|
|||||||
commandguihelp:
|
commandguihelp:
|
||||||
description: CommandGUI Help
|
description: CommandGUI Help
|
||||||
aliases: [cguihelp, guihelp]
|
aliases: [cguihelp, guihelp]
|
||||||
# commandguiadmin:
|
|
||||||
# aliases: [cguiadmin, cguia]
|
|
||||||
commandgui-item:
|
commandgui-item:
|
||||||
aliases: [gui-item]
|
aliases: [gui-item]
|
||||||
|
|
||||||
|
|
||||||
permissions:
|
#permissions:
|
||||||
commandgui.admin:
|
# commandgui.admin:
|
||||||
description: All permissions from CommandGUI
|
# description: All permissions from CommandGUI
|
||||||
default: op
|
# default: op
|
||||||
children:
|
# children:
|
||||||
commandgui.updatemsg: true
|
# commandgui.command: true
|
||||||
commandgui.command: true
|
# commandgui.get.guiitem.at.login: true
|
||||||
commandgui.get.guiitem.at.login: true
|
# commandgui.useitem: true
|
||||||
commandgui.useitem: true
|
# commandgui.useitem.toggle: true
|
||||||
commandgui.useitem.toggle: true
|
# commandgui.updatemsg: true
|
||||||
commandgui.bypass: true
|
# commandgui.bypass: true
|
||||||
commandgui.command.info: true
|
# commandgui.command.info: true
|
||||||
commandgui.command.give: true
|
# commandgui.command.give: true
|
||||||
|
#
|
||||||
commandgui.player:
|
# commandgui.player:
|
||||||
description: All permissions from CommandGUI
|
# description: All permissions from CommandGUI
|
||||||
default: op
|
# default: op
|
||||||
children:
|
# children:
|
||||||
commandgui.command: true
|
# commandgui.command: true
|
||||||
commandgui.get.guiitem.at.login: true
|
# commandgui.get.guiitem.at.login: true
|
||||||
commandgui.useitem: true
|
# commandgui.useitem: true
|
||||||
commandgui.useitem.toggle: true
|
# commandgui.useitem.toggle: true
|
||||||
|
#
|
||||||
commandgui.updatemsg:
|
# commandgui.updatemsg:
|
||||||
description: Players with this permission get the update message when joining if an update is available
|
# description: Players with this permission get the update message when joining if an update is available
|
||||||
default: op
|
# default: op
|
||||||
commandgui.command:
|
# commandgui.command:
|
||||||
description: Required permission to open GUIs via command
|
# description: Required permission to open GUIs via command
|
||||||
default: op
|
# default: op
|
||||||
commandgui.get.guiitem.at.login:
|
# commandgui.get.guiitem.at.login:
|
||||||
description: Only players with this permission will receive the GUI item
|
# description: Only players with this permission will receive the GUI item
|
||||||
default: op
|
# default: op
|
||||||
commandgui.useitem:
|
# commandgui.useitem:
|
||||||
description: Required permission to use the GUI Item
|
# description: Required permission to use the GUI Item
|
||||||
default: op
|
# default: op
|
||||||
commandgui.useitem.toggle:
|
# commandgui.useitem.toggle:
|
||||||
description: Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)
|
# description: Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)
|
||||||
default: op
|
# default: op
|
||||||
commandgui.bypass:
|
# commandgui.bypass:
|
||||||
description: Bypass to open disabled GUIs
|
# description: Bypass to open disabled GUIs
|
||||||
default: op
|
# default: op
|
||||||
commandgui.command.info:
|
# commandgui.command.info:
|
||||||
description: Permission to view CommandGUI info
|
# description: Permission to view CommandGUI info
|
||||||
default: not op
|
# default: not op
|
||||||
commandgui.command.give:
|
# commandgui.command.give:
|
||||||
description: Kommend in V2.1.0
|
# description: Kommend in V2.1.0
|
||||||
default: op
|
# default: op
|
Loading…
Reference in New Issue
Block a user