diff --git a/pom.xml b/pom.xml index a6326262..c814e055 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.songoda skyblock - 2.3.13 + 2.3.14 jar UTF-8 diff --git a/src/main/java/com/songoda/skyblock/listeners/EntityListeners.java b/src/main/java/com/songoda/skyblock/listeners/EntityListeners.java index d6b4f646..10aab47f 100644 --- a/src/main/java/com/songoda/skyblock/listeners/EntityListeners.java +++ b/src/main/java/com/songoda/skyblock/listeners/EntityListeners.java @@ -493,47 +493,48 @@ public class EntityListeners implements Listener { IslandManager islandManager = plugin.getIslandManager(); - if (plugin.getWorldManager().isIslandWorld(livingEntity.getWorld())) { - Island island = islandManager.getIslandAtLocation(livingEntity.getLocation()); + if (!plugin.getWorldManager().isIslandWorld(livingEntity.getWorld())) return; - if (island != null) { - List upgrades = plugin.getUpgradeManager().getUpgrades(Upgrade.Type.Drops); + Island island = islandManager.getIslandAtLocation(livingEntity.getLocation()); - if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.Drops)) { - Set dontMultiply = new HashSet<>(); + if (island == null) return; - if (ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) { - EntityEquipment equipment = livingEntity.getEquipment(); - if (equipment != null) { - for (ItemStack item : event.getDrops()) { - if (item.equals(equipment.getHelmet()) || item.equals(equipment.getChestplate()) - || item.equals(equipment.getLeggings()) || item.equals(equipment.getBoots()) - || item.equals(equipment.getItemInMainHand()) || item.equals(equipment.getItemInOffHand())) { - dontMultiply.add(item); - } - } - } + List upgrades = plugin.getUpgradeManager().getUpgrades(Upgrade.Type.Drops); - if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { - if (livingEntity instanceof Steerable) { - Steerable steerable = (Steerable) livingEntity; - if (steerable.hasSaddle()) - dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1)); - } - } else { - if (livingEntity instanceof Pig) { - Pig pig = (Pig) livingEntity; - if (pig.hasSaddle()) - dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1)); - } + if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.Drops)) { + Set dontMultiply = new HashSet<>(); + + if (ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) { + EntityEquipment equipment = livingEntity.getEquipment(); + if (equipment != null) { + for (ItemStack item : event.getDrops()) { + if (item.equals(equipment.getHelmet()) || item.equals(equipment.getChestplate()) + || item.equals(equipment.getLeggings()) || item.equals(equipment.getBoots()) + || item.equals(equipment.getItemInMainHand()) || item.equals(equipment.getItemInOffHand())) { + dontMultiply.add(item); } } + } - for (ItemStack is : event.getDrops()) - if (!dontMultiply.contains(is)) - livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), is); + if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { + if (livingEntity instanceof Steerable) { + Steerable steerable = (Steerable) livingEntity; + if (steerable.hasSaddle()) + dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1)); + } + } else { + if (livingEntity instanceof Pig) { + Pig pig = (Pig) livingEntity; + if (pig.hasSaddle()) + dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1)); + } } } + + for (ItemStack is : event.getDrops()) + for (ItemStack is2 : dontMultiply) + if (!is2.isSimilar(is)) + livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), is); } } diff --git a/src/main/java/com/songoda/skyblock/listeners/InteractListeners.java b/src/main/java/com/songoda/skyblock/listeners/InteractListeners.java index d81109ac..d109470a 100644 --- a/src/main/java/com/songoda/skyblock/listeners/InteractListeners.java +++ b/src/main/java/com/songoda/skyblock/listeners/InteractListeners.java @@ -26,6 +26,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.data.Levelled; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -62,9 +63,13 @@ public class InteractListeners implements Listener { IslandLevelManager levellingManager = plugin.getLevellingManager(); if (!worldManager.isIslandWorld(block.getWorld())) return; - if (event.getAction() == Action.RIGHT_CLICK_BLOCK && - worldManager.getIslandWorld(block.getWorld()).equals(IslandWorld.Nether) && - event.getItem().getType().equals(Material.WATER_BUCKET)) { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK + && worldManager.getIslandWorld(block.getWorld()).equals(IslandWorld.Nether) + && (event.getItem().getType().equals(Material.WATER_BUCKET) + || event.getItem().getType().equals(Material.TROPICAL_FISH_BUCKET) + || event.getItem().getType().equals(Material.COD_BUCKET) + || event.getItem().getType().equals(Material.SALMON_BUCKET) + || event.getItem().getType().equals(Material.PUFFERFISH_BUCKET))) { Location blockLoc = block.getLocation(); Island island = islandManager.getIslandAtLocation(blockLoc); @@ -85,6 +90,13 @@ public class InteractListeners implements Listener { return; } + CompatibleMaterial type = CompatibleMaterial.getMaterial(block); + + if (type.name().contains("SLAB")) { + event.setCancelled(true); + return; + } + FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")); FileConfiguration configLoad = config.getFileConfiguration(); IslandWorld world = worldManager.getIslandWorld(block.getWorld()); @@ -121,14 +133,8 @@ public class InteractListeners implements Listener { return; } - if (configLoad.getBoolean("Island.Nether.AllowNetherWater", false)) { - event.setCancelled(true); + if (configLoad.getBoolean("Island.Nether.AllowNetherWater", false)) block.setType(Material.WATER, true); - block.getWorld().playSound(block.getLocation(), CompatibleSound.ITEM_BUCKET_EMPTY.getSound(), 1f, 1f); - if (!event.getPlayer().getGameMode().equals(GameMode.CREATIVE)) { - event.getItem().setType(Material.BUCKET); - } - } } }