diff --git a/.gradle/8.8/checksums/checksums.lock b/.gradle/8.8/checksums/checksums.lock index 8166db8..7943a20 100644 Binary files a/.gradle/8.8/checksums/checksums.lock and b/.gradle/8.8/checksums/checksums.lock differ diff --git a/.gradle/8.8/checksums/sha1-checksums.bin b/.gradle/8.8/checksums/sha1-checksums.bin index 7f47b6b..0351e0f 100644 Binary files a/.gradle/8.8/checksums/sha1-checksums.bin and b/.gradle/8.8/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.8/executionHistory/executionHistory.bin b/.gradle/8.8/executionHistory/executionHistory.bin index 7cc1d85..0128478 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 ad3c85c..cd33731 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 0ed6b24..504ece6 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 61b175c..17b970f 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 12d1f4a..8b05ec0 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 dc50f56..c87cdb6 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index fc5e916..578c005 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$1.class b/build/classes/java/main/CoswayUtil/CoswayUtil$1.class index bfbd7ab..81ec650 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 9db13e0..55642bb 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 5342a47..3c74833 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 99e4ac5..1db9694 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 a8daf90..a64ef35 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 8338fbe..9c7ab1a 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 89c02af..7269353 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/classes/java/main/CoswayUtil/GravityGauntletCommand.class b/build/classes/java/main/CoswayUtil/GravityGauntletCommand.class index 61be90d..b8eb383 100644 Binary files a/build/classes/java/main/CoswayUtil/GravityGauntletCommand.class and b/build/classes/java/main/CoswayUtil/GravityGauntletCommand.class differ diff --git a/build/classes/java/main/CoswayUtil/LaunchStick.class b/build/classes/java/main/CoswayUtil/LaunchStick.class index 80c25f8..446d49a 100644 Binary files a/build/classes/java/main/CoswayUtil/LaunchStick.class and b/build/classes/java/main/CoswayUtil/LaunchStick.class differ diff --git a/build/classes/java/main/CoswayUtil/MobLevitationWand$1.class b/build/classes/java/main/CoswayUtil/MobLevitationWand$1.class index 33eb1ac..b7b9dbf 100644 Binary files a/build/classes/java/main/CoswayUtil/MobLevitationWand$1.class and b/build/classes/java/main/CoswayUtil/MobLevitationWand$1.class differ diff --git a/build/classes/java/main/CoswayUtil/MobLevitationWand.class b/build/classes/java/main/CoswayUtil/MobLevitationWand.class index 032615c..af0dcbb 100644 Binary files a/build/classes/java/main/CoswayUtil/MobLevitationWand.class and b/build/classes/java/main/CoswayUtil/MobLevitationWand.class differ diff --git a/build/libs/CoswayUtil-1.10-RELEASE.jar b/build/libs/CoswayUtil-1.10-RELEASE.jar index 4f9c7c0..b398b5f 100644 Binary files a/build/libs/CoswayUtil-1.10-RELEASE.jar and b/build/libs/CoswayUtil-1.10-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.uniqueId0 similarity index 93% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId1 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 index bfbd7ab..81ec650 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId1 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 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.uniqueId9 similarity index 91% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId7 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId9 index 9db13e0..55642bb 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId7 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId9 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 index 5342a47..3c74833 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId3 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId3 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.uniqueId6 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.uniqueId6 index 99e4ac5..1db9694 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.uniqueId6 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.uniqueId5 similarity index 92% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 index a8daf90..a64ef35 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 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 8338fbe..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$AnchorShield.class.uniqueId7 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId7 new file mode 100644 index 0000000..9c7ab1a Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId7 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 index 89c02af..7269353 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId2 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/GiveWandCommand.class.uniqueId8 b/build/tmp/compileJava/compileTransaction/stash-dir/GiveWandCommand.class.uniqueId8 new file mode 100644 index 0000000..5746ceb Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/GiveWandCommand.class.uniqueId8 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand$1.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand$1.class.uniqueId1 new file mode 100644 index 0000000..96ec75c Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand$1.class.uniqueId1 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand.class.uniqueId4 new file mode 100644 index 0000000..b963dfa Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand.class.uniqueId4 differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index 482894e..d496308 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 8b54836..09b5208 100644 --- a/src/main/java/CoswayUtil/CoswayUtil.java +++ b/src/main/java/CoswayUtil/CoswayUtil.java @@ -2,7 +2,9 @@ package CoswayUtil; import org.bukkit.*; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; +import org.bukkit.block.data.type.LightningRod; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.ArmorStand; @@ -112,6 +114,10 @@ public final class CoswayUtil extends JavaPlugin implements Listener { returnMsg(player,"&aYou threw "+Target.getName()); } } + if (cmd.getName().equalsIgnoreCase("rapidbow") && sender instanceof Player player) { + player.getInventory().addItem(RapidFireBow.createRapidFireBow()); + } + return true; } @@ -354,6 +360,33 @@ public final class CoswayUtil extends JavaPlugin implements Listener { } } } + @EventHandler + public void placedevent(BlockPlaceEvent event) { + Block placed = event.getBlockPlaced(); + Player player = event.getPlayer(); + + if (placed.getType() == Material.RESPAWN_ANCHOR) { + Location above = placed.getLocation().clone().add(0, 1, 0); + Block blockAbove = placed.getWorld().getBlockAt(above); + + // Check if the player has at least one Lightning Rod + if (player.getInventory().contains(Material.LIGHTNING_ROD, 1)) { + blockAbove.setType(Material.LIGHTNING_ROD); + + // Ensure the Lightning Rod is placed upright + LightningRod rodData = (LightningRod) blockAbove.getBlockData(); + rodData.setFacing(BlockFace.UP); + blockAbove.setBlockData(rodData); + + // Remove one Lightning Rod from the player's inventory + ItemStack lightningRod = new ItemStack(Material.LIGHTNING_ROD, 1); + player.getInventory().removeItem(lightningRod); + } else { + player.sendMessage(ChatColor.RED + "You need a Lightning Rod in your inventory to place one!"); + } + } + + } private void killHostileMobs(Location loc) { loc.getWorld().getEntitiesByClass(Monster.class).forEach(mob -> { if (mob.getLocation().distance(loc) <= RING_RADIUS) { diff --git a/src/main/java/CoswayUtil/LaunchStick.java b/src/main/java/CoswayUtil/LaunchStick.java index 21f9703..df0d4d8 100644 --- a/src/main/java/CoswayUtil/LaunchStick.java +++ b/src/main/java/CoswayUtil/LaunchStick.java @@ -19,7 +19,7 @@ import java.util.Set; public class LaunchStick implements Listener { private final CoswayUtil plugin; private final Set noFallPlayers = new HashSet<>(); - private final double LAUNCH_POWER = 4.0; // Adjust this to change launch strength + private final double LAUNCH_POWER = 3.0; // Adjust this to change launch strength public LaunchStick(CoswayUtil plugin) { this.plugin = plugin; @@ -42,7 +42,9 @@ public class LaunchStick implements Listener { player.setVelocity(direction); // Add player to no-fall damage list - noFallPlayers.add(player); + if(player.getLocation().clone().subtract(0,1,0).getBlock().getType() == Material.AIR) { + noFallPlayers.add(player); + } player.getWorld().playSound(player.getLocation(), Sound.ENTITY_BREEZE_JUMP,10,0); player.getWorld().playEffect(player.getLocation(), Effect.TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS,1); //player.sendMessage(ChatColor.GREEN + "You launched yourself forward!"); diff --git a/src/main/java/CoswayUtil/MobLevitationWand.java b/src/main/java/CoswayUtil/MobLevitationWand.java index 403760d..b1870bf 100644 --- a/src/main/java/CoswayUtil/MobLevitationWand.java +++ b/src/main/java/CoswayUtil/MobLevitationWand.java @@ -80,19 +80,19 @@ public class MobLevitationWand implements Listener { return; } - Vector direction = player.getLocation().getDirection().normalize().multiply(5); + Vector direction = player.getLocation().getDirection().normalize().multiply(8); Location newLocation = player.getLocation().add(direction); World world = player.getWorld(); // Ensure the mob is not placed inside a solid block - while (newLocation.getBlock().getType().isSolid()) { - newLocation.add(0, 1, 0); // Move up until a free space is found - } - - // Ensure the mob is not underground - int highestY = world.getHighestBlockYAt(newLocation); - if (newLocation.getY() < highestY) { - newLocation.setY(highestY + 1); // Adjust to be above ground + if (newLocation.getBlock().getType().isSolid()) { + Location safeLocation = findSafeLocation(newLocation); + if (safeLocation != null) { + newLocation = safeLocation; + } else { + player.sendMessage(ChatColor.RED + "No safe location found for teleporting!"); + return; + } } entity.teleport(newLocation); @@ -108,6 +108,24 @@ public class MobLevitationWand implements Listener { }.runTaskTimer(plugin, 0L, 2L); } + /** + * Finds the nearest safe location for teleportation by searching upwards but not going to max height. + */ + private Location findSafeLocation(Location loc) { + World world = loc.getWorld(); + int maxHeight = world.getMaxHeight(); + + for (int y = loc.getBlockY(); y < maxHeight; y++) { + Location checkLoc = new Location(world, loc.getX(), y, loc.getZ()); + if (!checkLoc.getBlock().getType().isSolid() && !checkLoc.clone().add(0, 1, 0).getBlock().getType().isSolid()) { + return checkLoc; // Found a safe spot + } + } + + return null; // No valid space found + } + + private void releaseMob(Player player) { Entity entity = levitatedMobs.remove(player.getUniqueId()); diff --git a/src/main/java/CoswayUtil/RapidFireBow.java b/src/main/java/CoswayUtil/RapidFireBow.java new file mode 100644 index 0000000..810714c --- /dev/null +++ b/src/main/java/CoswayUtil/RapidFireBow.java @@ -0,0 +1,98 @@ +package CoswayUtil; + +import org.bukkit.*; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataType; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import java.util.Collections; +import java.util.HashMap; +import java.util.UUID; + +public class RapidFireBow implements Listener { + private final NamespacedKey bowKey = new NamespacedKey("coswayutil", "rapid_fire_bow"); + private final HashMap shootingTasks = new HashMap<>(); + private final CoswayUtil plugin; + + public RapidFireBow(CoswayUtil plugin) { + this.plugin = plugin; + } + + @EventHandler + public void onRightClick(PlayerInteractEvent event) { + Player player = event.getPlayer(); + ItemStack item = player.getInventory().getItemInMainHand(); + + // Check if the player is holding the custom bow + if (!isRapidFireBow(item)) return; + + // If the player is already shooting, do nothing + if (shootingTasks.containsKey(player.getUniqueId())) return; + + // Start firing arrows every tick + BukkitRunnable task = new BukkitRunnable() { + @Override + public void run() { + if (!player.isOnline() || !isHoldingBow(player)) { + stopShooting(player); + return; + } + + // Fire arrow + Arrow arrow = player.launchProjectile(Arrow.class); + arrow.setVelocity(player.getLocation().getDirection().multiply(3)); // High speed + arrow.setCritical(true); + arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED); // Prevent pickup + arrow.setShooter(player); + + // Play sound and particles + player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ARROW_SHOOT, 1.0f, 1.5f); + player.getWorld().spawnParticle(Particle.CRIT, arrow.getLocation(), 5, 0.2, 0.2, 0.2, 0.1); + } + }; + task.runTaskTimer(plugin, 0L, 1L); // Fire every tick + shootingTasks.put(player.getUniqueId(), task); + } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + stopShooting(event.getPlayer()); + } + + private boolean isHoldingBow(Player player) { + ItemStack item = player.getInventory().getItemInMainHand(); + return isRapidFireBow(item); + } + + private boolean isRapidFireBow(ItemStack item) { + if (item == null || item.getType() != Material.BOW || !item.hasItemMeta()) return false; + ItemMeta meta = item.getItemMeta(); + return meta.getPersistentDataContainer().has(bowKey, PersistentDataType.STRING); + } + + private void stopShooting(Player player) { + UUID playerId = player.getUniqueId(); + if (shootingTasks.containsKey(playerId)) { + shootingTasks.get(playerId).cancel(); + shootingTasks.remove(playerId); + } + } + + public static ItemStack createRapidFireBow() { + ItemStack bow = new ItemStack(Material.BOW); + ItemMeta meta = bow.getItemMeta(); + meta.setDisplayName(ChatColor.GOLD + "Rapid-Fire Bow"); + meta.setLore(Collections.singletonList(ChatColor.RED + "Hold Right-Click to unleash rapid arrows!")); + meta.getPersistentDataContainer().set(new NamespacedKey("coswayutil", "rapid_fire_bow"), PersistentDataType.STRING, "true"); + bow.setItemMeta(meta); + return bow; + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 31ccdfc..12b2131 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -24,4 +24,8 @@ commands: launchstick: description: give player a stick to use for launching themselves usage: /launchstick - permission: CoswayUtil.launchStick \ No newline at end of file + permission: CoswayUtil.launchStick + rapidbow: + description: gives player a rapid fire bow + usage: /rapidbow + permission: CoswayUtil.rapidBow \ No newline at end of file