From 000219a5ff183e469129e5804d0a6090d6b47b26 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 30 Jul 2023 18:12:47 -0400 Subject: [PATCH] 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