diff --git a/src/main/java/dev/tylerm/khs/game/Game.java b/src/main/java/dev/tylerm/khs/game/Game.java index f52651d..de8c2cd 100644 --- a/src/main/java/dev/tylerm/khs/game/Game.java +++ b/src/main/java/dev/tylerm/khs/game/Game.java @@ -33,6 +33,7 @@ import dev.tylerm.khs.configuration.Maps; import dev.tylerm.khs.game.util.WinType; import org.bukkit.*; +import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -156,6 +157,7 @@ private void stop(WinType type) { Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type); } Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, endGameDelay * 20); + Bukkit.getWorld(currentMap.getGameSpawn().getWorld()).getEntitiesByClass(Arrow.class).forEach(Entity::remove); } public void end() { @@ -339,8 +341,8 @@ private void whilePlaying() { if (gameTick % 10 == 0 && gameTick / 10 < whenToHighlight * 20) { for (Player seeker : board.getSeekers()) { for (Entity nearbyEntity : seeker.getNearbyEntities(2, 2, 2)) { - if(nearbyEntity instanceof Player player){ - if(board.isHider(player)){ + if (nearbyEntity instanceof Player player) { + if (board.isHider(player)) { heartbeatSound.play(player.getLocation()); player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 20, 1)); } diff --git a/src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java b/src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java index c27400a..a8c89f2 100644 --- a/src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java @@ -11,6 +11,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerPickupArrowEvent; import org.bukkit.inventory.ItemStack; import static dev.tylerm.khs.configuration.Config.dropItems; @@ -53,4 +54,11 @@ public void onItemSpawn(ItemSpawnEvent event){ event.setCancelled(true); } + @EventHandler + public void onArrowPickup(PlayerPickupArrowEvent event){ + if (Main.getInstance().getGame().getStatus() == Status.PLAYING) { + event.setCancelled(true); + } + } + } diff --git a/src/main/resources/items.yml b/src/main/resources/items.yml index af4b10c..4ec7962 100644 --- a/src/main/resources/items.yml +++ b/src/main/resources/items.yml @@ -15,13 +15,12 @@ items: material: BOW amount: 1 enchantments: - infinity: 1 - power: 2 + power: 3 name: '&c寻找者之弓' unbreakable: true '2': material: ARROW - amount: 1 + amount: 16 'helmet': material: LEATHER_HELMET 'chestplate': @@ -57,19 +56,19 @@ items: feather_falling: 1 effects: seeker: - '1': + '0': type: SPEED duration: 1000000 amplifier: 2 ambient: false particles: false - '4': + '1': type: WATER_BREATHING duration: 1000000 amplifier: 10 ambient: false particles: false - '5': + '2': type: DOLPHINS_GRACE duration: 1000000 amplifier: 1