From 3488d01acf150a07db2c59f5323bb3a55d7caeb3 Mon Sep 17 00:00:00 2001 From: Wanbin Cao <93872019+Lagggpixel@users.noreply.github.com> Date: Wed, 24 Apr 2024 22:44:51 +0100 Subject: [PATCH] Updated to be compatible with API update (#65) * Bump version from 2.0.8-SNAPSHOT0 to 2.0.8-SNAPSHOT1 * Updated minigames box dependency version Took 28 seconds * Bump version from 2.0.8-SNAPSHOT1 to 2.0.8-SNAPSHOT2 * Updated to be compatible with API changes * Bump version from 2.0.8-SNAPSHOT2 to 2.0.8-SNAPSHOT3 * Update build.gradle.kts --------- Co-authored-by: version-bump[github-action] <41898282+version-bump[github-action]@users.noreply.github.com> Co-authored-by: Tigerpanzer_02 <37453987+Tigerpanzer02@users.noreply.github.com> --- build.gradle.kts | 4 +- .../java/plugily/projects/thebridge/Main.java | 13 +---- .../api/events/game/TBRoundResetEvent.java | 2 +- .../api/events/game/TBRoundStartEvent.java | 2 +- .../player/TBPlayerChooseBaseEvent.java | 2 +- .../projects/thebridge/arena/Arena.java | 8 +-- .../projects/thebridge/arena/ArenaEvents.java | 34 ++++++------ .../thebridge/arena/ArenaManager.java | 14 ++--- .../thebridge/arena/ArenaRegistry.java | 7 +-- .../arena/managers/ScoreboardManager.java | 10 ++-- .../thebridge/arena/states/StartingState.java | 4 +- .../boot/AdditionalValueInitializer.java | 4 +- .../boot/PlaceholderInitializer.java | 54 +++++++++---------- .../arguments/game/SelectBaseArgument.java | 6 +-- .../thebridge/events/PluginEvents.java | 8 ++- 15 files changed, 81 insertions(+), 91 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 37799470..bf88eb40 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,14 +17,14 @@ repositories { } dependencies { - implementation("plugily.projects:MiniGamesBox-Classic:1.3.7") { isTransitive = false } + implementation("plugily.projects:MiniGamesBox-Classic:1.3.8-SNAPSHOT1") { isTransitive = false } compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT") compileOnly("org.jetbrains:annotations:24.0.1") } group = "plugily.projects" -version = "2.0.8-SNAPSHOT0" +version = "2.0.8-SNAPSHOT3" description = "TheBridge" java { diff --git a/src/main/java/plugily/projects/thebridge/Main.java b/src/main/java/plugily/projects/thebridge/Main.java index ec261a94..637d275d 100644 --- a/src/main/java/plugily/projects/thebridge/Main.java +++ b/src/main/java/plugily/projects/thebridge/Main.java @@ -1,12 +1,10 @@ package plugily.projects.thebridge; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.java.JavaPluginLoader; import org.jetbrains.annotations.TestOnly; +import plugily.projects.minigamesbox.api.kit.IKit; import plugily.projects.minigamesbox.classic.PluginMain; import plugily.projects.minigamesbox.classic.handlers.setup.SetupInventory; import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginSetupCategoryManager; -import plugily.projects.minigamesbox.classic.kits.basekits.Kit; import plugily.projects.minigamesbox.classic.utils.services.metrics.Metrics; import plugily.projects.thebridge.arena.*; import plugily.projects.thebridge.arena.base.BaseMenuHandler; @@ -18,11 +16,9 @@ import plugily.projects.thebridge.handlers.setup.SetupCategoryManager; import plugily.projects.thebridge.kits.KitUtils; -import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; -import java.util.stream.Collectors; /** * Created by Tigerpanzer_02 on 13.03.2022 @@ -39,11 +35,6 @@ public Main() { super(); } - @TestOnly - protected Main(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) { - super(loader, description, dataFolder, file); - } - @Override public void onEnable() { long start = System.currentTimeMillis(); @@ -102,7 +93,7 @@ public void addKits() { getKitRegistry().setHandleItem((player, item) -> KitUtils.handleItem(this, player, item)); getKitRegistry().registerKits(optionalConfigurations); getDebugger().debug(Level.INFO, "Kits loaded: "); - for (Kit kit : getKitRegistry().getKits()) { + for (IKit kit : getKitRegistry().getKits()) { getDebugger().debug(kit.getName()); } diff --git a/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundResetEvent.java b/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundResetEvent.java index 5ba2ed80..2b3051de 100644 --- a/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundResetEvent.java +++ b/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundResetEvent.java @@ -1,7 +1,7 @@ package plugily.projects.thebridge.api.events.game; import org.bukkit.event.HandlerList; -import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent; +import plugily.projects.minigamesbox.api.events.PlugilyEvent; import plugily.projects.thebridge.arena.Arena; public class TBRoundResetEvent extends PlugilyEvent { diff --git a/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundStartEvent.java b/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundStartEvent.java index 85caa631..2d5f9314 100644 --- a/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundStartEvent.java +++ b/src/main/java/plugily/projects/thebridge/api/events/game/TBRoundStartEvent.java @@ -1,7 +1,7 @@ package plugily.projects.thebridge.api.events.game; import org.bukkit.event.HandlerList; -import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent; +import plugily.projects.minigamesbox.api.events.PlugilyEvent; import plugily.projects.thebridge.arena.Arena; /** diff --git a/src/main/java/plugily/projects/thebridge/api/events/player/TBPlayerChooseBaseEvent.java b/src/main/java/plugily/projects/thebridge/api/events/player/TBPlayerChooseBaseEvent.java index f31ab5cb..b209cedf 100644 --- a/src/main/java/plugily/projects/thebridge/api/events/player/TBPlayerChooseBaseEvent.java +++ b/src/main/java/plugily/projects/thebridge/api/events/player/TBPlayerChooseBaseEvent.java @@ -22,7 +22,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; -import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent; +import plugily.projects.minigamesbox.api.events.PlugilyEvent; import plugily.projects.thebridge.arena.Arena; import plugily.projects.thebridge.arena.base.Base; diff --git a/src/main/java/plugily/projects/thebridge/arena/Arena.java b/src/main/java/plugily/projects/thebridge/arena/Arena.java index 6bda5f6a..f8b03506 100644 --- a/src/main/java/plugily/projects/thebridge/arena/Arena.java +++ b/src/main/java/plugily/projects/thebridge/arena/Arena.java @@ -28,7 +28,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.Nullable; -import plugily.projects.minigamesbox.classic.arena.ArenaState; +import plugily.projects.minigamesbox.api.arena.IArenaState; import plugily.projects.minigamesbox.classic.arena.PluginArena; import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; import plugily.projects.minigamesbox.classic.utils.dimensional.Cuboid; @@ -79,9 +79,9 @@ public Arena(String id) { setScoreboardManager(new ScoreboardManager(this)); mapRestorerManager = new MapRestorerManager(this); setMapRestorerManager(mapRestorerManager); - addGameStateHandler(ArenaState.IN_GAME, new InGameState()); - addGameStateHandler(ArenaState.RESTARTING, new RestartingState()); - addGameStateHandler(ArenaState.STARTING, new StartingState()); + addGameStateHandler(IArenaState.IN_GAME, new InGameState()); + addGameStateHandler(IArenaState.RESTARTING, new RestartingState()); + addGameStateHandler(IArenaState.STARTING, new StartingState()); } public static void init(Main plugin) { diff --git a/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java b/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java index 5a86f9b3..18a6a471 100644 --- a/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java +++ b/src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java @@ -32,14 +32,14 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerMoveEvent; -import plugily.projects.minigamesbox.classic.arena.ArenaState; -import plugily.projects.minigamesbox.classic.arena.PluginArena; +import plugily.projects.minigamesbox.api.arena.IArenaState; +import plugily.projects.minigamesbox.api.arena.IPluginArena; +import plugily.projects.minigamesbox.api.user.IUser; import plugily.projects.minigamesbox.classic.arena.PluginArenaEvents; import plugily.projects.minigamesbox.classic.arena.PluginArenaUtils; import plugily.projects.minigamesbox.classic.handlers.items.SpecialItem; import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; import plugily.projects.minigamesbox.classic.handlers.language.TitleBuilder; -import plugily.projects.minigamesbox.classic.user.User; import plugily.projects.minigamesbox.classic.utils.dimensional.Cuboid; import plugily.projects.minigamesbox.classic.utils.version.VersionUtils; import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyEntityPickupItemEvent; @@ -82,7 +82,7 @@ public void onNaturalRegeneration(EntityRegainHealthEvent event) { if(arena == null) { return; } - if(arena.getArenaState() != ArenaState.IN_GAME) { + if(arena.getArenaState() != IArenaState.IN_GAME) { return; } if (event.getRegainReason() == EntityRegainHealthEvent.RegainReason.SATIATED || @@ -99,7 +99,7 @@ public void onBlockBreakEvent(BlockBreakEvent event) { if(arena == null) { return; } - if(arena.getArenaState() != ArenaState.IN_GAME) { + if(arena.getArenaState() != IArenaState.IN_GAME) { return; } if(!canBuild(arena, player, event.getBlock().getLocation())) { @@ -139,7 +139,7 @@ public void onBuild(BlockPlaceEvent event) { if(arena == null) { return; } - if(arena.getArenaState() != ArenaState.IN_GAME) { + if(arena.getArenaState() != IArenaState.IN_GAME) { return; } if(!canBuild(arena, player, event.getBlock().getLocation())) { @@ -219,7 +219,7 @@ public void onHit(EntityDamageByEntityEvent event) { return; } Arena arena = plugin.getArenaRegistry().getArena(victim); - if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) { + if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) { return; } if(plugin.getUserManager().getUser(attacker).isSpectator()) { @@ -254,7 +254,7 @@ public void onPlayerMove(PlayerMoveEvent event) { if(arena == null) { return; } - if(arena.getArenaState() != ArenaState.IN_GAME) { + if(arena.getArenaState() != IArenaState.IN_GAME) { return; } if(arena.isResetRound() && !plugin.getUserManager().getUser(player).isSpectator()) { @@ -396,7 +396,7 @@ public void onDeath(PlayerDeathEvent event) { if(arena == null) { return; } - if(arena.getArenaState() != ArenaState.IN_GAME) { + if(arena.getArenaState() != IArenaState.IN_GAME) { return; } event.setDroppedExp(0); @@ -406,7 +406,7 @@ public void onDeath(PlayerDeathEvent event) { private void playerDeath(Player player, Arena arena) { - User user = plugin.getUserManager().getUser(player); + IUser user = plugin.getUserManager().getUser(player); arena.resetPlayer(player); switch(arena.getArenaState()) { case STARTING: @@ -455,15 +455,15 @@ private void playerDeath(Player player, Arena arena) { } } - private void modeDeathHandle(Player player, Arena arena, User user) { + private void modeDeathHandle(Player player, Arena arena, IUser user) { if(arena.getMode() == Arena.Mode.HEARTS) { // if mode hearts and they are out it should set spec mode for them if(arena.getBase(player).getPoints() >= arena.getArenaOption("MODE_VALUE")) { user.setSpectator(true); ArenaUtils.hidePlayer(player, arena); player.getInventory().clear(); - if(arena.getArenaState() != ArenaState.ENDING - && arena.getArenaState() != ArenaState.RESTARTING) { + if(arena.getArenaState() != IArenaState.ENDING + && arena.getArenaState() != IArenaState.RESTARTING) { arena.addDeathPlayer(player); } List players = arena.getBase(player).getPlayers(); @@ -478,7 +478,7 @@ private void modeDeathHandle(Player player, Arena arena, User user) { @Override public boolean additionalFallDamageRules( - Player victim, PluginArena arena, EntityDamageEvent event) { + Player victim, IPluginArena arena, EntityDamageEvent event) { Arena pluginArena = plugin.getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return false; @@ -491,7 +491,7 @@ public boolean additionalFallDamageRules( } @Override - public void handleIngameVoidDeath(Player victim, PluginArena arena) { + public void handleIngameVoidDeath(Player victim, IPluginArena arena) { Arena pluginArena = plugin.getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return; @@ -505,7 +505,7 @@ public void onBowShot(EntityShootBowEvent event) { if(!(event.getEntity() instanceof Player)) { return; } - User user = plugin.getUserManager().getUser((Player) event.getEntity()); + IUser user = plugin.getUserManager().getUser((Player) event.getEntity()); Arena pluginArena = plugin.getArenaRegistry().getArena(user.getPlayer()); if(pluginArena == null) { return; @@ -614,7 +614,7 @@ public void onItemMove(InventoryClickEvent event) { if(event.getWhoClicked() instanceof Player && plugin.getArenaRegistry().isInArena((Player) event.getWhoClicked())) { if(plugin.getArenaRegistry().getArena(((Player) event.getWhoClicked())).getArenaState() - != ArenaState.IN_GAME) { + != IArenaState.IN_GAME) { if(event.getClickedInventory() == event.getWhoClicked().getInventory()) { if(event.getView().getType() == InventoryType.CRAFTING || event.getView().getType() == InventoryType.PLAYER) { diff --git a/src/main/java/plugily/projects/thebridge/arena/ArenaManager.java b/src/main/java/plugily/projects/thebridge/arena/ArenaManager.java index be7a4980..2c04b062 100644 --- a/src/main/java/plugily/projects/thebridge/arena/ArenaManager.java +++ b/src/main/java/plugily/projects/thebridge/arena/ArenaManager.java @@ -20,8 +20,8 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import plugily.projects.minigamesbox.classic.arena.ArenaState; -import plugily.projects.minigamesbox.classic.arena.PluginArena; +import plugily.projects.minigamesbox.api.arena.IArenaState; +import plugily.projects.minigamesbox.api.arena.IPluginArena; import plugily.projects.minigamesbox.classic.arena.PluginArenaManager; import plugily.projects.thebridge.Main; import plugily.projects.thebridge.arena.base.Base; @@ -42,7 +42,7 @@ public ArenaManager(Main plugin) { } @Override - public void additionalPartyJoin(Player player, PluginArena arena, Player partyLeader) { + public void additionalPartyJoin(Player player, IPluginArena arena, Player partyLeader) { Arena pluginArena = plugin.getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return; @@ -59,7 +59,7 @@ public void additionalPartyJoin(Player player, PluginArena arena, Player partyLe } @Override - public void leaveAttempt(@NotNull Player player, @NotNull PluginArena arena) { + public void leaveAttempt(@NotNull Player player, @NotNull IPluginArena arena) { Arena pluginArena = plugin.getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return; @@ -68,8 +68,8 @@ public void leaveAttempt(@NotNull Player player, @NotNull PluginArena arena) { if(pluginArena.isDeathPlayer(player)) { pluginArena.removeDeathPlayer(player); } - if(arena.getArenaState() != ArenaState.WAITING_FOR_PLAYERS - && arena.getArenaState() != ArenaState.STARTING + if(arena.getArenaState() != IArenaState.WAITING_FOR_PLAYERS + && arena.getArenaState() != IArenaState.STARTING && (arena.getPlayers().size() <= 1 || (arena.getPlayers().size() <= arena.getArenaOption("BASE_PLAYER_SIZE") && pluginArena.getBases().stream() @@ -82,7 +82,7 @@ public void leaveAttempt(@NotNull Player player, @NotNull PluginArena arena) { } @Override - public void stopGame(boolean quickStop, @NotNull PluginArena arena) { + public void stopGame(boolean quickStop, @NotNull IPluginArena arena) { Arena pluginArena = plugin.getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return; diff --git a/src/main/java/plugily/projects/thebridge/arena/ArenaRegistry.java b/src/main/java/plugily/projects/thebridge/arena/ArenaRegistry.java index 5f0c6c2e..b62ab324 100644 --- a/src/main/java/plugily/projects/thebridge/arena/ArenaRegistry.java +++ b/src/main/java/plugily/projects/thebridge/arena/ArenaRegistry.java @@ -22,6 +22,7 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import plugily.projects.minigamesbox.api.arena.IPluginArena; import plugily.projects.minigamesbox.classic.arena.PluginArena; import plugily.projects.minigamesbox.classic.arena.PluginArenaRegistry; import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; @@ -132,7 +133,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre @Override public @Nullable Arena getArena(Player player) { - PluginArena pluginArena = super.getArena(player); + IPluginArena pluginArena = super.getArena(player); if(pluginArena instanceof Arena) { return (Arena) pluginArena; } @@ -141,7 +142,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre @Override public @Nullable Arena getArena(String id) { - PluginArena pluginArena = super.getArena(id); + IPluginArena pluginArena = super.getArena(id); if(pluginArena instanceof Arena) { return (Arena) pluginArena; } @@ -150,7 +151,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre public @NotNull List getPluginArenas() { List arenas = new ArrayList<>(); - for(PluginArena pluginArena : super.getArenas()) { + for(IPluginArena pluginArena : super.getArenas()) { if(pluginArena instanceof Arena) { arenas.add((Arena) pluginArena); } diff --git a/src/main/java/plugily/projects/thebridge/arena/managers/ScoreboardManager.java b/src/main/java/plugily/projects/thebridge/arena/managers/ScoreboardManager.java index ffb65402..8b9567d1 100644 --- a/src/main/java/plugily/projects/thebridge/arena/managers/ScoreboardManager.java +++ b/src/main/java/plugily/projects/thebridge/arena/managers/ScoreboardManager.java @@ -18,11 +18,11 @@ package plugily.projects.thebridge.arena.managers; -import plugily.projects.minigamesbox.classic.arena.ArenaState; +import plugily.projects.minigamesbox.api.arena.IArenaState; +import plugily.projects.minigamesbox.api.user.IUser; import plugily.projects.minigamesbox.classic.arena.PluginArena; import plugily.projects.minigamesbox.classic.arena.managers.PluginScoreboardManager; import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; -import plugily.projects.minigamesbox.classic.user.User; import plugily.projects.minigamesbox.classic.utils.scoreboard.common.EntryBuilder; import plugily.projects.minigamesbox.classic.utils.scoreboard.type.Entry; import plugily.projects.thebridge.arena.Arena; @@ -46,10 +46,10 @@ public ScoreboardManager(PluginArena arena) { } @Override - public List formatScoreboard(User user) { + public List formatScoreboard(IUser user) { EntryBuilder builder = new EntryBuilder(); List lines; - if(user.getArena().getArenaState() == ArenaState.FULL_GAME) { + if(user.getArena().getArenaState() == IArenaState.FULL_GAME) { lines = user.getArena() .getPlugin() @@ -85,7 +85,7 @@ public List formatScoreboard(User user) { return builder.build(); } - public String formatBase(Base base, User user) { + public String formatBase(Base base, IUser user) { Arena pluginArena = (Arena) arena.getPlugin().getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return ""; diff --git a/src/main/java/plugily/projects/thebridge/arena/states/StartingState.java b/src/main/java/plugily/projects/thebridge/arena/states/StartingState.java index 18f5ad7f..c3ed2dd2 100644 --- a/src/main/java/plugily/projects/thebridge/arena/states/StartingState.java +++ b/src/main/java/plugily/projects/thebridge/arena/states/StartingState.java @@ -19,9 +19,9 @@ package plugily.projects.thebridge.arena.states; import org.bukkit.entity.Player; +import plugily.projects.minigamesbox.api.user.IUser; import plugily.projects.minigamesbox.classic.arena.PluginArena; import plugily.projects.minigamesbox.classic.arena.states.PluginStartingState; -import plugily.projects.minigamesbox.classic.user.User; import plugily.projects.thebridge.arena.Arena; import plugily.projects.thebridge.arena.base.Base; @@ -50,7 +50,7 @@ public void handleCall(PluginArena arena) { if(arena.getTimer() == 0 || arena.isForceStart()) { arenaStart = true; for(Player player : arena.getPlayers()) { - User user = arena.getPlugin().getUserManager().getUser(player); + IUser user = arena.getPlugin().getUserManager().getUser(player); user.resetNonePersistentStatistics(); // get base with min players Base minPlayers = diff --git a/src/main/java/plugily/projects/thebridge/boot/AdditionalValueInitializer.java b/src/main/java/plugily/projects/thebridge/boot/AdditionalValueInitializer.java index 4a1ab7c5..fbb958bb 100644 --- a/src/main/java/plugily/projects/thebridge/boot/AdditionalValueInitializer.java +++ b/src/main/java/plugily/projects/thebridge/boot/AdditionalValueInitializer.java @@ -1,5 +1,6 @@ package plugily.projects.thebridge.boot; +import plugily.projects.minigamesbox.api.preferences.IConfigPreferences; import plugily.projects.minigamesbox.classic.api.StatisticType; import plugily.projects.minigamesbox.classic.api.StatsStorage; import plugily.projects.minigamesbox.classic.arena.options.ArenaOption; @@ -10,7 +11,6 @@ import plugily.projects.minigamesbox.classic.handlers.reward.RewardType; import plugily.projects.minigamesbox.classic.handlers.reward.RewardsFactory; import plugily.projects.minigamesbox.classic.preferences.ConfigOption; -import plugily.projects.minigamesbox.classic.preferences.ConfigPreferences; import plugily.projects.thebridge.Main; /** @@ -91,7 +91,7 @@ private void registerArenaOptions() { getArenaOptionManager().registerArenaOption("RESET_TIME", new ArenaOption("null", 5)); } - private ConfigPreferences getConfigPreferences() { + private IConfigPreferences getConfigPreferences() { return plugin.getConfigPreferences(); } diff --git a/src/main/java/plugily/projects/thebridge/boot/PlaceholderInitializer.java b/src/main/java/plugily/projects/thebridge/boot/PlaceholderInitializer.java index 194d07ba..9b21ee7f 100644 --- a/src/main/java/plugily/projects/thebridge/boot/PlaceholderInitializer.java +++ b/src/main/java/plugily/projects/thebridge/boot/PlaceholderInitializer.java @@ -2,7 +2,7 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; -import plugily.projects.minigamesbox.classic.arena.PluginArena; +import plugily.projects.minigamesbox.api.arena.IPluginArena; import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder; import plugily.projects.minigamesbox.classic.handlers.placeholder.Placeholder; import plugily.projects.minigamesbox.classic.handlers.placeholder.PlaceholderManager; @@ -28,17 +28,17 @@ private void registerPlaceholders() { getPlaceholderManager().registerPlaceholder(new Placeholder("option_mode", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getMode(arena); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return getMode(arena); } @Nullable - private String getMode(PluginArena arena) { + private String getMode(IPluginArena arena) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -52,17 +52,17 @@ private String getMode(PluginArena arena) { getPlaceholderManager().registerPlaceholder(new Placeholder("base_color", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getBaseValue(arena, player); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return ""; } @Nullable - private String getBaseValue(PluginArena arena, Player player) { + private String getBaseValue(IPluginArena arena, Player player) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -76,17 +76,17 @@ private String getBaseValue(PluginArena arena, Player player) { getPlaceholderManager().registerPlaceholder(new Placeholder("base_color_formatted", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getBaseValue(arena, player); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return ""; } @Nullable - private String getBaseValue(PluginArena arena, Player player) { + private String getBaseValue(IPluginArena arena, Player player) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -100,17 +100,17 @@ private String getBaseValue(PluginArena arena, Player player) { getPlaceholderManager().registerPlaceholder(new Placeholder("summary_winner_base", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getSummary(arena); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return getSummary(arena); } @Nullable - private String getSummary(PluginArena arena) { + private String getSummary(IPluginArena arena) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -124,17 +124,17 @@ private String getSummary(PluginArena arena) { getPlaceholderManager().registerPlaceholder(new Placeholder("summary_winner_base_players", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getSummary(arena); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return getSummary(arena); } @Nullable - private String getSummary(PluginArena arena) { + private String getSummary(IPluginArena arena) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -160,17 +160,17 @@ private String getSummary(PluginArena arena) { }); getPlaceholderManager().registerPlaceholder(new Placeholder("summary_base_scored", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getSummary(arena); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return getSummary(arena); } @Nullable - private String getSummary(PluginArena arena) { + private String getSummary(IPluginArena arena) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -189,17 +189,17 @@ private String getSummary(PluginArena arena) { getPlaceholderManager().registerPlaceholder(new Placeholder("summary_player", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getSummary(arena, player); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return ""; } @Nullable - private String getSummary(PluginArena arena, Player player) { + private String getSummary(IPluginArena arena, Player player) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -219,7 +219,7 @@ private String getSummary(PluginArena arena, Player player) { getPlaceholderManager().registerPlaceholder(new Placeholder("option_reset_blocks_in", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; @@ -228,24 +228,24 @@ public String getValue(PluginArena arena) { } @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getValue(arena); } }); getPlaceholderManager().registerPlaceholder(new Placeholder("summary", Placeholder.PlaceholderType.ARENA, Placeholder.PlaceholderExecutor.ALL) { @Override - public String getValue(Player player, PluginArena arena) { + public String getValue(Player player, IPluginArena arena) { return getSummary(arena); } @Override - public String getValue(PluginArena arena) { + public String getValue(IPluginArena arena) { return getSummary(arena); } @Nullable - private String getSummary(PluginArena arena) { + private String getSummary(IPluginArena arena) { Arena pluginArena = getArenaRegistry().getArena(arena.getId()); if(pluginArena == null) { return null; diff --git a/src/main/java/plugily/projects/thebridge/commands/arguments/game/SelectBaseArgument.java b/src/main/java/plugily/projects/thebridge/commands/arguments/game/SelectBaseArgument.java index fdb6adab..f9ca88bd 100644 --- a/src/main/java/plugily/projects/thebridge/commands/arguments/game/SelectBaseArgument.java +++ b/src/main/java/plugily/projects/thebridge/commands/arguments/game/SelectBaseArgument.java @@ -21,7 +21,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import plugily.projects.minigamesbox.classic.arena.ArenaState; +import plugily.projects.minigamesbox.api.arena.IArenaState; import plugily.projects.minigamesbox.classic.commands.arguments.data.CommandArgument; import plugily.projects.thebridge.arena.Arena; import plugily.projects.thebridge.commands.arguments.ArgumentsRegistry; @@ -44,8 +44,8 @@ public void execute(CommandSender sender, String[] args) { } Arena arena = (Arena) registry.getPlugin().getArenaRegistry().getArena((Player) sender); if(arena != null) { - if(arena.getArenaState() == ArenaState.WAITING_FOR_PLAYERS - || arena.getArenaState() == ArenaState.STARTING) + if(arena.getArenaState() == IArenaState.WAITING_FOR_PLAYERS + || arena.getArenaState() == IArenaState.STARTING) arena.getPlugin().getBaseMenuHandler().createMenu((Player) sender, arena); } } diff --git a/src/main/java/plugily/projects/thebridge/events/PluginEvents.java b/src/main/java/plugily/projects/thebridge/events/PluginEvents.java index c08beeb9..4252610c 100644 --- a/src/main/java/plugily/projects/thebridge/events/PluginEvents.java +++ b/src/main/java/plugily/projects/thebridge/events/PluginEvents.java @@ -19,19 +19,17 @@ package plugily.projects.thebridge.events; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.potion.PotionEffectType; -import plugily.projects.minigamesbox.classic.arena.ArenaState; +import plugily.projects.minigamesbox.api.arena.IArenaState; import plugily.projects.minigamesbox.classic.utils.version.VersionUtils; import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial; import plugily.projects.thebridge.Main; @@ -76,7 +74,7 @@ public void onAppleConsume(PlayerItemConsumeEvent event) { public void onBlockBreakEvent(BlockBreakEvent event) { if (plugin.getArenaRegistry().isInArena(event.getPlayer()) && plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState() - != ArenaState.IN_GAME) { + != IArenaState.IN_GAME) { event.setCancelled(true); } } @@ -86,7 +84,7 @@ public void onBlockBreakEvent(BlockBreakEvent event) { public void onBuild(BlockPlaceEvent event) { if (plugin.getArenaRegistry().isInArena(event.getPlayer()) && plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState() - != ArenaState.IN_GAME) { + != IArenaState.IN_GAME) { event.setCancelled(true); } }