diff --git a/.gradle/8.8/executionHistory/executionHistory.bin b/.gradle/8.8/executionHistory/executionHistory.bin index 6233639..3c14da4 100644 Binary files a/.gradle/8.8/executionHistory/executionHistory.bin and b/.gradle/8.8/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.8/executionHistory/executionHistory.lock b/.gradle/8.8/executionHistory/executionHistory.lock index 5b632b0..46e4aeb 100644 Binary files a/.gradle/8.8/executionHistory/executionHistory.lock and b/.gradle/8.8/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.8/fileHashes/fileHashes.bin b/.gradle/8.8/fileHashes/fileHashes.bin index dd54988..cda3c7a 100644 Binary files a/.gradle/8.8/fileHashes/fileHashes.bin and b/.gradle/8.8/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.8/fileHashes/fileHashes.lock b/.gradle/8.8/fileHashes/fileHashes.lock index 215497f..4d053c8 100644 Binary files a/.gradle/8.8/fileHashes/fileHashes.lock and b/.gradle/8.8/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.8/fileHashes/resourceHashesCache.bin b/.gradle/8.8/fileHashes/resourceHashesCache.bin index 80b3f3c..8b88de7 100644 Binary files a/.gradle/8.8/fileHashes/resourceHashesCache.bin and b/.gradle/8.8/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index ccc24a6..01aa801 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$1.class b/build/classes/java/main/CoswayUtil/CoswayUtil$1.class index 62f671d..bfbd7ab 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$1.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$1.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class index e785381..cb71c74 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class index 2893557..f5b2622 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class index 942ce3e..81ae2b0 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class index db9e4bd..5408110 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class index d680fd9..ef95358 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil.class b/build/classes/java/main/CoswayUtil/CoswayUtil.class index d3735d1..0dd76ff 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil.class and b/build/classes/java/main/CoswayUtil/CoswayUtil.class differ diff --git a/build/libs/CoswayUtil-1.9-RELEASE.jar b/build/libs/CoswayUtil-1.9-RELEASE.jar index 6dee5f0..06576dc 100644 Binary files a/build/libs/CoswayUtil-1.9-RELEASE.jar and b/build/libs/CoswayUtil-1.9-RELEASE.jar differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId1 deleted file mode 100644 index 62f671d..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId1 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId7 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId7 deleted file mode 100644 index e785381..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId7 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId3 deleted file mode 100644 index 2893557..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId3 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId4 similarity index 88% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId4 index 942ce3e..37cc95b 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId4 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 deleted file mode 100644 index db9e4bd..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId6 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId6 deleted file mode 100644 index d680fd9..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId6 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 deleted file mode 100644 index d3735d1..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/GravityGauntlet.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/GravityGauntlet.class.uniqueId0 index 30aedee..d11403e 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/GravityGauntlet.class.uniqueId0 and b/build/tmp/compileJava/compileTransaction/stash-dir/GravityGauntlet.class.uniqueId0 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract$1.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract$1.class.uniqueId1 new file mode 100644 index 0000000..1d9a4fa Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract$1.class.uniqueId1 differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index b577511..5c04820 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/CoswayUtil/CoswayUtil.java b/src/main/java/CoswayUtil/CoswayUtil.java index 4d3a7d4..75e5841 100644 --- a/src/main/java/CoswayUtil/CoswayUtil.java +++ b/src/main/java/CoswayUtil/CoswayUtil.java @@ -9,9 +9,15 @@ import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Monster; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -283,6 +289,61 @@ public final class CoswayUtil extends JavaPlugin implements Listener { loc.getWorld().spawnParticle(Particle.PORTAL, centered,10); } + @EventHandler + public void onAnchorExplosion(BlockExplodeEvent event) { + Block block = event.getBlock(); + + // Check if the explosion is caused by a Respawn Anchor in a non-Nether world + if (block.getType() == Material.RESPAWN_ANCHOR && block.getWorld().getEnvironment() != World.Environment.NETHER) { + event.setCancelled(true); // Cancel the explosion + } + } + + @EventHandler + public void onAnchorEntityExplosion(EntityExplodeEvent event) { + Block block = event.getLocation().getBlock(); + + // Check if the explosion is caused by a Respawn Anchor in a non-Nether world + if (block.getType() == Material.RESPAWN_ANCHOR && block.getWorld().getEnvironment() != World.Environment.NETHER) { + event.setCancelled(true); // Cancel the explosion + } + } + @EventHandler + public void onRespawnAnchorInteract(PlayerInteractEvent event) { + // Check if the player right-clicked a block + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { + Block block = event.getClickedBlock(); + Player player = event.getPlayer(); + ItemStack itemInHand = player.getInventory().getItemInMainHand(); + + if (block != null && block.getType() == Material.RESPAWN_ANCHOR) { + World world = block.getWorld(); + + // Check if the world is not the Nether + if (world.getEnvironment() != World.Environment.NETHER) { + // Get the Respawn Anchor's data + RespawnAnchor anchor = (RespawnAnchor) block.getBlockData(); + + // Check if the anchor is fully charged (4 charges) + if (anchor.getCharges() >= anchor.getMaximumCharges()) { + event.setCancelled(true); + player.sendMessage("This Respawn Anchor is fully charged and cannot be used here."); + return; + } + + // Allow charging if holding Glowstone + if (itemInHand.getType() == Material.GLOWSTONE) { + // Let the charging happen naturally + player.sendMessage("Charging Respawn Anchor..."); + } else { + // Cancel any other interaction (like right-clicking with an empty hand) + event.setCancelled(true); + player.sendMessage("Respawn Anchors can only be charged with Glowstone outside the Nether."); + } + } + } + } + } private void killHostileMobs(Location loc) { loc.getWorld().getEntitiesByClass(Monster.class).forEach(mob -> { if (mob.getLocation().distance(loc) <= RING_RADIUS) {