Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0c55d53
Version 1.23.0
tastybento Apr 5, 2026
c824533
Update BlockListenerTest2 to assert no exceptions are thrown during e…
tastybento Apr 6, 2026
955381b
Refactor OneBlocksManager and PhasesPanel for improved readability an…
tastybento Apr 6, 2026
f0d8bc7
Fix description formatting in PhasesPanel to correctly handle pipe ch…
tastybento Apr 6, 2026
b1e6985
Add no-op implementations for setDifficulty and setResetEpoch in test…
tastybento Apr 6, 2026
2b0ad28
Update API version to 3.14.0 in addon.yml
tastybento Apr 6, 2026
8c007f6
Implement translation key handling using Adventure Components in Chec…
tastybento Apr 6, 2026
f6f120c
Downgrade API version to 3.13.0 in addon.yml
tastybento Apr 6, 2026
59fc0a2
Initial plan
Copilot Apr 6, 2026
ef97465
Initial plan
Copilot Apr 6, 2026
cc1b5e1
Revert CheckPhase.java to use user.sendMessage() directly instead of …
Copilot Apr 6, 2026
7f19977
chore: update BentoBox Maven dependency to 3.13.0 for MiniMessage sup…
Copilot Apr 6, 2026
af015f4
Merge pull request #486 from BentoBoxWorld/copilot/sub-pr-484-again
tastybento Apr 6, 2026
5123896
Fix broken tests: restore showTitle() Adventure API in CheckPhase (no…
Copilot Apr 6, 2026
06a5bee
Fix InfoListenerTest: verify via lm.get() instead of deprecated spigo…
Copilot Apr 6, 2026
7d14d50
Remove obsolete testOnInfo from InfoListenerTest
tastybento Apr 7, 2026
976f3af
Merge branch 'develop' into copilot/sub-pr-484
tastybento Apr 7, 2026
b69a5f7
Merge pull request #485 from BentoBoxWorld/copilot/sub-pr-484
tastybento Apr 7, 2026
878e732
Update src/main/java/world/bentobox/aoneblock/panels/PhasesPanel.java
tastybento Apr 7, 2026
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<mockito.version>5.11.0</mockito.version>
<mock-bukkit.version>v1.21-SNAPSHOT</mock-bukkit.version>
<!-- More visible way how to change dependency versions -->
<bentobox.version>3.10.0</bentobox.version>
<bentobox.version>3.13.0</bentobox.version>
<items-adder.version>4.0.10</items-adder.version>
<nexo.version>1.8.0</nexo.version>
<level.version>2.6.2</level.version>
Expand All @@ -66,7 +66,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.22.1</build.version>
<build.version>1.23.0</build.version>
<!-- SonarCloud -->
<sonar.projectKey>BentoBoxWorld_AOneBlock</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.Title;

import world.bentobox.aoneblock.AOneBlock;
import world.bentobox.aoneblock.dataobjects.OneBlockIslands;
import world.bentobox.aoneblock.oneblocks.OneBlockPhase;
Expand Down Expand Up @@ -82,7 +85,7 @@ void setNewPhase(@Nullable Player player, @NonNull Island i, @NonNull OneBlockIs
// Set the phase name
is.setPhaseName(newPhaseName);
if (user.isPlayer() && user.isOnline() && addon.inWorld(user.getWorld())) {
user.getPlayer().sendTitle(newPhaseName, null, -1, -1, -1);
user.getPlayer().showTitle(Title.title(Component.text(newPhaseName), Component.empty()));
}
// Run phase start commands
Util.runCommands(user,
Expand Down
147 changes: 87 additions & 60 deletions src/main/java/world/bentobox/aoneblock/oneblocks/OneBlocksManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -790,71 +790,98 @@ public double getPercentageDone(@NonNull OneBlockIslands obi) {
}

public void getProbs(OneBlockPhase phase) {
// Find the phase after this one
Integer blockNum = Integer.valueOf(phase.getBlockNumber());
Integer nextKey = blockProbs.ceilingKey(blockNum + 1);
if (nextKey != null) {
// This is the size of the phase in blocks
int phaseSize = nextKey - blockNum;
int blockTotal = phase.getBlockTotal();
int likelyChestTotal = 0;
double totalBlocks = 0;
// Now calculate the relative block probability
for (Entry<Material, Integer> en : phase.getBlocks().entrySet()) {
double chance = (double) en.getValue() / blockTotal;
double likelyNumberGenerated = chance * phaseSize;
totalBlocks += likelyNumberGenerated;
String report = en.getKey() + " likely generated = " + Math.round(likelyNumberGenerated) + " = "
+ Math.round(likelyNumberGenerated * 100 / phaseSize) + "%";
if (likelyNumberGenerated < 1) {
addon.logWarning(report);
} else {
addon.log(report);
}
if (en.getKey().equals(Material.CHEST)) {
likelyChestTotal = (int) Math.round(likelyNumberGenerated);
}
}
addon.log("Total blocks generated = " + totalBlocks);
// Get the specific chest probability
if (likelyChestTotal == 0) {
addon.logWarning("No chests will be generated");
return;
}
addon.log("**** A total of " + likelyChestTotal + " chests will be generated ****");
// Now calculate chest chances
double lastChance = 0;
for (Entry<Double, Rarity> en : OneBlockPhase.CHEST_CHANCES.entrySet()) {
// Get the number of chests in this rarity group
int num = phase.getChestsMap().getOrDefault(en.getValue(), Collections.emptyList()).size();
double likelyNumberGenerated = (en.getKey() - lastChance) * likelyChestTotal;
lastChance = en.getKey();
String report = num + " " + en.getValue() + " chests in phase. Likely number generated = "
+ Math.round(likelyNumberGenerated);
if (num > 0 && likelyNumberGenerated < 1) {
addon.logWarning(report);
} else {
addon.log(report);
}
if (nextKey == null) {
return;
}
int phaseSize = nextKey - blockNum;
int likelyChestTotal = logBlockProbs(phase, phaseSize);
if (likelyChestTotal == 0) {
addon.logWarning("No chests will be generated");
return;
}
addon.log("**** A total of " + likelyChestTotal + " chests will be generated ****");
logChestProbs(phase, likelyChestTotal);
logMobProbs(phase, phaseSize);
}

/**
* Logs the probability report for each block type in the phase.
*
* @param phase - the phase to report on
* @param phaseSize - total number of blocks in the phase
* @return the likely number of CHEST blocks that will be generated
*/
private int logBlockProbs(OneBlockPhase phase, int phaseSize) {
int blockTotal = phase.getBlockTotal();
int likelyChestTotal = 0;
double totalBlocks = 0;
for (Entry<Material, Integer> en : phase.getBlocks().entrySet()) {
double likelyNumberGenerated = (double) en.getValue() / blockTotal * phaseSize;
totalBlocks += likelyNumberGenerated;
logReport(en.getKey() + " likely generated = " + Math.round(likelyNumberGenerated) + " = "
+ Math.round(likelyNumberGenerated * 100 / phaseSize) + "%", likelyNumberGenerated);
if (en.getKey().equals(Material.CHEST)) {
likelyChestTotal = (int) Math.round(likelyNumberGenerated);
}
// Mobs
addon.log("-=-=-=-= Mobs -=-=-=-=-");
double totalMobs = 0;
// Now calculate the relative block probability
for (Entry<EntityType, Integer> en : phase.getMobs().entrySet()) {
double chance = (double) en.getValue() / phase.getTotal();
double likelyNumberGenerated = chance * phaseSize;
totalMobs += likelyNumberGenerated;
String report = en.getKey() + " likely generated = " + Math.round(likelyNumberGenerated) + " = "
+ Math.round(likelyNumberGenerated * 100 / phaseSize) + "%";
if (likelyNumberGenerated < 1) {
addon.logWarning(report);
} else {
addon.log(report);
}
}
addon.log("Total blocks generated = " + totalBlocks);
return likelyChestTotal;
}

/**
* Logs the probability report for each chest rarity in the phase.
*
* @param phase - the phase to report on
* @param likelyChestTotal - the likely total number of chests generated
*/
private void logChestProbs(OneBlockPhase phase, int likelyChestTotal) {
double lastChance = 0;
for (Entry<Double, Rarity> en : OneBlockPhase.CHEST_CHANCES.entrySet()) {
int num = phase.getChestsMap().getOrDefault(en.getValue(), Collections.emptyList()).size();
double likelyNumberGenerated = (en.getKey() - lastChance) * likelyChestTotal;
lastChance = en.getKey();
String report = num + " " + en.getValue() + " chests in phase. Likely number generated = "
+ Math.round(likelyNumberGenerated);
if (num > 0 && likelyNumberGenerated < 1) {
addon.logWarning(report);
} else {
addon.log(report);
}
addon.log("**** A total of " + Math.round(totalMobs) + " mobs will likely be generated ****");
}
}

/**
* Logs the probability report for each mob type in the phase.
*
* @param phase - the phase to report on
* @param phaseSize - total number of blocks in the phase
*/
private void logMobProbs(OneBlockPhase phase, int phaseSize) {
addon.log("-=-=-=-= Mobs -=-=-=-=-");
double totalMobs = 0;
for (Entry<EntityType, Integer> en : phase.getMobs().entrySet()) {
double likelyNumberGenerated = (double) en.getValue() / phase.getTotal() * phaseSize;
totalMobs += likelyNumberGenerated;
logReport(en.getKey() + " likely generated = " + Math.round(likelyNumberGenerated) + " = "
+ Math.round(likelyNumberGenerated * 100 / phaseSize) + "%", likelyNumberGenerated);
}
addon.log("**** A total of " + Math.round(totalMobs) + " mobs will likely be generated ****");
}

/**
* Logs a report line as a warning if the likely count is below 1, otherwise as
* a normal log entry.
*
* @param report - the message to log
* @param likelyNumberGenerated - the computed likelihood
*/
private void logReport(String report, double likelyNumberGenerated) {
if (likelyNumberGenerated < 1) {
addon.logWarning(report);
} else {
addon.log(report);
}
}

Expand Down
Loading
Loading