Skip to content

Commit bd2c2f2

Browse files
committed
Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop
2 parents 554e9cd + 5bed29b commit bd2c2f2

File tree

5 files changed

+76
-79
lines changed

5 files changed

+76
-79
lines changed

build.gradle.kts

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@ val vaultVersion = "1.7.1"
9393
val levelVersion = "2.21.3"
9494
val placeholderapiVersion = "2.11.7"
9595
val myworldsVersion = "1.19.3-v1"
96+
val awaitilityVersion = "4.2.2"
97+
val mythicDistVersion = "5.9.5"
98+
val multiverseCore5Version = "5.0.0-SNAPSHOT"
99+
val multiverseCore4Version = "4.3.16"
100+
val langUtilsVersion = "3.2.2"
101+
val slimefun4Version = "RC-37"
102+
val itemsAdderVersion = "4.0.2-beta-release-11"
103+
val fancyNpcsVersion = "2.4.4"
104+
val znpcsplusApiVersion = "2.0.0-SNAPSHOT"
105+
val fancyHologramsVersion = "2.4.1"
106+
val commonsLangVersion = "2.6"
107+
val jaxbApiVersion = "2.3.0"
108+
val gsonRecordTypeAdapterFactoryVersion = "0.3.0"
109+
val jdtAnnotationVersion = "2.2.600"
110+
val multilibVersion = "1.1.13"
111+
val oraxenVersion = "1.193.1"
96112

