diff options
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command')
17 files changed, 563 insertions, 231 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/About.java b/src/main/java/net/tylermurphy/hideAndSeek/command/About.java index c341666..de1062b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/About.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/About.java @@ -1,3 +1,22 @@ +/* + * 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 org.bukkit.ChatColor; @@ -7,7 +26,7 @@ public class About implements ICommand { public void execute(CommandSender sender, String[] args) { sender.sendMessage( - String.format("%s%sHide and Seek %s(1.3.2%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) + + String.format("%s%sHide and Seek %s(%s1.3.3%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY,ChatColor.WHITE,ChatColor.GRAY) + String.format("%sAuthor: %s[KenshinEto]\n", ChatColor.GRAY, ChatColor.WHITE) + String.format("%sHelp Command: %s/hs %shelp", ChatColor.GRAY, ChatColor.AQUA, ChatColor.WHITE) ); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java index e38c19a..c1934a9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java @@ -1,19 +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 org.bukkit.command.CommandSender; import net.md_5.bungee.api.ChatColor; -import net.tylermurphy.hideAndSeek.bukkit.CommandHandler; +import net.tylermurphy.hideAndSeek.game.CommandHandler; public class Help implements ICommand { public void execute(CommandSender sender, String[] args) { - String message = ""; + StringBuilder message = new StringBuilder(); for(ICommand command : CommandHandler.COMMAND_REGISTER.values()) { - message += String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription()+"\n"); + message.append(String.format("%s/hs %s%s %s%s\n %s%s%s", ChatColor.AQUA, ChatColor.WHITE, command.getLabel().toLowerCase(), ChatColor.BLUE, command.getUsage(), ChatColor.GRAY, ChatColor.ITALIC, command.getDescription() + "\n")); } - message = message.substring(0, message.length()-1); - sender.sendMessage(message); + message = new StringBuilder(message.substring(0, message.length() - 1)); + sender.sendMessage(message.toString()); } public String getLabel() { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java b/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java index 928787e..6404c22 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/ICommand.java @@ -1,15 +1,34 @@ +/* + * 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 org.bukkit.command.CommandSender; public interface ICommand { - public void execute(CommandSender sender, String[] args); - - public String getLabel(); + void execute(CommandSender sender, String[] args); - public String getUsage(); + String getLabel(); + + String getUsage(); - public String getDescription(); + String getDescription(); } 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() { 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(); } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java index 971cd13..fc2592b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java @@ -1,11 +1,31 @@ +/* + * 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.configuration.Items; +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.command.CommandSender; -import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.configuration.Config; import net.tylermurphy.hideAndSeek.configuration.Localization; @@ -15,7 +35,7 @@ public class Reload implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java index 2befd73..c48e1c6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java @@ -1,8 +1,30 @@ +/* + * 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.Game; +import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.Bukkit; +import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.scheduler.BukkitRunnable; @@ -14,7 +36,7 @@ public class SaveMap implements ICommand { public static boolean runningBackup = false; public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } @@ -24,11 +46,15 @@ public class SaveMap implements ICommand { } sender.sendMessage(messagePrefix + message("MAPSAVE_START")); sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING")); - Bukkit.getServer().getWorld(spawnWorld).save(); + World world = Bukkit.getServer().getWorld(spawnWorld); + if(world == null){ + throw new RuntimeException("Unable to get world: " + spawnWorld); + } + world.save(); BukkitRunnable runnable = new BukkitRunnable() { public void run() { sender.sendMessage( - Main.plugin.worldLoader.save() + Game.worldLoader.save() ); runningBackup = false; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java index 472396c..5f14b20 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.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 java.util.HashMap; -import java.util.Map; - +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.events.Worldborder; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class SetBorder implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } @@ -29,7 +45,7 @@ public class SetBorder implements ICommand { addToConfig("worldBorder.enabled",false); saveConfig(); sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE")); - Worldborder.resetWorldborder(spawnWorld); + Game.resetWorldborder(spawnWorld); return; } int num,delay; @@ -65,7 +81,7 @@ public class SetBorder implements ICommand { addToConfig("worldBorder.enabled", true); sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay)); saveConfig(); - Worldborder.resetWorldborder(spawnWorld); + Game.resetWorldborder(spawnWorld); } public String getLabel() { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java index c94a0d1..9f4101a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java @@ -1,17 +1,37 @@ +/* + * 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.Game; +import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.tylermurphy.hideAndSeek.Main; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class SetBounds implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java index aeaa89b..7461767 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java @@ -1,21 +1,39 @@ +/* + * 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 java.util.HashMap; -import java.util.Map; - +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; +import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.tylermurphy.hideAndSeek.Main; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class SetExitLocation implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } @@ -28,7 +46,11 @@ public class SetExitLocation implements ICommand { newExitPosition.setX(player.getLocation().getBlockX()); newExitPosition.setY(player.getLocation().getBlockY()); newExitPosition.setZ(player.getLocation().getBlockZ()); - exitWorld = player.getLocation().getWorld().getName(); + World world = player.getLocation().getWorld(); + if(world == null){ + throw new RuntimeException("Unable to get world: " + spawnWorld); + } + exitWorld = world.getName(); exitPosition = newExitPosition; sender.sendMessage(messagePrefix + message("EXIT_SPAWN")); addToConfig("spawns.exit.x", exitPosition.getX()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java index 2e96a9d..69e5e52 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java @@ -1,21 +1,39 @@ +/* + * 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 java.util.HashMap; -import java.util.Map; - +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; +import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.tylermurphy.hideAndSeek.Main; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class SetLobbyLocation implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } @@ -28,7 +46,11 @@ public class SetLobbyLocation implements ICommand { newLobbyPosition.setX(player.getLocation().getBlockX()); newLobbyPosition.setY(player.getLocation().getBlockY()); newLobbyPosition.setZ(player.getLocation().getBlockZ()); - lobbyWorld = player.getLocation().getWorld().getName(); + World world = player.getLocation().getWorld(); + if(world == null){ + throw new RuntimeException("Unable to get world: " + spawnWorld); + } + lobbyWorld = world.getName(); lobbyPosition = newLobbyPosition; sender.sendMessage(messagePrefix + message("LOBBY_SPAWN")); addToConfig("spawns.lobby.x", lobbyPosition.getX()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java index bb3de6d..7afe861 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java @@ -1,23 +1,41 @@ +/* + * 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 java.util.HashMap; -import java.util.Map; - +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; +import net.tylermurphy.hideAndSeek.world.WorldLoader; +import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.tylermurphy.hideAndSeek.Main; - import static net.tylermurphy.hideAndSeek.configuration.Config.addToConfig; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class SetSpawnLocation implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } @@ -34,7 +52,15 @@ public class SetSpawnLocation implements ICommand { sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); return; } - spawnWorld = player.getLocation().getWorld().getName(); + World world = player.getLocation().getWorld(); + if(world == null){ + throw new RuntimeException("Unable to get world: " + spawnWorld); + } + if(!world.getName().equals(spawnWorld)){ + Game.worldLoader.unloadMap(); + Game.worldLoader = new WorldLoader(world.getName()); + } + spawnWorld = world.getName(); spawnPosition = newSpawnPosition; sender.sendMessage(messagePrefix + message("GAME_SPAWN")); addToConfig("spawns.game.x", spawnPosition.getX()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java index f47503a..74c29bf 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java @@ -1,3 +1,22 @@ +/* + * 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 org.bukkit.command.CommandSender; @@ -17,24 +36,24 @@ public class Setup implements ICommand { int count = 0; if(spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) { - msg = msg + "\n" + message("SETUP_GAME").toString(); + msg = msg + "\n" + message("SETUP_GAME"); count++; } if(lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) { - msg = msg + "\n" + message("SETUP_LOBBY").toString(); + msg = msg + "\n" + message("SETUP_LOBBY"); count++; } if(exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) { - msg = msg + "\n" + message("SETUP_EXIT").toString(); + msg = msg + "\n" + message("SETUP_EXIT"); count++; } if(saveMinX == 0 || saveMinZ == 0 || saveMaxX == 0 || saveMaxZ == 0) { - msg = msg + "\n" + message("SETUP_BOUNDS").toString(); + msg = msg + "\n" + message("SETUP_BOUNDS"); count++; } File destenation = new File(Main.root+File.separator+"hideandseek_"+spawnWorld); if(!destenation.exists()) { - msg = msg + "\n" + message("SETUP_SAVEMAP").toString(); + msg = msg + "\n" + message("SETUP_SAVEMAP"); count++; } if(count < 1) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java index 05565da..b82e3b5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java @@ -1,140 +1,75 @@ +/* + * 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.Localization.*; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; +import net.tylermurphy.hideAndSeek.game.Board; +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; import org.bukkit.command.CommandSender; -import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.potion.PotionData; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.potion.PotionType; -import net.md_5.bungee.api.ChatColor; import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.events.Glow; -import net.tylermurphy.hideAndSeek.events.Taunt; -import net.tylermurphy.hideAndSeek.events.Worldborder; -import net.tylermurphy.hideAndSeek.util.Util; import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import java.util.ArrayList; -import java.util.List; +import java.util.Optional; import java.util.Random; public class Start implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Util.isSetup()) { + if(Game.isNotSetup()) { sender.sendMessage(errorPrefix + message("GAME_SETUP")); return; } - if(!Main.plugin.status.equals("Standby")) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } - if(!Main.plugin.board.isPlayer(sender)) { + if(!Board.isPlayer(sender)) { sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME")); return; } - if(Main.plugin.board.size() < minPlayers) { + if(Board.size() < minPlayers) { sender.sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers)); return; } - if(Bukkit.getServer().getWorld("hideandseek_"+spawnWorld) != null) { - Main.plugin.worldLoader.rollback(); - } else { - Main.plugin.worldLoader.loadMap(); - } String seekerName; if(args.length < 1) { - seekerName = Main.plugin.board.getPlayers().stream().skip(new Random().nextInt(Main.plugin.board.size())).findFirst().get().getName(); + Optional<Player> rand = Board.getPlayers().stream().skip(new Random().nextInt(Board.size())).findFirst(); + if(!rand.isPresent()){ + Main.plugin.getLogger().warning("Failed to select random seeker."); + return; + } + seekerName = rand.get().getName(); } else { seekerName = args[0]; } - Player seeker = Main.plugin.board.getPlayer(seekerName); + Player seeker = Board.getPlayer(seekerName); if(seeker == null) { sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName)); return; } - Main.plugin.board.reload(); - for(Player temp : Main.plugin.board.getPlayers()) { - if(temp.getName().equals(seeker.getName())) - continue; - Main.plugin.board.addHider(temp); - } - Main.plugin.board.addSeeker(seeker); - currentWorldborderSize = worldborderSize; - for(Player player : Main.plugin.board.getPlayers()) { - player.getInventory().clear(); - player.setGameMode(GameMode.ADVENTURE); - player.teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ())); - for(PotionEffect effect : player.getActivePotionEffects()){ - player.removePotionEffect(effect.getType()); - } - } - for(Player player : Main.plugin.board.getSeekers()) { - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,1000000,127,false,false)); - player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000,127,false,false)); - player.sendTitle(ChatColor.RED + "" + ChatColor.BOLD + "SEEKER", ChatColor.WHITE + message("SEEKERS_SUBTITLE").toString(), 10, 70, 20); - } - for(Player player : Main.plugin.board.getHiders()) { - player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1000000,5,false,false)); - player.sendTitle(ChatColor.GOLD + "" + ChatColor.BOLD + "HIDER", ChatColor.WHITE + message("HIDERS_SUBTITLE").toString(), 10, 70, 20); - } - Worldborder.resetWorldborder("hideandseek_"+spawnWorld); - for(Player player : Main.plugin.board.getPlayers()){ - Main.plugin.board.createGameBoard(player); - } - Main.plugin.board.reloadGameBoards(); - Main.plugin.status = "Starting"; - int temp = Main.plugin.gameId; - Util.broadcastMessage(messagePrefix + message("START_COUNTDOWN").addAmount(30)); - Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(20), Main.plugin.gameId, 20 * 10); - Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(10), Main.plugin.gameId, 20 * 20); - Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(5), Main.plugin.gameId, 20 * 25); - Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(3), Main.plugin.gameId, 20 * 27); - Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(2), Main.plugin.gameId, 20 * 28); - Util.sendDelayedMessage(messagePrefix + message("START_COUNTDOWN").addAmount(1), Main.plugin.gameId, 20 * 29); - Bukkit.getServer().getScheduler().runTaskLater(Main.plugin, new Runnable() { - public void run() { - if(temp != Main.plugin.gameId) return; - Util.broadcastMessage(messagePrefix + message("START")); - Main.plugin.status = "Playing"; - for(Player player : Main.plugin.board.getPlayers()) { - Util.resetPlayer(player); - } - Main.plugin.worldborder = null; - Main.plugin.taunt = null; - Main.plugin.glow = null; - - if(worldborderEnabled) { - Main.plugin.worldborder = new Worldborder(Main.plugin.gameId); - Main.plugin.worldborder.schedule(); - } - - if(tauntEnabled) { - Main.plugin.taunt = new Taunt(Main.plugin.gameId); - Main.plugin.taunt.schedule(); - } - - if (glowEnabled) { - Main.plugin.glow = new Glow(Main.plugin.gameId); - } - - if(gameLength > 0) { - Main.plugin.timeLeft = gameLength; - } - } - }, 20 * 30); - + Game.start(seeker); } public String getLabel() { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java index e4dd16e..b41277b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java @@ -1,36 +1,47 @@ +/* + * 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.Game; +import net.tylermurphy.hideAndSeek.util.Status; +import net.tylermurphy.hideAndSeek.util.WinType; 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.*; public class Stop implements ICommand { public void execute(CommandSender sender, String[] args) { - if(!Util.isSetup()) { + if(Game.isNotSetup()) { 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(Game.status == Status.STARTING || Game.status == Status.PLAYING) { if(announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("STOP")); - else Util.broadcastMessage(abortPrefix + message("STOP")); - onStop(); - + else Game.broadcastMessage(abortPrefix + message("STOP")); + Game.stop(WinType.NONE); } else { sender.sendMessage(errorPrefix + message("GAME_NOT_INPROGRESS")); - return; } } @@ -38,30 +49,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 ""; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java new file mode 100644 index 0000000..760bb2c --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java @@ -0,0 +1,80 @@ +/* + * 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 net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.database.Database; +import net.tylermurphy.hideAndSeek.database.PlayerInfo; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + +import java.util.List; + +import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static net.tylermurphy.hideAndSeek.configuration.Localization.*; + +public class Top implements ICommand { + + public void execute(CommandSender sender, String[] args) { + int page; + if(args.length == 0) page = 1; + else try{ + page = Integer.parseInt(args[0]); + } catch(Exception e){ + sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0])); + return; + } + if(page < 1){ + sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(page)); + return; + } + StringBuilder message = new StringBuilder(String.format( + "%s------- %sLEADERBOARD %s(Page %s) %s-------\n", + ChatColor.WHITE, ChatColor.BOLD, ChatColor.GRAY, page, ChatColor.WHITE)); + List<PlayerInfo> infos = Database.playerInfo.getInfoPage(page); + int i = 1 + (page-1)*10; + for(PlayerInfo info : infos){ + String name = Main.plugin.getServer().getOfflinePlayer(info.uuid).getName(); + ChatColor color; + switch (i){ + case 1: color = ChatColor.YELLOW; break; + case 2: color = ChatColor.GRAY; break; + case 3: color = ChatColor.GOLD; break; + default: color = ChatColor.WHITE; break; + } + message.append(String.format("%s%s. %s%s %s%s\n", + color, i, ChatColor.RED, info.wins, ChatColor.WHITE, name)); + i++; + } + sender.sendMessage(message.toString()); + } + + public String getLabel() { + return "top"; + } + + public String getUsage() { + return "<page>"; + } + + public String getDescription() { + return "Gets the top players in the server."; + } +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java new file mode 100644 index 0000000..dfa5338 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java @@ -0,0 +1,88 @@ +/* + * 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 net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.database.Database; +import net.tylermurphy.hideAndSeek.database.PlayerInfo; +import net.tylermurphy.hideAndSeek.util.UUIDFetcher; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import java.util.UUID; + +import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static net.tylermurphy.hideAndSeek.configuration.Localization.*; + +public class Wins implements ICommand { + + public void execute(CommandSender sender, String[] args) { + Main.plugin.getServer().getScheduler().runTaskAsynchronously(Main.plugin, () -> { + + UUID uuid; + String name; + if(args.length == 0) { + Player player = Main.plugin.getServer().getPlayer(sender.getName()); + if(player == null){ + sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(sender.getName())); + return; + } + uuid = player.getUniqueId(); + name = sender.getName(); + } + else { + try { + name = args[0]; + uuid = UUIDFetcher.getUUID(args[0]); + } catch (Exception e){ + sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0])); + return; + } + } + PlayerInfo info = Database.playerInfo.getInfo(uuid); + if(info == null){ + sender.sendMessage(errorPrefix + message("NO_GAME_INFO")); + return; + } + String message = ChatColor.WHITE + "" + ChatColor.BOLD + "==============================\n"; + message = message + message("INFORMATION_FOR").addPlayer(name) + "\n"; + message = message + "==============================\n"; + message = message + String.format("%sTOTAL WINS: %s%s\n%sHIDER WINS: %s%s\n%sSEEKER WINS: %s%s\n%sGAMES PLAYED: %s", + ChatColor.YELLOW, ChatColor.WHITE, info.wins, ChatColor.GOLD, ChatColor.WHITE, info.hider_wins, + ChatColor.RED, ChatColor.WHITE, info.seeker_wins, ChatColor.WHITE, info.games_played); + message = message + ChatColor.WHITE + "" + ChatColor.BOLD + "\n=============================="; + sender.sendMessage(message); + + }); + } + + public String getLabel() { + return "wins"; + } + + public String getUsage() { + return "<player>"; + } + + public String getDescription() { + return "Get the win information for yourself or another player."; + } +} |