mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +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) {
|
public CargoCraftingNode(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
super(category, item, name, recipeType, recipe);
|
super(category, item, name, recipeType, recipe);
|
||||||
|
|
||||||
new BlockMenuPreset(name, "§3Input Node") {
|
new BlockMenuPreset(name, "§3Input Node") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
@ -39,7 +39,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
|||||||
@Override
|
@Override
|
||||||
public void newInstance(final BlockMenu menu, final Block b) {
|
public void newInstance(final BlockMenu menu, final Block b) {
|
||||||
try {
|
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() {
|
menu.addMenuClickHandler(41, new MenuClickHandler() {
|
||||||
|
|
||||||
@Override
|
@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() {
|
menu.addMenuClickHandler(42, new MenuClickHandler() {
|
||||||
|
|
||||||
@Override
|
@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() {
|
menu.addMenuClickHandler(43, new MenuClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -81,7 +81,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canOpen(Block b, Player p) {
|
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) {
|
if (!open) {
|
||||||
Messages.local.sendTranslation(p, "inventory.no-access", true);
|
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() {
|
new MenuClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user