Skip to content

Commit

Permalink
#patch API update and minor improvements (#84)
Browse files Browse the repository at this point in the history
* Bump version from 5.0.6 to 5.0.6-SNAPSHOT0

* feat: added new API compatibility

* feat: optimised scoreboard

* feat: added allowing disabling of super votes
https://github.com/Sowgro

* Bump version from 5.0.6-SNAPSHOT0 to 5.0.6-SNAPSHOT1

---------

Co-authored-by: version-bump[github-action] <41898282+version-bump[github-action]@users.noreply.github.com>
  • Loading branch information
Lagggpixel and version-bump[github-action] authored Jun 21, 2024
1 parent 980defa commit ecc34b0
Show file tree
Hide file tree
Showing 24 changed files with 178 additions and 170 deletions.
8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
*
* BuildBattle - Ultimate building competition minigame
Expand Down Expand Up @@ -38,14 +39,15 @@ repositories {
}

dependencies {
implementation("plugily.projects:MiniGamesBox-Classic:1.3.7") { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
implementation("plugily.projects:MiniGamesBox-Classic:1.3.9") { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("net.citizensnpcs:citizensapi:2.0.31-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
}

group = "plugily.projects"
version = "5.0.6"
version = "5.0.6-SNAPSHOT1"
description = "BuildBattle"

java {
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/plugily/projects/buildbattle/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

package plugily.projects.buildbattle;

import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.jetbrains.annotations.TestOnly;
import plugily.projects.buildbattle.arena.ArenaEvents;
import plugily.projects.buildbattle.arena.ArenaManager;
Expand All @@ -43,8 +41,6 @@
import plugily.projects.minigamesbox.classic.handlers.setup.categories.PluginSetupCategoryManager;
import plugily.projects.minigamesbox.classic.utils.services.metrics.Metrics;

import java.io.File;

/**
* Created by Tom on 17/08/2015.
* Updated by Tigerpanzer_02 on 03.12.2021
Expand All @@ -66,11 +62,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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.bukkit.event.HandlerList;
import plugily.projects.buildbattle.arena.GuessArena;
import plugily.projects.buildbattle.handlers.themes.BBTheme;
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
import plugily.projects.minigamesbox.api.events.PlugilyEvent;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.bukkit.event.HandlerList;
import plugily.projects.buildbattle.arena.BaseArena;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
import plugily.projects.minigamesbox.api.events.PlugilyEvent;

public class PlotPlayerChooseEvent extends PlugilyEvent implements Cancellable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.bukkit.event.HandlerList;
import plugily.projects.buildbattle.arena.BaseArena;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
import plugily.projects.minigamesbox.api.events.PlugilyEvent;

/**
* @author Plajer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.bukkit.event.HandlerList;
import plugily.projects.buildbattle.arena.BaseArena;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
import plugily.projects.minigamesbox.classic.api.event.PlugilyEvent;
import plugily.projects.minigamesbox.api.events.PlugilyEvent;

/**
* @author Plajer
Expand Down
42 changes: 21 additions & 21 deletions src/main/java/plugily/projects/buildbattle/arena/ArenaEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
import org.bukkit.inventory.ItemStack;
import plugily.projects.buildbattle.Main;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
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.PluginArenaEvents;
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
Expand Down Expand Up @@ -74,7 +74,7 @@ public void onBreak(BlockBreakEvent event) {
if(arena == null) {
return;
}
if(arena.getArenaState() != ArenaState.IN_GAME || (arena instanceof BuildArena && arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING)
if(arena.getArenaState() != IArenaState.IN_GAME || (arena instanceof BuildArena && arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING)
|| plugin.getBlacklistManager().getItemList().contains(event.getBlock().getType())) {
event.setCancelled(true);
return;
Expand All @@ -95,7 +95,7 @@ public void onPlace(BlockPlaceEvent event) {
if(arena == null) {
return;
}
if(arena.getArenaState() != ArenaState.IN_GAME || plugin.getBlacklistManager().getItemList().contains(event.getBlock().getType())
if(arena.getArenaState() != IArenaState.IN_GAME || plugin.getBlacklistManager().getItemList().contains(event.getBlock().getType())
|| (arena instanceof BuildArena && arena.getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING)) {
event.setCancelled(true);
return;
Expand All @@ -119,7 +119,7 @@ public void onItemFrameRotate(PlayerInteractEntityEvent event) {
if(event.getRightClicked().getType() == EntityType.ITEM_FRAME && ((ItemFrame) event.getRightClicked()).getItem().getType() != Material.AIR) {
Location entityLocation = event.getRightClicked().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand All @@ -146,7 +146,7 @@ public void onNPCClick(PlugilyPlayerInteractEntityEvent event) {

BaseArena arena = plugin.getArenaRegistry().getArena(event.getPlayer());

if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) {
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
return;
}

Expand Down Expand Up @@ -204,7 +204,7 @@ public void onEnderchestClick(PlugilyPlayerInteractEvent event) {
return;
}

if(arena.getArenaState() != ArenaState.IN_GAME || event.getClickedBlock().getType() == XMaterial.ENDER_CHEST.parseMaterial()) {
if(arena.getArenaState() != IArenaState.IN_GAME || event.getClickedBlock().getType() == XMaterial.ENDER_CHEST.parseMaterial()) {
event.setCancelled(true);
}
}
Expand All @@ -215,7 +215,7 @@ public void onMinecartMove(VehicleMoveEvent event) {
if(vehicle.getType() != EntityType.MINECART) {
return;
}
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand All @@ -232,7 +232,7 @@ public void onMinecartMove(VehicleMoveEvent event) {
public void onIgniteEvent(BlockIgniteEvent event) {
Location blockLocation = event.getBlock().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand All @@ -248,7 +248,7 @@ public void onIgniteEvent(BlockIgniteEvent event) {
public void onPistonRetractEvent(BlockPistonRetractEvent event) {
Location blockLocation = event.getBlock().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand All @@ -266,7 +266,7 @@ public void onPistonRetractEvent(BlockPistonRetractEvent event) {
public void onLeavesDecay(LeavesDecayEvent event) {
Location blockLocation = event.getBlock().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand Down Expand Up @@ -301,7 +301,7 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
int maxMobPerPlot = plugin.getConfig().getInt("Mob.Max-Amount", 20);
Location entityLoc = event.getEntity().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand Down Expand Up @@ -353,7 +353,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
if(event.getSource().getType() != Material.FIRE)
return;

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand All @@ -373,7 +373,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
public void onDispense(BlockDispenseEvent event) {
Location blockLoc = event.getBlock().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand Down Expand Up @@ -409,7 +409,7 @@ public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
return;
}
BaseArena arena = plugin.getArenaRegistry().getArena((Player) event.getEntity());
if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) {
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
return;
}
if(event.getEntity().getType() != EntityType.PLAYER) {
Expand All @@ -424,7 +424,7 @@ public void onDamage(EntityDamageEvent event) {
return;
}
BaseArena arena = plugin.getArenaRegistry().getArena((Player) event.getEntity());
if(arena == null || arena.getArenaState() != ArenaState.IN_GAME) {
if(arena == null || arena.getArenaState() != IArenaState.IN_GAME) {
return;
}
event.setCancelled(true);
Expand Down Expand Up @@ -455,7 +455,7 @@ public void onTNTInteract(PlugilyPlayerInteractEvent event) {
public void onTNTExplode(EntityExplodeEvent event) {
Location entityLocation = event.getEntity().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand All @@ -473,7 +473,7 @@ public void onWaterFlowEvent(BlockFromToEvent event) {
Location toBlock = event.getToBlock().getLocation();
Location blockLoc = event.getBlock().getLocation();

for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand Down Expand Up @@ -507,7 +507,7 @@ public void onFoodChange(FoodLevelChangeEvent event) {
@EventHandler
public void onPistonExtendEvent(BlockPistonExtendEvent event) {
Location blockLoc = event.getBlock().getLocation();
for(PluginArena arena : plugin.getArenaRegistry().getArenas()) {
for(IPluginArena arena : plugin.getArenaRegistry().getArenas()) {
if(!(arena instanceof BaseArena)) {
continue;
}
Expand Down Expand Up @@ -548,7 +548,7 @@ public void onItemMove(InventoryClickEvent event) {
if(humanEntity instanceof Player) {
BaseArena baseArena = plugin.getArenaRegistry().getArena((Player) humanEntity);

if(baseArena != null && baseArena.getArenaState() != ArenaState.IN_GAME) {
if(baseArena != null && baseArena.getArenaState() != IArenaState.IN_GAME) {
if(event.getClickedInventory() == humanEntity.getInventory()) {
if(event.getView().getType() == InventoryType.CRAFTING
|| event.getView().getType() == InventoryType.PLAYER) {
Expand All @@ -566,7 +566,7 @@ public void onGTBGuessChat(AsyncPlayerChatEvent event) {
if(!(arena instanceof GuessArena)) {
return;
}
if(arena.getArenaState() != ArenaState.IN_GAME) {
if(arena.getArenaState() != IArenaState.IN_GAME) {
return;
}
if(arena.getSpectators().contains(player)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import org.jetbrains.annotations.NotNull;
import plugily.projects.buildbattle.Main;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
import plugily.projects.minigamesbox.classic.arena.ArenaState;
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.PluginArena;
import plugily.projects.minigamesbox.classic.arena.PluginArenaManager;
import plugily.projects.minigamesbox.classic.user.User;
Expand All @@ -45,7 +47,7 @@ public ArenaManager(Main plugin) {
}

@Override
public void additionalPartyJoin(Player player, PluginArena arena, Player partyLeader) {
public void additionalPartyJoin(Player player, IPluginArena arena, Player partyLeader) {
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
if(pluginArena == null) {
return;
Expand All @@ -67,13 +69,13 @@ 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) {
BaseArena pluginArena = plugin.getArenaRegistry().getArena(arena.getId());
if(pluginArena == null) {
return;
}
super.leaveAttempt(player, arena);
User user = plugin.getUserManager().getUser(player);
IUser user = plugin.getUserManager().getUser(player);
user.setStatistic("LOCAL_POINTS", 0);
user.setStatistic("LOCAL_POINTS_GTB", 0);
Plot plot = pluginArena.getPlotManager().getPlot(player);
Expand All @@ -91,7 +93,7 @@ public void leaveAttempt(@NotNull Player player, @NotNull PluginArena arena) {
((GuessArena) arena).getWhoGuessed().remove(player);
if(guessArena.getCurrentBuilders().contains(player)) {
if(plot.getMembers().isEmpty()) {
if(arena.getArenaState() == ArenaState.IN_GAME) {
if(arena.getArenaState() == IArenaState.IN_GAME) {
//ToDo message force skipped
pluginArena.setTimer(plugin.getConfig().getInt("Time-Manager." + pluginArena.getArenaType().getPrefix() + ".Round-Delay"), true);
pluginArena.setArenaInGameState(BaseArena.ArenaInGameState.PLOT_VOTING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jetbrains.annotations.Nullable;
import plugily.projects.buildbattle.Main;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
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 @@ -156,7 +157,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre

@Override
public @Nullable BaseArena getArena(Player player) {
PluginArena pluginArena = super.getArena(player);
IPluginArena pluginArena = super.getArena(player);
if(pluginArena instanceof BaseArena) {
return (BaseArena) pluginArena;
}
Expand All @@ -165,7 +166,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre

@Override
public @Nullable BaseArena getArena(String id) {
PluginArena pluginArena = super.getArena(id);
IPluginArena pluginArena = super.getArena(id);
if(pluginArena instanceof BaseArena) {
return (BaseArena) pluginArena;
}
Expand All @@ -174,7 +175,7 @@ public boolean additionalValidatorChecks(ConfigurationSection section, PluginAre

public @NotNull List<BaseArena> getPluginArenas() {
List<BaseArena> baseArenas = new ArrayList<>(super.getArenas().size());
for(PluginArena pluginArena : super.getArenas()) {
for(IPluginArena pluginArena : super.getArenas()) {
if(pluginArena instanceof BaseArena) {
baseArenas.add((BaseArena) pluginArena);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import plugily.projects.buildbattle.arena.states.build.StartingState;
import plugily.projects.buildbattle.handlers.themes.vote.VoteMenu;
import plugily.projects.buildbattle.handlers.themes.vote.VotePoll;
import plugily.projects.minigamesbox.classic.arena.ArenaState;
import plugily.projects.minigamesbox.api.arena.IArenaState;

import java.util.*;

Expand All @@ -44,8 +44,8 @@ public class BuildArena extends BaseArena {
public BuildArena(String id) {
super(id);
setArenaType(ArenaType.SOLO);
addGameStateHandler(ArenaState.IN_GAME, new InGameState());
addGameStateHandler(ArenaState.STARTING, new StartingState());
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
addGameStateHandler(IArenaState.STARTING, new StartingState());
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import plugily.projects.buildbattle.arena.states.guess.InGameState;
import plugily.projects.buildbattle.arena.states.guess.StartingState;
import plugily.projects.buildbattle.handlers.themes.BBTheme;
import plugily.projects.minigamesbox.classic.arena.ArenaState;
import plugily.projects.minigamesbox.api.arena.IArenaState;
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;

Expand Down Expand Up @@ -60,8 +60,8 @@ public class GuessArena extends BaseArena {
public GuessArena(String id) {
super(id);
setArenaType(ArenaType.GUESS_THE_BUILD);
addGameStateHandler(ArenaState.IN_GAME, new InGameState());
addGameStateHandler(ArenaState.STARTING, new StartingState());
addGameStateHandler(IArenaState.IN_GAME, new InGameState());
addGameStateHandler(IArenaState.STARTING, new StartingState());
getPlugin().getDebugger().debug("Init Arena {0} with ArenaType {1}", getId(), getArenaType());
}

Expand Down
Loading

0 comments on commit ecc34b0

Please sign in to comment.