mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Cargo Nodes can now be opened by anyone permitted to access Inventories in that Area
This commit is contained in:
parent
391f2d9391
commit
f3d9346619
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user