From 068e1f406abc1063080f8fdff94f03d2ade8238f Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Wed, 11 May 2022 11:31:43 -0400 Subject: [PATCH] dont load mapsave if its disabled, fixed seeker join effects --- .../net/tylermurphy/hideAndSeek/configuration/Config.java | 2 +- .../net/tylermurphy/hideAndSeek/game/EventListener.java | 4 ++-- src/main/java/net/tylermurphy/hideAndSeek/game/Game.java | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index 4a2ae3a..22f4480 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -247,7 +247,7 @@ public class Config { Optional heartbeatOptional = XSound.matchXSound(config.getString("seekerPing.sounds.heartbeatNoise")); heartbeatSound = heartbeatOptional.orElse(XSound.BLOCK_NOTE_BLOCK_BASEDRUM); Optional ringingOptional = XSound.matchXSound(config.getString("seekerPing.sounds.ringingNoise")); - ringingSound = heartbeatOptional.orElse(XSound.BLOCK_NOTE_BLOCK_PLING); + ringingSound = ringingOptional.orElse(XSound.BLOCK_NOTE_BLOCK_PLING); //Other nametagsVisible = config.getBoolean("nametagsVisible"); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java index 17bd65a..f2ed00c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/EventListener.java @@ -67,8 +67,8 @@ public class EventListener implements Listener { event.getPlayer().setGameMode(GameMode.ADVENTURE); } } else { - if (event.getPlayer().getWorld().getName().equals(Game.getGameWorld())) { - if(Game.status != Status.STANDBY){ + if (mapSaveEnabled && event.getPlayer().getWorld().getName().equals(Game.getGameWorld())) { + if(Game.status != Status.STANDBY && Game.status != Status.ENDING){ Game.join(event.getPlayer()); } else { event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ())); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index f30f4d1..55e78b5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -91,7 +91,7 @@ public class Game { if(status == Status.STARTING || status == Status.PLAYING) return; if(mapSaveEnabled && worldLoader.getWorld() != null) { worldLoader.rollback(); - } else { + } else if(mapSaveEnabled) { worldLoader.loadMap(); } Board.reload(); @@ -302,6 +302,9 @@ public class Game { Board.addHider(player); if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); else Game.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player)); + for(PotionEffect effect : player.getActivePotionEffects()){ + player.removePotionEffect(effect.getType()); + } player.setGameMode(GameMode.ADVENTURE); Board.createLobbyBoard(player); Board.reloadLobbyBoards(); @@ -348,6 +351,9 @@ public class Game { Board.reloadGameBoards(); Board.reloadBoardTeams(); } + for(PotionEffect effect : player.getActivePotionEffects()){ + player.removePotionEffect(effect.getType()); + } if(bungeeLeave) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect");