Skip to content

Commit f96fa9c

Browse files
committed
update nbtapi for 1.21.6
1 parent eb2fb1e commit f96fa9c

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import me.xginko.aef.modules.AEFModule;
99
import me.xginko.aef.utils.KyoriUtil;
1010
import me.xginko.aef.utils.LocaleUtil;
11-
import me.xginko.aef.utils.models.VersionChecker;
1211
import me.xginko.aef.utils.enums.Platform;
12+
import me.xginko.aef.utils.models.VersionChecker;
1313
import me.xginko.aef.utils.permissions.AEFPermission;
1414
import me.xginko.aef.utils.permissions.PermissionHandler;
1515
import me.xginko.aef.utils.tickdata.TickReporter;
@@ -34,7 +34,6 @@
3434
import java.util.Locale;
3535
import java.util.Map;
3636
import java.util.jar.JarFile;
37-
import java.util.logging.Logger;
3837
import java.util.regex.Matcher;
3938
import java.util.stream.Collectors;
4039
import java.util.stream.Stream;
@@ -63,10 +62,14 @@ public void onLoad() {
6362
public void onEnable() {
6463
instance = this;
6564

66-
List<Platform> required = Arrays.stream(Platform.values()).filter(Platform::isRequired).toList();
65+
List<Platform> required = Arrays.stream(Platform.values())
66+
.filter(Platform::isRequired)
67+
.toList();
6768
if (required.stream().anyMatch(platform -> !platform.isPresent())) {
68-
List<String> missing = required.stream().filter(platform -> !platform.isPresent())
69-
.map(Platform::toString).toList();
69+
List<String> missing = required.stream()
70+
.filter(platform -> !platform.isPresent())
71+
.map(Platform::toString)
72+
.toList();
7073
getLogger().severe("AEF requires the following " + (missing.size() > 1 ? "platforms" : "platform") +
7174
" to enable: " + String.join(", ", missing) + ".");
7275
getServer().getPluginManager().disablePlugin(instance);
@@ -103,8 +106,9 @@ public void onEnable() {
103106
" ██ ██ ██ ██ Rewritten by xGinko ",
104107
" ██ ██ ███████ ██ ",
105108
" ",
106-
" "
107-
).map(str -> Component.text(str).color(KyoriUtil.AEF_WHITE)).forEach(prefixedLogger::info);
109+
" ")
110+
.map(str -> Component.text(str).color(KyoriUtil.AEF_WHITE))
111+
.forEach(prefixedLogger::info);
108112

109113
prefixedLogger.info("Detected {} {}", Platform.getMajorType().toString(), Platform.getServerVersion().getReleaseName());
110114

@@ -123,6 +127,17 @@ public void onEnable() {
123127
return;
124128
}
125129

130+
prefixedLogger.info("Preloading NBT-API ...");
131+
// Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging.
132+
java.util.logging.Logger.getLogger("NBTAPI").setLevel(java.util.logging.Level.WARNING);
133+
if (NBT.preloadApi()) {
134+
prefixedLogger.info("Success!");
135+
} else {
136+
prefixedLogger.error("Error initializing NBT-API!");
137+
prefixedLogger.error("This will break all NBT related modules!");
138+
prefixedLogger.error("Please check if your version is compatible!");
139+
}
140+
126141
prefixedLogger.info("Registering Permissions");
127142
AEFPermission.registerAll();
128143

@@ -132,11 +147,6 @@ public void onEnable() {
132147
prefixedLogger.info("Loading Translations");
133148
reloadTranslations();
134149

135-
prefixedLogger.info("Loading NBT-API");
136-
// Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging.
137-
Logger.getLogger("NBTAPI").setLevel(java.util.logging.Level.WARNING);
138-
if (!NBT.preloadApi()) prefixedLogger.error("Error initializing NBT-API! This will break some modules!");
139-
140150
prefixedLogger.info("Loading Metrics");
141151
metrics = new Metrics(instance, 8700);
142152

AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@ public void onLoad() {
6363
public void onEnable() {
6464
instance = this;
6565

66-
List<Platform> required = Arrays.stream(Platform.values()).filter(Platform::isRequired).collect(Collectors.toList());
66+
List<Platform> required = Arrays.stream(Platform.values())
67+
.filter(Platform::isRequired)
68+
.collect(Collectors.toList());
6769
if (required.stream().anyMatch(platform -> !platform.isPresent())) {
68-
List<String> missing = required.stream().filter(platform -> !platform.isPresent())
69-
.map(Platform::toString).collect(Collectors.toList());
70+
List<String> missing = required.stream()
71+
.filter(platform -> !platform.isPresent())
72+
.map(Platform::toString)
73+
.collect(Collectors.toList());
7074
getLogger().severe("AEF requires the following " + (missing.size() > 1 ? "platforms" : "platform") +
7175
" to enable: " + String.join(", ", missing) + ".");
7276
getServer().getPluginManager().disablePlugin(instance);
@@ -109,8 +113,8 @@ public void onEnable() {
109113
" ██ ██ ██ ██ Rewritten by xGinko ",
110114
" ██ ██ ███████ ██ ",
111115
" ",
112-
" "
113-
).forEach(prefixedLogger::info);
116+
" ")
117+
.forEach(prefixedLogger::info);
114118

115119
prefixedLogger.info("Detected {} {}", Platform.getMajorType().toString(), Platform.getServerVersion().getReleaseName());
116120

@@ -129,6 +133,17 @@ public void onEnable() {
129133
return;
130134
}
131135

136+
prefixedLogger.info("Preloading NBT-API ...");
137+
// Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging.
138+
java.util.logging.Logger.getLogger("NBTAPI").setLevel(java.util.logging.Level.WARNING);
139+
if (NBT.preloadApi()) {
140+
prefixedLogger.info("Success!");
141+
} else {
142+
prefixedLogger.error("Error initializing NBT-API!");
143+
prefixedLogger.error("This will break all NBT related modules!");
144+
prefixedLogger.error("Please check if your version is compatible!");
145+
}
146+
132147
prefixedLogger.info("Registering Permissions");
133148
AEFPermission.registerAll();
134149

@@ -141,11 +156,6 @@ public void onEnable() {
141156
prefixedLogger.info("Loading Translations");
142157
reloadTranslations();
143158

144-
prefixedLogger.info("Loading NBT-API");
145-
// Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging.
146-
java.util.logging.Logger.getLogger("NBTAPI").setLevel(java.util.logging.Level.WARNING);
147-
if (!NBT.preloadApi()) prefixedLogger.error("Error initializing NBT-API! This will break some modules!");
148-
149159
prefixedLogger.info("Loading Metrics");
150160
metrics = new Metrics(instance, 8700);
151161

build-logic/src/main/kotlin/me.xginko.aef.wrapper.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dependencies {
5252
compileOnly("com.mojang:brigadier:1.0.18")
5353
api("com.github.cryptomorin:XSeries:13.3.2") // Crossversion entitytype, material, potion, item etc support
5454
api("com.github.thatsmusic99:ConfigurationMaster-API:v2.0.0-rc.3") // ConfigurationMaster for enhanced config management
55-
api("de.tr7zw:item-nbt-api:2.15.0") // NBT API for cross version nbt handling
55+
api("de.tr7zw:item-nbt-api:2.15.1") // NBT API for cross version nbt handling
5656
api("org.bstats:bstats-bukkit:3.0.2") // Bukkit bStats
5757
api("org.reflections:reflections:0.10.2") // Reflections
5858
compileOnly("org.apache.logging.log4j:log4j-core:2.23.1")

0 commit comments

Comments
 (0)