Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ deploy webhooks to print changelog successfully

That's all, matcher will stop when detects next line started with `###` match

## 5.0.15 Release (03.05.2025)
* Allowing by default 20 places placeholder for summary list
* Check if OPTIONS_MENU item is still in builders inventory and readd it if necessary
* Fixed IllegalArgumentException on PlotSelector, also switched to PaginatedInventory to support all Plots
* Added filter to maxplayers/random join team / solo so that only the correct arenas are selected
* Updated Minigamesbox to 1.4.1

### 5.0.14 Release (13.03.2025)
* Changed plot distribution on team mode tries to create only full plots now
* Fixed plot distribution in same cases lets spectators into the plot as member
Expand Down
12 changes: 5 additions & 7 deletions .github/building/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<groupId>plugily.projects</groupId>
<artifactId>buildbattle</artifactId>
<version>5.0.13-SNAPSHOT5</version>
<version>5.0.14-SNAPSHOT1</version>
<name>BuildBattle</name>

<properties>
Expand All @@ -51,17 +51,13 @@
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>citizens-repo</id>
<url>http://repo.citizensnpcs.co/</url>
<url>https://repo.citizensnpcs.co/</url>
</repository>
</repositories>

Expand All @@ -82,7 +78,7 @@
<dependency>
<groupId>plugily.projects</groupId>
<artifactId>MiniGamesBox-Classic</artifactId>
<version>1.3.17-SNAPSHOT12</version>
<version>1.4.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down Expand Up @@ -115,6 +111,7 @@
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -160,6 +157,7 @@
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<groupId>plugily.projects</groupId>
<artifactId>buildbattle</artifactId>
<version>5.0.14</version>
<version>5.0.14-SNAPSHOT8</version>
<name>BuildBattle</name>

<properties>
Expand Down Expand Up @@ -78,7 +78,7 @@
<dependency>
<groupId>plugily.projects</groupId>
<artifactId>MiniGamesBox-Classic</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down Expand Up @@ -111,6 +111,7 @@
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ public ScoreboardManager(PluginArena arena) {
}

