summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2021-12-30 12:17:32 -0500
committerGitHub <noreply@github.com>2021-12-30 12:17:32 -0500
commit31d60d7d23715aa3f063241c0c420ea0b0bf003b (patch)
treeca43ffa540d9629f6f0faf2ab3d5e5941db0f352 /src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
parentMerge pull request #16 from tylermurphy534/1.3.2 (diff)
parent1.3.3 rc5 (diff)
downloadkenshinshideandseek-31d60d7d23715aa3f063241c0c420ea0b0bf003b.tar.gz
kenshinshideandseek-31d60d7d23715aa3f063241c0c420ea0b0bf003b.tar.bz2
kenshinshideandseek-31d60d7d23715aa3f063241c0c420ea0b0bf003b.zip
Merge pull request #20 from tylermurphy534/1.3.3
1.3.3
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/Join.java')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/Join.java54
1 files changed, 24 insertions, 30 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
index 17b8f7a..0ca21d1 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java
@@ -1,22 +1,38 @@
+/*
+ * 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 org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.attribute.Attribute;
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 Join implements ICommand {
public void execute(CommandSender sender, String[] args) {
- if(!Util.isSetup()) {
+ if(Game.isNotSetup()) {
sender.sendMessage(errorPrefix + message("GAME_SETUP"));
return;
}
@@ -25,34 +41,12 @@ public class Join implements ICommand {
sender.sendMessage(errorPrefix + message("COMMAND_ERROR"));
return;
}
- if(Main.plugin.board.isPlayer(player)){
+ if(Board.isPlayer(player)){
sender.sendMessage(errorPrefix + message("GAME_INGAME"));
return;
}
- join(player);
- }
-
- public static void join(Player player){
- if(Main.plugin.status.equals("Standby")) {
- player.getInventory().clear();
- Main.plugin.board.addHider(player);
- if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
- else Util.broadcastMessage(messagePrefix + message("GAME_JOIN").addPlayer(player));
- player.teleport(new Location(Bukkit.getWorld(lobbyWorld), lobbyPosition.getX(),lobbyPosition.getY(),lobbyPosition.getZ()));
- player.setGameMode(GameMode.ADVENTURE);
- Main.plugin.board.createLobbyBoard(player);
- Main.plugin.board.reloadLobbyBoards();
- } else {
- Main.plugin.board.addSpectator(player);
- player.sendMessage(messagePrefix + message("GAME_JOIN_SPECTATOR"));
- player.setGameMode(GameMode.SPECTATOR);
- Main.plugin.board.createGameBoard(player);
- player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
- }
-
- player.setFoodLevel(20);
- player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
+ Game.join(player);
}
public String getLabel() {