Skip to content

Commit

Permalink
Updated to be compatible with API update (#65)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
3 people authored Apr 24, 2024
1 parent 1d2794a commit 3488d01
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 91 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 2 additions & 11 deletions src/main/java/plugily/projects/thebridge/Main.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/plugily/projects/thebridge/arena/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ||
Expand All @@ -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())) {
Expand Down Expand Up @@ -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())) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
Expand All @@ -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:
Expand Down Expand Up @@ -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<Player> players = arena.getBase(player).getPlayers();
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/plugily/projects/thebridge/arena/ArenaManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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()
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -150,7 +151,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre

public @NotNull List<Arena> getPluginArenas() {
List<Arena> arenas = new ArrayList<>();
for(PluginArena pluginArena : super.getArenas()) {
for(IPluginArena pluginArena : super.getArenas()) {
if(pluginArena instanceof Arena) {
arenas.add((Arena) pluginArena);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,10 +46,10 @@ public ScoreboardManager(PluginArena arena) {
}

@Override
public List<Entry> formatScoreboard(User user) {
public List<Entry> formatScoreboard(IUser user) {
EntryBuilder builder = new EntryBuilder();
List<String> lines;
if(user.getArena().getArenaState() == ArenaState.FULL_GAME) {
if(user.getArena().getArenaState() == IArenaState.FULL_GAME) {
lines =
user.getArena()
.getPlugin()
Expand Down Expand Up @@ -85,7 +85,7 @@ public List<Entry> 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 "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 =
Expand Down
Loading

0 comments on commit 3488d01

Please sign in to comment.