@Override
public List<String> formatScoreboardLines(List<String> lines, Player player) {
List<String> changedLines = new ArrayList<>();

switch (arena.getArenaState()) {
public List<String> getScoreboardLines(Player player) {
List<String> lines;
switch(arena.getArenaState()) {
case IN_GAME: {
if(arena instanceof GuessArena) {
lines = arena.getPlugin().getLanguageManager().getLanguageList("Scoreboard.Content." + arena.getArenaState().getFormattedName() + ".Guess-The-Build" + (((GuessArena) arena).getArenaInGameState() == BaseArena.ArenaInGameState.PLOT_VOTING ? "-Waiting" : ""));
Expand All @@ -70,16 +69,9 @@ public List<String> formatScoreboardLines(List<String> lines, Player player) {
break;
}
default: {
lines = arena.getPlugin().getLanguageManager().getLanguageList(arena.getArenaState() == IArenaState.FULL_GAME ? "Scoreboard.Content.Starting"
: "Scoreboard.Content." + arena.getArenaState().getFormattedName());

lines = super.getScoreboardLines(player);
}
}

for(String line : lines) {
changedLines.add(new MessageBuilder(line).player(player).arena(arena).build());
}
return changedLines;
return lines;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
import plugily.projects.minigamesbox.inventory.common.item.SimpleClickableItem;
import plugily.projects.minigamesbox.inventory.normal.NormalFastInv;
import plugily.projects.minigamesbox.inventory.utils.fastinv.InventoryScheme;
import plugily.projects.minigamesbox.inventory.utils.fastinv.PaginatedFastInv;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -79,10 +81,22 @@ private ItemStack getItemStack(Plot plot, int maxPlotMembers, Player player) {
}

public void createMenu(Player player, BaseArena arena) {
NormalFastInv gui = new NormalFastInv(plugin.getBukkitHelper().serializeInt(arena.getPlotManager().getPlots().size()), new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME").asKey().build());
PaginatedFastInv gui = new PaginatedFastInv(27, new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_MENU_NAME").asKey().build());
new InventoryScheme()
.mask(" 1111111 ")
.mask(" 1111111 ")
.bindPagination('1').apply(gui);


int plots = 0;
int arenaPlotMemberSize = arena.getArenaOption("PLOT_MEMBER_SIZE");

gui.previousPageItem(20, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name("<- " + p + "/" + gui.lastPage()).build());
gui.nextPageItem(24, p -> new ItemBuilder(XMaterial.ARROW.parseItem()).name(p + "/" + gui.lastPage() + " ->").build());

gui.setItem(22, new ItemBuilder(XMaterial.BARRIER.parseItem()).name("X").build(),
e -> e.getWhoClicked().closeInventory());

for(Plot plot : arena.getPlotManager().getPlots()) {
ItemStack itemStack = getItemStack(plot, arenaPlotMemberSize, player);
int plotMemberSize = plot.getMembersSize();
Expand Down Expand Up @@ -127,7 +141,7 @@ public void createMenu(Player player, BaseArena arena) {
});

int finalPlots = plots;
gui.addItem(new SimpleClickableItem(itemStack, event -> {
gui.addContent(itemStack, event -> {
event.setCancelled(true);

if(!(event.isLeftClick() || event.isRightClick())) {
Expand All @@ -143,7 +157,7 @@ public void createMenu(Player player, BaseArena arena) {

new MessageBuilder("IN_GAME_MESSAGES_PLOT_SELECTOR_PLOT_CHOOSE").asKey().player(player).integer(finalPlots).sendPlayer();
event.getWhoClicked().closeInventory();
}));
});

plots++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ public void handleCall(PluginArena arena) {
break;
case BUILD_TIME:
handleBuildTime(pluginArena);
handleOptionsMenu(pluginArena);
if(arena.getTimer() <= 0) {
for(Player player : pluginArena.getPlayersLeft()) {
IUser user = getPlugin().getUserManager().getUser(player);

if(user.isSpectator()) continue;

Plot playerPlot = pluginArena.getPlotFromPlayer(player);
if(!pluginArena.getQueue().contains(playerPlot)) {
pluginArena.getQueue().add(playerPlot);
Expand Down Expand Up @@ -198,6 +197,15 @@ private void handleBuildTime(BuildArena pluginArena) {
pluginArena.checkPlayerOutSidePlot();
}

private void handleOptionsMenu(BuildArena pluginArena) {
if(pluginArena.getTimer() % 10 != 0) {
return;
}
for(Player player : pluginArena.getPlayersLeft()) {
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU").setItem(player);
}
}

private void handlePlotVoting(BuildArena pluginArena) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import plugily.projects.buildbattle.arena.BaseArena;
import plugily.projects.buildbattle.arena.BuildArena;
import plugily.projects.buildbattle.arena.GuessArena;
import plugily.projects.buildbattle.arena.managers.plots.Plot;
import plugily.projects.buildbattle.handlers.themes.BBTheme;
Expand Down Expand Up @@ -102,6 +103,7 @@ public void handleCall(PluginArena arena) {
}
//}
handleBuildTime(pluginArena);
handleOptionsMenu(pluginArena);
break;
case PLOT_VOTING:
if(pluginArena.getRound() + 1 > pluginArena.getPlotList().size() * pluginArena.getArenaOption("GTB_ROUNDS_PER_PLOT")) {
Expand Down Expand Up @@ -189,6 +191,15 @@ private void forceSetTheme(GuessArena pluginArena) {
setChosenTheme(pluginArena, getThemeByDifficulty(pluginArena, difficulty));
}

private void handleOptionsMenu(GuessArena pluginArena) {
if(pluginArena.getTimer() % 10 != 0) {
return;
}
for(Player player : pluginArena.getCurrentBuilders()) {
pluginArena.getPlugin().getSpecialItemManager().getSpecialItem("OPTIONS_MENU").setItem(player);
}
}

private void setChosenTheme(GuessArena pluginArena, BBTheme bbTheme) {
setTheme(pluginArena, bbTheme);
pluginArena.getCurrentBuilders().forEach(HumanEntity::closeInventory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ private String getSummary(IPluginArena arena) {
return null;
}
int places = pluginArena.getPlotManager().getTopPlotsOrder().size();
if(places > 16) {
places = 16;
if(places > 20) {
places = 20;
}
StringBuilder placeSummary = new StringBuilder();
for(int i = 1; i <= places; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package plugily.projects.buildbattle.commands.arguments;

import plugily.projects.buildbattle.Main;
import plugily.projects.buildbattle.arena.BaseArena;
import plugily.projects.buildbattle.arena.BuildArena;
import plugily.projects.buildbattle.arena.GuessArena;
import plugily.projects.buildbattle.commands.arguments.admin.ThemeArgument;
Expand Down Expand Up @@ -63,10 +64,13 @@ public List<IPluginArena> getSpecificFilteredArenas(List<IPluginArena> arenas, S
case "guessthebuild":
case "guess_the_build":
return arenas.stream().filter(GuessArena.class::isInstance).collect(Collectors.toList());
case "team":
return arenas.stream().filter(BuildArena.class::isInstance).filter(arena -> ((BuildArena) arena).getArenaType().equals(BaseArena.ArenaType.TEAM)).collect(Collectors.toList());
case "classic":
case "solo":
case "team":
default:
return arenas.stream().filter(BuildArena.class::isInstance).filter(arena -> ((BuildArena) arena).getArenaType().equals(BaseArena.ArenaType.SOLO)).collect(Collectors.toList());
case "build":
default:
return arenas.stream().filter(BuildArena.class::isInstance).collect(Collectors.toList());
}
}
Expand Down
Loading