diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java index 30fcc15..97d04b9 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/handlers/HopHandler.java @@ -82,8 +82,6 @@ public class HopHandler { Hopper hopperBlock = hopper.getHopper(); - ItemStack[] is = hopperBlock.getInventory().getContents(); - List blockedMaterials = new ArrayList<>(); for (Module module : hopper.getLevel().getRegisteredModules()) { @@ -96,6 +94,8 @@ public class HopHandler { blockedMaterials.addAll(materials); } + ItemStack[] is = hopperBlock.getInventory().getContents(); + if (hopper.getLinkedBlocks() == null || hopper.getLinkedBlocks().isEmpty()) continue; for (Block destBlock : hopper.getLinkedBlocks()) { diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java index 4fd1063..e3eb0aa 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java @@ -39,36 +39,36 @@ public class ModuleSuction implements Module { Collection nearbyEntite = hopper.getLocation().getWorld().getNearbyEntities(hopper.getLocation().add(0.5, 0.5, 0.5), radius, radius, radius); - for (Entity e : nearbyEntite) { - if (!(e instanceof Item) || e.getTicksLived() < 10 || e.getLocation().getBlock().getType() == Material.HOPPER) { + for (Entity entity : nearbyEntite) { + if (!(entity instanceof Item) || entity.getTicksLived() < 10 || entity.getLocation().getBlock().getType() == Material.HOPPER) { continue; } - ItemStack hopItem = ((Item) e).getItemStack().clone(); + + ItemStack hopItem = ((Item) entity).getItemStack().clone(); if (hopItem.getType().name().contains("SHULKER_BOX")) continue; + if (hopItem.hasItemMeta() && hopItem.getItemMeta().hasDisplayName() && StringUtils.substring(hopItem.getItemMeta().getDisplayName(), 0, 3).equals("***")) { continue; //Compatibility with Shop instance: https://www.spigotmc.org/resources/shop-a-simple-intuitive-shop-instance.9628/ } - if (e.hasMetadata("grabbed")) + if (entity.hasMetadata("grabbed") || !entity.isOnGround()) continue; - if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) { - hopItem.setAmount(WildStackerAPI.getItemAmount((Item)e)); - } - ItemStack item = ((Item) e).getItemStack(); + if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) + hopItem.setAmount(WildStackerAPI.getItemAmount((Item)entity)); + + ItemStack item = ((Item) entity).getItemStack(); if (!canMove(hopperBlock.getInventory(), item)) { continue; } - if (!e.isOnGround()) - continue; - ((Item) e).setPickupDelay(10); - e.setMetadata("grabbed", new FixedMetadataValue(EpicHoppersPlugin.getInstance(), "")); + ((Item) entity).setPickupDelay(10); + entity.setMetadata("grabbed", new FixedMetadataValue(EpicHoppersPlugin.getInstance(), "")); float xx = (float) (0 + (Math.random() * .3)); float yy = (float) (0 + (Math.random() * .3)); float zz = (float) (0 + (Math.random() * .3)); - Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(e.getLocation(), xx, yy, zz, 0, "FLAME", 5); - e.remove(); + Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(entity.getLocation(), xx, yy, zz, 0, "FLAME", 5); + entity.remove(); hopperBlock.getInventory().addItem(hopItem); break; } diff --git a/EpicHoppers-Plugin/src/main/resources/en_US.lang b/EpicHoppers-Plugin/src/main/resources/en_US.lang index d83e27c..40ef8f2 100644 --- a/EpicHoppers-Plugin/src/main/resources/en_US.lang +++ b/EpicHoppers-Plugin/src/main/resources/en_US.lang @@ -21,7 +21,7 @@ interface.hopper.teleport = "&7Teleport: &6%enabled%" interface.hopper.filter = "&7Filter: &6%enabled%" interface.hopper.crafting = "&7AutoCrafting: &6%enabled%" interface.hopper.suction = "&7Suction: &6%suction%" -interface.hopper.linkamount = "&7Link Amount: &6%amount%" +interface.hopper.linkamount = "&7Link Overflow: &6%amount%" interface.hopper.blockbreak = "&7Block Break: &6Every %ticks% ticks" interface.hopper.alreadymaxed = "&7This hopper is already maxed out!" interface.hopper.synclore = "|&7Left-Click then click a another|&7hopper or chest to link!||&7Right-Click to unlink."