mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Merge pull request #662 from Redemption198/master
Added CS-CoreLib permission check for Slimefun Machines
This commit is contained in:
commit
dbdfa3cdb7
@ -197,6 +197,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ENHANCED_CRAFTING_TABLE");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
|
||||
@ -305,6 +306,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -343,6 +345,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("GRIND_STONE");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
Inventory inv = disp.getInventory();
|
||||
@ -364,6 +367,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.unknown-material", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -382,6 +386,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ARMOR_FORGE");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
final Inventory inv = disp.getInventory();
|
||||
@ -434,6 +439,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -452,6 +458,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ORE_CRUSHER");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
Inventory inv = disp.getInventory();
|
||||
@ -473,6 +480,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.unknown-material", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -491,6 +499,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("COMPRESSOR");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
final Inventory inv = disp.getInventory();
|
||||
@ -533,6 +542,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.unknown-material", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -682,13 +692,14 @@ public class SlimefunSetup {
|
||||
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
|
||||
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.GOLD_PAN, true)) {
|
||||
if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.GRAVEL) {
|
||||
if (CSCoreLib.getLib().getProtectionManager().canBuild(p.getUniqueId(), e.getClickedBlock(), true)) {
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.SIFTED_ORE"))) drops.add(SlimefunItems.SIFTED_ORE);
|
||||
else if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.CLAY"))) drops.add(new ItemStack(Material.CLAY_BALL));
|
||||
else if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.FLINT"))) drops.add(new ItemStack(Material.FLINT));
|
||||
|
||||
|
||||
if (CSCoreLib.getLib().getProtectionManager().canBuild(p.getUniqueId(), e.getClickedBlock(), true)) {
|
||||
|
||||
e.getClickedBlock().getWorld().playEffect(e.getClickedBlock().getLocation(), Effect.STEP_SOUND, e.getClickedBlock().getType());
|
||||
e.getClickedBlock().setType(Material.AIR);
|
||||
for (ItemStack drop: drops) {
|
||||
@ -719,6 +730,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("SMELTERY");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
Inventory inv = disp.getInventory();
|
||||
@ -786,6 +798,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -809,6 +822,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("PRESSURE_CHAMBER");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.UP).getRelative(BlockFace.UP).getState();
|
||||
final Inventory inv = disp.getInventory();
|
||||
@ -863,6 +877,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.unknown-material", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -1109,9 +1124,9 @@ public class SlimefunSetup {
|
||||
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
|
||||
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.GRAPPLING_HOOK, true)) {
|
||||
if (e.getClickedBlock() == null && !Variables.jump.containsKey(p.getUniqueId())) {
|
||||
Variables.jump.put(p.getUniqueId(), p.getItemInHand().getType() != Material.SHEARS);
|
||||
Variables.jump.put(p.getUniqueId(), p.getInventory().getItemInMainHand().getType() != Material.SHEARS);
|
||||
e.setCancelled(true);
|
||||
if (p.getItemInHand().getType() == Material.LEASH) PlayerInventory.consumeItemInHand(p);
|
||||
if (p.getInventory().getItemInMainHand().getType() == Material.LEASH) PlayerInventory.consumeItemInHand(p);
|
||||
|
||||
Vector direction = p.getEyeLocation().getDirection().multiply(2.0);
|
||||
Projectile projectile = p.getWorld().spawn(p.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), Arrow.class);
|
||||
@ -1143,6 +1158,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("MAGIC_WORKBENCH");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = null;
|
||||
|
||||
@ -1282,6 +1298,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -1300,7 +1317,7 @@ public class SlimefunSetup {
|
||||
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
|
||||
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.STAFF_WIND, true)) {
|
||||
if (p.getFoodLevel() >= 2) {
|
||||
if (p.getItemInHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) {
|
||||
if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) {
|
||||
FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
p.setFoodLevel(event.getFoodLevel());
|
||||
@ -1381,6 +1398,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ORE_WASHER");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.UP).getState();
|
||||
Inventory inv = disp.getInventory();
|
||||
@ -1439,6 +1457,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.unknown-material", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -1634,7 +1653,7 @@ public class SlimefunSetup {
|
||||
|
||||
@Override
|
||||
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getItemInHand(), SlimefunItems.LUMBER_AXE, true)) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.LUMBER_AXE, true)) {
|
||||
if (e.getBlock().getType() == Material.LOG || e.getBlock().getType() == Material.LOG_2) {
|
||||
List<Location> logs = new ArrayList<Location>();
|
||||
TreeCalculator.getTree(e.getBlock().getLocation(), e.getBlock().getLocation(), logs);
|
||||
@ -1822,7 +1841,7 @@ public class SlimefunSetup {
|
||||
|
||||
@Override
|
||||
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getItemInHand(), SlimefunItems.PICKAXE_OF_CONTAINMENT, true)) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.PICKAXE_OF_CONTAINMENT, true)) {
|
||||
if (e.getBlock().getType() != Material.MOB_SPAWNER) return true;
|
||||
ItemStack spawner = SlimefunItems.BROKEN_SPAWNER.clone();
|
||||
ItemMeta im = spawner.getItemMeta();
|
||||
@ -1846,7 +1865,7 @@ public class SlimefunSetup {
|
||||
|
||||
@Override
|
||||
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getItemInHand(), SlimefunItems.HERCULES_PICKAXE, true) && e.getBlock().getType().toString().endsWith("_ORE")) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.HERCULES_PICKAXE, true) && e.getBlock().getType().toString().endsWith("_ORE")) {
|
||||
if (e.getBlock().getType() == Material.IRON_ORE) drops.add(new CustomItem(SlimefunItems.IRON_DUST, 2));
|
||||
else if (e.getBlock().getType() == Material.GOLD_ORE) drops.add(new CustomItem(SlimefunItems.GOLD_DUST, 2));
|
||||
else {
|
||||
@ -1868,10 +1887,12 @@ public class SlimefunSetup {
|
||||
@Override
|
||||
public boolean onInteract(Player p, MultiBlock mb, Block b) {
|
||||
if (mb.isMultiBlock(SlimefunItem.getByID("SAW_MILL"))) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, SlimefunItems.SAW_MILL, true)) {
|
||||
if (b.getRelative(BlockFace.UP).getType() == Material.LOG) BlockBreaker.breakBlock(p, b.getRelative(BlockFace.UP), Arrays.asList(new ItemStack[] {new CustomItem(Material.WOOD, b.getRelative(BlockFace.UP).getData() % 4, 8)}), true);
|
||||
else if (b.getRelative(BlockFace.UP).getType() == Material.LOG_2) BlockBreaker.breakBlock(p, b.getRelative(BlockFace.UP), Arrays.asList(new ItemStack[] {new CustomItem(Material.WOOD, (b.getRelative(BlockFace.UP).getData() % 2) + 4, 8)}), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -1923,6 +1944,7 @@ public class SlimefunSetup {
|
||||
@Override
|
||||
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
||||
if (mb.isMultiBlock(SlimefunItem.getByID("DIGITAL_MINER"))) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, SlimefunItems.DIGITAL_MINER, true)) {
|
||||
Chest chest = (Chest) b.getRelative(BlockFace.UP).getState();
|
||||
final Inventory inv = chest.getInventory();
|
||||
@ -1985,6 +2007,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
else Messages.local.sendTranslation(p, "miner.no-ores", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -1999,6 +2022,7 @@ public class SlimefunSetup {
|
||||
@Override
|
||||
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
||||
if (mb.isMultiBlock(SlimefunItem.getByID("ADVANCED_DIGITAL_MINER"))) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, SlimefunItems.ADVANCED_DIGITAL_MINER, true)) {
|
||||
Chest chest = (Chest) b.getRelative(BlockFace.UP).getState();
|
||||
final Inventory inv = chest.getInventory();
|
||||
@ -2066,6 +2090,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
else Messages.local.sendTranslation(p, "miner.no-ores", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -2085,8 +2110,9 @@ public class SlimefunSetup {
|
||||
public boolean onRightClick(ItemUseEvent e, final Player p, ItemStack item) {
|
||||
if (e.getClickedBlock() != null) {
|
||||
SlimefunItem machine = BlockStorage.check(e.getClickedBlock());
|
||||
if (machine != null && machine.getName().equals("COMPOSTER")) {
|
||||
final ItemStack input = p.getItemInHand();
|
||||
if (machine != null && machine.getID().equals("COMPOSTER")) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
|
||||
final ItemStack input = p.getInventory().getItemInMainHand();
|
||||
final Block b = e.getClickedBlock();
|
||||
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
||||
if (convert != null && SlimefunManager.isItemSimiliar(input, convert, true)) {
|
||||
@ -2191,6 +2217,8 @@ public class SlimefunSetup {
|
||||
Messages.local.sendTranslation(p, "machines.wrong-item", true);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2262,7 +2290,8 @@ public class SlimefunSetup {
|
||||
@Override
|
||||
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
||||
if (mb.isMultiBlock(SlimefunItem.getByID("AUTOMATED_PANNING_MACHINE"))) {
|
||||
final ItemStack input = p.getItemInHand();
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
final ItemStack input = p.getInventory().getItemInMainHand();
|
||||
ItemStack output = null;
|
||||
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.SIFTED_ORE"))) output = SlimefunItems.SIFTED_ORE;
|
||||
else if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.CLAY"))) output = new ItemStack(Material.CLAY_BALL);
|
||||
@ -2321,6 +2350,8 @@ public class SlimefunSetup {
|
||||
Messages.local.sendTranslation(p, "machines.wrong-item", true);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
});
|
||||
@ -2364,8 +2395,8 @@ public class SlimefunSetup {
|
||||
p.teleport(new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), yaw, pitch));
|
||||
}
|
||||
|
||||
if (e.getPlayer().getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY)) {
|
||||
if (SlimefunStartup.randomize(100) <= (60 + 40 / (e.getPlayer().getItemInHand().getEnchantmentLevel(Enchantment.DURABILITY) + 1))) PlayerInventory.damageItemInHand(e.getPlayer());
|
||||
if (e.getPlayer().getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.DURABILITY)) {
|
||||
if (SlimefunStartup.randomize(100) <= (60 + 40 / (e.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.DURABILITY) + 1))) PlayerInventory.damageItemInHand(e.getPlayer());
|
||||
}
|
||||
else PlayerInventory.damageItemInHand(e.getPlayer());
|
||||
|
||||
@ -2401,8 +2432,9 @@ public class SlimefunSetup {
|
||||
public boolean onRightClick(ItemUseEvent e, final Player p, ItemStack item) {
|
||||
if (e.getClickedBlock() != null) {
|
||||
SlimefunItem machine = BlockStorage.check(e.getClickedBlock());
|
||||
if (machine != null && machine.getName().equals("CRUCIBLE")) {
|
||||
final ItemStack input = p.getItemInHand();
|
||||
if (machine != null && machine.getID().equals("CRUCIBLE")) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
|
||||
final ItemStack input = p.getInventory().getItemInMainHand();
|
||||
final Block block = e.getClickedBlock().getRelative(BlockFace.UP);
|
||||
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
||||
if (input != null) {
|
||||
@ -2547,6 +2579,8 @@ public class SlimefunSetup {
|
||||
Messages.local.sendTranslation(p, "machines.wrong-item", true);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2667,9 +2701,9 @@ public class SlimefunSetup {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (e.getPlayer().getItemInHand() != null) {
|
||||
if (e.getPlayer().getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY)) {
|
||||
if (SlimefunStartup.randomize(100) <= (60 + 40 / (e.getPlayer().getItemInHand().getEnchantmentLevel(Enchantment.DURABILITY) + 1))) PlayerInventory.damageItemInHand(e.getPlayer());
|
||||
if (e.getPlayer().getInventory().getItemInMainHand() != null) {
|
||||
if (e.getPlayer().getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.DURABILITY)) {
|
||||
if (SlimefunStartup.randomize(100) <= (60 + 40 / (e.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.DURABILITY) + 1))) PlayerInventory.damageItemInHand(e.getPlayer());
|
||||
}
|
||||
else PlayerInventory.damageItemInHand(e.getPlayer());
|
||||
}
|
||||
@ -2686,7 +2720,7 @@ public class SlimefunSetup {
|
||||
|
||||
@Override
|
||||
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getItemInHand(), SlimefunItems.PICKAXE_OF_VEIN_MINING, true)) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.PICKAXE_OF_VEIN_MINING, true)) {
|
||||
if (e.getBlock().getType().toString().endsWith("_ORE")) {
|
||||
List<Location> blocks = new ArrayList<Location>();
|
||||
Vein.calculate(e.getBlock().getLocation(), e.getBlock().getLocation(), blocks, 16);
|
||||
@ -2760,6 +2794,7 @@ public class SlimefunSetup {
|
||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("JUICER");
|
||||
|
||||
if (mb.isMultiBlock(machine)) {
|
||||
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
||||
if (Slimefun.hasUnlocked(p, SlimefunItems.JUICER, true)) {
|
||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||
Inventory inv = disp.getInventory();
|
||||
@ -2782,6 +2817,7 @@ public class SlimefunSetup {
|
||||
}
|
||||
Messages.local.sendTranslation(p, "machines.unknown-material", true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
@ -2908,7 +2944,7 @@ public class SlimefunSetup {
|
||||
|
||||
@Override
|
||||
public boolean onBlockDispense(final BlockDispenseEvent e, Block dispenser, final Dispenser d, Block block, Block chest, SlimefunItem machine) {
|
||||
if (machine.getName().equalsIgnoreCase("BLOCK_PLACER")) {
|
||||
if (machine.getID().equalsIgnoreCase("BLOCK_PLACER")) {
|
||||
e.setCancelled(true);
|
||||
if ((block.getType() == null || block.getType() == Material.AIR) && e.getItem().getType().isBlock()) {
|
||||
for(String blockType : blockPlacerBlacklist) {
|
||||
|
Loading…
Reference in New Issue
Block a user