97113
// Store versions in extra properties for resource filtering (used in plugin.yml, config.yml)
98114
extra["java.version"] = javaVersion
@@ -176,59 +192,40 @@ dependencies {
176192
testImplementation("org.junit.jupiter:junit-jupiter-api")
177193
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
178194
testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitVersion")
179-
testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion") // Mocking framework
195+
testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion")
180196
testImplementation("org.mockito:mockito-core:$mockitoVersion")
181-
testImplementation("com.github.MockBukkit:MockBukkit:$mockBukkitVersion") // Bukkit mock server
182-
testImplementation("org.awaitility:awaitility:4.2.2") // Async testing helper
183-
testImplementation("io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT") // Paper API for tests
197+
testImplementation("com.github.MockBukkit:MockBukkit:$mockBukkitVersion")
198+
testImplementation("org.awaitility:awaitility:$awaitilityVersion")
199+
testImplementation("io.papermc.paper:paper-api:$paperVersion")
184200
testImplementation("com.github.MilkBowl:VaultAPI:$vaultVersion")
185201
testImplementation("me.clip:placeholderapi:$placeholderapiVersion")
202+
testImplementation("commons-lang:commons-lang:$commonsLangVersion")
186203

187-
// --- Provided/Compile-Only Dependencies: Available at compile time but provided by server ---
188-
// These are NOT shaded into the final JAR (the server provides them at runtime)
189-
//compileOnly("io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT") // Bukkit/Spigot/Paper API
190-
paperweight.paperDevBundle("1.21.10-R0.1-SNAPSHOT")
191-
192-
// Spigot NMS - Used for internal Minecraft code (chunk deletion and pasting)
204+
// --- Compile Only Dependencies: Provided by the server at runtime ---
193205
compileOnly("org.spigotmc:spigot:$spigotVersion") {
194-
exclude(group = "org.spigotmc", module = "spigot-api") // Already provided by Paper
206+
exclude(group = "org.spigotmc", module = "spigot-api")
195207
}
196-
197-
// Optional plugins that may be installed on the server
198208
compileOnly("org.mongodb:mongodb-driver:$mongodbVersion")
199-
compileOnly("com.zaxxer:HikariCP:$hikaricpVersion") // Database connection pooling
200-
compileOnly("com.github.MilkBowl:VaultAPI:$vaultVersion") // Economy/permission API
201-
compileOnly("me.clip:placeholderapi:$placeholderapiVersion") // Placeholder API
209+
compileOnly("com.zaxxer:HikariCP:$hikaricpVersion")
210+
compileOnly("com.github.MilkBowl:VaultAPI:$vaultVersion")
211+
compileOnly("me.clip:placeholderapi:$placeholderapiVersion")
202212
compileOnly("com.bergerkiller.bukkit:MyWorlds:$myworldsVersion") {
203213
exclude(group = "org.spigotmc", module = "spigot-api")
204214
}
205-
compileOnly("io.lumine:Mythic-Dist:5.9.5") // Mythic Mobs
206-
compileOnly("org.mvplugins.multiverse.core:multiverse-core:5.0.0-SNAPSHOT")
207-
compileOnly("com.onarandombox.multiversecore:multiverse-core:4.3.16") {
215+
compileOnly("io.lumine:Mythic-Dist:$mythicDistVersion")
216+
compileOnly("org.mvplugins.multiverse.core:multiverse-core:$multiverseCore5Version")
217+
compileOnly("com.onarandombox.multiversecore:multiverse-core:$multiverseCore4Version") {
208218
exclude(group = "org.spigotmc", module = "spigot-api")
209219
}
210-
compileOnly("com.github.apachezy:LangUtils:3.2.2")
211-
compileOnly("com.github.Slimefun:Slimefun4:RC-37") // Slimefun custom items
212-
compileOnly("dev.lone:api-itemsadder:4.0.2-beta-release-11") // ItemsAdder custom items
213-
compileOnly("de.oliver:FancyNpcs:2.4.4") // NPC plugin
214-
compileOnly("lol.pyr:znpcsplus-api:2.0.0-SNAPSHOT") // Alternative NPC plugin
215-
compileOnly("de.oliver:FancyHolograms:2.4.1") // Hologram plugin
216-
compileOnly("world.bentobox:level:2.21.3-SNAPSHOT") // BentoBox Level addon
217-
218-
// Apache Commons Lang - utility library
219-
compileOnly("commons-lang:commons-lang:2.6")
220-
testImplementation("commons-lang:commons-lang:2.6")
221-
222-
// --- Implementation Dependencies: Shaded into final JAR ---
223-
// These are embedded in the final JAR since they're not commonly available
224-
implementation("org.bstats:bstats-bukkit:$bstatsVersion") // Plugin metrics
225-
implementation("javax.xml.bind:jaxb-api:2.3.0") // XML serialization
226-
implementation("com.github.Marcono1234:gson-record-type-adapter-factory:0.3.0") // JSON serialization
227-
implementation("org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.600") // Nullability annotations
228-
implementation("com.github.puregero:multilib:1.1.13") // Multi-library support
229-
230-
// Oraxen with custom exclusions (embed only what we need)
231-
compileOnly("io.th0rgal:oraxen:1.193.1") {
220+
compileOnly("com.github.apachezy:LangUtils:$langUtilsVersion")
221+
compileOnly("com.github.Slimefun:Slimefun4:$slimefun4Version")
222+
compileOnly("dev.lone:api-itemsadder:$itemsAdderVersion")
223+
compileOnly("de.oliver:FancyNpcs:$fancyNpcsVersion")
224+
compileOnly("lol.pyr:znpcsplus-api:$znpcsplusApiVersion")
225+
compileOnly("de.oliver:FancyHolograms:$fancyHologramsVersion")
226+
compileOnly("world.bentobox:level:$levelVersion-SNAPSHOT")
227+
compileOnly("commons-lang:commons-lang:$commonsLangVersion")
228+
compileOnly("io.th0rgal:oraxen:$oraxenVersion") {
232229
exclude(group = "me.gabytm.util", module = "actions-spigot")
233230
exclude(group = "org.jetbrains", module = "annotations")
234231
exclude(group = "com.ticxo", module = "PlayerAnimator")
@@ -238,9 +235,19 @@ dependencies {
238235
exclude(group = "org.bstats", module = "bstats-bukkit")
239236
exclude(group = "com.jeff-media", module = "custom-block-data")
240237
exclude(group = "com.jeff-media", module = "persistent-data-serializer")
241-
exclude(group = "com.jeff_media", module = "MorePersistentDataTypes")
238+
exclude(group = "com.jeff-media", module = "MorePersistentDataTypes")
242239
exclude(group = "gs.mclo", module = "java")
243240
}
241+
242+
// --- Implementation Dependencies: Shaded into final JAR ---
243+
implementation("org.bstats:bstats-bukkit:$bstatsVersion")
244+
implementation("javax.xml.bind:jaxb-api:$jaxbApiVersion")
245+
implementation("com.github.Marcono1234:gson-record-type-adapter-factory:$gsonRecordTypeAdapterFactoryVersion")
246+
implementation("org.eclipse.jdt:org.eclipse.jdt.annotation:$jdtAnnotationVersion")
247+
implementation("com.github.puregero:multilib:$multilibVersion")
248+
249+
// --- Paperweight Development Bundle (Provided by plugin development tools) ---
250+
paperweight.paperDevBundle(paperVersion)
244251
}
245252

246253
paperweight {

src/main/java/world/bentobox/bentobox/api/addons/AddonClassLoader.java

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -218,31 +218,19 @@ public Class<?> findClass(String name, boolean checkGlobal) {
218218
if (name.startsWith("world.bentobox.bentobox")) {
219219
return null;
220220
}
221-
// Check local cache first.
222-
Class<?> result = classes.get(name);
223-
if (result == null) {
224-
// Check global cache for classes from other addons.
225-
if (checkGlobal) {
226-
result = loader.getClassByName(name);
221+
return classes.computeIfAbsent(name, key -> {
222+
Class<?> resolved = checkGlobal ? loader.getClassByName(key) : null;
223+
if (resolved != null) {
224+
return resolved;
227225
}
228-
229-
if (result == null) {
230-
// Try to find the class in this addon's jar.
231-
try {
232-
result = super.findClass(name);
233-
} catch (ClassNotFoundException | NoClassDefFoundError e) {
234-
// Do nothing. The class is not in this jar.
235-
}
236-
if (result != null) {
237-
// Class found in this addon's jar, so add it to the global cache.
238-
loader.setClass(name, result);
239-
240-
}
226+
try {
227+
resolved = AddonClassLoader.super.findClass(key);
228+
loader.setClass(key, resolved);
229+
return resolved;
230+
} catch (ClassNotFoundException | NoClassDefFoundError e) {
231+
return null; // Not found locally.
241232
}
242-
// Add the class to the local cache.
243-
classes.put(name, result);
244-
}
245-
return result;
233+
});
246234
}
247235

248236
/**

src/main/java/world/bentobox/bentobox/api/flags/clicklisteners/CycleClick.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public CycleClick(String id, int minRank, int maxRank) {
6262
public boolean onClick(Panel panel, User user2, ClickType click, int slot) {
6363
if (panel.getWorld().isEmpty()) {
6464
plugin.logError("Panel " + panel.getName()
65-
+ " has no world associated with it. Please report this bug to the author.");
65+
+ " has no world associated with it. Please report this bug to the author.");
6666
return true;
6767
}
6868
// This click listener is used with TabbedPanel and SettingsTabs only
@@ -73,14 +73,17 @@ public boolean onClick(Panel panel, User user2, ClickType click, int slot) {
7373
this.user = user2;
7474
changeOccurred = false;
7575
// Permission prefix
76-
String prefix = plugin.getIWM().getPermissionPrefix(Util.getWorld(panel.getWorld().get()));
77-
String reqPerm = prefix + "settings." + id;
78-
String allPerms = prefix + "settings.*";
79-
if (!user.hasPermission(reqPerm) && !user.hasPermission(allPerms)
80-
&& !user.isOp() && !user.hasPermission(prefix + "admin.settings")) {
81-
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, reqPerm);
82-
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
83-
return true;
76+
String prefix = "";
77+
if (panel.getWorld().isPresent()) {
78+
prefix = plugin.getIWM().getPermissionPrefix(Util.getWorld(panel.getWorld().get()));
79+
String reqPerm = prefix + "settings." + id;
80+
String allPerms = prefix + "settings.*";
81+
if (!user.hasPermission(reqPerm) && !user.hasPermission(allPerms)
82+
&& !user.isOp() && !user.hasPermission(prefix + "admin.settings")) {
83+
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, reqPerm);
84+
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
85+
return true;
86+
}
8487
}
8588
// Left-clicking increases the rank required
8689
// Right-clicking decreases the rank required

src/main/java/world/bentobox/bentobox/api/user/User.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,7 @@ private int iteratePerms(List<String> permissions, String permPrefix, int defaul
441441
String[] spl = permission.split(permPrefix);
442442
if (spl.length > 1) {
443443
if (!NumberUtils.isCreatable(spl[1])) {
444-
plugin.logError("Player " + player.getName() + " has permission: '" + permission
445-
+ "' <-- the last part MUST be a number! Ignoring...");
444+
plugin.logError("Player " + player.getName() + " has permission: '" + permission);
446445
} else {
447446
int v = Integer.parseInt(spl[1]);
448447
if (v < 0) {
@@ -981,7 +980,7 @@ public String toString() {
981980
+ (offlinePlayer != null ? "offlinePlayer=" + offlinePlayer + ", " : "")
982981
+ (playerUUID != null ? "playerUUID=" + playerUUID + ", " : "")
983982
+ (sender != null ? "sender=" + sender + ", " : "") + (addon != null ? "addon=" + addon + ", " : "")
984-
+ (getLocation() != null ? "getLocation()=" + getLocation() + ", " : "") + "isPlayer()=" + isPlayer()
983+
+ "getLocation()=" + getLocation() + "isPlayer()=" + isPlayer()
985984
+ "]";
986985
}
987986

src/main/resources/locales/zh-CN.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,10 +1363,10 @@ protection:
13631363
name: '&b&l放置方块'
13641364
hint: 禁止放置方块
13651365
PODZOL:
1366-
name: 树荫土生成
1366+
name: 灰化土转化
13671367
description: |-
13681368
&a 如果禁用,将防止在大树
1369-
&a 生长时生成树荫土
1369+
&a 生长时转化灰化土
13701370
POTION_THROWING:
13711371
name: '&b&l投掷药水'
13721372
description: |-

0 commit comments

Comments
 (0)