diff --git a/.gradle/8.8/checksums/checksums.lock b/.gradle/8.8/checksums/checksums.lock index 9fdabb5..32d87bb 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/md5-checksums.bin b/.gradle/8.8/checksums/md5-checksums.bin index 8832e9b..a21048a 100644 Binary files a/.gradle/8.8/checksums/md5-checksums.bin and b/.gradle/8.8/checksums/md5-checksums.bin differ diff --git a/.gradle/8.8/checksums/sha1-checksums.bin b/.gradle/8.8/checksums/sha1-checksums.bin index 1ef836f..a080e94 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 d348faa..d5e23fc 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 f2feae8..e5761d3 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 8fcb56f..1b02f86 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 9c6d61c..155cb20 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 62df894..7d065b4 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 50fef76..7fa8795 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 9746776..9be656d 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index 53e8c4e..afadb01 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 17690f8..341d5f6 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$2.class b/build/classes/java/main/CoswayUtil/CoswayUtil$2.class index 928c380..47fe399 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$2.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$2.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 06c73e0..b812d25 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 a8a8349..fa87804 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 ccc1052..81bf3aa 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 8d63bfb..5891ef5 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 8519da6..a3116c9 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 1c9f7d6..6f06b34 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/FireflySimulator$1.class b/build/classes/java/main/CoswayUtil/FireflySimulator$1.class new file mode 100644 index 0000000..62d16c2 Binary files /dev/null and b/build/classes/java/main/CoswayUtil/FireflySimulator$1.class differ diff --git a/build/classes/java/main/CoswayUtil/FireflySimulator$2.class b/build/classes/java/main/CoswayUtil/FireflySimulator$2.class new file mode 100644 index 0000000..b307551 Binary files /dev/null and b/build/classes/java/main/CoswayUtil/FireflySimulator$2.class differ diff --git a/build/classes/java/main/CoswayUtil/FireflySimulator.class b/build/classes/java/main/CoswayUtil/FireflySimulator.class new file mode 100644 index 0000000..7eac3d8 Binary files /dev/null and b/build/classes/java/main/CoswayUtil/FireflySimulator.class differ diff --git a/build/libs/CoswayUtil-1.12-RELEASE.jar b/build/libs/CoswayUtil-1.12-RELEASE.jar index eaec1c0..3b5e67e 100644 Binary files a/build/libs/CoswayUtil-1.12-RELEASE.jar and b/build/libs/CoswayUtil-1.12-RELEASE.jar differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/BlockShop.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/BlockShop.class.uniqueId3 deleted file mode 100644 index fc5153d..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/BlockShop.class.uniqueId3 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 deleted file mode 100644 index 17690f8..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId4 deleted file mode 100644 index 928c380..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$2.class.uniqueId4 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId8 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId13 similarity index 91% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId8 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId13 index 06c73e0..b812d25 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId8 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId13 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 deleted file mode 100644 index a8a8349..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId6 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId3 similarity index 88% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId6 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId3 index ccc1052..81bf3aa 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId6 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId3 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 deleted file mode 100644 index 8d63bfb..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId5 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 deleted file mode 100644 index 8519da6..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId7 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 deleted file mode 100644 index 1c9f7d6..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId6 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId6 new file mode 100644 index 0000000..158deb8 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId6 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/LaunchStick.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/LaunchStick.class.uniqueId4 new file mode 100644 index 0000000..446d49a Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/LaunchStick.class.uniqueId4 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand$1.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand$1.class.uniqueId0 new file mode 100644 index 0000000..b7b9dbf Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/MobLevitationWand$1.class.uniqueId0 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract$2.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract$2.class.uniqueId2 new file mode 100644 index 0000000..ef78745 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract$2.class.uniqueId2 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract.class.uniqueId12 b/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract.class.uniqueId12 new file mode 100644 index 0000000..6ce948a Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/WitherContract.class.uniqueId12 differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index ce09fd0..df27f69 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/BlackholeEffect.java b/src/main/java/CoswayUtil/BlackholeEffect.java new file mode 100644 index 0000000..11f2d37 --- /dev/null +++ b/src/main/java/CoswayUtil/BlackholeEffect.java @@ -0,0 +1,97 @@ +package CoswayUtil; +import org.bukkit.*; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import java.util.*; + +public class BlackholeEffect extends BukkitRunnable { + + private final CoswayUtil plugin; + private final Map pullTimer = new HashMap<>(); + + public BlackholeEffect(CoswayUtil plugin) { + this.plugin = plugin; + startTask(); + //Bukkit.broadcastMessage(ChatColor.GREEN+"this is proof the blackhole class is registered properly"); + } + + @Override + public void run() { + for (World world : Bukkit.getWorlds()) { + for (Entity entity : world.getEntities()) { + if (entity instanceof Monster && "Blackhole".equalsIgnoreCase(ChatColor.stripColor(entity.getCustomName()))) { + Location blackholeLocation = entity.getLocation(); + ((LivingEntity) entity).setAI(false); + entity.setInvulnerable(true); + entity.setGravity(false); + ((Monster) entity).setCollidable(false); + + entity.getWorld().playSound(entity.getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 4, 0); + entity.getWorld().playSound(entity.getLocation(), Sound.BLOCK_BEACON_ACTIVATE, 4, 0); + spawnBlackholeParticles(blackholeLocation); + + List nearbyEntities = entity.getNearbyEntities(20, 20, 20); + for (Entity nearbyEntity : nearbyEntities) { + if (nearbyEntity instanceof Monster && nearbyEntity != entity) { + pullEntityTowards(nearbyEntity, blackholeLocation); + pullTimer.putIfAbsent(nearbyEntity, 0); + } + } + + pullTimer.replaceAll((mob, time) -> time + 1); + + Iterator> iterator = pullTimer.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + Entity mob = entry.getKey(); + + if (entry.getValue() >= 100) { + new BukkitRunnable() { + int ticks = 0; + final int maxTicks = 100; + + @Override + public void run() { + if (ticks >= maxTicks || mob.isDead()) { + mob.getWorld().playEffect(mob.getLocation(), Effect.END_GATEWAY_SPAWN, 1); + mob.remove(); + cancel(); + return; + } + Location currentLocation = mob.getLocation(); + mob.teleport(currentLocation.add(0, 0.1, 0)); // Move entity up + ticks++; + } + }.runTaskTimer(plugin, 0, 1); + iterator.remove(); + } + } + } + } + } + } + + + private void pullEntityTowards(Entity entity, Location targetLocation) { + Vector direction = targetLocation.toVector().subtract(entity.getLocation().toVector()).normalize(); + entity.setVelocity(direction.multiply(0.3)); + } + + private void spawnBlackholeParticles(Location location) { + for (int i = 0; i < 20; i++) { + double angle = Math.toRadians(i * 18); + double x = Math.cos(angle) * 2; + double z = Math.sin(angle) * 2; + location.getWorld().spawnParticle(Particle.PORTAL,location,2); + location.getWorld().spawnParticle(Particle.PORTAL, location.clone().add(x, 0.5, z), 1, 0, 0, 0, 0); + } + } + + public void startTask() { + this.runTaskTimer(plugin, 0, 3); + } +} diff --git a/src/main/java/CoswayUtil/CoswayUtil.java b/src/main/java/CoswayUtil/CoswayUtil.java index 0722daa..937d6e5 100644 --- a/src/main/java/CoswayUtil/CoswayUtil.java +++ b/src/main/java/CoswayUtil/CoswayUtil.java @@ -4,6 +4,7 @@ import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; +import org.bukkit.block.Chest; import org.bukkit.block.data.type.LightningRod; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -22,6 +23,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BlockStateMeta; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.entity.Entity; @@ -53,6 +55,7 @@ public final class CoswayUtil extends JavaPlugin implements Listener { Bukkit.getPluginManager().registerEvents(new AnchorShield(), this); // Start the detection loop when the plugin is enabled new AnchorShield().startDetectionLoop(); + registration("Anchor Shield"); new BukkitRunnable() { @Override public void run() { @@ -75,12 +78,17 @@ public final class CoswayUtil extends JavaPlugin implements Listener { } } }.runTaskTimer(this, 0, 2); // Runs every 10 ticks (0.5 seconds) + registration("Wither Contract"); + registration("Totem Tweaks"); // Register Gravity Gauntlet new GravityGauntlet(this); + registration("Gravity Gauntlet"); // Register TotemShield new TotemShield(this); + registration("Totem Shield"); // Register the ShadowStep listener new MobLevitationWand(this); + registration("Levitation Wand"); if (!setupEconomy()) { getLogger().severe("Vault not found or no economy provider found."); getServer().getPluginManager().disablePlugin(this); @@ -89,7 +97,9 @@ public final class CoswayUtil extends JavaPlugin implements Listener { new BlockShop(this, economy).register(); new BlockShop(this, economy); + registration("BlockShop"); new RapidFireBow(this); + registration("Rapid Fire Bow"); getServer().getPluginManager().registerEvents(new RapidFireBow(this), this); getServer().getPluginManager().registerEvents(new ShadowStep(this), this); //register levitation wand @@ -102,6 +112,9 @@ public final class CoswayUtil extends JavaPlugin implements Listener { this.getCommand("gravitygauntlet").setExecutor(new GravityGauntletCommand()); this.getCommand("getwand").setExecutor(new GiveWandCommand()); getServer().getPluginManager().registerEvents(new LaunchStick(this), this); + new FireflySimulator(this); + registration("FireFlies"); + //getServer().getPluginManager().registerEvents(new FireflySimulator(this), this); new BukkitRunnable() { @Override @@ -125,13 +138,14 @@ public final class CoswayUtil extends JavaPlugin implements Listener { } if(removeCustomKnowledgeBook(player,ChatColor.GREEN+"Anchor Shield Kit")) { // Create a chest item - ItemStack anchor = new ItemStack(Material.RESPAWN_ANCHOR, 1); + giveAnchorKit(player); + /* ItemStack anchor = new ItemStack(Material.RESPAWN_ANCHOR, 1); ItemStack rod = new ItemStack(Material.LIGHTNING_ROD, 1); ItemStack core = new ItemStack(Material.HEAVY_CORE, 1); ItemStack charge = new ItemStack(Material.GLOWSTONE,4); // Give the chest and items to the player - player.getInventory().addItem(anchor,rod,core,charge); + player.getInventory().addItem(anchor,rod,core,charge);*/ } if(removeCustomKnowledgeBook(player,ChatColor.GREEN+"Levitation Wand")) { player.getInventory().addItem(MobLevitationWand.createWand()); @@ -146,9 +160,15 @@ public final class CoswayUtil extends JavaPlugin implements Listener { } }.runTaskTimer(this,0,2); new IlluminationWand(this); + registration("Illumination Wand"); + new BlackholeEffect(this); + registration("BlackHole (W.I.P.)"); + } - + public void registration(String msg) { + Bukkit.broadcastMessage(ColorKey("&7[&eRegistrations&7] &aUtility Registered: &6"+msg)); + } private boolean setupEconomy() { // Setup Vault economy (make sure it's enabled and available) if (getServer().getPluginManager().getPlugin("Vault") != null) { @@ -260,6 +280,32 @@ public final class CoswayUtil extends JavaPlugin implements Listener { return false; // No matching book found } + public static void giveAnchorKit(Player player) { + // Create a chest item + ItemStack chestItem = new ItemStack(Material.CHEST); + BlockStateMeta meta = (BlockStateMeta) chestItem.getItemMeta(); + + if (meta != null) { + // Get the block state as a chest + Chest chestState = (Chest) meta.getBlockState(); + meta.setDisplayName(ChatColor.GOLD+"Anchor Shield Kit"); + // Get the inventory of the chest + Inventory chestInventory = chestState.getInventory(); + + // Add items to the chest + chestInventory.setItem(0, new ItemStack(Material.RESPAWN_ANCHOR, 1)); // 1 Respawn Anchor in slot 0 + chestInventory.setItem(1, new ItemStack(Material.LIGHTNING_ROD, 1)); // 1 Lightning Rod in slot 1 + chestInventory.setItem(2, new ItemStack(Material.HEAVY_CORE, 1)); // 1 Heavy Core in slot 2 + chestInventory.setItem(3, new ItemStack(Material.GLOWSTONE,4)); // 4 Glowstone in slot 3 + // Update the block state in the meta + chestState.update(); + meta.setBlockState(chestState); + chestItem.setItemMeta(meta); + } + + // Give the player the preloaded chest + player.getInventory().addItem(chestItem); + } public void serverMessage(String msg) { getServer().broadcastMessage(prefix()+ColorKey(msg)); @@ -328,6 +374,7 @@ public final class CoswayUtil extends JavaPlugin implements Listener { if (state.getBlock().getType() == Material.HEAVY_CORE) { Location anchorLoc = state.getLocation(); if (isMultiBlock(anchorLoc)) { + manageAnchor(anchorLoc); } } @@ -341,7 +388,7 @@ public final class CoswayUtil extends JavaPlugin implements Listener { private boolean isMultiBlock(Location loc) { return loc.getBlock().getType() == Material.HEAVY_CORE && loc.clone().add(0, -1, 0).getBlock().getType() == Material.LIGHTNING_ROD && - loc.clone().add(0, -2, 0).getBlock().getType() == Material.RESPAWN_ANCHOR; // Assuming Heavy Core + loc.clone().add(0, -2, 0).getBlock().getType() == Material.RESPAWN_ANCHOR; } private void manageAnchor(Location loc) { @@ -359,6 +406,7 @@ public final class CoswayUtil extends JavaPlugin implements Listener { marker.setInvulnerable(true); marker.setMarker(true); debugMessage("Anchor shield created"); + serverMessage("&6A new anchor shield has been activated at &eX:"+loc.getX()+" Y:"+loc.getY()+" Z:"+loc.getZ()); marker.getWorld().playEffect(marker.getLocation().subtract(0,2,0),Effect.TRIAL_SPAWNER_BECOME_OMINOUS,1); marker.getWorld().playEffect(marker.getLocation().subtract(0,2,0),Effect.SMASH_ATTACK,1); marker.getWorld().playSound(marker.getLocation(),Sound.BLOCK_END_PORTAL_SPAWN,100,0); @@ -532,6 +580,8 @@ public final class CoswayUtil extends JavaPlugin implements Listener { } else { removeMarker(loc); debugMessage("removed anchor shield for no fuel"); + loc.getBlock().getWorld().spawnParticle(Particle.PORTAL,loc,100); + serverMessage("&cAn Anchor Shield at &eX:"+loc.getX()+" Y:"+loc.getY()+" Z:"+loc.getZ()+" &chas run out of fuel and deactivated!"); loc.getBlock().getWorld().playSound(loc,Sound.ITEM_TOTEM_USE,10,0); loc.getBlock().getWorld().playEffect(loc,Effect.ENDER_DRAGON_DEATH,1); cancel(); @@ -563,6 +613,7 @@ public final class CoswayUtil extends JavaPlugin implements Listener { loc.equals(anchorLoc.clone().add(0, -2, 0)) )) { removeMarker(anchorLoc); + serverMessage("&cAn anchor shield has been broken at &eX:"+anchorLoc.getX()+" Y:"+anchorLoc.getY()+" Z:"+anchorLoc.getZ()); return; } } diff --git a/src/main/java/CoswayUtil/FireflySimulator.java b/src/main/java/CoswayUtil/FireflySimulator.java new file mode 100644 index 0000000..12d9a4d --- /dev/null +++ b/src/main/java/CoswayUtil/FireflySimulator.java @@ -0,0 +1,80 @@ +package CoswayUtil; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; +import java.util.Random; + +public class FireflySimulator { + private final CoswayUtil plugin; + private final Random random = new Random(); + private final int radius = 10; // Radius around the player where fireflies will appear + private final int fireflyCount = 5; // Number of fireflies per player + + public FireflySimulator(CoswayUtil plugin) { + this.plugin = plugin; + startSimulation(); + } + + public void startSimulation() { + new BukkitRunnable() { + @Override + public void run() { + for (Player player : Bukkit.getOnlinePlayers()) { + if (player.getWorld().getTime() == 13000) { // Only at night + player.stopAllSounds(); + player.playSound(player.getLocation().clone().add(0,100,0), Sound.MUSIC_DISC_MALL,10,1); + statMsg(player,"&6time for bed"); + } + if (player.getWorld().getTime() == 1137) { // Only at night + player.stopAllSounds(); + player.playSound(player.getLocation().clone().add(0,100,0), Sound.MUSIC_DISC_OTHERSIDE,10,1); + statMsg(player,"&eRize and Shine!"); + } + } + } + }.runTaskTimer(plugin,0L,1); + new BukkitRunnable() { + @Override + public void run() { + for (Player player : Bukkit.getOnlinePlayers()) { + if (player.getWorld().getTime() >= 13000) { // Only at night + spawnFireflies(player); + } + } + } + }.runTaskTimer(plugin, 0L, 10L); // Runs every 10 ticks (0.5 seconds) + } + public String ColorKey(String t) { + char searchChar = '&'; // Character to search for + char replacementChar = 'ยง'; // Character to replace with + StringBuilder sb = new StringBuilder(t); + // Search for the character in the StringBuilder + int index = sb.indexOf(String.valueOf(searchChar)); + + // Replace the character if found + for (int j = 0; j < sb.length(); j++) { + if (sb.charAt(j) == searchChar) { + sb.setCharAt(j, replacementChar); + } + } + return sb.toString(); + } + public void statMsg(Player player,String msg) { + player.sendMessage(ColorKey("&7[&dCosway Util&7] "+msg)); + } + private void spawnFireflies(Player player) { + Location playerLocation = player.getLocation(); + for (int i = 0; i < fireflyCount; i++) { + double offsetX = (random.nextDouble() - 0.5) * radius * 2; + double offsetZ = (random.nextDouble() - 0.5) * radius * 2; + double offsetY = random.nextDouble() * 3 + 1; // Fireflies hover slightly above the ground + + Location fireflyLocation = playerLocation.clone().add(offsetX, offsetY, offsetZ); + player.getWorld().spawnParticle(Particle.END_ROD, fireflyLocation, 0, 0, 0.01, 0, 1); // Small movement effect + } + } +}