From dd9a6dfd888954a174fd95432c72d585fac74ca5 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Fri, 28 Jul 2023 18:21:37 -0400 Subject: [PATCH 1/4] 1.7.5 rc1 --- .project | 34 ++++++++++++++ pom.xml | 2 +- .../hideAndSeek/command/Start.java | 32 ++++++------- .../command/util/CommandGroup.java | 2 +- .../hideAndSeek/configuration/Config.java | 13 +++++- .../hideAndSeek/database/GameDataTable.java | 7 +-- .../database/connections/MySQLConnection.java | 1 - .../connections/SQLiteConnection.java | 2 +- .../tylermurphy/hideAndSeek/game/Board.java | 21 +++++---- .../tylermurphy/hideAndSeek/game/Game.java | 46 ++++++++++++------- .../hideAndSeek/game/PlayerLoader.java | 11 +++++ .../game/listener/DamageHandler.java | 12 +++-- .../hideAndSeek/util/PAPIExpansion.java | 2 +- src/main/resources/config.yml | 20 +++++++- src/main/resources/plugin.yml | 2 +- 15 files changed, 147 insertions(+), 60 deletions(-) create mode 100644 .project diff --git a/.project b/.project new file mode 100644 index 0000000..12a14d4 --- /dev/null +++ b/.project @@ -0,0 +1,34 @@ + + + KenshinsHideAndSeek + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1690577727676 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/pom.xml b/pom.xml index 0515362..23eec91 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 net.tylermurphy KenshinsHideAndSeek - 1.7.4 + 1.7.5 Hide and Seek Plugin diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java index 5184933..83665a0 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java @@ -7,6 +7,7 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -33,19 +34,21 @@ public class Start implements ICommand { sender.sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers)); return; } - String seekerName; + if (args.length < 1) { Main.getInstance().getGame().start(); return; - } else { - seekerName = args[0]; - } - Player seeker = Bukkit.getPlayer(seekerName); - if (seeker == null || !Main.getInstance().getBoard().contains(seeker)) { - sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName)); - return; - } - Main.getInstance().getGame().start(seeker); + }; + + List initialSeekers = new ArrayList<>(args.length); + for (int i = 0; i < args.length; i++) { + Player seeker = Bukkit.getPlayer(args[i]); + if (seeker == null || !Main.getInstance().getBoard().contains(seeker) || initialSeekers.contains(seeker)) { + sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[i])); + return; + } + } + Main.getInstance().getGame().start(initialSeekers); } public String getLabel() { @@ -53,18 +56,15 @@ public class Start implements ICommand { } public String getUsage() { - return "<*player>"; + return "<*seekers...>"; } public String getDescription() { - return "Starts the game either with a random seeker or chosen one"; + return "Starts the game either with a random set of seekers or a chosen list"; } public List autoComplete(@NotNull String parameter, @NotNull String typed) { - if(parameter.equals("player")) { - return Main.getInstance().getBoard().getPlayers().stream().map(Player::getName).collect(Collectors.toList()); - } - return null; + return Main.getInstance().getBoard().getPlayers().stream().map(Player::getName).collect(Collectors.toList()); } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java index 9bfdd0e..907f031 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java @@ -51,7 +51,7 @@ public class CommandGroup { if (data == null) { player.sendMessage( - String.format("%s%sKenshin's Hide and Seek %s(%s1.7.4%s)\n", ChatColor.AQUA, ChatColor.BOLD, ChatColor.GRAY, ChatColor.WHITE, ChatColor.GRAY) + + String.format("%s%sKenshin's Hide and Seek %s(%s1.7.5%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/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index 9fc7009..67fc4bf 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -62,8 +62,11 @@ public class Config { allowNaturalCauses, saveInventory, delayedRespawn, + dontRewardQuit, spawnPatch, dropItems, + respawnAsSpectator, + waitTillNoneLeft, regenHealth; public static int @@ -82,6 +85,7 @@ public class Config { lobbyItemStartPosition, flightToggleItemPosition, teleportItemPosition, + startingSeekerCount, delayedRespawnDelay; public static float @@ -154,7 +158,9 @@ public class Config { } //Lobby - minPlayers = Math.max(2, config.getInt("minPlayers")); + startingSeekerCount = Math.max(1, config.getInt("startingSeekerCount")); + waitTillNoneLeft = config.getBoolean("waitTillNoneLeft"); + minPlayers = Math.max(1 + startingSeekerCount + (waitTillNoneLeft ? 0 : 1), config.getInt("minPlayers")); countdown = Math.max(10, config.getInt("lobby.countdown")); changeCountdown = Math.max(minPlayers, config.getInt("lobby.changeCountdown")); lobbyMin = Math.max(minPlayers, config.getInt("lobby.min")); @@ -188,6 +194,9 @@ public class Config { placeholderError = config.getString("placeholder.incorrect"); placeholderNoData = config.getString("placeholder.noData"); saveInventory = config.getBoolean("saveInventory"); + respawnAsSpectator = config.getBoolean("respawnAsSpectator"); + dontRewardQuit = config.getBoolean("dontRewardQuit"); + try { countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay")); } catch (IllegalArgumentException e) { @@ -271,4 +280,4 @@ public class Config { return temp; } -} \ No newline at end of file +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java b/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java index 87378f9..d5fe7e6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java @@ -79,7 +79,6 @@ public class GameDataTable { rs.getInt("seeker_deaths") ); rs.close(); - connection.close(); CACHE.put(uuid, info); return info; } @@ -111,7 +110,6 @@ public class GameDataTable { rs.getInt("seeker_deaths") ); rs.close(); - connection.close(); CACHE.put(uuid, info); return info; } @@ -145,7 +143,6 @@ public class GameDataTable { infoList.add(info); } rs.close(); - connection.close(); return infoList; } catch (SQLException e) { Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage()); @@ -190,8 +187,8 @@ public class GameDataTable { database.encodeUUID(info.getUniqueId()), info.getHiderWins() + (winners.contains(uuid) && type == WinType.HIDER_WIN ? 1 : 0), info.getSeekerWins() + (winners.contains(uuid) && type == WinType.SEEKER_WIN ? 1 : 0), - info.getHiderGames() + (board.isHider(uuid) || (board.isSeeker(uuid) && !board.getFirstSeeker().getUniqueId().equals(uuid)) ? 1 : 0), - info.getSeekerGames() + (board.getFirstSeeker().getUniqueId().equals(uuid) ? 1 : 0), + info.getHiderGames() + (board.isHider(uuid) || (board.isSeeker(uuid) && winners.contains(uuid)) ? 1 : 0), + info.getSeekerGames() + (board.isSeeker(uuid) && winners.contains(uuid) ? 1 : 0), info.getHiderKills() + hider_kills.getOrDefault(uuid, 0), info.getSeekerKills() + seeker_kills.getOrDefault(uuid, 0), info.getHiderDeaths() + hider_deaths.getOrDefault(uuid, 0), diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java b/src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java index e237e71..20e7c8e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java @@ -25,7 +25,6 @@ import net.tylermurphy.hideAndSeek.Main; import java.sql.Connection; import java.sql.SQLException; -import java.sql.Statement; import static net.tylermurphy.hideAndSeek.configuration.Config.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java b/src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java index 1a03106..bbf330b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java @@ -52,7 +52,7 @@ public class SQLiteConnection implements DatabaseConnection { public Connection connect() { Connection conn = null; try { - String url = "jdbc:sqlite:"+databaseFile; + String url = "jdbc:sqlite:"+databaseFile.getPath(); conn = DriverManager.getConnection(url, config.toProperties()); } catch (SQLException e) { Main.getInstance().getLogger().severe(e.getMessage()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java index 2050f33..4c56453 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java @@ -25,7 +25,7 @@ public class Board { SPECTATOR, } - private UUID initialSeeker = null; + private List initialSeekers = null; private final Map Players = new HashMap<>(); private final Map customBoards = new HashMap<>(); private final Map hider_kills = new HashMap<>(), seeker_kills = new HashMap<>(), hider_deaths = new HashMap<>(), seeker_deaths = new HashMap<>(); @@ -104,9 +104,15 @@ public class Board { .collect(Collectors.toList()); } - public Player getFirstSeeker() { - if(initialSeeker == null) return null; - return Bukkit.getPlayer(initialSeeker); + public void setInitialSeekers(List seekers) { + initialSeekers = seekers; + } + + public List getInitialSeekers() { + if(initialSeekers == null) return null; + return initialSeekers.stream().map(u -> { + return Bukkit.getPlayer(u); + }).collect(Collectors.toList()); } public Player getPlayer(UUID uuid) { @@ -121,9 +127,6 @@ public class Board { } public void addSeeker(Player player) { - if(initialSeeker == null) { - initialSeeker = player.getUniqueId(); - } Players.put(player.getUniqueId(), Type.SEEKER); } @@ -347,7 +350,7 @@ public class Board { public void cleanup() { Players.clear();; - initialSeeker = null; + initialSeekers = null; customBoards.clear(); } @@ -487,4 +490,4 @@ class Line { this.message = message; } -} \ No newline at end of file +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index 41df9b8..e8b39d1 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -97,22 +97,28 @@ public class Game { } public void start() { - Player seeker; - try { - int rand = (int) (Math.random() * board.getPlayers().size()); - seeker = board.getPlayers().get(rand); - } catch (Exception e){ - Main.getInstance().getLogger().warning("Failed to select random seeker."); - return; - } - start(seeker); + List seekers = new ArrayList<>(startingSeekerCount); + List pool = board.getPlayers(); + for (int i = 0; i < startingSeekerCount; i++) { + try { + int rand = new Random().nextInt(0, pool.size()-1); + seekers.add(pool.remove(rand)); + } catch (Exception e){ + Main.getInstance().getLogger().warning("Failed to select random seeker."); + return; + } + } + start(seekers); } - public void start(Player seeker) { + public void start(List seekers) { if (mapSaveEnabled) currentMap.getWorldLoader().rollback(); board.reload(); - board.addSeeker(seeker); - PlayerLoader.loadSeeker(seeker, currentMap); + board.setInitialSeekers(seekers.stream().map(Player::getUniqueId).collect(Collectors.toList())); + seekers.forEach(seeker -> { + board.addSeeker(seeker); + PlayerLoader.loadSeeker(seeker, currentMap); + }); board.getPlayers().forEach(player -> { if(board.isSeeker(player)) return; board.addHider(player); @@ -133,7 +139,12 @@ public class Game { Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type); } else if (type == WinType.SEEKER_WIN) { List winners = new ArrayList<>(); - winners.add(board.getFirstSeeker().getUniqueId()); + board.getInitialSeekers().forEach(p -> { + winners.add(p.getUniqueId()); + }); + if (!waitTillNoneLeft && board.getHiders().size() == 1) { + winners.add(board.getHiders().get(0).getUniqueId()); + } Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type); } Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, 5*20); @@ -351,8 +362,9 @@ public class Game { } private void checkWinConditions() { - if (board.sizeHider() < 1) { - if (hiderLeft) { + int hiderCount = board.sizeHider(); + if (hiderCount < 1 || (!waitTillNoneLeft && hiderCount < 2)) { + if (hiderLeft && dontRewardQuit) { if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT")); else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT")); stop(WinType.NONE); @@ -364,7 +376,7 @@ public class Game { } else if (board.sizeSeeker() < 1) { if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); - stop(WinType.NONE); + stop(dontRewardQuit ? WinType.NONE : WinType.HIDER_WIN); } else if (gameTimer < 1) { if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME")); else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME")); @@ -373,4 +385,4 @@ public class Game { hiderLeft = false; } -} \ No newline at end of file +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java b/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java index 4ee1f5c..e424024 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java @@ -67,6 +67,17 @@ public class PlayerLoader { Titles.sendTitle(player, 10, 70, 20, ChatColor.GRAY + "" + ChatColor.BOLD + "SPECTATING", ChatColor.WHITE + message("SPECTATOR_SUBTITLE").toString()); } + public static void loadDeadHiderSpectator(Player player, Map map) { + map.getGameSpawn().teleport(player); + loadPlayer(player); + player.setAllowFlight(true); + player.setFlying(true); + player.setFallDistance(0.0F); + player.getInventory().setItem(flightToggleItemPosition, flightToggleItem); + player.getInventory().setItem(teleportItemPosition, teleportItem); + Main.getInstance().getBoard().getPlayers().forEach(otherPlayer -> otherPlayer.hidePlayer(player)); + } + public static void resetPlayer(Player player, Board board){ if(board.isSpectator(player)) return; loadPlayer(player); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java index 37537d6..7f3f22e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java @@ -94,7 +94,7 @@ public class DamageHandler implements Listener { // Reveal player if they are disguised Main.getInstance().getDisguiser().reveal(player); // Teleport player to seeker spawn - if(delayedRespawn){ + if(delayedRespawn && !respawnAsSpectator){ game.getCurrentMap().getGameSeekerLobby().teleport(player); player.sendMessage(messagePrefix + message("RESPAWN_NOTICE").addAmount(delayedRespawnDelay)); Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> { @@ -117,10 +117,14 @@ public class DamageHandler implements Listener { } else { game.broadcastMessage(message("GAME_PLAYER_FOUND_BY").addPlayer(player).addPlayer(attacker).toString()); } - board.addSeeker(player); + if (respawnAsSpectator) { + board.addSpectator(player); + PlayerLoader.loadDeadHiderSpectator(player, game.getCurrentMap()); + } else { + board.addSeeker(player); + PlayerLoader.resetPlayer(player, board); + } } - //Reload player - PlayerLoader.resetPlayer(player, board); board.reloadBoardTeams(); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java index 8e4078e..54c2f02 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java @@ -28,7 +28,7 @@ public class PAPIExpansion extends PlaceholderExpansion { @Override public @NotNull String getVersion() { - return "1.4.3"; + return "1.7.5"; } @Override diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5316402..1642b82 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -48,6 +48,24 @@ permissionsRequired: true # default: 2 minPlayers: 2 +# Amount of initial seekers when game starts +# default: 1 +startingSeekerCount: 1 + +# By default, when a HIDER dies they will join the SEEKER team. If enabled they will instead become a spectator +# default: false +respawnAsSpectator: false + +# If enabled, the game will go until no hiders are left. If the timer runs out all hiders left will be marked as winning. +# If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if t here is one +# hider left, all inital seekers win along with the last hider. +waitTillNoneLeft: true + +# By default, if the last hider or seeker quits the game, a win type of NONE is given, which doesnt mark anyone as winning. This can be +# used as a way to prevent players form quitting in a loop to get someone else points. +# default: true +dontRewardQuit: true + # This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons, # and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this # entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight @@ -304,4 +322,4 @@ exit: x: 0 y: 0 z: 0 - world: "world" \ No newline at end of file + world: "world" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index dc8cab1..777c1ba 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: KenshinsHideAndSeek main: net.tylermurphy.hideAndSeek.Main -version: 1.7.4 +version: 1.7.5 author: KenshinEto load: STARTUP api-version: 1.13 From 062defa28593bac8f07cd5b923b4793f06e30bcd Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Fri, 28 Jul 2023 21:18:13 -0400 Subject: [PATCH 2/4] 1.7.5 rc2 --- .../hideAndSeek/command/Start.java | 13 ++- .../hideAndSeek/configuration/Items.java | 47 +++++++++- .../tylermurphy/hideAndSeek/game/Game.java | 6 +- .../hideAndSeek/game/PlayerLoader.java | 22 ++++- .../game/listener/InteractHandler.java | 85 +++++++++++++++++-- .../game/listener/InventoryHandler.java | 33 +++++-- .../hideAndSeek/util/PAPIExpansion.java | 20 +++++ 7 files changed, 202 insertions(+), 24 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java index 83665a0..455e777 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java @@ -11,8 +11,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.minPlayers; +import static net.tylermurphy.hideAndSeek.configuration.Config.*; import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class Start implements ICommand { @@ -40,14 +39,22 @@ public class Start implements ICommand { return; }; - List initialSeekers = new ArrayList<>(args.length); + List initialSeekers = new ArrayList<>(); for (int i = 0; i < args.length; i++) { Player seeker = Bukkit.getPlayer(args[i]); if (seeker == null || !Main.getInstance().getBoard().contains(seeker) || initialSeekers.contains(seeker)) { sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[i])); return; } + initialSeekers.add(seeker); } + + int minHiders = minPlayers - startingSeekerCount; + if (Main.getInstance().getBoard().size() - initialSeekers.size() < minHiders) { + sender.sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers)); + return; + } + Main.getInstance().getGame().start(initialSeekers); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java index e5f970b..8b4cddc 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java @@ -16,6 +16,12 @@ import java.util.List; public class Items { public static List HIDER_ITEMS, SEEKER_ITEMS; + public static ItemStack + HIDER_HELM, SEEKER_HELM, + HIDER_CHEST, SEEKER_CHEST, + HIDER_LEGS, SEEKER_LEGS, + HIDER_BOOTS, SEEKER_BOOTS; + public static List HIDER_EFFECTS, SEEKER_EFFECTS; public static void loadItems() { @@ -23,24 +29,60 @@ public class Items { ConfigManager manager = ConfigManager.create("items.yml"); SEEKER_ITEMS = new ArrayList<>(); + SEEKER_HELM = null; + SEEKER_CHEST = null; + SEEKER_LEGS = null; + SEEKER_BOOTS = null; ConfigurationSection SeekerItems = manager.getConfigurationSection("items.seeker"); int i = 1; while (true) { ConfigurationSection section = SeekerItems.getConfigurationSection(String.valueOf(i)); if (section == null) break; ItemStack item = createItem(section); - if (item != null) SEEKER_ITEMS.add(item); + if (item == null) continue; + String loc = section.getString("location"); + if (loc == null) { + SEEKER_ITEMS.add(item); + } else if (loc.equals("helmet")) { + SEEKER_HELM = item; + } else if (loc.equals("chestplate")) { + SEEKER_CHEST = item; + } else if (loc.equals("leggings")) { + SEEKER_LEGS = item; + } else if (loc.equals("boots")) { + SEEKER_BOOTS = item; + } else { + SEEKER_ITEMS.add(item); + } i++; } HIDER_ITEMS = new ArrayList<>(); + HIDER_HELM = null; + HIDER_CHEST = null; + HIDER_LEGS = null; + HIDER_BOOTS = null; ConfigurationSection HiderItems = manager.getConfigurationSection("items.hider"); i = 1; while (true) { ConfigurationSection section = HiderItems.getConfigurationSection(String.valueOf(i)); if (section == null) break; ItemStack item = createItem(section); - if (item != null) HIDER_ITEMS.add(item); + if (item == null) continue; + String loc = section.getString("location"); + if (loc == null) { + HIDER_ITEMS.add(item); + } else if (loc.equals("helmet")) { + HIDER_HELM = item; + } else if (loc.equals("chestplate")) { + HIDER_CHEST = item; + } else if (loc.equals("leggings")) { + HIDER_LEGS = item; + } else if (loc.equals("boots")) { + HIDER_BOOTS = item; + } else { + HIDER_ITEMS.add(item); + } i++; } SEEKER_EFFECTS = new ArrayList<>(); @@ -64,7 +106,6 @@ public class Items { if (effect != null) HIDER_EFFECTS.add(effect); i++; } - } private static ItemStack createItem(ConfigurationSection item) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index e8b39d1..5213c87 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -58,6 +58,8 @@ public class Game { private int gameTimer; private boolean hiderLeft; + private Random random; + public Game(Map map, Board board) { this.currentMap = map; @@ -74,6 +76,8 @@ public class Game { this.startingTimer = -1; this.gameTimer = 0; this.hiderLeft = false; + + this.random = new Random(); } public Status getStatus(){ @@ -101,7 +105,7 @@ public class Game { List pool = board.getPlayers(); for (int i = 0; i < startingSeekerCount; i++) { try { - int rand = new Random().nextInt(0, pool.size()-1); + int rand = random.nextInt(0, pool.size()); seekers.add(pool.remove(rand)); } catch (Exception e){ Main.getInstance().getLogger().warning("Failed to select random seeker."); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java b/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java index e424024..9c2dd37 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java @@ -82,15 +82,33 @@ public class PlayerLoader { if(board.isSpectator(player)) return; loadPlayer(player); if (board.isSeeker(player)) { - if (pvpEnabled) + if (pvpEnabled) { for(ItemStack item : Items.SEEKER_ITEMS) player.getInventory().addItem(item); + if (Items.SEEKER_HELM != null) + player.getInventory().setHelmet(Items.SEEKER_HELM); + if (Items.SEEKER_CHEST != null) + player.getInventory().setChestplate(Items.SEEKER_CHEST); + if (Items.SEEKER_LEGS != null) + player.getInventory().setLeggings(Items.SEEKER_LEGS); + if (Items.SEEKER_BOOTS != null) + player.getInventory().setBoots(Items.SEEKER_BOOTS); + } for(PotionEffect effect : Items.SEEKER_EFFECTS) player.addPotionEffect(effect); } else if (board.isHider(player)) { - if (pvpEnabled) + if (pvpEnabled) { for(ItemStack item : Items.HIDER_ITEMS) player.getInventory().addItem(item); + if (Items.HIDER_HELM != null) + player.getInventory().setHelmet(Items.HIDER_HELM); + if (Items.HIDER_CHEST != null) + player.getInventory().setChestplate(Items.HIDER_CHEST); + if (Items.HIDER_LEGS != null) + player.getInventory().setLeggings(Items.HIDER_LEGS); + if (Items.HIDER_BOOTS != null) + player.getInventory().setBoots(Items.HIDER_BOOTS); + } for(PotionEffect effect : Items.HIDER_EFFECTS) player.addPotionEffect(effect); if (glowEnabled) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java index 0326391..95577ee 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java @@ -3,8 +3,10 @@ package net.tylermurphy.hideAndSeek.game.listener; import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.messages.ActionBar; import net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.game.Board; import net.tylermurphy.hideAndSeek.game.util.Status; import org.bukkit.ChatColor; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -13,6 +15,8 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BookMeta; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import java.util.ArrayList; @@ -94,17 +98,82 @@ public class InteractHandler implements Listener { return; } if(temp.isSimilar(teleportItem)){ - int amount = Main.getInstance().getBoard().getHiders().size() + Main.getInstance().getBoard().getSeekers().size(); - Inventory teleportMenu = Main.getInstance().getServer().createInventory(null, 9*(((amount-1)/9)+1), ChatColor.stripColor(teleportItem.getItemMeta().getDisplayName())); - List hider_lore = new ArrayList<>(); hider_lore.add(message("HIDER_TEAM_NAME").toString()); - Main.getInstance().getBoard().getHiders().forEach(hider -> teleportMenu.addItem(getSkull(hider, hider_lore))); - List seeker_lore = new ArrayList<>(); seeker_lore.add(message("SEEKER_TEAM_NAME").toString()); - Main.getInstance().getBoard().getSeekers().forEach(seeker -> teleportMenu.addItem(getSkull(seeker, seeker_lore))); - event.getPlayer().openInventory(teleportMenu); + // int amount = Main.getInstance().getBoard().getHiders().size() + Main.getInstance().getBoard().getSeekers().size(); + // Inventory teleportMenu = Main.getInstance().getServer().createInventory(null, 9*(((amount-1)/9)+1), ChatColor.stripColor(teleportItem.getItemMeta().getDisplayName())); + // List hider_lore = new ArrayList<>(); hider_lore.add(message("HIDER_TEAM_NAME").toString()); + // Main.getInstance().getBoard().getHiders().forEach(hider -> teleportMenu.addItem(getSkull(hider, hider_lore))); + // List seeker_lore = new ArrayList<>(); seeker_lore.add(message("SEEKER_TEAM_NAME").toString()); + // Main.getInstance().getBoard().getSeekers().forEach(seeker -> teleportMenu.addItem(getSkull(seeker, seeker_lore))); + // event.getPlayer().openInventory(teleportMenu); + createSpectatorTeleportPage(event.getPlayer(), 0); } } - private ItemStack getSkull(Player player, List lore){ + public static void createSpectatorTeleportPage(Player player, int page) { + + if (page < 0) { + return; + } + + final Board board = Main.getInstance().getBoard(); + List players = new ArrayList<>(); + players.addAll(board.getHiders()); + players.addAll(board.getSeekers()); + + final int page_size = 9 * 5; + final int amount = players.size(); + final int start = page * page_size; + + int page_amount = amount - start; + + if (page_amount < 1) { + return; + } + + boolean next = false, prev = true; + + if (page_amount > page_size) { + page_amount = page_size; + next = true; + } + + if (page == 0) { + prev = false; + } + + final int rows = ((amount - 1) / 9) + 2; + + final Inventory teleportMenu = Main.getInstance().getServer().createInventory(null, 9 * rows, ChatColor.stripColor(teleportItem.getItemMeta().getDisplayName())); + + final List hider_lore = new ArrayList<>(); hider_lore.add(message("HIDER_TEAM_NAME").toString()); + final List seeker_lore = new ArrayList<>(); seeker_lore.add(message("SEEKER_TEAM_NAME").toString()); + + for (int i = 0; i < page_amount; i++) { + Player plr = players.get(i); + teleportMenu.addItem(getSkull(plr, board.isHider(plr) ? hider_lore : seeker_lore)); + } + + final int lastRow = (rows - 1) * 9; + if (prev) { + teleportMenu.setItem(lastRow, getPageItem(page - 1)); + } + + if (next) { + teleportMenu.setItem(lastRow + 8, getPageItem(page + 1)); + } + + player.openInventory(teleportMenu); + } + + private static ItemStack getPageItem(int page) { + ItemStack prevItem = new ItemStack(XMaterial.ENCHANTED_BOOK.parseMaterial(), page + 1); + ItemMeta meta = prevItem.getItemMeta(); + meta.setDisplayName("Page " + (page+1)); + prevItem.setItemMeta(meta); + return prevItem; + } + + private static ItemStack getSkull(Player player, List lore){ assert XMaterial.PLAYER_HEAD.parseMaterial() != null; ItemStack playerHead = new ItemStack(XMaterial.PLAYER_HEAD.parseMaterial(), 1, (byte) 3); SkullMeta playerHeadMeta = (SkullMeta) playerHead.getItemMeta(); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java index 0f306b1..dd30e60 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java @@ -32,6 +32,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; public class InventoryHandler implements Listener { @@ -52,13 +54,30 @@ public class InventoryHandler implements Listener { private void checkForSpectatorTeleportMenu(InventoryClickEvent event){ Player player = (Player) event.getWhoClicked(); - if (Main.getInstance().getBoard().isSpectator(player) && event.getCurrentItem().getType() == XMaterial.PLAYER_HEAD.parseMaterial()) { - event.setCancelled(true); - player.closeInventory(); - String name = event.getCurrentItem().getItemMeta().getDisplayName(); - Player clicked = Main.getInstance().getServer().getPlayer(name); - if(clicked == null) return; - player.teleport(clicked); + + ItemStack item = event.getCurrentItem(); + ItemMeta meta = item.getItemMeta(); + String name = meta.getDisplayName(); + + if (Main.getInstance().getBoard().isSpectator(player)) { + if (XMaterial.PLAYER_HEAD.isSimilar(item)) { + event.setCancelled(true); + player.closeInventory(); + Player clicked = Main.getInstance().getServer().getPlayer(name); + if (clicked == null) return; + player.teleport(clicked); + } else if (XMaterial.ENCHANTED_BOOK.isSimilar(item)) { + event.setCancelled(true); + player.closeInventory(); + if (!name.startsWith("Page ")) return; + String number_str = name.substring(5); + try { + int page = Integer.parseInt(number_str); + InteractHandler.createSpectatorTeleportPage(player, page - 1); + } catch(Exception ignored) { + return; + } + } } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java index 54c2f02..3a58940 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java @@ -4,6 +4,8 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion; import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.database.Database; import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; +import net.tylermurphy.hideAndSeek.game.util.Status; + import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -41,8 +43,26 @@ public class PAPIExpansion extends PlaceholderExpansion { public String onRequest(OfflinePlayer player, @NotNull String params) { Database database = Main.getInstance().getDatabase(); String[] args = params.split("_"); + Status status = Main.getInstance().getGame().getStatus(); if (args.length < 1) return null; + + if (args.length == 1 && args[0] == "hiders") { + if (status == Status.PLAYING || status == Status.STARTING) { + return "" + Main.getInstance().getBoard().getHiders().size(); + } else { + return "-"; + } + } + + if (args.length == 1 && args[0] == "seekers") { + if (status == Status.PLAYING || status == Status.STARTING) { + return "" + Main.getInstance().getBoard().getSeekers().size(); + } else { + return "-"; + } + } + if ((args.length == 2 || args.length == 3) && (args[0].equals("stats") || args[0].equals("rank-place"))) { Optional info = this.getPlayerInfo(args.length == 2 ? player.getUniqueId() : database.getNameData().getUUID(args[2])); if (info.isPresent()) { From b01a4fd3c01a0486f0257c46e9f8bde5acc9660a Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 29 Jul 2023 15:54:12 -0400 Subject: [PATCH 3/4] 1.7.5 rc3 --- .../hideAndSeek/configuration/Config.java | 6 ++++- .../configuration/Localization.java | 6 +++-- .../tylermurphy/hideAndSeek/game/Board.java | 13 +++++------ .../tylermurphy/hideAndSeek/game/Game.java | 23 ++++++++++++++++--- .../game/listener/ChatHandler.java | 2 +- .../hideAndSeek/util/PAPIExpansion.java | 16 +++++++++---- src/main/resources/config.yml | 9 ++++++++ .../resources/lang/localization_de-DE.yml | 12 +++++++--- .../resources/lang/localization_en-US.yml | 14 +++++++---- 9 files changed, 76 insertions(+), 25 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index 67fc4bf..8a71903 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -67,6 +67,7 @@ public class Config { dropItems, respawnAsSpectator, waitTillNoneLeft, + gameOverTitle, regenHealth; public static int @@ -86,7 +87,8 @@ public class Config { flightToggleItemPosition, teleportItemPosition, startingSeekerCount, - delayedRespawnDelay; + delayedRespawnDelay, + endGameDelay; public static float seekerPingLeadingVolume, @@ -196,6 +198,8 @@ public class Config { saveInventory = config.getBoolean("saveInventory"); respawnAsSpectator = config.getBoolean("respawnAsSpectator"); dontRewardQuit = config.getBoolean("dontRewardQuit"); + endGameDelay = Math.max(0,config.getInt("endGameDelay")); + gameOverTitle = config.getBoolean("gameOverTitle"); try { countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay")); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java index b9f9b69..babf759 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java @@ -15,12 +15,14 @@ public class Localization { put("en-US", new String[][]{ {"WORLDBORDER_DECREASING"}, {"START","TAUNTED"}, - {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"} + {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"}, + {"GAME_PLAYER_FOUND", "GAME_PLAYER_FOUND_BY"} }); put("de-DE", new String[][]{ {}, {"TAUNTED"}, - {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"} + {"GAME_SETUP", "SETUP_GAME", "SETUP_LOBBY", "SETUP_SEEKER_LOBBY", "SETUP_EXIT", "SETUP_SAVEMAP", "SETUP_BOUNDS"}, + {"GAME_PLAYER_FOUND", "GAME_PLAYER_FOUND_BY"} }); }}; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java index 4c56453..4f6be2f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java @@ -34,6 +34,10 @@ public class Board { return Players.containsKey(player.getUniqueId()); } + public boolean containsUUID(UUID uuid) { + return Players.containsKey(uuid); + } + public boolean isHider(Player player) { return isHider(player.getUniqueId()); } @@ -418,13 +422,8 @@ class CustomBoard { seekerTeam.setNameTagVisibility(NameTagVisibility.NEVER); } } - if (Main.getInstance().supports(12)) { - hiderTeam.setColor(ChatColor.GOLD); - seekerTeam.setColor(ChatColor.RED); - } else { - hiderTeam.setPrefix(ChatColor.translateAlternateColorCodes('&', "&6")); - seekerTeam.setPrefix(ChatColor.translateAlternateColorCodes('&', "&c")); - } + hiderTeam.setPrefix(message("HIDER_TEAM_NAME").toString() + " " + ChatColor.RESET); + seekerTeam.setPrefix(message("SEEKER_TEAM_NAME").toString() + " " + ChatColor.RESET); } public void setLine(String key, String message) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index 5213c87..36e48b0 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -151,7 +151,7 @@ public class Game { } Main.getInstance().getDatabase().getGameData().addWins(board, players, winners, board.getHiderKills(), board.getHiderDeaths(), board.getSeekerKills(), board.getSeekerDeaths(), type); } - Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, 5*20); + Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), this::end, endGameDelay*20); } public void end() { @@ -347,6 +347,12 @@ public class Game { } } + public void broadcastTitle(String title, String subtitle) { + for (Player player : board.getPlayers()) { + Titles.sendTitle(player, 10, 70, 20, title, subtitle); + } + } + public boolean isCurrentMapValid() { return currentMap != null && !currentMap.isNotSetup(); } @@ -371,19 +377,30 @@ public class Game { if (hiderLeft && dontRewardQuit) { if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT")); else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_QUIT")); + if (gameOverTitle) broadcastTitle(message("GAME_TITLE_NO_WIN").toString(), message("GAME_GAMEOVER_HIDERS_QUIT").toString()); stop(WinType.NONE); } else { - if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND")); - else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND")); + if (hiderCount < 1 || waitTillNoneLeft) { + if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND")); + else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_HIDERS_FOUND")); + if (gameOverTitle) broadcastTitle(message("GAME_TITLE_SEEKERS_WIN").toString(), message("GAME_GAMEOVER_HIDERS_FOUND").toString()); + } else { + Player hider = board.getHiders().get(0); + if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_LAST_HIDER").addPlayer(hider)); + else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_LAST_HIDER").addPlayer(hider)); + if (gameOverTitle) broadcastTitle(message("GAME_TITLE_SINGLE_HIDER_WIN").addPlayer(hider).toString(), message("GAME_SUBTITLE_SINGLE_HIDER_WIN").addPlayer(hider).toString()); + } stop(WinType.SEEKER_WIN); } } else if (board.sizeSeeker() < 1) { if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); else broadcastMessage(abortPrefix + message("GAME_GAMEOVER_SEEKERS_QUIT")); + if (gameOverTitle) broadcastTitle(message("GAME_TITLE_NO_WIN").toString(), message("GAME_GAMEOVER_SEEKERS_QUIT").toString()); stop(dontRewardQuit ? WinType.NONE : WinType.HIDER_WIN); } else if (gameTimer < 1) { if (announceMessagesToNonPlayers) Bukkit.broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME")); else broadcastMessage(gameOverPrefix + message("GAME_GAMEOVER_TIME")); + if (gameOverTitle) broadcastTitle(message("GAME_TITLE_HIDERS_WIN").toString(), message("GAME_GAMEOVER_TIME").toString()); stop(WinType.HIDER_WIN); } hiderLeft = false; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java index 27347c2..d83b702 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java @@ -9,7 +9,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; public class ChatHandler implements Listener { - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onChat(AsyncPlayerChatEvent event) { if (Main.getInstance().getBoard().isSpectator(event.getPlayer())) { event.setCancelled(true); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java index 3a58940..2d80b88 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java @@ -4,6 +4,7 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion; import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.database.Database; import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; +import net.tylermurphy.hideAndSeek.game.Board; import net.tylermurphy.hideAndSeek.game.util.Status; import org.bukkit.OfflinePlayer; @@ -44,19 +45,26 @@ public class PAPIExpansion extends PlaceholderExpansion { Database database = Main.getInstance().getDatabase(); String[] args = params.split("_"); Status status = Main.getInstance().getGame().getStatus(); + Board board = Main.getInstance().getBoard(); + + System.out.println(args); if (args.length < 1) return null; - if (args.length == 1 && args[0] == "hiders") { - if (status == Status.PLAYING || status == Status.STARTING) { + if (args.length == 1 && args[0].equals("hiders")) { + if (!board.containsUUID(player.getUniqueId())) { + return "-"; + } else if (status == Status.PLAYING || status == Status.STARTING) { return "" + Main.getInstance().getBoard().getHiders().size(); } else { return "-"; } } - if (args.length == 1 && args[0] == "seekers") { - if (status == Status.PLAYING || status == Status.STARTING) { + if (args.length == 1 && args[0].equals("seekers")) { + if (!board.containsUUID(player.getUniqueId())) { + return "-"; + } else if (status == Status.PLAYING || status == Status.STARTING) { return "" + Main.getInstance().getBoard().getSeekers().size(); } else { return "-"; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1642b82..a514b56 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -59,6 +59,7 @@ respawnAsSpectator: false # If enabled, the game will go until no hiders are left. If the timer runs out all hiders left will be marked as winning. # If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if t here is one # hider left, all inital seekers win along with the last hider. +# default: true waitTillNoneLeft: true # By default, if the last hider or seeker quits the game, a win type of NONE is given, which doesnt mark anyone as winning. This can be @@ -66,6 +67,14 @@ waitTillNoneLeft: true # default: true dontRewardQuit: true +# The amount of seconds the game will wait until the players are teleported to the lobby after a game over +# default: 5 +endGameDelay: 5 + +# Along with a chat message, display a title describing the gameover +# default: false +gameOverTitle: false + # This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons, # and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this # entire pvp functionality, and make Hiders get found on a single hit. Hiders would also not be able to fight diff --git a/src/main/resources/lang/localization_de-DE.yml b/src/main/resources/lang/localization_de-DE.yml index 92309ee..ca98ea2 100644 --- a/src/main/resources/lang/localization_de-DE.yml +++ b/src/main/resources/lang/localization_de-DE.yml @@ -12,12 +12,18 @@ Localization: COMMAND_ERROR: "Ein unbekannter Fehler ist aufgetreten." COMMAND_INVALID_ARG: "Ungültiges Argument: {AMOUNT}" GAME_PLAYER_DEATH: "&c{PLAYER}&f ist gestorben." - GAME_PLAYER_FOUND: "&e{PLAYER}&f wurde gefunden und ist nun ein Seeker." - GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden und ist nun ein Seeker." + GAME_PLAYER_FOUND: "&e{PLAYER}&f wurde gefunden" + GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f wurde von &c{PLAYER}&f gefunden" GAME_GAMEOVER_HIDERS_FOUND: "Alle Hider wurden gefunden." + GAME_GAMEOVER_LAST_HIDER: "Der letzte Hider, &e{PLAYER}&f, hat gewonnen!" GAME_GAMEOVER_SEEKERS_QUIT: "All Seeker haben das Spiel verlassen." GAME_GAMEOVER_HIDERS_QUIT: "All Hider haben das Spiel verlassen." GAME_GAMEOVER_TIME: "Seekers haben keine Spielzeit mehr. Die Hiders haben gewonnen!" + GAME_TITLE_HIDERS_WIN: "&aHiders haben gewonnen!" + GAME_TITLE_SINGLE_HIDER_WIN: "&a{PLAYER} haben gewonnen!" + GAME_TITLE_SEEKERS_WIN: "&cSeekers haben gewonnen!" + GAME_TITLE_NO_WIN: "&bSpiel ist aus" + GAME_SUBTITLE_SINGLE_HIDER_WIN: "{PLAYER} ist der letzte lebende Hider!" GAME_SETUP: "Es gibt keine Setup-Karten! Führen Sie /hs map status auf einer Karte aus, um zu sehen, was Sie tun müssen." GAME_INGAME: "Du bist bereits in der Lobby oder im Spiel." GAME_NOT_INGAME: "Du bist weder in einer Lobby noch in einem Spiel." @@ -128,5 +134,5 @@ Localization: CONFIRMATION: "Führen Sie /hs confirm innerhalb von 10s aus, um zu bestätigen." # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE -version: 4 +version: 5 type: "de-DE" diff --git a/src/main/resources/lang/localization_en-US.yml b/src/main/resources/lang/localization_en-US.yml index 062f4f2..a2a2223 100644 --- a/src/main/resources/lang/localization_en-US.yml +++ b/src/main/resources/lang/localization_en-US.yml @@ -12,12 +12,18 @@ Localization: COMMAND_ERROR: "An internal error has occurred." COMMAND_INVALID_ARG: "Invalid argument: {AMOUNT}" GAME_PLAYER_DEATH: "&c{PLAYER}&f was killed." - GAME_PLAYER_FOUND: "&e{PLAYER}&f was found and became a seeker." - GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker." + GAME_PLAYER_FOUND: "&e{PLAYER}&f was found" + GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f" GAME_GAMEOVER_HIDERS_FOUND: "All hiders have been found." + GAME_GAMEOVER_LAST_HIDER: "The last hider, &e{PLAYER}&f, has won!" GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit." GAME_GAMEOVER_HIDERS_QUIT: "All hiders have quit." GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!" + GAME_TITLE_HIDERS_WIN: "&aHiders Win!" + GAME_TITLE_SINGLE_HIDER_WIN: "&a{PLAYER} Wins!" + GAME_TITLE_SEEKERS_WIN: "&cSeekers Win!" + GAME_TITLE_NO_WIN: "&bGame Over" + GAME_SUBTITLE_SINGLE_HIDER_WIN: "{PLAYER} is the last hider alive!" GAME_SETUP: "There are no setup maps! Run /hs map status on a map to see what you need to do." GAME_INGAME: "You are already in the lobby/game." GAME_NOT_INGAME: "You are not in a lobby/game." @@ -128,5 +134,5 @@ Localization: CONFIRMATION: "Run /hs confirm within 10s to confirm." # DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE -version: 4 -type: "en-US" \ No newline at end of file +version: 5 +type: "en-US" From 000219a5ff183e469129e5804d0a6090d6b47b26 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 30 Jul 2023 18:12:47 -0400 Subject: [PATCH 4/4] 1.7.5 rc4 --- pom.xml | 6 +- .../hideAndSeek => dev/tylerm/khs}/Main.java | 59 ++++---- .../tylerm/khs}/command/Confirm.java | 8 +- .../tylerm/khs}/command/Help.java | 12 +- .../tylerm/khs}/command/Join.java | 10 +- .../tylerm/khs}/command/Leave.java | 10 +- .../tylerm/khs}/command/Reload.java | 16 +-- .../tylerm/khs}/command/Send.java | 27 ++-- .../tylerm/khs/command/SetExitLocation.java | 42 ++++++ .../tylerm/khs}/command/Start.java | 12 +- .../tylerm/khs}/command/Stop.java | 14 +- .../tylerm/khs}/command/Top.java | 12 +- .../tylerm/khs}/command/Wins.java | 19 ++- .../khs}/command/location/LocationUtils.java | 25 ++-- .../khs}/command/location/Locations.java | 2 +- .../tylerm/khs}/command/map/Add.java | 26 ++-- .../tylerm/khs}/command/map/Debug.java | 37 +++-- .../tylerm/khs}/command/map/GoTo.java | 23 ++- .../tylerm/khs}/command/map/List.java | 18 ++- .../dev/tylerm/khs/command/map/Remove.java | 52 +++++++ .../tylerm/khs}/command/map/Save.java | 37 +++-- .../tylerm/khs}/command/map/Status.java | 39 +++--- .../khs}/command/map/blockhunt/Enabled.java | 28 ++-- .../command/map/blockhunt/blocks/Add.java | 32 ++--- .../command/map/blockhunt/blocks/List.java | 26 ++-- .../command/map/blockhunt/blocks/Remove.java | 32 ++--- .../tylerm/khs/command/map/set/Border.java | 86 ++++++++++++ .../tylerm/khs}/command/map/set/Bounds.java | 39 +++--- .../tylerm/khs}/command/map/set/Lobby.java | 15 +- .../khs}/command/map/set/SeekerLobby.java | 24 ++-- .../tylerm/khs}/command/map/set/Spawn.java | 26 ++-- .../tylerm/khs/command/map/unset/Border.java | 58 ++++++++ .../khs}/command/util/CommandGroup.java | 28 ++-- .../tylerm/khs}/command/util/ICommand.java | 2 +- .../tylerm/khs}/command/world/Create.java | 22 ++- .../tylerm/khs}/command/world/Delete.java | 30 ++-- .../tylerm/khs}/command/world/List.java | 16 +-- .../tylerm/khs}/command/world/Tp.java | 17 ++- .../tylerm/khs}/configuration/Config.java | 10 +- .../khs}/configuration/ConfigManager.java | 4 +- .../tylerm/khs}/configuration/Items.java | 132 ++++++++++++------ .../khs}/configuration/Leaderboard.java | 2 +- .../khs}/configuration/Localization.java | 2 +- .../configuration/LocalizationString.java | 2 +- .../tylerm/khs}/configuration/Map.java | 34 ++--- .../tylerm/khs}/configuration/Maps.java | 6 +- .../tylerm/khs}/database/Database.java | 19 ++- .../tylerm/khs}/database/GameDataTable.java | 10 +- .../tylerm/khs}/database/InventoryTable.java | 4 +- .../tylerm/khs}/database/LegacyTable.java | 4 +- .../tylerm/khs}/database/NameDataTable.java | 4 +- .../connections/DatabaseConnection.java | 2 +- .../database/connections/MySQLConnection.java | 21 ++- .../connections/SQLiteConnection.java | 4 +- .../khs}/database/util/LegacyPlayerInfo.java | 2 +- .../tylerm/khs}/database/util/PlayerInfo.java | 2 +- .../tylerm/khs}/game/Board.java | 20 +-- .../tylerm/khs}/game/Disguiser.java | 10 +- .../tylerm/khs}/game/EntityHider.java | 2 +- .../tylerm/khs}/game/Game.java | 24 ++-- .../tylerm/khs}/game/PlayerLoader.java | 26 ++-- .../tylerm/khs}/game/events/Border.java | 10 +- .../tylerm/khs}/game/events/Glow.java | 13 +- .../tylerm/khs}/game/events/Taunt.java | 10 +- .../game/listener/BlockedCommandHandler.java | 12 +- .../khs}/game/listener/ChatHandler.java | 4 +- .../khs}/game/listener/DamageHandler.java | 16 +-- .../khs}/game/listener/DisguiseHandler.java | 10 +- .../khs}/game/listener/InteractHandler.java | 16 +-- .../khs}/game/listener/InventoryHandler.java | 12 +- .../khs}/game/listener/JoinLeaveHandler.java | 26 ++-- .../khs}/game/listener/MovementHandler.java | 8 +- .../khs}/game/listener/PlayerHandler.java | 12 +- .../khs}/game/listener/RespawnHandler.java | 4 +- .../game/listener/WorldInteractHandler.java | 6 +- .../game/listener/events/PlayerJumpEvent.java | 2 +- .../khs}/game/util/CountdownDisplay.java | 2 +- .../tylerm/khs}/game/util/Disguise.java | 8 +- .../tylerm/khs}/game/util/Status.java | 2 +- .../tylerm/khs}/game/util/WinType.java | 2 +- .../tylerm/khs}/util/Location.java | 8 +- .../tylerm/khs}/util/PAPIExpansion.java | 16 +-- .../tylerm/khs}/util/Pair.java | 2 +- .../tylerm/khs}/util/Tuple.java | 2 +- .../khs}/util/packet/AbstractPacket.java | 2 +- .../khs}/util/packet/BlockChangePacket.java | 2 +- .../util/packet/EntityMetadataPacket.java | 4 +- .../util/packet/EntityTeleportPacket.java | 2 +- .../tylerm/khs}/world/VoidGenerator.java | 2 +- .../tylerm/khs}/world/WorldLoader.java | 11 +- .../hideAndSeek/command/SetExitLocation.java | 43 ------ .../hideAndSeek/command/map/Remove.java | 54 ------- .../hideAndSeek/command/map/set/Border.java | 94 ------------- src/main/resources/config.yml | 10 +- src/main/resources/items.yml | 27 ++-- src/main/resources/plugin.yml | 2 +- 96 files changed, 935 insertions(+), 854 deletions(-) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/Main.java (84%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Confirm.java (86%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Help.java (87%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Join.java (77%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Leave.java (77%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Reload.java (66%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Send.java (60%) create mode 100644 src/main/java/dev/tylerm/khs/command/SetExitLocation.java rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Start.java (86%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Stop.java (68%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Top.java (86%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/Wins.java (77%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/location/LocationUtils.java (55%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/location/Locations.java (75%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/Add.java (53%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/Debug.java (79%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/GoTo.java (60%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/List.java (61%) create mode 100644 src/main/java/dev/tylerm/khs/command/map/Remove.java rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/Save.java (53%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/Status.java (53%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/blockhunt/Enabled.java (57%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/blockhunt/blocks/Add.java (57%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/blockhunt/blocks/List.java (54%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/blockhunt/blocks/Remove.java (58%) create mode 100644 src/main/java/dev/tylerm/khs/command/map/set/Border.java rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/set/Bounds.java (64%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/set/Lobby.java (58%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/set/SeekerLobby.java (59%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/map/set/Spawn.java (63%) create mode 100644 src/main/java/dev/tylerm/khs/command/map/unset/Border.java rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/util/CommandGroup.java (84%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/util/ICommand.java (86%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/world/Create.java (70%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/world/Delete.java (61%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/world/List.java (74%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/command/world/Tp.java (65%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/Config.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/ConfigManager.java (99%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/Items.java (68%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/Leaderboard.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/Localization.java (98%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/LocalizationString.java (94%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/Map.java (85%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/configuration/Maps.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/Database.java (85%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/GameDataTable.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/InventoryTable.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/LegacyTable.java (96%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/NameDataTable.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/connections/DatabaseConnection.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/connections/MySQLConnection.java (80%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/connections/SQLiteConnection.java (95%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/util/LegacyPlayerInfo.java (96%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/database/util/PlayerInfo.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/Board.java (96%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/Disguiser.java (86%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/EntityHider.java (99%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/Game.java (95%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/PlayerLoader.java (90%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/events/Border.java (88%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/events/Glow.java (79%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/events/Taunt.java (91%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/BlockedCommandHandler.java (75%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/ChatHandler.java (88%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/DamageHandler.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/DisguiseHandler.java (92%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/InteractHandler.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/InventoryHandler.java (94%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/JoinLeaveHandler.java (84%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/MovementHandler.java (91%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/PlayerHandler.java (84%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/RespawnHandler.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/WorldInteractHandler.java (91%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/listener/events/PlayerJumpEvent.java (96%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/util/CountdownDisplay.java (94%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/util/Disguise.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/util/Status.java (60%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/game/util/WinType.java (55%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/Location.java (94%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/PAPIExpansion.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/Pair.java (87%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/Tuple.java (90%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/packet/AbstractPacket.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/packet/BlockChangePacket.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/packet/EntityMetadataPacket.java (95%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/util/packet/EntityTeleportPacket.java (93%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/world/VoidGenerator.java (97%) rename src/main/java/{net/tylermurphy/hideAndSeek => dev/tylerm/khs}/world/WorldLoader.java (94%) delete mode 100644 src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java delete mode 100644 src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java delete mode 100644 src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java diff --git a/pom.xml b/pom.xml index 23eec91..90ee803 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ 4.0.0 - net.tylermurphy + dev.tylerm KenshinsHideAndSeek 1.7.5 Hide and Seek Plugin @@ -27,11 +27,11 @@ com.cryptomorin.xseries - net.tylermurphy.dependencies.xseries + dev.tylerm.depend.xseries com.zaxxer.hikari - net.tylermurphy.dependencies.hikari + dev.tylerm.depend.hikari diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Main.java b/src/main/java/dev/tylerm/khs/Main.java similarity index 84% rename from src/main/java/net/tylermurphy/hideAndSeek/Main.java rename to src/main/java/dev/tylerm/khs/Main.java index be1c445..bb69c99 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/Main.java +++ b/src/main/java/dev/tylerm/khs/Main.java @@ -1,18 +1,24 @@ -package net.tylermurphy.hideAndSeek; +package dev.tylerm.khs; -import net.tylermurphy.hideAndSeek.command.*; -import net.tylermurphy.hideAndSeek.command.map.*; -import net.tylermurphy.hideAndSeek.command.map.blockhunt.Enabled; -import net.tylermurphy.hideAndSeek.command.map.set.*; -import net.tylermurphy.hideAndSeek.command.world.Create; -import net.tylermurphy.hideAndSeek.command.world.Delete; -import net.tylermurphy.hideAndSeek.command.world.Tp; -import net.tylermurphy.hideAndSeek.configuration.*; -import net.tylermurphy.hideAndSeek.database.Database; -import net.tylermurphy.hideAndSeek.game.*; -import net.tylermurphy.hideAndSeek.command.util.CommandGroup; -import net.tylermurphy.hideAndSeek.game.listener.*; -import net.tylermurphy.hideAndSeek.util.PAPIExpansion; +import dev.tylerm.khs.command.*; +import dev.tylerm.khs.command.map.Debug; +import dev.tylerm.khs.command.map.GoTo; +import dev.tylerm.khs.command.map.Save; +import dev.tylerm.khs.command.map.blockhunt.blocks.Add; +import dev.tylerm.khs.command.map.blockhunt.blocks.List; +import dev.tylerm.khs.command.map.blockhunt.blocks.Remove; +import dev.tylerm.khs.command.map.set.*; +import dev.tylerm.khs.configuration.*; +import dev.tylerm.khs.game.*; +import dev.tylerm.khs.game.listener.*; +import dev.tylerm.khs.game.util.Status; +import dev.tylerm.khs.util.PAPIExpansion; +import dev.tylerm.khs.command.map.blockhunt.Enabled; +import dev.tylerm.khs.command.world.Create; +import dev.tylerm.khs.command.world.Delete; +import dev.tylerm.khs.command.world.Tp; +import dev.tylerm.khs.database.Database; +import dev.tylerm.khs.command.util.CommandGroup; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -27,8 +33,8 @@ import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class Main extends JavaPlugin implements Listener { @@ -94,9 +100,9 @@ public class Main extends JavaPlugin implements Listener { new CommandGroup("map", new CommandGroup("blockhunt", new CommandGroup("blocks", - new net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks.Add(), - new net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks.Remove(), - new net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks.List() + new Add(), + new Remove(), + new List() ), new Enabled() ), @@ -107,10 +113,13 @@ public class Main extends JavaPlugin implements Listener { new Border(), new Bounds() ), - new Add(), - new Remove(), - new List(), - new Status(), + new CommandGroup("unset", + new dev.tylerm.khs.command.map.unset.Border() + ), + new dev.tylerm.khs.command.map.Add(), + new dev.tylerm.khs.command.map.Remove(), + new dev.tylerm.khs.command.map.List(), + new dev.tylerm.khs.command.map.Status(), new Save(), new Debug(), new GoTo() @@ -118,7 +127,7 @@ public class Main extends JavaPlugin implements Listener { new CommandGroup("world", new Create(), new Delete(), - new net.tylermurphy.hideAndSeek.command.world.List(), + new dev.tylerm.khs.command.world.List(), new Tp() ), new SetExitLocation(), @@ -170,7 +179,7 @@ public class Main extends JavaPlugin implements Listener { } private void onTick() { - if(game.getStatus() == net.tylermurphy.hideAndSeek.game.util.Status.ENDED) game = new Game(game.getCurrentMap(), board); + if(game.getStatus() == Status.ENDED) game = new Game(game.getCurrentMap(), board); game.onTick(); disguiser.check(); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java b/src/main/java/dev/tylerm/khs/command/Confirm.java similarity index 86% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java rename to src/main/java/dev/tylerm/khs/command/Confirm.java index a25185d..9a13b72 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Confirm.java +++ b/src/main/java/dev/tylerm/khs/command/Confirm.java @@ -1,14 +1,14 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.command.util.ICommand; +import dev.tylerm.khs.command.util.ICommand; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.function.Consumer; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Confirm implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java b/src/main/java/dev/tylerm/khs/command/Help.java similarity index 87% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Help.java rename to src/main/java/dev/tylerm/khs/command/Help.java index 41db5a9..5dfd7e9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Help.java +++ b/src/main/java/dev/tylerm/khs/command/Help.java @@ -1,8 +1,8 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.util.Pair; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.util.Pair; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -11,8 +11,8 @@ import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Help implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/dev/tylerm/khs/command/Join.java similarity index 77% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Join.java rename to src/main/java/dev/tylerm/khs/command/Join.java index 3e724fb..d8ba212 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java +++ b/src/main/java/dev/tylerm/khs/command/Join.java @@ -1,15 +1,15 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Join implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java b/src/main/java/dev/tylerm/khs/command/Leave.java similarity index 77% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java rename to src/main/java/dev/tylerm/khs/command/Leave.java index 109930b..dc485b6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java +++ b/src/main/java/dev/tylerm/khs/command/Leave.java @@ -1,15 +1,15 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Leave implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/dev/tylerm/khs/command/Reload.java similarity index 66% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java rename to src/main/java/dev/tylerm/khs/command/Reload.java index 0c2b6b1..098af6f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java +++ b/src/main/java/dev/tylerm/khs/command/Reload.java @@ -1,17 +1,17 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.*; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.*; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Config.messagePrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Reload implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Send.java b/src/main/java/dev/tylerm/khs/command/Send.java similarity index 60% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Send.java rename to src/main/java/dev/tylerm/khs/command/Send.java index 43620c5..6c8d449 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Send.java +++ b/src/main/java/dev/tylerm/khs/command/Send.java @@ -1,41 +1,40 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Send implements ICommand { public void execute(Player sender, String[] args) { if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } if(map.isNotSetup()){ - sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP")); + sender.sendMessage(Config.errorPrefix + Localization.message("MAP_NOT_SETUP")); return; } if (!Main.getInstance().getBoard().contains(sender)) { - sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_NOT_INGAME")); return; } @@ -61,7 +60,7 @@ public class Send implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().filter(map -> !map.isNotSetup()).map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().filter(map -> !map.isNotSetup()).map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/dev/tylerm/khs/command/SetExitLocation.java b/src/main/java/dev/tylerm/khs/command/SetExitLocation.java new file mode 100644 index 0000000..9849f81 --- /dev/null +++ b/src/main/java/dev/tylerm/khs/command/SetExitLocation.java @@ -0,0 +1,42 @@ +package dev.tylerm.khs.command; + +import dev.tylerm.khs.command.location.LocationUtils; +import dev.tylerm.khs.command.location.Locations; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.util.Location; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class SetExitLocation implements ICommand { + + public void execute(Player sender, String[] args) { + LocationUtils.setLocation(sender, Locations.EXIT, null, map -> { + Config.addToConfig("exit.x", sender.getLocation().getBlockX()); + Config.addToConfig("exit.y", sender.getLocation().getBlockY()); + Config.addToConfig("exit.z", sender.getLocation().getBlockZ()); + Config.addToConfig("exit.world", sender.getLocation().getWorld().getName()); + Config.exitPosition = Location.from(sender); + Config.saveConfig(); + }); + } + + public String getLabel() { + return "setexit"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Sets the plugins exit location"; + } + + public List autoComplete(@NotNull String parameter, @NotNull String typed) { + return null; + } + +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/dev/tylerm/khs/command/Start.java similarity index 86% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Start.java rename to src/main/java/dev/tylerm/khs/command/Start.java index 455e777..0a75855 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/dev/tylerm/khs/command/Start.java @@ -1,8 +1,8 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.game.util.Status; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -11,8 +11,8 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class Start implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/dev/tylerm/khs/command/Stop.java similarity index 68% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java rename to src/main/java/dev/tylerm/khs/command/Stop.java index 498e30d..557e147 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java +++ b/src/main/java/dev/tylerm/khs/command/Stop.java @@ -1,16 +1,16 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.abortPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.abortPrefix; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Stop implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/dev/tylerm/khs/command/Top.java similarity index 86% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Top.java rename to src/main/java/dev/tylerm/khs/command/Top.java index 13f3069..27a438c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java +++ b/src/main/java/dev/tylerm/khs/command/Top.java @@ -1,8 +1,8 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.database.util.PlayerInfo; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -10,8 +10,8 @@ import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class Top implements ICommand { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/dev/tylerm/khs/command/Wins.java similarity index 77% rename from src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java rename to src/main/java/dev/tylerm/khs/command/Wins.java index fb61fb2..2a7f046 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java +++ b/src/main/java/dev/tylerm/khs/command/Wins.java @@ -1,8 +1,10 @@ -package net.tylermurphy.hideAndSeek.command; +package dev.tylerm.khs.command; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.database.util.PlayerInfo; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -11,9 +13,6 @@ import java.util.Collections; import java.util.List; import java.util.UUID; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Wins implements ICommand { public void execute(Player sender, String[] args) { @@ -30,16 +29,16 @@ public class Wins implements ICommand { uuid = Main.getInstance().getDatabase().getNameData().getUUID(args[0]); } if(uuid == null){ - sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0])); + sender.sendMessage(Config.errorPrefix + Localization.message("START_INVALID_NAME").addPlayer(args[0])); return; } PlayerInfo info = Main.getInstance().getDatabase().getGameData().getInfo(uuid); if (info == null) { - sender.sendMessage(errorPrefix + message("NO_GAME_INFO")); + sender.sendMessage(Config.errorPrefix + Localization.message("NO_GAME_INFO")); return; } String message = ChatColor.WHITE + "" + ChatColor.BOLD + "==============================\n"; - message = message + message("INFORMATION_FOR").addPlayer(name) + "\n"; + message = message + Localization.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.getSeekerWins() +info.getHiderWins(), ChatColor.GOLD, ChatColor.WHITE, info.getHiderWins(), diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/LocationUtils.java b/src/main/java/dev/tylerm/khs/command/location/LocationUtils.java similarity index 55% rename from src/main/java/net/tylermurphy/hideAndSeek/command/location/LocationUtils.java rename to src/main/java/dev/tylerm/khs/command/location/LocationUtils.java index 5e4afb5..8c8e3f7 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/LocationUtils.java +++ b/src/main/java/dev/tylerm/khs/command/location/LocationUtils.java @@ -1,17 +1,16 @@ -package net.tylermurphy.hideAndSeek.command.location; +package dev.tylerm.khs.command.location; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - /** * @author bobby29831 */ @@ -20,12 +19,12 @@ public class LocationUtils { public static void setLocation(@NotNull Player player, @NotNull Locations place, String mapName, @NotNull Consumer consumer) { if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - player.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + player.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } if (player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){ - player.sendMessage(errorPrefix + message("NOT_AT_ZERO")); + player.sendMessage(Config.errorPrefix + Localization.message("NOT_AT_ZERO")); return; } @@ -33,7 +32,7 @@ public class LocationUtils { if(mapName != null) { map = Maps.getMap(mapName); if (map == null) { - player.sendMessage(errorPrefix + message("INVALID_MAP")); + player.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } } @@ -41,13 +40,13 @@ public class LocationUtils { try { consumer.accept(map); } catch (Exception e) { - player.sendMessage(errorPrefix + e.getMessage()); + player.sendMessage(Config.errorPrefix + e.getMessage()); return; } if(map != null) Maps.setMap(mapName, map); - player.sendMessage(messagePrefix + message(place.message())); + player.sendMessage(Config.messagePrefix + Localization.message(place.message())); } } \ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/Locations.java b/src/main/java/dev/tylerm/khs/command/location/Locations.java similarity index 75% rename from src/main/java/net/tylermurphy/hideAndSeek/command/location/Locations.java rename to src/main/java/dev/tylerm/khs/command/location/Locations.java index c1316f8..c3d505c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/Locations.java +++ b/src/main/java/dev/tylerm/khs/command/location/Locations.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.command.location; +package dev.tylerm.khs.command.location; /** * @author bobby29831 diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java b/src/main/java/dev/tylerm/khs/command/map/Add.java similarity index 53% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java rename to src/main/java/dev/tylerm/khs/command/map/Add.java index 72f0740..761db0f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java +++ b/src/main/java/dev/tylerm/khs/command/map/Add.java @@ -1,35 +1,33 @@ -package net.tylermurphy.hideAndSeek.command.map; +package dev.tylerm.khs.command.map; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Add implements ICommand { public void execute(Player sender, String[] args) { if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map != null) { - sender.sendMessage(errorPrefix + message("MAP_ALREADY_EXISTS")); + sender.sendMessage(Config.errorPrefix + Localization.message("MAP_ALREADY_EXISTS")); } else if(!args[0].matches("[a-zA-Z0-9]*") || args[0].length() < 1) { - sender.sendMessage(errorPrefix + message("INVALID_MAP_NAME")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP_NAME")); } else { Maps.setMap(args[0], new Map(args[0])); - sender.sendMessage(messagePrefix + message("MAP_CREATED").addAmount(args[0])); + sender.sendMessage(Config.messagePrefix + Localization.message("MAP_CREATED").addAmount(args[0])); } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java b/src/main/java/dev/tylerm/khs/command/map/Debug.java similarity index 79% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java rename to src/main/java/dev/tylerm/khs/command/map/Debug.java index 209d0d6..07f4e69 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java +++ b/src/main/java/dev/tylerm/khs/command/map/Debug.java @@ -1,11 +1,13 @@ -package net.tylermurphy.hideAndSeek.command.map; +package dev.tylerm.khs.command.map; import com.cryptomorin.xseries.XMaterial; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.PlayerLoader; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.PlayerLoader; +import dev.tylerm.khs.game.util.Status; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -20,46 +22,43 @@ import java.util.Map; import java.util.function.Consumer; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Debug implements ICommand { private static final Map>> debugMenuFunctions = new HashMap<>(); public void execute(Player sender, String[] args) { - net.tylermurphy.hideAndSeek.configuration.Map map = Maps.getMap(args[0]); + dev.tylerm.khs.configuration.Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } Inventory debugMenu = createMenu(map, sender); sender.openInventory(debugMenu); } - private Inventory createMenu(net.tylermurphy.hideAndSeek.configuration.Map map, Player sender){ + private Inventory createMenu(dev.tylerm.khs.configuration.Map map, Player sender){ Map> functions = new HashMap<>(); Inventory debugMenu = Main.getInstance().getServer().createInventory(null, 9, "Debug Menu"); debugMenu.setItem(0, createOption(functions, 0, XMaterial.LEATHER_CHESTPLATE.parseMaterial(), "&6Become a &lHider", 1, player -> { - if(mapSaveEnabled) { + if(Config.mapSaveEnabled) { if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap(); } Main.getInstance().getBoard().addHider(player); PlayerLoader.loadHider(player, map); - if(Main.getInstance().getGame().getStatus() != Status.STARTING) + if(Main.getInstance().getGame().getStatus() != dev.tylerm.khs.game.util.Status.STARTING) PlayerLoader.resetPlayer(player, Main.getInstance().getBoard()); })); debugMenu.setItem(1, createOption(functions, 1, XMaterial.GOLDEN_CHESTPLATE.parseMaterial(), "&cBecome a &lSeeker", 1, player -> { - if(mapSaveEnabled) { + if(Config.mapSaveEnabled) { if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap(); } Main.getInstance().getBoard().addSeeker(player); PlayerLoader.loadSeeker(player, map); - if(Main.getInstance().getGame().getStatus() != Status.STARTING) + if(Main.getInstance().getGame().getStatus() != dev.tylerm.khs.game.util.Status.STARTING) PlayerLoader.resetPlayer(player, Main.getInstance().getBoard()); })); debugMenu.setItem(2, createOption(functions, 2, XMaterial.IRON_CHESTPLATE.parseMaterial(), "&8Become a &lSpectator", 1, player -> { - if(mapSaveEnabled) { + if(Config.mapSaveEnabled) { if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap(); } Main.getInstance().getBoard().addSpectator(player); @@ -68,7 +67,7 @@ public class Debug implements ICommand { debugMenu.setItem(3, createOption(functions, 3, XMaterial.BARRIER.parseMaterial(), "&cUnload from Game", 1, player -> { Main.getInstance().getBoard().remove(player); PlayerLoader.unloadPlayer(player); - exitPosition.teleport(player); + Config.exitPosition.teleport(player); })); debugMenu.setItem(4, createOption(functions, 4, XMaterial.BARRIER.parseMaterial(), "&cDie In Game", 2, player -> { if((Main.getInstance().getBoard().isSeeker(player) || Main.getInstance().getBoard().isHider(player)) && Main.getInstance().getGame().getStatus() == Status.PLAYING){ @@ -115,7 +114,7 @@ public class Debug implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(dev.tylerm.khs.configuration.Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java b/src/main/java/dev/tylerm/khs/command/map/GoTo.java similarity index 60% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java rename to src/main/java/dev/tylerm/khs/command/map/GoTo.java index 7d27642..5cce5a6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java +++ b/src/main/java/dev/tylerm/khs/command/map/GoTo.java @@ -1,8 +1,10 @@ -package net.tylermurphy.hideAndSeek.command.map; +package dev.tylerm.khs.command.map; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -10,19 +12,16 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class GoTo implements ICommand { public void execute(Player sender, String[] args) { Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } if (map.isNotSetup()) { - sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP").addAmount(map.getName())); + sender.sendMessage(Config.errorPrefix + Localization.message("MAP_NOT_SETUP").addAmount(map.getName())); return; } switch (args[1].toLowerCase()) { @@ -33,9 +32,9 @@ public class GoTo implements ICommand { case "seekerlobby": map.getSeekerLobby().teleport(sender); break; case "exit": - exitPosition.teleport(sender); break; + Config.exitPosition.teleport(sender); break; default: - sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase())); + sender.sendMessage(Config.errorPrefix + Localization.message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase())); } } @@ -53,7 +52,7 @@ public class GoTo implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } else if(parameter.equals("spawn")) { return Arrays.asList("spawn","lobby","seekerlobby","exit"); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java b/src/main/java/dev/tylerm/khs/command/map/List.java similarity index 61% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java rename to src/main/java/dev/tylerm/khs/command/map/List.java index ac2badf..987138d 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java +++ b/src/main/java/dev/tylerm/khs/command/map/List.java @@ -1,27 +1,25 @@ -package net.tylermurphy.hideAndSeek.command.map; +package dev.tylerm.khs.command.map; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.Collection; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class List implements ICommand { public void execute(Player sender, String[] args) { Collection maps = Maps.getAllMaps(); if(maps.size() < 1) { - sender.sendMessage(errorPrefix + message("NO_MAPS")); + sender.sendMessage(Config.errorPrefix + Localization.message("NO_MAPS")); return; } - StringBuilder response = new StringBuilder(messagePrefix + message("LIST_MAPS")); + StringBuilder response = new StringBuilder(Config.messagePrefix + Localization.message("LIST_MAPS")); for(Map map : maps) { response.append("\n ").append(map.getName()).append(": ").append(map.isNotSetup() ? ChatColor.RED + "NOT SETUP" : ChatColor.GREEN + "SETUP").append(ChatColor.WHITE); } diff --git a/src/main/java/dev/tylerm/khs/command/map/Remove.java b/src/main/java/dev/tylerm/khs/command/map/Remove.java new file mode 100644 index 0000000..b5231a5 --- /dev/null +++ b/src/main/java/dev/tylerm/khs/command/map/Remove.java @@ -0,0 +1,52 @@ +package dev.tylerm.khs.command.map; + +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.stream.Collectors; + +public class Remove implements ICommand { + + public void execute(Player sender, String[] args) { + if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); + return; + } + Map map = Maps.getMap(args[0]); + if(map == null) { + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); + } else if(!Maps.removeMap(args[0])){ + sender.sendMessage(Config.errorPrefix + Localization.message("MAP_FAIL_DELETE").addAmount(args[0])); + } else { + sender.sendMessage(Config.messagePrefix + Localization.message("MAP_DELETED").addAmount(args[0])); + } + } + + public String getLabel() { + return "remove"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Remove a map from the plugin!"; + } + + public List autoComplete(@NotNull String parameter, @NotNull String typed) { + if(parameter.equals("map")) { + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); + } + return null; + } + +} \ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java b/src/main/java/dev/tylerm/khs/command/map/Save.java similarity index 53% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java rename to src/main/java/dev/tylerm/khs/command/map/Save.java index 03e23a8..86871d4 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java +++ b/src/main/java/dev/tylerm/khs/command/map/Save.java @@ -1,10 +1,12 @@ -package net.tylermurphy.hideAndSeek.command.map; +package dev.tylerm.khs.command.map; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -13,40 +15,37 @@ import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Save implements ICommand { public static boolean runningBackup = false; public void execute(Player sender, String[] args) { - if (!mapSaveEnabled) { - sender.sendMessage(errorPrefix + message("MAPSAVE_DISABLED")); + if (!Config.mapSaveEnabled) { + sender.sendMessage(Config.errorPrefix + Localization.message("MAPSAVE_DISABLED")); return; } if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } if (map.getSpawn().isNotSetup()) { - sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); + sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN")); return; } if (map.isBoundsNotSetup()) { - sender.sendMessage(errorPrefix + message("ERROR_MAP_BOUNDS")); + sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_MAP_BOUNDS")); return; } - sender.sendMessage(messagePrefix + message("MAPSAVE_START")); - sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING")); + sender.sendMessage(Config.messagePrefix + Localization.message("MAPSAVE_START")); + sender.sendMessage(Config.warningPrefix + Localization.message("MAPSAVE_WARNING")); World world = map.getSpawn().load(); if (world == null) { - sender.sendMessage(warningPrefix + message("MAPSAVE_FAIL_WORLD")); + sender.sendMessage(Config.warningPrefix + Localization.message("MAPSAVE_FAIL_WORLD")); return; } world.save(); @@ -76,7 +75,7 @@ public class Save implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java b/src/main/java/dev/tylerm/khs/command/map/Status.java similarity index 53% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java rename to src/main/java/dev/tylerm/khs/command/map/Status.java index 79036b1..869fc26 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java +++ b/src/main/java/dev/tylerm/khs/command/map/Status.java @@ -1,58 +1,57 @@ -package net.tylermurphy.hideAndSeek.command.map; +package dev.tylerm.khs.command.map; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Status implements ICommand { public void execute(Player sender, String[] args) { - String msg = message("SETUP").toString(); + String msg = Localization.message("SETUP").toString(); int count = 0; Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } if (map.getSpawn().getBlockX() == 0 && map.getSpawn().getBlockY() == 0 && map.getSpawn().getBlockZ() == 0 || !map.getSpawn().exists()) { - msg = msg + "\n" + message("SETUP_GAME"); + msg = msg + "\n" + Localization.message("SETUP_GAME"); count++; } if (map.getLobby().getBlockX() == 0 && map.getLobby().getBlockY() == 0 && map.getLobby().getBlockZ() == 0 || !map.getLobby().exists()) { - msg = msg + "\n" + message("SETUP_LOBBY"); + msg = msg + "\n" + Localization.message("SETUP_LOBBY"); count++; } if (map.getSeekerLobby().getBlockX() == 0 && map.getSeekerLobby().getBlockY() == 0 && map.getSeekerLobby().getBlockZ() == 0 || !map.getSeekerLobby().exists()) { - msg = msg + "\n" + message("SETUP_SEEKER_LOBBY"); + msg = msg + "\n" + Localization.message("SETUP_SEEKER_LOBBY"); count++; } - if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0 || !exitPosition.exists()) { - msg = msg + "\n" + message("SETUP_EXIT"); + if (Config.exitPosition.getBlockX() == 0 && Config.exitPosition.getBlockY() == 0 && Config.exitPosition.getBlockZ() == 0 || !Config.exitPosition.exists()) { + msg = msg + "\n" + Localization.message("SETUP_EXIT"); count++; } if (map.isBoundsNotSetup()) { - msg = msg + "\n" + message("SETUP_BOUNDS"); + msg = msg + "\n" + Localization.message("SETUP_BOUNDS"); count++; } - if (mapSaveEnabled && !map.getGameSpawn().exists()) { - msg = msg + "\n" + message("SETUP_SAVEMAP"); + if (Config.mapSaveEnabled && !map.getGameSpawn().exists()) { + msg = msg + "\n" + Localization.message("SETUP_SAVEMAP"); count++; } if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) { - msg = msg + "\n" + message("SETUP_BLOCKHUNT"); + msg = msg + "\n" + Localization.message("SETUP_BLOCKHUNT"); count++; } if (count < 1) { - sender.sendMessage(messagePrefix + message("SETUP_COMPLETE")); + sender.sendMessage(Config.messagePrefix + Localization.message("SETUP_COMPLETE")); } else { sender.sendMessage(msg); } @@ -72,7 +71,7 @@ public class Status implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java b/src/main/java/dev/tylerm/khs/command/map/blockhunt/Enabled.java similarity index 57% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java rename to src/main/java/dev/tylerm/khs/command/map/blockhunt/Enabled.java index 2567427..1d49473 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java +++ b/src/main/java/dev/tylerm/khs/command/map/blockhunt/Enabled.java @@ -1,10 +1,12 @@ -package net.tylermurphy.hideAndSeek.command.map.blockhunt; +package dev.tylerm.khs.command.map.blockhunt; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -13,30 +15,26 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Enabled implements ICommand { public void execute(Player sender, String[] args) { if (!Main.getInstance().supports(9)) { - sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED")); + sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED")); return; } if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } boolean bool = Boolean.parseBoolean(args[1]); map.setBlockhunt(bool, map.getBlockHunt()); Maps.setMap(map.getName(), map); - sender.sendMessage(messagePrefix + message("BLOCKHUNT_SET_TO") + sender.sendMessage(Config.messagePrefix + Localization.message("BLOCKHUNT_SET_TO") .addAmount(bool ? ChatColor.GREEN + "true" : ChatColor.RED + "false") + ChatColor.WHITE); } @@ -54,7 +52,7 @@ public class Enabled implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } if(parameter.equals("bool")) { return Arrays.asList("true", "false"); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java b/src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/Add.java similarity index 57% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java rename to src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/Add.java index fea08ef..4232bb5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java +++ b/src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/Add.java @@ -1,10 +1,12 @@ -package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks; +package dev.tylerm.khs.command.map.blockhunt.blocks; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.Material; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -13,40 +15,36 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Add implements ICommand { public void execute(Player sender, String[] args) { if (!Main.getInstance().supports(9)) { - sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED")); + sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED")); return; } if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } Material block; try { block = Material.valueOf(args[1]); } catch (IllegalArgumentException e) { - sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1])); + sender.sendMessage(Config.errorPrefix + Localization.message("COMMAND_INVALID_ARG").addAmount(args[1])); return; } List blocks = map.getBlockHunt(); if(blocks.contains(block)) { - sender.sendMessage(errorPrefix + message("BLOCKHUNT_BLOCK_EXISTS").addAmount(args[1])); + sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_BLOCK_EXISTS").addAmount(args[1])); } blocks.add(block); map.setBlockhunt(map.isBlockHuntEnabled(), blocks); Maps.setMap(map.getName(), map); - sender.sendMessage(messagePrefix + message("BLOCKHUNT_BLOCK_ADDED").addAmount(args[1])); + sender.sendMessage(Config.messagePrefix + Localization.message("BLOCKHUNT_BLOCK_ADDED").addAmount(args[1])); } public String getLabel() { @@ -63,7 +61,7 @@ public class Add implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } else if(parameter.equals("block")) { return Arrays.stream(Material.values()) .filter(Material::isBlock) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java b/src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/List.java similarity index 54% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java rename to src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/List.java index de783ce..9ba90fa 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java +++ b/src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/List.java @@ -1,9 +1,11 @@ -package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks; +package dev.tylerm.khs.command.map.blockhunt.blocks; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -11,28 +13,24 @@ import org.jetbrains.annotations.NotNull; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class List implements ICommand { public void execute(Player sender, String[] args) { if (!Main.getInstance().supports(9)) { - sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED")); + sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } java.util.List blocks = map.getBlockHunt(); if(blocks.isEmpty()) { - sender.sendMessage(errorPrefix + message("NO_BLOCKS")); + sender.sendMessage(Config.errorPrefix + Localization.message("NO_BLOCKS")); return; } - StringBuilder response = new StringBuilder(messagePrefix + message("BLOCKHUNT_LIST_BLOCKS")); + StringBuilder response = new StringBuilder(Config.messagePrefix + Localization.message("BLOCKHUNT_LIST_BLOCKS")); for(int i = 0; i < blocks.size(); i++) { response.append(String.format("\n%s. %s", i, blocks.get(i).toString())); } @@ -53,7 +51,7 @@ public class List implements ICommand { public java.util.List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java b/src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/Remove.java similarity index 58% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java rename to src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/Remove.java index 1c16fdc..38ab4a3 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java +++ b/src/main/java/dev/tylerm/khs/command/map/blockhunt/blocks/Remove.java @@ -1,10 +1,12 @@ -package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks; +package dev.tylerm.khs.command.map.blockhunt.blocks; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.Material; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -13,40 +15,36 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Remove implements ICommand { public void execute(Player sender, String[] args) { if (!Main.getInstance().supports(9)) { - sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED")); + sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_UNSUPPORTED")); return; } if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } Material block; try { block = Material.valueOf(args[1]); } catch (IllegalArgumentException e) { - sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1])); + sender.sendMessage(Config.errorPrefix + Localization.message("COMMAND_INVALID_ARG").addAmount(args[1])); return; } java.util.List blocks = map.getBlockHunt(); if(!blocks.contains(block)) { - sender.sendMessage(errorPrefix + message("BLOCKHUNT_BLOCK_DOESNT_EXIT").addAmount(args[1])); + sender.sendMessage(Config.errorPrefix + Localization.message("BLOCKHUNT_BLOCK_DOESNT_EXIT").addAmount(args[1])); } blocks.remove(block); map.setBlockhunt(map.isBlockHuntEnabled(), blocks); Maps.setMap(map.getName(), map); - sender.sendMessage(messagePrefix + message("BLOCKHUNT_BLOCK_REMOVED").addAmount(args[1])); + sender.sendMessage(Config.messagePrefix + Localization.message("BLOCKHUNT_BLOCK_REMOVED").addAmount(args[1])); } public String getLabel() { @@ -63,7 +61,7 @@ public class Remove implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } else if(parameter.equals("block")) { return Arrays.stream(Material.values()) .filter(Material::isBlock) diff --git a/src/main/java/dev/tylerm/khs/command/map/set/Border.java b/src/main/java/dev/tylerm/khs/command/map/set/Border.java new file mode 100644 index 0000000..7ef3bf9 --- /dev/null +++ b/src/main/java/dev/tylerm/khs/command/map/set/Border.java @@ -0,0 +1,86 @@ +package dev.tylerm.khs.command.map.set; + +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class Border implements ICommand { + + public void execute(Player sender, String[] args) { + if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); + return; + } + Map map = Maps.getMap(args[0]); + if(map == null) { + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); + return; + } + if (map.getSpawn().isNotSetup()) { + sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN")); + return; + } + + int num,delay,change; + try { num = Integer.parseInt(args[1]); } catch (Exception e) { + sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_INVALID_INPUT").addAmount(args[0])); + return; + } + try { delay = Integer.parseInt(args[2]); } catch (Exception e) { + sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_INVALID_INPUT").addAmount(args[1])); + return; + } + try { change = Integer.parseInt(args[3]); } catch (Exception e) { + sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_INVALID_INPUT").addAmount(args[2])); + return; + } + if (num < 100) { + sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_MIN_SIZE")); + return; + } + if (change < 1) { + sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_CHANGE_SIZE")); + return; + } + map.setWorldBorderData( + sender.getLocation().getBlockX(), + sender.getLocation().getBlockZ(), + num, + delay, + change + ); + Maps.setMap(map.getName(), map); + sender.sendMessage(Config.messagePrefix + Localization.message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change)); + map.getWorldBorder().resetWorldBorder(); + } + + public String getLabel() { + return "border"; + } + + public String getUsage() { + return " "; + } + + public String getDescription() { + return "Sets a maps world border information"; + } + + public List autoComplete(@NotNull String parameter, @NotNull String typed) { + if(parameter.equals("map")) { + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); + } + return Collections.singletonList(parameter); + } + +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java b/src/main/java/dev/tylerm/khs/command/map/set/Bounds.java similarity index 64% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java rename to src/main/java/dev/tylerm/khs/command/map/set/Bounds.java index 3d1f036..5fde50e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java +++ b/src/main/java/dev/tylerm/khs/command/map/set/Bounds.java @@ -1,46 +1,45 @@ -package net.tylermurphy.hideAndSeek.command.map.set; +package dev.tylerm.khs.command.map.set; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; +import dev.tylerm.khs.util.Location; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Bounds implements ICommand { public void execute(Player sender, String[] args) { if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); return; } Map map = Maps.getMap(args[0]); if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); return; } if (map.getSpawn().isNotSetup()) { - sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); + sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN")); return; } if (map.getSeekerLobby().isNotSetup()) { - sender.sendMessage(errorPrefix + message("ERROR_GAME_SEEKER_SPAWN")); + sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SEEKER_SPAWN")); return; } if (!sender.getWorld().getName().equals(map.getSpawnName())) { - sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD")); + sender.sendMessage(Config.errorPrefix + Localization.message("BOUNDS_WRONG_WORLD")); return; } if (sender.getLocation().getBlockX() == 0 || sender.getLocation().getBlockZ() == 0) { - sender.sendMessage(errorPrefix + message("NOT_AT_ZERO")); + sender.sendMessage(Config.errorPrefix + Localization.message("NOT_AT_ZERO")); return; } boolean first = true; @@ -77,18 +76,18 @@ public class Bounds implements ICommand { if(!map.getSpawn().isNotSetup()) { if(map.getSpawn().isNotInBounds(bxs, bxl, bzs, bzl)) { map.setSpawn(Location.getDefault()); - sender.sendMessage(warningPrefix + message("WARN_SPAWN_RESET")); + sender.sendMessage(Config.warningPrefix + Localization.message("WARN_SPAWN_RESET")); } } if(!map.getSeekerLobby().isNotSetup()) { if(map.getSeekerLobby().isNotInBounds(bxs, bxl, bzs, bzl)) { map.setSeekerLobby(Location.getDefault()); - sender.sendMessage(warningPrefix + message("WARN_SEEKER_SPAWN_RESET")); + sender.sendMessage(Config.warningPrefix + Localization.message("WARN_SEEKER_SPAWN_RESET")); } } } Maps.setMap(map.getName(), map); - sender.sendMessage(messagePrefix + message("BOUNDS").addAmount(first ? 1 : 2)); + sender.sendMessage(Config.messagePrefix + Localization.message("BOUNDS").addAmount(first ? 1 : 2)); } public String getLabel() { @@ -105,7 +104,7 @@ public class Bounds implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java b/src/main/java/dev/tylerm/khs/command/map/set/Lobby.java similarity index 58% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java rename to src/main/java/dev/tylerm/khs/command/map/set/Lobby.java index 6690ae9..a1c8036 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java +++ b/src/main/java/dev/tylerm/khs/command/map/set/Lobby.java @@ -1,10 +1,11 @@ -package net.tylermurphy.hideAndSeek.command.map.set; +package dev.tylerm.khs.command.map.set; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.command.location.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.Locations; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.command.location.LocationUtils; +import dev.tylerm.khs.command.location.Locations; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.util.Location; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -33,7 +34,7 @@ public class Lobby implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java b/src/main/java/dev/tylerm/khs/command/map/set/SeekerLobby.java similarity index 59% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java rename to src/main/java/dev/tylerm/khs/command/map/set/SeekerLobby.java index b6c5cf0..7187ac9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java +++ b/src/main/java/dev/tylerm/khs/command/map/set/SeekerLobby.java @@ -1,10 +1,11 @@ -package net.tylermurphy.hideAndSeek.command.map.set; +package dev.tylerm.khs.command.map.set; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.command.location.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.Locations; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.command.location.LocationUtils; +import dev.tylerm.khs.command.location.Locations; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.*; +import dev.tylerm.khs.util.Location; +import dev.tylerm.khs.configuration.Maps; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; @@ -12,25 +13,22 @@ import org.jetbrains.annotations.NotNull; import java.util.List;; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.warningPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class SeekerLobby implements ICommand { public void execute(Player sender, String[] args) { LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> { if(map.getSpawn().isNotSetup()) { - throw new RuntimeException(message("GAME_SPAWN_NEEDED").toString()); + throw new RuntimeException(Localization.message("GAME_SPAWN_NEEDED").toString()); } if(!map.getSpawnName().equals(sender.getLocation().getWorld().getName())) { - throw new RuntimeException(message("SEEKER_LOBBY_INVALID").toString()); + throw new RuntimeException(Localization.message("SEEKER_LOBBY_INVALID").toString()); } map.setSeekerLobby(Location.from(sender)); if(!map.isBoundsNotSetup()) { Vector boundsMin = map.getBoundsMin(); Vector boundsMax = map.getBoundsMax(); if(map.getSeekerLobby().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) { - sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS")); + sender.sendMessage(Config.warningPrefix + Localization.message("WARN_MAP_BOUNDS")); } } }); @@ -50,7 +48,7 @@ public class SeekerLobby implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java b/src/main/java/dev/tylerm/khs/command/map/set/Spawn.java similarity index 63% rename from src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java rename to src/main/java/dev/tylerm/khs/command/map/set/Spawn.java index 0baf55e..6541fac 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java +++ b/src/main/java/dev/tylerm/khs/command/map/set/Spawn.java @@ -1,10 +1,11 @@ -package net.tylermurphy.hideAndSeek.command.map.set; +package dev.tylerm.khs.command.map.set; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.command.location.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.Locations; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.command.location.LocationUtils; +import dev.tylerm.khs.command.location.Locations; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.*; +import dev.tylerm.khs.util.Location; +import dev.tylerm.khs.configuration.Maps; import org.bukkit.entity.Player; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; @@ -12,9 +13,6 @@ import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Spawn implements ICommand { public void execute(Player sender, String[] args) { @@ -22,7 +20,7 @@ public class Spawn implements ICommand { if (map.isWorldBorderEnabled() && new Vector(sender.getLocation().getX(), 0, sender.getLocation().getZ()).distance(map.getWorldBorderPos()) > 100) { - sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLDBORDER_POSITION")); throw new RuntimeException("World border not enabled or not in valid position!"); } @@ -32,16 +30,16 @@ public class Spawn implements ICommand { Vector boundsMin = map.getBoundsMin(); Vector boundsMax = map.getBoundsMax(); if(map.getSpawn().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) { - sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS")); + sender.sendMessage(Config.warningPrefix + Localization.message("WARN_MAP_BOUNDS")); } } if(map.getSeekerLobby().getWorld() != null && !map.getSeekerLobby().getWorld().equals(sender.getLocation().getWorld().getName())) { - sender.sendMessage(warningPrefix + message("SEEKER_LOBBY_SPAWN_RESET")); + sender.sendMessage(Config.warningPrefix + Localization.message("SEEKER_LOBBY_SPAWN_RESET")); map.setSeekerLobby(Location.getDefault()); } - if (!sender.getLocation().getWorld().getName().equals(map.getSpawnName()) && mapSaveEnabled) { + if (!sender.getLocation().getWorld().getName().equals(map.getSpawnName()) && Config.mapSaveEnabled) { map.getWorldLoader().unloadMap(); } }); @@ -61,7 +59,7 @@ public class Spawn implements ICommand { public List autoComplete(@NotNull String parameter, @NotNull String typed) { if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); } return null; } diff --git a/src/main/java/dev/tylerm/khs/command/map/unset/Border.java b/src/main/java/dev/tylerm/khs/command/map/unset/Border.java new file mode 100644 index 0000000..f26b0e1 --- /dev/null +++ b/src/main/java/dev/tylerm/khs/command/map/unset/Border.java @@ -0,0 +1,58 @@ +package dev.tylerm.khs.command.map.unset; + +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.stream.Collectors; + +public class Border implements ICommand { + + public void execute(Player sender, String[] args) { + if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { + sender.sendMessage(Config.errorPrefix + Localization.message("GAME_INPROGRESS")); + return; + } + Map map = Maps.getMap(args[0]); + if(map == null) { + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); + return; + } + if (map.getSpawn().isNotSetup()) { + sender.sendMessage(Config.errorPrefix + Localization.message("ERROR_GAME_SPAWN")); + return; + } + map.setWorldBorderData(0, 0, 0, 0, 0); + Config.addToConfig("worldBorder.enabled",false); + Config.saveConfig(); + sender.sendMessage(Config.messagePrefix + Localization.message("WORLDBORDER_DISABLE")); + map.getWorldBorder().resetWorldBorder(); + } + + public String getLabel() { + return "border"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Removes a maps world border information"; + } + + public List autoComplete(@NotNull String parameter, @NotNull String typed) { + if(parameter.equals("map")) { + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); + } + return null; + } + +} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java b/src/main/java/dev/tylerm/khs/command/util/CommandGroup.java similarity index 84% rename from src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java rename to src/main/java/dev/tylerm/khs/command/util/CommandGroup.java index 907f031..02777a3 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/util/CommandGroup.java +++ b/src/main/java/dev/tylerm/khs/command/util/CommandGroup.java @@ -1,8 +1,10 @@ -package net.tylermurphy.hideAndSeek.command.util; +package dev.tylerm.khs.command.util; -import net.tylermurphy.hideAndSeek.command.map.Save; -import net.tylermurphy.hideAndSeek.util.Pair; -import net.tylermurphy.hideAndSeek.util.Tuple; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.util.Pair; +import dev.tylerm.khs.util.Tuple; +import dev.tylerm.khs.command.map.Save; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; @@ -10,10 +12,6 @@ import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.permissionsRequired; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class CommandGroup { private final Map commandRegister; @@ -63,25 +61,25 @@ public class CommandGroup { String[] parameters = data.getRight(); if (Save.runningBackup) { - player.sendMessage(errorPrefix + message("MAPSAVE_INPROGRESS")); + player.sendMessage(Config.errorPrefix + Localization.message("MAPSAVE_INPROGRESS")); return; } - if (permissionsRequired && !player.hasPermission(permission)) { - player.sendMessage(errorPrefix + message("COMMAND_NOT_ALLOWED")); + if (Config.permissionsRequired && !player.hasPermission(permission)) { + player.sendMessage(Config.errorPrefix + Localization.message("COMMAND_NOT_ALLOWED")); return; } int parameterCount = (int) Arrays.stream(command.getUsage().split(" ")).filter(p -> p.startsWith("<") && !p.startsWith("<*")).count(); if(parameters.length < parameterCount) { - player.sendMessage(errorPrefix + message("ARGUMENT_COUNT")); + player.sendMessage(Config.errorPrefix + Localization.message("ARGUMENT_COUNT")); return; } try { command.execute(player, parameters); } catch (Exception e) { - player.sendMessage(errorPrefix + "An error has occurred."); + player.sendMessage(Config.errorPrefix + "An error has occurred."); e.printStackTrace(); } } @@ -122,10 +120,10 @@ public class CommandGroup { Object object = commandRegister.get(handle); if (object instanceof ICommand) { ICommand command = (ICommand) object; - return !permissionsRequired || player.hasPermission(permission + "." + command.getLabel()); + return !Config.permissionsRequired || player.hasPermission(permission + "." + command.getLabel()); } else if (object instanceof CommandGroup) { CommandGroup group = (CommandGroup) object; - return !permissionsRequired || group.hasPermission(player, permission + "." + group.getLabel()); + return !Config.permissionsRequired || group.hasPermission(player, permission + "." + group.getLabel()); } return false; }) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java b/src/main/java/dev/tylerm/khs/command/util/ICommand.java similarity index 86% rename from src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java rename to src/main/java/dev/tylerm/khs/command/util/ICommand.java index 1be678c..615f165 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/util/ICommand.java +++ b/src/main/java/dev/tylerm/khs/command/util/ICommand.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.command.util; +package dev.tylerm.khs.command.util; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Create.java b/src/main/java/dev/tylerm/khs/command/world/Create.java similarity index 70% rename from src/main/java/net/tylermurphy/hideAndSeek/command/world/Create.java rename to src/main/java/dev/tylerm/khs/command/world/Create.java index e399993..a3fecdc 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Create.java +++ b/src/main/java/dev/tylerm/khs/command/world/Create.java @@ -1,8 +1,10 @@ -package net.tylermurphy.hideAndSeek.command.world; +package dev.tylerm.khs.command.world; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.util.Location; +import dev.tylerm.khs.command.util.ICommand; import org.bukkit.World; import org.bukkit.WorldType; import org.bukkit.entity.Player; @@ -12,16 +14,12 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Create implements ICommand { public void execute(Player sender, String[] args) { List worlds = Main.getInstance().getWorlds(); if(worlds.contains(args[0])) { - sender.sendMessage(errorPrefix + message("WORLD_EXISTS").addAmount(args[0])); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_EXISTS").addAmount(args[0])); return; } WorldType type; @@ -44,16 +42,16 @@ public class Create implements ICommand { environment = World.Environment.THE_END; break; default: - sender.sendMessage(errorPrefix + message("INVALID_WORLD_TYPE").addAmount(args[1])); + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_WORLD_TYPE").addAmount(args[1])); return; } Location temp = new Location(args[0], 0, 0, 0); if (temp.load(type, environment) == null) { - sender.sendMessage(errorPrefix + message("WORLD_ADDED_FAILED")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_ADDED_FAILED")); } else { - sender.sendMessage(messagePrefix + message("WORLD_ADDED").addAmount(args[0])); + sender.sendMessage(Config.messagePrefix + Localization.message("WORLD_ADDED").addAmount(args[0])); } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Delete.java b/src/main/java/dev/tylerm/khs/command/world/Delete.java similarity index 61% rename from src/main/java/net/tylermurphy/hideAndSeek/command/world/Delete.java rename to src/main/java/dev/tylerm/khs/command/world/Delete.java index 985ccdc..aef200e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Delete.java +++ b/src/main/java/dev/tylerm/khs/command/world/Delete.java @@ -1,9 +1,11 @@ -package net.tylermurphy.hideAndSeek.command.world; +package dev.tylerm.khs.command.world; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.Confirm; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.world.WorldLoader; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.Confirm; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.world.WorldLoader; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; @@ -12,46 +14,42 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Delete implements ICommand { public void execute(Player sender, String[] args) { java.util.List worlds = Main.getInstance().getWorlds(); if(!worlds.contains(args[0])) { - sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(args[0])); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_DOESNT_EXIST").addAmount(args[0])); return; } Confirm.Confirmation confirmation = new Confirm.Confirmation(args[0], world -> { java.util.List worlds_now = Main.getInstance().getWorlds(); if(!worlds_now.contains(world)) { - sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIST").addAmount(world)); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_DOESNT_EXIST").addAmount(world)); return; } World bukkit_world = Bukkit.getWorld(world); if(bukkit_world != null && bukkit_world.getPlayers().size() > 0) { - sender.sendMessage(errorPrefix + message("WORLD_NOT_EMPTY")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_NOT_EMPTY")); return; } String path = Main.getInstance().getWorldContainer().getPath() + File.separator + world; if (!Bukkit.getServer().unloadWorld(world, false)) { - sender.sendMessage(errorPrefix + message("WORLD_REMOVED_FAILED")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_REMOVED_FAILED")); return; } try { WorldLoader.deleteDirectory(new File(path)); } catch (Exception e) { - sender.sendMessage(errorPrefix + message("WORLD_REMOVED_FAILED")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_REMOVED_FAILED")); return; } - sender.sendMessage(messagePrefix + message("WORLD_REMOVED").addAmount(world)); + sender.sendMessage(Config.messagePrefix + Localization.message("WORLD_REMOVED").addAmount(world)); }); Confirm.confirmations.put(sender.getUniqueId(), confirmation); - sender.sendMessage(messagePrefix + message("CONFIRMATION")); + sender.sendMessage(Config.messagePrefix + Localization.message("CONFIRMATION")); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/world/List.java b/src/main/java/dev/tylerm/khs/command/world/List.java similarity index 74% rename from src/main/java/net/tylermurphy/hideAndSeek/command/world/List.java rename to src/main/java/dev/tylerm/khs/command/world/List.java index bdb98e5..e907138 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/world/List.java +++ b/src/main/java/dev/tylerm/khs/command/world/List.java @@ -1,25 +1,23 @@ -package net.tylermurphy.hideAndSeek.command.world; +package dev.tylerm.khs.command.world; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.command.util.ICommand; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class List implements ICommand { public void execute(Player sender, String[] args) { java.util.List worlds = Main.getInstance().getWorlds(); if(worlds.isEmpty()) { - sender.sendMessage(errorPrefix + message("NO_WORLDS")); + sender.sendMessage(Config.errorPrefix + Localization.message("NO_WORLDS")); } else { - StringBuilder response = new StringBuilder(messagePrefix + message("LIST_WORLDS")); + StringBuilder response = new StringBuilder(Config.messagePrefix + Localization.message("LIST_WORLDS")); for (String world : worlds) { String status = ChatColor.GRAY + "NOT LOADED"; World bukkit_world = Bukkit.getWorld(world); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java b/src/main/java/dev/tylerm/khs/command/world/Tp.java similarity index 65% rename from src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java rename to src/main/java/dev/tylerm/khs/command/world/Tp.java index b166297..a2ada0a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java +++ b/src/main/java/dev/tylerm/khs/command/world/Tp.java @@ -1,27 +1,26 @@ -package net.tylermurphy.hideAndSeek.command.world; +package dev.tylerm.khs.command.world; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.util.ICommand; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.configuration.Localization; +import dev.tylerm.khs.util.Location; import org.bukkit.World; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - public class Tp implements ICommand { public void execute(Player sender, String[] args) { Location test = new Location(args[0], 0, 0,0); if(!test.exists()) { - sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIT")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_DOESNT_EXIT")); return; } World world = test.load(); if(world == null) { - sender.sendMessage(errorPrefix + message("WORLD_LOAD_FAILED")); + sender.sendMessage(Config.errorPrefix + Localization.message("WORLD_LOAD_FAILED")); return; } Location loc = new Location(world.getName(), world.getSpawnLocation()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/dev/tylerm/khs/configuration/Config.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java rename to src/main/java/dev/tylerm/khs/configuration/Config.java index 8a71903..36d74d8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/dev/tylerm/khs/configuration/Config.java @@ -1,11 +1,11 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import com.cryptomorin.xseries.XItemStack; import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.util.CountdownDisplay; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.util.CountdownDisplay; +import dev.tylerm.khs.util.Location; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; @@ -88,6 +88,7 @@ public class Config { teleportItemPosition, startingSeekerCount, delayedRespawnDelay, + hidingTimer, endGameDelay; public static float @@ -200,6 +201,7 @@ public class Config { dontRewardQuit = config.getBoolean("dontRewardQuit"); endGameDelay = Math.max(0,config.getInt("endGameDelay")); gameOverTitle = config.getBoolean("gameOverTitle"); + hidingTimer = Math.max(10, config.getInt("hidingTimer")); try { countdownDisplay = CountdownDisplay.valueOf(config.getString("hideCountdownDisplay")); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/dev/tylerm/khs/configuration/ConfigManager.java similarity index 99% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java rename to src/main/java/dev/tylerm/khs/configuration/ConfigManager.java index 92fa4ce..3a81cb8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/dev/tylerm/khs/configuration/ConfigManager.java @@ -1,6 +1,6 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/dev/tylerm/khs/configuration/Items.java similarity index 68% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java rename to src/main/java/dev/tylerm/khs/configuration/Items.java index 8b4cddc..af8216d 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/dev/tylerm/khs/configuration/Items.java @@ -1,7 +1,7 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import com.cryptomorin.xseries.XItemStack; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; @@ -33,28 +33,49 @@ public class Items { SEEKER_CHEST = null; SEEKER_LEGS = null; SEEKER_BOOTS = null; + ConfigurationSection SeekerItems = manager.getConfigurationSection("items.seeker"); - int i = 1; - while (true) { + + for (int i = 0; i < 9; i++) { ConfigurationSection section = SeekerItems.getConfigurationSection(String.valueOf(i)); - if (section == null) break; - ItemStack item = createItem(section); - if (item == null) continue; - String loc = section.getString("location"); - if (loc == null) { - SEEKER_ITEMS.add(item); - } else if (loc.equals("helmet")) { - SEEKER_HELM = item; - } else if (loc.equals("chestplate")) { - SEEKER_CHEST = item; - } else if (loc.equals("leggings")) { - SEEKER_LEGS = item; - } else if (loc.equals("boots")) { - SEEKER_BOOTS = item; - } else { - SEEKER_ITEMS.add(item); + if (section == null) { + SEEKER_ITEMS.add(null); + continue; + } + ItemStack item = createItem(section); + SEEKER_ITEMS.add(item); + } + + ConfigurationSection SeekerHelmet = SeekerItems.getConfigurationSection("helmet"); + if (SeekerHelmet != null) { + ItemStack item = createItem(SeekerHelmet); + if (item != null) { + SEEKER_HELM = item; + } + } + + ConfigurationSection SeekerChestplate = SeekerItems.getConfigurationSection("chestplate"); + if (SeekerChestplate != null) { + ItemStack item = createItem(SeekerChestplate); + if (item != null) { + SEEKER_CHEST = item; + } + } + + ConfigurationSection SeekerLeggings = SeekerItems.getConfigurationSection("leggings"); + if (SeekerLeggings != null) { + ItemStack item = createItem(SeekerLeggings); + if (item != null) { + SEEKER_LEGS = item; + } + } + + ConfigurationSection SeekerBoots = SeekerItems.getConfigurationSection("boots"); + if (SeekerBoots != null) { + ItemStack item = createItem(SeekerBoots); + if (item != null) { + SEEKER_BOOTS = item; } - i++; } HIDER_ITEMS = new ArrayList<>(); @@ -62,32 +83,55 @@ public class Items { HIDER_CHEST = null; HIDER_LEGS = null; HIDER_BOOTS = null; + ConfigurationSection HiderItems = manager.getConfigurationSection("items.hider"); - i = 1; - while (true) { + + for (int i = 0; i < 9; i++) { ConfigurationSection section = HiderItems.getConfigurationSection(String.valueOf(i)); - if (section == null) break; - ItemStack item = createItem(section); - if (item == null) continue; - String loc = section.getString("location"); - if (loc == null) { - HIDER_ITEMS.add(item); - } else if (loc.equals("helmet")) { - HIDER_HELM = item; - } else if (loc.equals("chestplate")) { - HIDER_CHEST = item; - } else if (loc.equals("leggings")) { - HIDER_LEGS = item; - } else if (loc.equals("boots")) { - HIDER_BOOTS = item; - } else { - HIDER_ITEMS.add(item); + if (section == null) { + HIDER_ITEMS.add(null); + continue; } - i++; + ItemStack item = createItem(section); + HIDER_ITEMS.add(item); } + + ConfigurationSection HiderHelmet = HiderItems.getConfigurationSection("helmet"); + if (HiderHelmet != null) { + ItemStack item = createItem(HiderHelmet); + if (item != null) { + HIDER_HELM = item; + } + } + + ConfigurationSection HiderChestplate = HiderItems.getConfigurationSection("chestplate"); + if (HiderChestplate != null) { + ItemStack item = createItem(HiderChestplate); + if (item != null) { + HIDER_CHEST = item; + } + } + + ConfigurationSection HiderLeggings = HiderItems.getConfigurationSection("leggings"); + if (HiderLeggings != null) { + ItemStack item = createItem(HiderLeggings); + if (item != null) { + HIDER_LEGS = item; + } + } + + ConfigurationSection HiderBoots = HiderItems.getConfigurationSection("boots"); + if (HiderBoots != null) { + ItemStack item = createItem(HiderBoots); + if (item != null) { + HIDER_BOOTS = item; + } + } + SEEKER_EFFECTS = new ArrayList<>(); ConfigurationSection SeekerEffects = manager.getConfigurationSection("effects.seeker"); - i = 1; + + int i = 1; while (true) { ConfigurationSection section = SeekerEffects.getConfigurationSection(String.valueOf(i)); if (section == null) break; @@ -135,7 +179,9 @@ public class Items { if (material.equalsIgnoreCase("POTION") || material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION")) config.set("base-effect", String.format("%s,%s,%s", item.getString("type"), false, splash)); ItemStack stack = XItemStack.deserialize(config); - stack.setAmount(item.getInt("amount")); + int amt = item.getInt("amount"); + if (amt < 1) amt = 1; + stack.setAmount(amt); if (stack.getData().getItemType() == Material.AIR) return null; return stack; } @@ -162,7 +208,7 @@ public class Items { } private static boolean equals(ItemStack a, ItemStack b) { - if (a == null) { + if (a == null || b == null) { return false; } else if (a == b) { return true; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Leaderboard.java b/src/main/java/dev/tylerm/khs/configuration/Leaderboard.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/Leaderboard.java rename to src/main/java/dev/tylerm/khs/configuration/Leaderboard.java index 63dc850..93ba855 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Leaderboard.java +++ b/src/main/java/dev/tylerm/khs/configuration/Leaderboard.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import java.util.Collections; import java.util.List; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java b/src/main/java/dev/tylerm/khs/configuration/Localization.java similarity index 98% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java rename to src/main/java/dev/tylerm/khs/configuration/Localization.java index babf759..2ac84e7 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Localization.java +++ b/src/main/java/dev/tylerm/khs/configuration/Localization.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import net.md_5.bungee.api.ChatColor; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java b/src/main/java/dev/tylerm/khs/configuration/LocalizationString.java similarity index 94% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java rename to src/main/java/dev/tylerm/khs/configuration/LocalizationString.java index b457622..5dc3724 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/LocalizationString.java +++ b/src/main/java/dev/tylerm/khs/configuration/LocalizationString.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import org.bukkit.entity.Entity; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java b/src/main/java/dev/tylerm/khs/configuration/Map.java similarity index 85% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java rename to src/main/java/dev/tylerm/khs/configuration/Map.java index 394bbf3..7d3ef9f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Map.java +++ b/src/main/java/dev/tylerm/khs/configuration/Map.java @@ -1,26 +1,26 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import java.util.ArrayList; import java.util.List; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.events.Border; -import net.tylermurphy.hideAndSeek.world.WorldLoader; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.events.Border; +import dev.tylerm.khs.util.Location; +import dev.tylerm.khs.world.WorldLoader; import org.bukkit.*; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static dev.tylerm.khs.configuration.Config.*; public class Map { private final String name; - private Location - spawnPosition = Location.getDefault(), - lobbyPosition = Location.getDefault(), - seekerLobbyPosition = Location.getDefault(); + private dev.tylerm.khs.util.Location + spawnPosition = dev.tylerm.khs.util.Location.getDefault(), + lobbyPosition = dev.tylerm.khs.util.Location.getDefault(), + seekerLobbyPosition = dev.tylerm.khs.util.Location.getDefault(); private int xBoundMin = 0, @@ -51,15 +51,15 @@ public class Map { this.worldLoader = new WorldLoader(this); } - public void setSpawn(Location pos) { + public void setSpawn(dev.tylerm.khs.util.Location pos) { this.spawnPosition = pos; } - public void setLobby(Location pos) { + public void setLobby(dev.tylerm.khs.util.Location pos) { this.lobbyPosition = pos; } - public void setSeekerLobby(Location pos) { + public void setSeekerLobby(dev.tylerm.khs.util.Location pos) { this.seekerLobbyPosition = pos; } @@ -100,7 +100,7 @@ public class Map { } @NotNull - public Location getGameSpawn() { + public dev.tylerm.khs.util.Location getGameSpawn() { if(mapSaveEnabled) { return spawnPosition.changeWorld("hs_"+name); } else { @@ -117,7 +117,7 @@ public class Map { } @NotNull - public Location getSpawn() { + public dev.tylerm.khs.util.Location getSpawn() { return spawnPosition; } @@ -127,7 +127,7 @@ public class Map { } @NotNull - public Location getLobby() { + public dev.tylerm.khs.util.Location getLobby() { return lobbyPosition; } @@ -137,7 +137,7 @@ public class Map { } @NotNull - public Location getSeekerLobby() { + public dev.tylerm.khs.util.Location getSeekerLobby() { return seekerLobbyPosition; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Maps.java b/src/main/java/dev/tylerm/khs/configuration/Maps.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/configuration/Maps.java rename to src/main/java/dev/tylerm/khs/configuration/Maps.java index d691fa9..54c6d5b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Maps.java +++ b/src/main/java/dev/tylerm/khs/configuration/Maps.java @@ -1,10 +1,10 @@ -package net.tylermurphy.hideAndSeek.configuration; +package dev.tylerm.khs.configuration; import java.util.*; import java.util.stream.Collectors; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.util.Location; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.util.Location; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java b/src/main/java/dev/tylerm/khs/database/Database.java similarity index 85% rename from src/main/java/net/tylermurphy/hideAndSeek/database/Database.java rename to src/main/java/dev/tylerm/khs/database/Database.java index 58c13cc..42c4798 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/Database.java +++ b/src/main/java/dev/tylerm/khs/database/Database.java @@ -1,6 +1,4 @@ -package net.tylermurphy.hideAndSeek.database; - -import static net.tylermurphy.hideAndSeek.configuration.Config.databaseType; +package dev.tylerm.khs.database; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -13,10 +11,11 @@ import java.util.UUID; import com.google.common.io.ByteStreams; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.database.connections.DatabaseConnection; -import net.tylermurphy.hideAndSeek.database.connections.MySQLConnection; -import net.tylermurphy.hideAndSeek.database.connections.SQLiteConnection; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Config; +import dev.tylerm.khs.database.connections.DatabaseConnection; +import dev.tylerm.khs.database.connections.MySQLConnection; +import dev.tylerm.khs.database.connections.SQLiteConnection; public class Database { @@ -27,14 +26,14 @@ public class Database { public Database(){ - if(databaseType.equalsIgnoreCase("SQLITE")) { + if(Config.databaseType.equalsIgnoreCase("SQLITE")) { Main.getInstance().getLogger().info("SQLITE database chosen"); connection = new SQLiteConnection(); - } else if(databaseType.equalsIgnoreCase("MYSQL")) { + } else if(Config.databaseType.equalsIgnoreCase("MYSQL")) { Main.getInstance().getLogger().info("MYSQL database chosen"); connection = new MySQLConnection(); } else { - throw new IllegalArgumentException("Invalid database type: " + databaseType); + throw new IllegalArgumentException("Invalid database type: " + Config.databaseType); } playerInfo = new GameDataTable(this); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java b/src/main/java/dev/tylerm/khs/database/GameDataTable.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java rename to src/main/java/dev/tylerm/khs/database/GameDataTable.java index d5fe7e6..ed54baa 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/GameDataTable.java +++ b/src/main/java/dev/tylerm/khs/database/GameDataTable.java @@ -17,12 +17,12 @@ * */ -package net.tylermurphy.hideAndSeek.database; +package dev.tylerm.khs.database; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; -import net.tylermurphy.hideAndSeek.game.Board; -import net.tylermurphy.hideAndSeek.game.util.WinType; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.database.util.PlayerInfo; +import dev.tylerm.khs.game.Board; +import dev.tylerm.khs.game.util.WinType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/InventoryTable.java b/src/main/java/dev/tylerm/khs/database/InventoryTable.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/database/InventoryTable.java rename to src/main/java/dev/tylerm/khs/database/InventoryTable.java index b023801..3fc62fb 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/InventoryTable.java +++ b/src/main/java/dev/tylerm/khs/database/InventoryTable.java @@ -1,6 +1,6 @@ -package net.tylermurphy.hideAndSeek.database; +package dev.tylerm.khs.database; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.inventory.ItemStack; import org.bukkit.util.io.BukkitObjectInputStream; import org.bukkit.util.io.BukkitObjectOutputStream; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/LegacyTable.java b/src/main/java/dev/tylerm/khs/database/LegacyTable.java similarity index 96% rename from src/main/java/net/tylermurphy/hideAndSeek/database/LegacyTable.java rename to src/main/java/dev/tylerm/khs/database/LegacyTable.java index e134c22..7bf079c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/LegacyTable.java +++ b/src/main/java/dev/tylerm/khs/database/LegacyTable.java @@ -17,9 +17,9 @@ * */ -package net.tylermurphy.hideAndSeek.database; +package dev.tylerm.khs.database; -import net.tylermurphy.hideAndSeek.database.util.LegacyPlayerInfo; +import dev.tylerm.khs.database.util.LegacyPlayerInfo; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/NameDataTable.java b/src/main/java/dev/tylerm/khs/database/NameDataTable.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/database/NameDataTable.java rename to src/main/java/dev/tylerm/khs/database/NameDataTable.java index 4cc77fc..1ce7143 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/NameDataTable.java +++ b/src/main/java/dev/tylerm/khs/database/NameDataTable.java @@ -17,9 +17,9 @@ * */ -package net.tylermurphy.hideAndSeek.database; +package dev.tylerm.khs.database; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/DatabaseConnection.java b/src/main/java/dev/tylerm/khs/database/connections/DatabaseConnection.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/database/connections/DatabaseConnection.java rename to src/main/java/dev/tylerm/khs/database/connections/DatabaseConnection.java index 466bda5..7dd8c01 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/DatabaseConnection.java +++ b/src/main/java/dev/tylerm/khs/database/connections/DatabaseConnection.java @@ -17,7 +17,7 @@ * */ -package net.tylermurphy.hideAndSeek.database.connections; +package dev.tylerm.khs.database.connections; import java.sql.Connection; import java.sql.SQLException; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java b/src/main/java/dev/tylerm/khs/database/connections/MySQLConnection.java similarity index 80% rename from src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java rename to src/main/java/dev/tylerm/khs/database/connections/MySQLConnection.java index 20e7c8e..0f7ce30 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/MySQLConnection.java +++ b/src/main/java/dev/tylerm/khs/database/connections/MySQLConnection.java @@ -17,17 +17,16 @@ * */ -package net.tylermurphy.hideAndSeek.database.connections; +package dev.tylerm.khs.database.connections; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Config; import java.sql.Connection; import java.sql.SQLException; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; - public class MySQLConnection implements DatabaseConnection { private final HikariDataSource ds; @@ -36,20 +35,20 @@ public class MySQLConnection implements DatabaseConnection { HikariConfig config = new HikariConfig(); - Main.getInstance().getLogger().info("Database host: " + databaseHost); - Main.getInstance().getLogger().info("Database port: " + databasePort); - Main.getInstance().getLogger().info("Database user: " + databaseUser); + Main.getInstance().getLogger().info("Database host: " + Config.databaseHost); + Main.getInstance().getLogger().info("Database port: " + Config.databasePort); + Main.getInstance().getLogger().info("Database user: " + Config.databaseUser); Main.getInstance().getLogger().info("Database pass: xxxxxxxxxxx"); - Main.getInstance().getLogger().info("Database name: " + databaseName); + Main.getInstance().getLogger().info("Database name: " + Config.databaseName); config.setDriverClassName(org.mariadb.jdbc.Driver.class.getName()); - config.setJdbcUrl("jdbc:mariadb://"+databaseHost+":"+databasePort+"/"+databaseName.trim()); + config.setJdbcUrl("jdbc:mariadb://"+ Config.databaseHost+":"+ Config.databasePort+"/"+ Config.databaseName.trim()); config.addDataSourceProperty("cachePrepStmts", "true"); config.addDataSourceProperty("prepStmtCacheSize", "250"); config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); - config.addDataSourceProperty("user", databaseUser); - config.addDataSourceProperty("password",databasePass); + config.addDataSourceProperty("user", Config.databaseUser); + config.addDataSourceProperty("password", Config.databasePass); config.addDataSourceProperty("autoCommit", "true"); config.setAutoCommit(true); config.setMaximumPoolSize(20); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java b/src/main/java/dev/tylerm/khs/database/connections/SQLiteConnection.java similarity index 95% rename from src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java rename to src/main/java/dev/tylerm/khs/database/connections/SQLiteConnection.java index bbf330b..70a31fd 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/connections/SQLiteConnection.java +++ b/src/main/java/dev/tylerm/khs/database/connections/SQLiteConnection.java @@ -17,9 +17,9 @@ * */ -package net.tylermurphy.hideAndSeek.database.connections; +package dev.tylerm.khs.database.connections; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.sqlite.SQLiteConfig; import java.io.File; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/util/LegacyPlayerInfo.java b/src/main/java/dev/tylerm/khs/database/util/LegacyPlayerInfo.java similarity index 96% rename from src/main/java/net/tylermurphy/hideAndSeek/database/util/LegacyPlayerInfo.java rename to src/main/java/dev/tylerm/khs/database/util/LegacyPlayerInfo.java index 067ab0b..bbf6e55 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/util/LegacyPlayerInfo.java +++ b/src/main/java/dev/tylerm/khs/database/util/LegacyPlayerInfo.java @@ -17,7 +17,7 @@ * */ -package net.tylermurphy.hideAndSeek.database.util; +package dev.tylerm.khs.database.util; public class LegacyPlayerInfo { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/database/util/PlayerInfo.java b/src/main/java/dev/tylerm/khs/database/util/PlayerInfo.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/database/util/PlayerInfo.java rename to src/main/java/dev/tylerm/khs/database/util/PlayerInfo.java index 96fe9d8..555a954 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/database/util/PlayerInfo.java +++ b/src/main/java/dev/tylerm/khs/database/util/PlayerInfo.java @@ -17,7 +17,7 @@ * */ -package net.tylermurphy.hideAndSeek.database.util; +package dev.tylerm.khs.database.util; import java.util.UUID; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/dev/tylerm/khs/game/Board.java similarity index 96% rename from src/main/java/net/tylermurphy/hideAndSeek/game/Board.java rename to src/main/java/dev/tylerm/khs/game/Board.java index 4f6be2f..c02174b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/dev/tylerm/khs/game/Board.java @@ -1,10 +1,10 @@ -package net.tylermurphy.hideAndSeek.game; +package dev.tylerm.khs.game; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.events.Border; -import net.tylermurphy.hideAndSeek.game.events.Glow; -import net.tylermurphy.hideAndSeek.game.events.Taunt; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.game.events.Border; +import dev.tylerm.khs.game.events.Glow; +import dev.tylerm.khs.game.events.Taunt; +import dev.tylerm.khs.game.util.Status; +import dev.tylerm.khs.Main; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -13,9 +13,9 @@ import org.bukkit.scoreboard.*; import java.util.*; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Leaderboard.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Leaderboard.*; +import static dev.tylerm.khs.configuration.Localization.message; public class Board { @@ -230,7 +230,7 @@ public class Board { } public String getMapName() { - net.tylermurphy.hideAndSeek.configuration.Map map = Main.getInstance().getGame().getCurrentMap(); + dev.tylerm.khs.configuration.Map map = Main.getInstance().getGame().getCurrentMap(); if(map == null) return "Invalid"; else return map.getName(); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java b/src/main/java/dev/tylerm/khs/game/Disguiser.java similarity index 86% rename from src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java rename to src/main/java/dev/tylerm/khs/game/Disguiser.java index 351ba10..68166a3 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java +++ b/src/main/java/dev/tylerm/khs/game/Disguiser.java @@ -1,10 +1,10 @@ -package net.tylermurphy.hideAndSeek.game; +package dev.tylerm.khs.game; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.game.util.Disguise; +import dev.tylerm.khs.game.util.Disguise; +import dev.tylerm.khs.configuration.Map; import org.bukkit.Material; import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/EntityHider.java b/src/main/java/dev/tylerm/khs/game/EntityHider.java similarity index 99% rename from src/main/java/net/tylermurphy/hideAndSeek/game/EntityHider.java rename to src/main/java/dev/tylerm/khs/game/EntityHider.java index 755e89d..dc4e02f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/EntityHider.java +++ b/src/main/java/dev/tylerm/khs/game/EntityHider.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.game; +package dev.tylerm.khs.game; import static com.comphenix.protocol.PacketType.Play.Server.*; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/dev/tylerm/khs/game/Game.java similarity index 95% rename from src/main/java/net/tylermurphy/hideAndSeek/game/Game.java rename to src/main/java/dev/tylerm/khs/game/Game.java index 36e48b0..ac7e808 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/dev/tylerm/khs/game/Game.java @@ -17,19 +17,21 @@ * */ -package net.tylermurphy.hideAndSeek.game; +package dev.tylerm.khs.game; import com.cryptomorin.xseries.messages.ActionBar; import com.cryptomorin.xseries.messages.Titles; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.events.Glow; -import net.tylermurphy.hideAndSeek.game.events.Taunt; -import net.tylermurphy.hideAndSeek.game.listener.RespawnHandler; -import net.tylermurphy.hideAndSeek.game.util.*; +import dev.tylerm.khs.game.events.Glow; +import dev.tylerm.khs.game.events.Taunt; +import dev.tylerm.khs.game.listener.RespawnHandler; +import dev.tylerm.khs.game.util.CountdownDisplay; +import dev.tylerm.khs.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.WinType; import org.bukkit.*; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -38,8 +40,8 @@ import org.bukkit.inventory.ItemStack; import java.util.*; import java.util.stream.Collectors; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class Game { @@ -132,7 +134,7 @@ public class Game { currentMap.getWorldBorder().resetWorldBorder(); if (gameLength > 0) gameTimer = gameLength; status = Status.STARTING; - startingTimer = 30; + startingTimer = hidingTimer; } private void stop(WinType type) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java b/src/main/java/dev/tylerm/khs/game/PlayerLoader.java similarity index 90% rename from src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java rename to src/main/java/dev/tylerm/khs/game/PlayerLoader.java index 9c2dd37..2387388 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/PlayerLoader.java +++ b/src/main/java/dev/tylerm/khs/game/PlayerLoader.java @@ -17,13 +17,13 @@ * */ -package net.tylermurphy.hideAndSeek.game; +package dev.tylerm.khs.game; import com.cryptomorin.xseries.messages.Titles; import net.md_5.bungee.api.ChatColor; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Items; -import net.tylermurphy.hideAndSeek.configuration.Map; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Items; +import dev.tylerm.khs.configuration.Map; import org.bukkit.GameMode; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeInstance; @@ -33,8 +33,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Items.HIDER_ITEMS; +import static dev.tylerm.khs.configuration.Items.SEEKER_ITEMS; +import static dev.tylerm.khs.configuration.Localization.message; @SuppressWarnings("deprecation") public class PlayerLoader { @@ -83,8 +85,10 @@ public class PlayerLoader { loadPlayer(player); if (board.isSeeker(player)) { if (pvpEnabled) { - for(ItemStack item : Items.SEEKER_ITEMS) - player.getInventory().addItem(item); + for(int i = 0; i < 9; i++) { + if (SEEKER_ITEMS.get(i) == null) continue; + player.getInventory().setItem(i, SEEKER_ITEMS.get(i)); + } if (Items.SEEKER_HELM != null) player.getInventory().setHelmet(Items.SEEKER_HELM); if (Items.SEEKER_CHEST != null) @@ -98,8 +102,10 @@ public class PlayerLoader { player.addPotionEffect(effect); } else if (board.isHider(player)) { if (pvpEnabled) { - for(ItemStack item : Items.HIDER_ITEMS) - player.getInventory().addItem(item); + for(int i = 0; i < 9; i++) { + if (HIDER_ITEMS.get(i) == null) continue; + player.getInventory().setItem(i, HIDER_ITEMS.get(i)); + } if (Items.HIDER_HELM != null) player.getInventory().setHelmet(Items.HIDER_HELM); if (Items.HIDER_CHEST != null) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Border.java b/src/main/java/dev/tylerm/khs/game/events/Border.java similarity index 88% rename from src/main/java/net/tylermurphy/hideAndSeek/game/events/Border.java rename to src/main/java/dev/tylerm/khs/game/events/Border.java index 9f7b5bf..adcb5ce 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Border.java +++ b/src/main/java/dev/tylerm/khs/game/events/Border.java @@ -1,10 +1,10 @@ -package net.tylermurphy.hideAndSeek.game.events; +package dev.tylerm.khs.game.events; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Map; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Map; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class Border { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Glow.java b/src/main/java/dev/tylerm/khs/game/events/Glow.java similarity index 79% rename from src/main/java/net/tylermurphy/hideAndSeek/game/events/Glow.java rename to src/main/java/dev/tylerm/khs/game/events/Glow.java index dec23d7..6015f26 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Glow.java +++ b/src/main/java/dev/tylerm/khs/game/events/Glow.java @@ -1,17 +1,12 @@ -package net.tylermurphy.hideAndSeek.game.events; +package dev.tylerm.khs.game.events; -import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.wrappers.WrappedDataWatcher; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.util.packet.EntityMetadataPacket; +import dev.tylerm.khs.util.packet.EntityMetadataPacket; +import dev.tylerm.khs.Main; import org.bukkit.entity.Player; -import java.lang.reflect.InvocationTargetException; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static dev.tylerm.khs.configuration.Config.*; public class Glow { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Taunt.java b/src/main/java/dev/tylerm/khs/game/events/Taunt.java similarity index 91% rename from src/main/java/net/tylermurphy/hideAndSeek/game/events/Taunt.java rename to src/main/java/dev/tylerm/khs/game/events/Taunt.java index 191b1e7..98a9351 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Taunt.java +++ b/src/main/java/dev/tylerm/khs/game/events/Taunt.java @@ -1,6 +1,6 @@ -package net.tylermurphy.hideAndSeek.game.events; +package dev.tylerm.khs.game.events; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.World; @@ -13,9 +13,9 @@ import java.util.Optional; import java.util.Random; import java.util.UUID; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Config.tauntDelay; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Config.tauntDelay; +import static dev.tylerm.khs.configuration.Localization.message; public class Taunt { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/BlockedCommandHandler.java b/src/main/java/dev/tylerm/khs/game/listener/BlockedCommandHandler.java similarity index 75% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/BlockedCommandHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/BlockedCommandHandler.java index 7cc6dc3..f99c678 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/BlockedCommandHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/BlockedCommandHandler.java @@ -1,16 +1,16 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import static net.tylermurphy.hideAndSeek.configuration.Config.blockedCommands; -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.blockedCommands; +import static dev.tylerm.khs.configuration.Config.errorPrefix; +import static dev.tylerm.khs.configuration.Localization.message; public class BlockedCommandHandler implements Listener { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java b/src/main/java/dev/tylerm/khs/game/listener/ChatHandler.java similarity index 88% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/ChatHandler.java index d83b702..e387a92 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/ChatHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/ChatHandler.java @@ -1,6 +1,6 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java b/src/main/java/dev/tylerm/khs/game/listener/DamageHandler.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/DamageHandler.java index 7f3f22e..7111d7b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DamageHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/DamageHandler.java @@ -1,11 +1,11 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; import com.cryptomorin.xseries.XSound; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.Board; -import net.tylermurphy.hideAndSeek.game.Game; -import net.tylermurphy.hideAndSeek.game.PlayerLoader; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.Board; +import dev.tylerm.khs.game.Game; +import dev.tylerm.khs.game.PlayerLoader; +import dev.tylerm.khs.game.util.Status; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -16,8 +16,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.PlayerDeathEvent; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class DamageHandler implements Listener { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java b/src/main/java/dev/tylerm/khs/game/listener/DisguiseHandler.java similarity index 92% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/DisguiseHandler.java index 3f99d2e..5883387 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/DisguiseHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/DisguiseHandler.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; import static com.comphenix.protocol.PacketType.Play.Client.*; @@ -8,15 +8,11 @@ import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.wrappers.EnumWrappers; -import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction; import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction; -import com.cryptomorin.xseries.XSound; -import com.cryptomorin.xseries.messages.ActionBar; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.util.Disguise; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.util.Disguise; import org.bukkit.Bukkit; import org.bukkit.GameMode; -import org.bukkit.Location; import org.bukkit.attribute.Attribute; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java b/src/main/java/dev/tylerm/khs/game/listener/InteractHandler.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/InteractHandler.java index 95577ee..806b90b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InteractHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/InteractHandler.java @@ -1,12 +1,11 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.messages.ActionBar; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.Board; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.Board; +import dev.tylerm.khs.game.util.Status; import org.bukkit.ChatColor; -import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -15,16 +14,15 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import java.util.ArrayList; import java.util.List; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Config.glowPowerupItem; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Config.glowPowerupItem; +import static dev.tylerm.khs.configuration.Localization.message; @SuppressWarnings("deprecation") public class InteractHandler implements Listener { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java b/src/main/java/dev/tylerm/khs/game/listener/InventoryHandler.java similarity index 94% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/InventoryHandler.java index dd30e60..bf40896 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/InventoryHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/InventoryHandler.java @@ -17,14 +17,14 @@ * */ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; import com.cryptomorin.xseries.XMaterial; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.map.Debug; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.command.map.Debug; +import dev.tylerm.khs.configuration.Map; +import dev.tylerm.khs.configuration.Maps; +import dev.tylerm.khs.game.util.Status; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/JoinLeaveHandler.java b/src/main/java/dev/tylerm/khs/game/listener/JoinLeaveHandler.java similarity index 84% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/JoinLeaveHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/JoinLeaveHandler.java index d8534a3..2a4d9cc 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/JoinLeaveHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/JoinLeaveHandler.java @@ -1,9 +1,9 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Items; -import net.tylermurphy.hideAndSeek.game.PlayerLoader; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Items; +import dev.tylerm.khs.game.PlayerLoader; +import dev.tylerm.khs.game.util.Status; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -14,8 +14,8 @@ import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class JoinLeaveHandler implements Listener { @@ -83,12 +83,16 @@ public class JoinLeaveHandler implements Listener { } private void removeItems(Player player) { - for(ItemStack si : Items.SEEKER_ITEMS) - for(ItemStack i : player.getInventory().getContents()) + for(ItemStack si : Items.SEEKER_ITEMS) { + if (si == null) continue; + for (ItemStack i : player.getInventory().getContents()) if (si.isSimilar(i)) player.getInventory().remove(i); - for(ItemStack hi : Items.HIDER_ITEMS) - for(ItemStack i : player.getInventory().getContents()) + } + for(ItemStack hi : Items.HIDER_ITEMS) { + if (hi == null) continue; + for (ItemStack i : player.getInventory().getContents()) if (hi.isSimilar(i)) player.getInventory().remove(i); + } } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/MovementHandler.java b/src/main/java/dev/tylerm/khs/game/listener/MovementHandler.java similarity index 91% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/MovementHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/MovementHandler.java index 290b679..7d4be5b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/MovementHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/MovementHandler.java @@ -1,9 +1,9 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; import com.google.common.collect.Sets; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.game.listener.events.PlayerJumpEvent; +import dev.tylerm.khs.game.listener.events.PlayerJumpEvent; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Map; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/PlayerHandler.java b/src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java similarity index 84% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/PlayerHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java index 760f1f9..c27400a 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/PlayerHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/PlayerHandler.java @@ -1,8 +1,8 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Items; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Items; +import dev.tylerm.khs.game.util.Status; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -13,8 +13,8 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.inventory.ItemStack; -import static net.tylermurphy.hideAndSeek.configuration.Config.dropItems; -import static net.tylermurphy.hideAndSeek.configuration.Config.regenHealth; +import static dev.tylerm.khs.configuration.Config.dropItems; +import static dev.tylerm.khs.configuration.Config.regenHealth; public class PlayerHandler implements Listener { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/RespawnHandler.java b/src/main/java/dev/tylerm/khs/game/listener/RespawnHandler.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/RespawnHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/RespawnHandler.java index 951304a..0932e4c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/RespawnHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/RespawnHandler.java @@ -1,6 +1,6 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/WorldInteractHandler.java b/src/main/java/dev/tylerm/khs/game/listener/WorldInteractHandler.java similarity index 91% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/WorldInteractHandler.java rename to src/main/java/dev/tylerm/khs/game/listener/WorldInteractHandler.java index 10b8e3e..97334b2 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/WorldInteractHandler.java +++ b/src/main/java/dev/tylerm/khs/game/listener/WorldInteractHandler.java @@ -1,7 +1,7 @@ -package net.tylermurphy.hideAndSeek.game.listener; +package dev.tylerm.khs.game.listener; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.game.Board; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.game.Board; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/events/PlayerJumpEvent.java b/src/main/java/dev/tylerm/khs/game/listener/events/PlayerJumpEvent.java similarity index 96% rename from src/main/java/net/tylermurphy/hideAndSeek/game/listener/events/PlayerJumpEvent.java rename to src/main/java/dev/tylerm/khs/game/listener/events/PlayerJumpEvent.java index 49920f2..24c47b9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/listener/events/PlayerJumpEvent.java +++ b/src/main/java/dev/tylerm/khs/game/listener/events/PlayerJumpEvent.java @@ -17,7 +17,7 @@ * */ -package net.tylermurphy.hideAndSeek.game.listener.events; +package dev.tylerm.khs.game.listener.events; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/CountdownDisplay.java b/src/main/java/dev/tylerm/khs/game/util/CountdownDisplay.java similarity index 94% rename from src/main/java/net/tylermurphy/hideAndSeek/game/util/CountdownDisplay.java rename to src/main/java/dev/tylerm/khs/game/util/CountdownDisplay.java index e735af9..5292627 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/CountdownDisplay.java +++ b/src/main/java/dev/tylerm/khs/game/util/CountdownDisplay.java @@ -17,7 +17,7 @@ * */ -package net.tylermurphy.hideAndSeek.game.util; +package dev.tylerm.khs.game.util; public enum CountdownDisplay { CHAT, diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java b/src/main/java/dev/tylerm/khs/game/util/Disguise.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java rename to src/main/java/dev/tylerm/khs/game/util/Disguise.java index 17ad90c..1bc185e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java +++ b/src/main/java/dev/tylerm/khs/game/util/Disguise.java @@ -1,10 +1,10 @@ -package net.tylermurphy.hideAndSeek.game.util; +package dev.tylerm.khs.game.util; import com.cryptomorin.xseries.XSound; import com.cryptomorin.xseries.messages.ActionBar; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.util.packet.BlockChangePacket; -import net.tylermurphy.hideAndSeek.util.packet.EntityTeleportPacket; +import dev.tylerm.khs.util.packet.BlockChangePacket; +import dev.tylerm.khs.util.packet.EntityTeleportPacket; +import dev.tylerm.khs.Main; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java b/src/main/java/dev/tylerm/khs/game/util/Status.java similarity index 60% rename from src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java rename to src/main/java/dev/tylerm/khs/game/util/Status.java index 44f19b2..70035af 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Status.java +++ b/src/main/java/dev/tylerm/khs/game/util/Status.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.game.util; +package dev.tylerm.khs.game.util; public enum Status { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java b/src/main/java/dev/tylerm/khs/game/util/WinType.java similarity index 55% rename from src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java rename to src/main/java/dev/tylerm/khs/game/util/WinType.java index 24544ba..ad8bfd7 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/WinType.java +++ b/src/main/java/dev/tylerm/khs/game/util/WinType.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.game.util; +package dev.tylerm.khs.game.util; public enum WinType { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java b/src/main/java/dev/tylerm/khs/util/Location.java similarity index 94% rename from src/main/java/net/tylermurphy/hideAndSeek/util/Location.java rename to src/main/java/dev/tylerm/khs/util/Location.java index 916b6f9..658b3cc 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java +++ b/src/main/java/dev/tylerm/khs/util/Location.java @@ -1,7 +1,7 @@ -package net.tylermurphy.hideAndSeek.util; +package dev.tylerm.khs.util; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.world.VoidGenerator; +import dev.tylerm.khs.world.VoidGenerator; +import dev.tylerm.khs.Main; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; import java.io.File; -import static net.tylermurphy.hideAndSeek.configuration.Config.spawnPatch; +import static dev.tylerm.khs.configuration.Config.spawnPatch; public class Location { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java b/src/main/java/dev/tylerm/khs/util/PAPIExpansion.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java rename to src/main/java/dev/tylerm/khs/util/PAPIExpansion.java index 2d80b88..e29a098 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/PAPIExpansion.java +++ b/src/main/java/dev/tylerm/khs/util/PAPIExpansion.java @@ -1,11 +1,11 @@ -package net.tylermurphy.hideAndSeek.util; +package dev.tylerm.khs.util; import me.clip.placeholderapi.expansion.PlaceholderExpansion; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.database.Database; -import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; -import net.tylermurphy.hideAndSeek.game.Board; -import net.tylermurphy.hideAndSeek.game.util.Status; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.database.Database; +import dev.tylerm.khs.database.util.PlayerInfo; +import dev.tylerm.khs.game.Board; +import dev.tylerm.khs.game.util.Status; import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; @@ -14,8 +14,8 @@ import org.jetbrains.annotations.Nullable; import java.util.Optional; import java.util.UUID; -import static net.tylermurphy.hideAndSeek.configuration.Config.placeholderError; -import static net.tylermurphy.hideAndSeek.configuration.Config.placeholderNoData; +import static dev.tylerm.khs.configuration.Config.placeholderError; +import static dev.tylerm.khs.configuration.Config.placeholderNoData; public class PAPIExpansion extends PlaceholderExpansion { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Pair.java b/src/main/java/dev/tylerm/khs/util/Pair.java similarity index 87% rename from src/main/java/net/tylermurphy/hideAndSeek/util/Pair.java rename to src/main/java/dev/tylerm/khs/util/Pair.java index 0aad195..a650e76 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Pair.java +++ b/src/main/java/dev/tylerm/khs/util/Pair.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.util; +package dev.tylerm.khs.util; public class Pair { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Tuple.java b/src/main/java/dev/tylerm/khs/util/Tuple.java similarity index 90% rename from src/main/java/net/tylermurphy/hideAndSeek/util/Tuple.java rename to src/main/java/dev/tylerm/khs/util/Tuple.java index 5a40ff8..64ebda6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Tuple.java +++ b/src/main/java/dev/tylerm/khs/util/Tuple.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.util; +package dev.tylerm.khs.util; public class Tuple { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/AbstractPacket.java b/src/main/java/dev/tylerm/khs/util/packet/AbstractPacket.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/util/packet/AbstractPacket.java rename to src/main/java/dev/tylerm/khs/util/packet/AbstractPacket.java index 4e3fc3b..e6113ac 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/AbstractPacket.java +++ b/src/main/java/dev/tylerm/khs/util/packet/AbstractPacket.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.util.packet; +package dev.tylerm.khs.util.packet; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java b/src/main/java/dev/tylerm/khs/util/packet/BlockChangePacket.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java rename to src/main/java/dev/tylerm/khs/util/packet/BlockChangePacket.java index 53f3f9c..0603832 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/BlockChangePacket.java +++ b/src/main/java/dev/tylerm/khs/util/packet/BlockChangePacket.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.util.packet; +package dev.tylerm.khs.util.packet; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.wrappers.BlockPosition; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java b/src/main/java/dev/tylerm/khs/util/packet/EntityMetadataPacket.java similarity index 95% rename from src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java rename to src/main/java/dev/tylerm/khs/util/packet/EntityMetadataPacket.java index 051e4ae..cf5d2a1 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityMetadataPacket.java +++ b/src/main/java/dev/tylerm/khs/util/packet/EntityMetadataPacket.java @@ -1,11 +1,11 @@ -package net.tylermurphy.hideAndSeek.util.packet; +package dev.tylerm.khs.util.packet; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.wrappers.WrappedDataValue; import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedWatchableObject; -import net.tylermurphy.hideAndSeek.Main; +import dev.tylerm.khs.Main; import org.bukkit.entity.Entity; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityTeleportPacket.java b/src/main/java/dev/tylerm/khs/util/packet/EntityTeleportPacket.java similarity index 93% rename from src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityTeleportPacket.java rename to src/main/java/dev/tylerm/khs/util/packet/EntityTeleportPacket.java index b3c7734..cd29e28 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/packet/EntityTeleportPacket.java +++ b/src/main/java/dev/tylerm/khs/util/packet/EntityTeleportPacket.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.util.packet; +package dev.tylerm.khs.util.packet; import com.comphenix.protocol.PacketType; import org.bukkit.entity.Entity; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java b/src/main/java/dev/tylerm/khs/world/VoidGenerator.java similarity index 97% rename from src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java rename to src/main/java/dev/tylerm/khs/world/VoidGenerator.java index 4f9ad0d..eb972e8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java +++ b/src/main/java/dev/tylerm/khs/world/VoidGenerator.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.world; +package dev.tylerm.khs.world; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java b/src/main/java/dev/tylerm/khs/world/WorldLoader.java similarity index 94% rename from src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java rename to src/main/java/dev/tylerm/khs/world/WorldLoader.java index 821ef63..6f13548 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/WorldLoader.java +++ b/src/main/java/dev/tylerm/khs/world/WorldLoader.java @@ -1,16 +1,17 @@ -package net.tylermurphy.hideAndSeek.world; +package dev.tylerm.khs.world; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Map; +import dev.tylerm.khs.Main; +import dev.tylerm.khs.configuration.Map; import org.bukkit.Bukkit; +import org.bukkit.GameRule; import org.bukkit.World; import org.bukkit.WorldCreator; import java.io.*; import java.nio.file.Files; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; +import static dev.tylerm.khs.configuration.Config.*; +import static dev.tylerm.khs.configuration.Localization.message; public class WorldLoader { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java deleted file mode 100644 index 7da404f..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.tylermurphy.hideAndSeek.command; - -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.command.location.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.Locations; -import net.tylermurphy.hideAndSeek.util.Location; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; - -public class SetExitLocation implements ICommand { - - public void execute(Player sender, String[] args) { - LocationUtils.setLocation(sender, Locations.EXIT, null, map -> { - addToConfig("exit.x", sender.getLocation().getBlockX()); - addToConfig("exit.y", sender.getLocation().getBlockY()); - addToConfig("exit.z", sender.getLocation().getBlockZ()); - addToConfig("exit.world", sender.getLocation().getWorld().getName()); - exitPosition = Location.from(sender); - saveConfig(); - }); - } - - public String getLabel() { - return "setexit"; - } - - public String getUsage() { - return ""; - } - - public String getDescription() { - return "Sets the plugins exit location"; - } - - public List autoComplete(@NotNull String parameter, @NotNull String typed) { - return null; - } - -} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java deleted file mode 100644 index d681848..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.tylermurphy.hideAndSeek.command.map; - -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; -import java.util.stream.Collectors; - -import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; -import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - -public class Remove implements ICommand { - - public void execute(Player sender, String[] args) { - if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); - return; - } - Map map = Maps.getMap(args[0]); - if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); - } else if(!Maps.removeMap(args[0])){ - sender.sendMessage(errorPrefix + message("MAP_FAIL_DELETE").addAmount(args[0])); - } else { - sender.sendMessage(messagePrefix + message("MAP_DELETED").addAmount(args[0])); - } - } - - public String getLabel() { - return "remove"; - } - - public String getUsage() { - return ""; - } - - public String getDescription() { - return "Remove a map from the plugin!"; - } - - public List autoComplete(@NotNull String parameter, @NotNull String typed) { - if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); - } - return null; - } - -} \ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java deleted file mode 100644 index 2c05115..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.tylermurphy.hideAndSeek.command.map.set; - -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.command.util.ICommand; -import net.tylermurphy.hideAndSeek.configuration.Map; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import net.tylermurphy.hideAndSeek.game.util.Status; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - -public class Border implements ICommand { - - public void execute(Player sender, String[] args) { - if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { - sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); - return; - } - Map map = Maps.getMap(args[0]); - if(map == null) { - sender.sendMessage(errorPrefix + message("INVALID_MAP")); - return; - } - if (map.getSpawn().isNotSetup()) { - sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); - return; - } - if (args.length < 4) { - map.setWorldBorderData(0, 0, 0, 0, 0); - addToConfig("worldBorder.enabled",false); - saveConfig(); - sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE")); - map.getWorldBorder().resetWorldBorder(); - return; - } - int num,delay,change; - try { num = Integer.parseInt(args[1]); } catch (Exception e) { - sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0])); - return; - } - try { delay = Integer.parseInt(args[2]); } catch (Exception e) { - sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[1])); - return; - } - try { change = Integer.parseInt(args[3]); } catch (Exception e) { - sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[2])); - return; - } - if (num < 100) { - sender.sendMessage(errorPrefix + message("WORLDBORDER_MIN_SIZE")); - return; - } - if (change < 1) { - sender.sendMessage(errorPrefix + message("WORLDBORDER_CHANGE_SIZE")); - return; - } - map.setWorldBorderData( - sender.getLocation().getBlockX(), - sender.getLocation().getBlockZ(), - num, - delay, - change - ); - Maps.setMap(map.getName(), map); - sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change)); - map.getWorldBorder().resetWorldBorder(); - } - - public String getLabel() { - return "border"; - } - - public String getUsage() { - return " <*size> <*delay> <*move>"; - } - - public String getDescription() { - return "Sets a maps world border information"; - } - - public List autoComplete(@NotNull String parameter, @NotNull String typed) { - if(parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); - } - return Collections.singletonList(parameter); - } - -} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a514b56..522e10e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -15,6 +15,10 @@ spawnPatch: false # default: 1200 aka 20min gameLength: 1200 +# How long in seconds will the initial hiding period last, minimum is 10 seconds +# default: 30 +hidingTimer: 30 + # Announce join/leave/game over messages to people not playing the game # default: true announceMessagesToNonPlayers: true @@ -57,7 +61,7 @@ startingSeekerCount: 1 respawnAsSpectator: false # If enabled, the game will go until no hiders are left. If the timer runs out all hiders left will be marked as winning. -# If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if t here is one +# If disabled the game wll go until there is only one hider left. If the timer runs out, all hiders left win, if there is one # hider left, all inital seekers win along with the last hider. # default: true waitTillNoneLeft: true @@ -65,7 +69,7 @@ waitTillNoneLeft: true # By default, if the last hider or seeker quits the game, a win type of NONE is given, which doesnt mark anyone as winning. This can be # used as a way to prevent players form quitting in a loop to get someone else points. # default: true -dontRewardQuit: true +dontRewardQuit: false # The amount of seconds the game will wait until the players are teleported to the lobby after a game over # default: 5 @@ -73,7 +77,7 @@ endGameDelay: 5 # Along with a chat message, display a title describing the gameover # default: false -gameOverTitle: false +gameOverTitle: true # This plugin by default functions as not tag to catch Hiders, but to pvp. All players are given weapons, # and seekers slightly better weapons (this can be changed in items.yml). If you want, you can disable this diff --git a/src/main/resources/items.yml b/src/main/resources/items.yml index 682cfe4..de68cc0 100644 --- a/src/main/resources/items.yml +++ b/src/main/resources/items.yml @@ -4,7 +4,7 @@ # If pvp is disabled in config.yml, only effects will be given to players. items: seeker: - '1': + '0': material: DIAMOND_SWORD amount: 1 enchantments: @@ -13,7 +13,7 @@ items: unbreakable: true lore: - 'This is the seeker sword' - '2': + '1': material: STICK amount: 1 enchantments: @@ -22,8 +22,19 @@ items: lore: - 'It will launch people very far' - 'Use wisely!' + 'helmet': + material: LEATHER_HELMET + 'chestplate': + material: LEATHER_CHESTPLATE + 'leggings': + material: LEATHER_LEGGINGS + 'boots': + material: LEATHER_BOOTS + enchantments: + feather_falling: 4 + hider: - '1': + '0': material: STONE_SWORD amount: 1 enchantments: @@ -32,11 +43,11 @@ items: unbreakable: true lore: - 'This is the hider sword' - '2': + '1': material: SPLASH_POTION amount: 1 type: REGEN - '3': + '2': material: POTION amount: 2 type: INSTANT_HEAL @@ -55,12 +66,6 @@ effects: amplifier: 1 ambient: false particles: false - '3': - type: SLOW_FALLING - duration: 1000000 - amplifier: 1 - ambient: false - particles: false '4': type: WATER_BREATHING duration: 1000000 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 777c1ba..5e681d0 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: KenshinsHideAndSeek -main: net.tylermurphy.hideAndSeek.Main +main: dev.tylerm.khs.Main version: 1.7.5 author: KenshinEto load: STARTUP