summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2021-12-25 08:16:03 -0600
committerTyler Murphy <tylermurphy534@gmail.com>2021-12-25 08:16:03 -0600
commit6239acb08a43d6bfef51f6abc8b7cc65687c51c7 (patch)
tree0f8fa7d17f9139f8aa64e72453272674334029df /src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
parentMerge pull request #16 from tylermurphy534/1.3.2 (diff)
downloadkenshinshideandseek-6239acb08a43d6bfef51f6abc8b7cc65687c51c7.tar.gz
kenshinshideandseek-6239acb08a43d6bfef51f6abc8b7cc65687c51c7.tar.bz2
kenshinshideandseek-6239acb08a43d6bfef51f6abc8b7cc65687c51c7.zip
1.3.3 beta 2
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
index e4dd16e..f444f34 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java
@@ -2,17 +2,11 @@ package net.tylermurphy.hideAndSeek.command;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import net.tylermurphy.hideAndSeek.game.Status;
import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
import net.tylermurphy.hideAndSeek.Main;
-import net.tylermurphy.hideAndSeek.events.Worldborder;
-import net.tylermurphy.hideAndSeek.util.Packet;
import net.tylermurphy.hideAndSeek.util.Util;
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
@@ -23,14 +17,12 @@ public class Stop implements ICommand {
sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do");
return;
}
- if(Main.plugin.status.equals("Starting") || Main.plugin.status.equals("Playing")) {
+ if(Main.plugin.status == Status.STARTING || Main.plugin.status == Status.PLAYING) {
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("STOP"));
else Util.broadcastMessage(abortPrefix + message("STOP"));
- onStop();
-
+ Main.plugin.game.stop();
} else {
sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS"));
- return;
}
}
@@ -38,30 +30,6 @@ public class Stop implements ICommand {
return "stop";
}
- public static void onStop() {
- if(Main.plugin.status.equals("Standby")) return;
- Main.plugin.status = "Standby";
- Main.plugin.gameId++;
- Main.plugin.timeLeft = 0;
- Worldborder.resetWorldborder("hideandseek_"+spawnWorld);
- for(Player player : Main.plugin.board.getPlayers()) {
- Main.plugin.board.createLobbyBoard(player);
- player.setGameMode(GameMode.ADVENTURE);
- Main.plugin.board.addHider(player);
- player.getInventory().clear();
- player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
- for(PotionEffect effect : player.getActivePotionEffects()){
- player.removePotionEffect(effect.getType());
- }
- player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 100));
- for(Player temp : Main.plugin.board.getPlayers()) {
- Packet.setGlow(player, temp, false);
- }
- }
- Main.plugin.worldLoader.unloadMap();
- Main.plugin.board.reloadLobbyBoards();
- }
-
public String getUsage() {
return "";
}