summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
index 8809b5d..cc4f0b4 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java
@@ -1,20 +1,40 @@
+/*
+ * This file is part of Kenshins Hide and Seek
+ *
+ * Copyright (c) 2021 Tyler Murphy.
+ *
+ * Kenshins Hide and Seek free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * he Free Software Foundation version 3.
+ *
+ * Kenshins Hide and Seek is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
package net.tylermurphy.hideAndSeek.command;
import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import net.tylermurphy.hideAndSeek.game.Board;
+import net.tylermurphy.hideAndSeek.game.Game;
+import net.tylermurphy.hideAndSeek.util.Status;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import net.tylermurphy.hideAndSeek.Main;
-import net.tylermurphy.hideAndSeek.util.Util;
import static net.tylermurphy.hideAndSeek.configuration.Localization.*;
public class Leave implements ICommand {
public void execute(CommandSender sender, String[] args) {
- if(!Util.isSetup()) {
+ if(Game.isNotSetup()) {
sender.sendMessage(errorPrefix + message("GAME_SETUP"));
return;
}
@@ -23,20 +43,20 @@ public class Leave implements ICommand {
sender.sendMessage(errorPrefix + message("COMMAND_ERROR"));
return;
}
- if(!Main.plugin.board.isPlayer(player)) {
+ if(!Board.isPlayer(player)) {
sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME"));
return;
}
if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
- else Util.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
- Main.plugin.board.removeBoard(player);
- Main.plugin.board.remove(player);
+ else Game.broadcastMessage(messagePrefix + message("GAME_LEAVE").addPlayer(player));
+ Board.removeBoard(player);
+ Board.remove(player);
player.teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
- if(Main.plugin.status.equals("Standby")) {
- Main.plugin.board.reloadLobbyBoards();
+ if(Game.status == Status.STANDBY) {
+ Board.reloadLobbyBoards();
} else {
- Main.plugin.board.reloadGameBoards();
- Main.plugin.board.reloadBoardTeams();
+ Board.reloadGameBoards();
+ Board.reloadBoardTeams();
}
}