From f710d08115702af07a691a405465d8dab54a4f1d Mon Sep 17 00:00:00 2001 From: iceBear67 Date: Wed, 16 Oct 2024 11:44:04 +0800 Subject: [PATCH] Obfuscate the sound location --- src/main/java/dev/tylerm/khs/game/Game.java | 8 ++++---- src/main/java/dev/tylerm/khs/util/Helper.java | 6 +++--- src/main/resources/config.yml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/tylerm/khs/game/Game.java b/src/main/java/dev/tylerm/khs/game/Game.java index de8c2cd..99cbf2a 100644 --- a/src/main/java/dev/tylerm/khs/game/Game.java +++ b/src/main/java/dev/tylerm/khs/game/Game.java @@ -32,6 +32,7 @@ import dev.tylerm.khs.configuration.Map; import dev.tylerm.khs.configuration.Maps; import dev.tylerm.khs.game.util.WinType; +import dev.tylerm.khs.util.Helper; import org.bukkit.*; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; @@ -338,13 +339,12 @@ private void whilePlaying() { break; } } - if (gameTick % 10 == 0 && gameTick / 10 < whenToHighlight * 20) { + if (gameTick % 10 == 0 && gameTimer < whenToHighlight ) { for (Player seeker : board.getSeekers()) { - for (Entity nearbyEntity : seeker.getNearbyEntities(2, 2, 2)) { + for (Entity nearbyEntity : seeker.getNearbyEntities(8, 2, 8)) { if (nearbyEntity instanceof Player player) { if (board.isHider(player)) { - heartbeatSound.play(player.getLocation()); - player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 20, 1)); + heartbeatSound.play(Helper.obfuscateLocation(player.getLocation())); } } } diff --git a/src/main/java/dev/tylerm/khs/util/Helper.java b/src/main/java/dev/tylerm/khs/util/Helper.java index f97c5a7..d0cc44f 100644 --- a/src/main/java/dev/tylerm/khs/util/Helper.java +++ b/src/main/java/dev/tylerm/khs/util/Helper.java @@ -8,9 +8,9 @@ public class Helper { public static Location obfuscateLocation(Location location) { var rand = ThreadLocalRandom.current(); return location.clone().add( - rand.nextInt(0, 6) - 3, - rand.nextInt(0, 6) - 3, - rand.nextInt(0, 6) - 3 + rand.nextInt(0, 16) - 8, + rand.nextInt(0, 16) - 8, + rand.nextInt(0, 16) - 8 ); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8210e55..f879495 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -16,7 +16,7 @@ spawnPatch: false gameLength: 300 # The last seconds in the game we'll highlight hiders around seekers. -whenToHighlight: 10 +whenToHighlight: 30 # How long will be added into the timer when a seeker is found extendPerKill: 30