Skip to content

#patch Quality Updates and 1.21.5 pre update #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
25 changes: 20 additions & 5 deletions .github/building/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>plugily.projects</groupId>
<artifactId>minigamesbox</artifactId>
<version>1.3.17-SNAPSHOT4</version>
<version>1.4.0-SNAPSHOT0</version>
<packaging>pom</packaging>

<modules>
Expand Down Expand Up @@ -101,21 +101,32 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.14.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.0</version>
<version>3.21.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.9.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.12</version>
<configuration>
<append>true</append>
</configuration>
Expand Down Expand Up @@ -153,8 +164,12 @@

<distributionManagement>
<repository>
<id>plugily-projects</id>
<id>Release</id>
<url>https://maven.plugily.xyz/releases</url>
</repository>
<snapshotRepository>
<id>Snapshot</id>
<url>https://maven.plugily.xyz/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
4 changes: 2 additions & 2 deletions MiniGamesBox API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.0</version>
<version>1.4.0-SNAPSHOT7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>13.0.0</version>
<version>13.2.0</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface IPluginScoreboardManager {
/**
* Get Lines from the language.yml according to arena state
*/
List<String> getScoreboardLines();
List<String> getScoreboardLines(Player player);

/**
* Update lines with defined placeholders
Expand Down
4 changes: 2 additions & 2 deletions MiniGamesBox Classic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.0</version>
<version>1.4.0-SNAPSHOT7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -87,7 +87,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>13.0.0</version>
<version>13.2.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ private boolean canJoinArenaAndMessage(Player player, IPluginArena arena) {
return false;
}
String perm = plugin.getPluginNamePrefixLong() + ".join.<arena>";
plugin.getDebugger().debug("[{0}] Initial perm is <{1}> of name <{2}>", arena.getId(), perm, plugin.getPluginNamePrefixLong());
if(!(player.hasPermission(perm.replace("<arena>", "*")) || player.hasPermission(perm.replace("<arena>", arena.getId())))) {
MessageBuilder denyMessage = new MessageBuilder("IN_GAME_JOIN_NO_PERMISSION").asKey().player(player).value(perm.replace("<arena>", arena.getId()));
if(plugin.getConfigPreferences().getOption("BUNGEEMODE")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,20 @@ public void createScoreboard(IUser user) {
FastBoard board = new FastBoard(player) {
@Override
public boolean hasLinesMaxLength() {
if(Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) {
try {
return Via.getAPI().getPlayerVersion(getPlayer()) < ProtocolVersion.v1_13.getVersion();
} catch(Exception ignored) {
//Not using ViaVersion 4 or unable to get ViaVersion return LegacyBoard!
}
}
return !ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_13);
return isLinesMaxLength(getPlayer());
}
};

board.updateTitle(boardTitle);
board.updateLines(formatScoreboardLines(getScoreboardLines(), player));
board.updateLines(formatScoreboardLines(getScoreboardLines(player), player));


boardMap.put(user.getUniqueId(), board);
}

@Override
public void updateScoreboards() {
boardMap.values().forEach(fastBoard -> fastBoard.updateLines(formatScoreboardLines(getScoreboardLines(), fastBoard.getPlayer())));
boardMap.values().forEach(fastBoard -> fastBoard.updateLines(formatScoreboardLines(getScoreboardLines(fastBoard.getPlayer()), fastBoard.getPlayer())));
}

@Override
Expand All @@ -93,18 +86,36 @@ public void stopAllScoreboards() {
}

@Override
public List<String> getScoreboardLines() {
public List<String> getScoreboardLines(Player player) {
return new ArrayList<>(plugin.getLanguageManager().getLanguageList(arena.getArenaState() == IArenaState.FULL_GAME ? "Scoreboard.Content.Starting"
: "Scoreboard.Content." + arena.getArenaState().getFormattedName()));
}

@Override
public List<String> formatScoreboardLines(List<String> lines, Player player) {
List<String> formattedLines = new ArrayList<>();
if(isLinesMaxLength(player)) {
List<String> linesWithoutSpecialChars = new ArrayList<>();
for(String line : lines) {
linesWithoutSpecialChars.add(line.replace("■ ", "").replace("|", ""));
}
lines = linesWithoutSpecialChars;
}
for(String line : lines) {
formattedLines.add(new MessageBuilder(line).player(player).arena(arena).build());
}
return formattedLines;
}

private boolean isLinesMaxLength(Player player) {
if(Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) {
try {
return Via.getAPI().getPlayerVersion(player) < ProtocolVersion.v1_13.getVersion();
} catch(Exception ignored) {
//Not using ViaVersion 4 or unable to get ViaVersion return LegacyBoard!
}
}
return !ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_13);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ private void printLeaderboard(CommandSender sender, IStatisticType statisticType
}

private String formatMessage(String statisticName, String playerName, int position, int value) {
String message = new MessageBuilder("LEADERBOARD_TYPE_CHAT_TOP_FORMAT").asKey().build();
String message = new MessageBuilder("LEADERBOARD_TYPE_CHAT_TOP_FORMAT").asKey().getRaw();
message = message.replace("%number%", Integer.toString(position));
message = message.replace("%player%", playerName);
message = message.replace("%value%", Integer.toString(value));
message = message.replace("%user_statistic%", statisticName);
message = new MessageBuilder(message).build();
return message;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ public void updateHologram() {
String text;
if(i < reverseKeys.size()) {
UUID uuid = reverseKeys.get(i);
text = new MessageBuilder("LEADERBOARD_TYPE_HOLOGRAM_FORMAT").asKey().integer(i + 1).value(String.valueOf(values.get(uuid))).build();
text = new MessageBuilder("LEADERBOARD_TYPE_HOLOGRAM_FORMAT").asKey().integer(i + 1).value(String.valueOf(values.get(uuid))).getRaw();
text = text.replace("%player%", getPlayerNameSafely(uuid));
text = new MessageBuilder(text).build();
} else {
text = new MessageBuilder("LEADERBOARD_TYPE_HOLOGRAM_EMPTY_FORMAT").asKey().integer(i + 1).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,21 @@ public MessageBuilder prefix(String prefix) {

public MessageBuilder player(Player player) {
this.player = player;
colorChatIssue();
formatPlayer();
return this;
}

public MessageBuilder value(String value) {
this.value = value;
colorChatIssue();
formatValue();
return this;
}

public MessageBuilder integer(int integer) {
this.integer = integer;
colorChatIssue();
formatInteger();
return this;
}
Expand All @@ -138,6 +141,7 @@ public MessageBuilder arena(IPluginArena arena) {
return this;
}
this.arena = arena;
colorChatIssue();
formatArena();
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void addItems(NormalFastInv gui) {
CountItem minimumPlayers = new CountItem(setupInventory, new ItemBuilder(XMaterial.COAL.parseMaterial()), "Minimum Players", "How many players are needed to start the lobby countdown?", "minimumplayers");
itemList.add(minimumPlayers);
gui.setItem((getInventoryLine() * 9) + 1, minimumPlayers);
// could be added minimum players check
CountItem maximumPlayers = new CountItem(setupInventory, new ItemBuilder(XMaterial.REDSTONE_BLOCK.parseMaterial()), "Maximum Players", "How many players can the arena hold?", "maximumplayers");
itemList.add(maximumPlayers);
gui.setItem((getInventoryLine() * 9) + 2, maximumPlayers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public class ConfigOption implements IConfigOption {


options.put("EXTERNAL_PARTIES", new ConfigOption("Parties.External", true, true));
options.put("PARTIES", new ConfigOption("Parties.Own", false, true));
//todo not implemented yet!!!
options.put("OWN_PARTIES", new ConfigOption("Parties.Own", false, true));
options.put("FALL_DAMAGE", new ConfigOption("Damage.Fall", false, true));
options.put("DROWNING_DAMAGE", new ConfigOption("Damage.Drowning", false, true));
options.put("FIRE_DAMAGE", new ConfigOption("Damage.Fire", false, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,6 @@ public static boolean saveInventoryToFile(JavaPlugin plugin, Player player) {

FileConfiguration invConfig = YamlConfiguration.loadConfiguration(invFile);

invConfig.set("ExperienceProgress", player.getExp());
invConfig.set("ExperienceLevel", player.getLevel());
invConfig.set("Current health", player.getHealth());
invConfig.set("Food", player.getFoodLevel());
invConfig.set("Saturation", player.getSaturation());
invConfig.set("Fire ticks", player.getFireTicks());
invConfig.set("GameMode", player.getGameMode().name());
invConfig.set("Allow flight", player.getAllowFlight());
invConfig.set("Flight speed", player.getFlySpeed());
invConfig.set("Walk speed", player.getWalkSpeed());

invConfig.set("Size", inventory.getSize());
invConfig.set("Max stack size", inventory.getMaxStackSize());
Collection<PotionEffect> activeEffects = player.getActivePotionEffects();
List<String> activePotions = new ArrayList<>(activeEffects.size());

double maxHealth = VersionUtils.getMaxHealth(player);

for(PotionEffect potion : activeEffects) {
activePotions.add(potion.getType().getName() + "#" + potion.getDuration() + "#" + potion.getAmplifier());
if(potion.getType().equals(XPotion.HEALTH_BOOST.getPotionEffectType())) {
// Health boost effect gives +2 hearts per level, health is counted in half hearts so amplifier * 4
maxHealth -= (potion.getAmplifier() + 1) * 4;
}
}
invConfig.set("Active potion effects", activePotions);
invConfig.set("Max health", maxHealth);

org.bukkit.entity.HumanEntity holder = inventory.getHolder();
if(holder instanceof Player) {
invConfig.set("Holder", holder.getName());
}

ItemStack[] invContents = inventory.getContents();
for(int i = 0; i < invContents.length; i++) {
ItemStack itemInInv = invContents[i];
Expand Down Expand Up @@ -136,6 +103,7 @@ public static boolean saveInventoryToFile(JavaPlugin plugin, Player player) {

if(ServerVersion.Version.isCurrentEqualOrHigher(ServerVersion.Version.v1_9)) {
invConfig.set("Offhand", inventory.getItemInOffHand());
inventory.setItemInOffHand(null);
}

ItemStack[] armorContents = inventory.getArmorContents();
Expand All @@ -146,6 +114,43 @@ public static boolean saveInventoryToFile(JavaPlugin plugin, Player player) {
}
}

inventory.clear();
inventory.setArmorContents(null);


invConfig.set("ExperienceProgress", player.getExp());
invConfig.set("ExperienceLevel", player.getLevel());
invConfig.set("Current health", player.getHealth());
invConfig.set("Food", player.getFoodLevel());
invConfig.set("Saturation", player.getSaturation());
invConfig.set("Fire ticks", player.getFireTicks());
invConfig.set("GameMode", player.getGameMode().name());
invConfig.set("Allow flight", player.getAllowFlight());
invConfig.set("Flight speed", player.getFlySpeed());
invConfig.set("Walk speed", player.getWalkSpeed());

invConfig.set("Size", inventory.getSize());
invConfig.set("Max stack size", inventory.getMaxStackSize());
Collection<PotionEffect> activeEffects = player.getActivePotionEffects();
List<String> activePotions = new ArrayList<>(activeEffects.size());

double maxHealth = VersionUtils.getMaxHealth(player);

for(PotionEffect potion : activeEffects) {
activePotions.add(potion.getType().getName() + "#" + potion.getDuration() + "#" + potion.getAmplifier());
if(potion.getType().equals(XPotion.HEALTH_BOOST.getPotionEffectType())) {
// Health boost effect gives +2 hearts per level, health is counted in half hearts so amplifier * 4
maxHealth -= (potion.getAmplifier() + 1) * 4;
}
}
invConfig.set("Active potion effects", activePotions);
invConfig.set("Max health", maxHealth);

org.bukkit.entity.HumanEntity holder = inventory.getHolder();
if(holder instanceof Player) {
invConfig.set("Holder", holder.getName());
}

invConfig.save(invFile);
plugin.getLogger().log(Level.INFO, "Saved inventory of {0}", player.getName());
return true;
Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.0</version>
<version>1.4.0-SNAPSHOT7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.0</version>
<version>1.4.0-SNAPSHOT7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading