From f3d9346619d2e30adbf660cde62f1285f8d4a89a Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 30 Oct 2016 11:01:01 +0100 Subject: [PATCH] Cargo Nodes can now be opened by anyone permitted to access Inventories in that Area --- .../SlimefunItem/machines/CargoCraftingNode.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java index 0778e108c..119947189 100644 --- a/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java +++ b/src/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/machines/CargoCraftingNode.java @@ -28,7 +28,7 @@ public class CargoCraftingNode extends SlimefunItem { public CargoCraftingNode(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe) { super(category, item, name, recipeType, recipe); - new BlockMenuPreset(name, "§3Input Node") { + new BlockMenuPreset(name, "§3Input Node") { @Override public void init() { @@ -39,7 +39,7 @@ public class CargoCraftingNode extends SlimefunItem { @Override public void newInstance(final BlockMenu menu, final Block b) { try { - menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1")); + menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1")); menu.addMenuClickHandler(41, new MenuClickHandler() { @Override @@ -52,7 +52,7 @@ public class CargoCraftingNode extends SlimefunItem { } }); - menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))))), "§bChannel ID: §3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")))) + 1))); + menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))))), "§bChannel ID: §3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")))) + 1))); menu.addMenuClickHandler(42, new MenuClickHandler() { @Override @@ -61,7 +61,7 @@ public class CargoCraftingNode extends SlimefunItem { } }); - menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1")); + menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1")); menu.addMenuClickHandler(43, new MenuClickHandler() { @Override @@ -81,7 +81,7 @@ public class CargoCraftingNode extends SlimefunItem { @Override public boolean canOpen(Block b, Player p) { - boolean open = BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.cargo.bypass"); + boolean open = CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b) || p.hasPermission("slimefun.cargo.bypass"); if (!open) { Messages.local.sendTranslation(p, "inventory.no-access", true); } @@ -126,7 +126,7 @@ public class CargoCraftingNode extends SlimefunItem { }); } - preset.addItem(2, new CustomItem(new MaterialData(Material.WORKBENCH), "§eRecipe", "", "§bPut in the Recipe you want to craft"), + preset.addItem(2, new CustomItem(new MaterialData(Material.WORKBENCH), "§eRecipe", "", "§bPut in the Recipe you want to craft"), new MenuClickHandler() { @Override