Added remote open permission

This commit is contained in:
jameslfc19 2020-07-26 19:34:15 +01:00
parent f0a7d3231f
commit e12bc92019
4 changed files with 8 additions and 3 deletions

View File

@ -48,12 +48,14 @@ import org.bukkit.plugin.java.annotation.plugin.author.Author;
@Command(name = "chests++", desc = "Chests++ Commands.", aliases = {"c++"}, usage = "/chests++ version")})
@Permission(name = Permissions.ADD, desc = "Gives permission to add ChestLinks!", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.OPEN, desc = "Gives permission to open ChestLinks!", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.OPEN_REMOTE, desc = "Gives permission to remotely open ChestLinks!", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.MENU, desc = "Gives permission to open the ChestLink menu!", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.REMOVE, desc = "Gives permission to remove a ChestLink!", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.OPEN_ANY, desc = "Gives permission to open all chests/autocraft stations, for admin use.", defaultValue = PermissionDefault.OP)
@Permission(name = Permissions.MEMBER, desc = "Gives permission to add/remove a member to/from their chestlink.", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.SORT, desc = "Gives permission to sort ChestLinks.", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.AUTOCRAFT_OPEN, desc = "Gives permission to open AutoCrafting stations.", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.AUTOCRAFT_OPEN_REMOTE, desc = "Gives permission to remotely open AutoCrafting stations.", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.AUTOCRAFT_ADD, desc = "Gives permission to add AutoCrafting stations.", defaultValue = PermissionDefault.TRUE)
@Permission(name = Permissions.AUTOCRAFT_REMOVE, desc = "Gives permission to remove AutoCrafting stations.", defaultValue = PermissionDefault.TRUE)
public class ChestsPlusPlus extends JavaPlugin {
@ -110,6 +112,7 @@ public class ChestsPlusPlus extends JavaPlugin {
if(Settings.isUpdateCheckEnabled() && !isDev && !isBeta) {
String SPIGOT_URL = "https://www.spigotmc.org/resources/chests-chest-linking-hopper-filtering-remote-chests-menus.71355/";
String BUKKIT_URL = "https://dev.bukkit.org/projects/chests-plus-plus/files";
UpdateCheck updateChecker = UpdateCheck
.of(this)
.resourceId(71355)
@ -120,7 +123,7 @@ public class ChestsPlusPlus extends JavaPlugin {
getLogger().warning("New version of the plugin has been found: " + version);
getLogger().warning("Download at: "+SPIGOT_URL);
Bukkit.broadcastMessage(ChatColor.RED + "[Chests++] New version of the plugin was found: " + version);
Bukkit.broadcastMessage(ChatColor.RED + "[Chests++] Download at: " +ChatColor.WHITE+ SPIGOT_URL);
Bukkit.broadcastMessage(ChatColor.RED + "[Chests++] Download at: " +ChatColor.WHITE+ BUKKIT_URL);
break;
case LATEST:
if(!boot) getLogger().info("Plugin is up to date! Thank you for supporting Chests++!");

View File

@ -93,7 +93,7 @@ public class AutoCraftCommand extends ServerCommand {
}
case OPEN:
if(args.length > 1){
if(sender.hasPermission(Permissions.AUTOCRAFT_OPEN) && !Settings.isBlacklistedWorld(player.getWorld())) {
if(sender.hasPermission(Permissions.AUTOCRAFT_OPEN) && sender.hasPermission(Permissions.AUTOCRAFT_OPEN_REMOTE) && !Settings.isBlacklistedWorld(player.getWorld())) {
AutoCraftingStorage invs;
if(args[1].contains(":")){
invs = Config.getAutoCraft().getStorage(player,args[1]);

View File

@ -97,7 +97,7 @@ public class ChestLinkCommand extends ServerCommand {
}
case OPEN:
if(args.length > 1){
if(sender.hasPermission(Permissions.OPEN) && !Settings.isBlacklistedWorld(player.getWorld())) {
if(sender.hasPermission(Permissions.OPEN) && sender.hasPermission(Permissions.OPEN_REMOTE) && !Settings.isBlacklistedWorld(player.getWorld())) {
ChestLinkStorage invs;
if(args[1].contains(":")){
invs = Config.getChestLink().getStorage(player,args[1]);

View File

@ -4,12 +4,14 @@ public class Permissions {
public static final String ADD = "chestlink.add";
public static final String OPEN = "chestlink.open";
public static final String OPEN_REMOTE = "chestlink.remote-open";
public static final String MENU = "chestlink.menu";
public static final String REMOVE = "chestlink.remove";
public static final String OPEN_ANY = "chestlink.openall";
public static final String MEMBER = "chestlink.member";
public static final String SORT = "chestlink.sort";
public static final String AUTOCRAFT_OPEN = "chestlink.autocraft.open";
public static final String AUTOCRAFT_OPEN_REMOTE = "chestlink.autocraft.remote-open";
public static final String AUTOCRAFT_ADD = "chestlink.autocraft.add";
public static final String AUTOCRAFT_REMOVE = "chestlink.autocraft.remove";
}