Skip to content

Commit 4674844

Browse files
committed
stop shading nbtapi, closes #290
1 parent 08d198e commit 4674844

File tree

9 files changed

+109
-61
lines changed

9 files changed

+109
-61
lines changed

AnarchyExploitFixesFolia/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ configure<JavaPluginExtension> {
2525

2626
tasks.shadowJar {
2727
archiveFileName = "${rootProject.name}-${project.name}-${project.version}.${archiveExtension.get()}"
28+
relocate("com.cryptomorin.xseries", "me.xginko.aef.libs.xseries")
2829
exclude(
2930
"com/cryptomorin/xseries/XBiome*",
3031
"com/cryptomorin/xseries/NMSExtras*",
3132
"com/cryptomorin/xseries/NoteBlockMusic*",
3233
"com/cryptomorin/xseries/SkullCacheListener*"
3334
)
3435
relocate("io.github.thatsmusic99.configurationmaster", "me.xginko.aef.libs.configmaster")
35-
relocate("org.reflections", "me.xginko.aef.libs.reflections")
3636
relocate("com.github.benmanes.caffeine", "me.xginko.aef.libs.caffeine")
37-
relocate("de.tr7zw.changeme.nbtapi", "me.xginko.aef.libs.nbtapi")
37+
relocate("org.reflections", "me.xginko.aef.libs.reflections")
3838
relocate("org.bstats", "me.xginko.aef.libs.bstats")
39-
relocate("com.cryptomorin.xseries", "me.xginko.aef.libs.xseries")
4039
}

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

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,26 @@ public void onEnable() {
9494
" https://ci.codemc.io/job/retrooper/job/packetevents/ ",
9595
" "
9696
).forEach(prefixedLogger::error);
97-
getServer().shutdown(); // Don't allow plugman/serverutil users to hot-load this plugin if packetevents is missing.
97+
getServer().shutdown();
98+
return;
99+
}
100+
101+
if (getServer().getPluginManager().getPlugin("NBTAPI") == null) {
102+
Stream.of(" ",
103+
" _ _ _ _ _ ",
104+
" / \\ | |_| |_ ___ _ __ | |_(_) ___ _ __ ",
105+
" / _ \\| __| __/ _ \\ '_ \\| __| |/ _ \\| '_ \\ ",
106+
" / ___ \\ |_| || __/ | | | |_| | (_) | | | | ",
107+
" /_/ \\_\\__|\\__\\___|_| |_|\\__|_|\\___/|_| |_| ",
108+
" ",
109+
" AEF depends on NBT-API to function! ",
110+
" You can either download the latest release on modrinth: ",
111+
" https://modrinth.com/plugin/nbtapi/ ",
112+
" or choose a dev build on github actions: ",
113+
" https://github.com/tr7zw/Item-NBT-API/actions ",
114+
" "
115+
).forEach(prefixedLogger::error);
116+
getServer().shutdown();
98117
return;
99118
}
100119

@@ -127,15 +146,20 @@ public void onEnable() {
127146
return;
128147
}
129148

130-
prefixedLogger.info("Preloading NBT-API ...");
131149
// Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging.
132150
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!");
151+
if (!NBT.preloadApi()) {
152+
prefixedLogger.error(" ");
153+
prefixedLogger.error(" Error preloading NBT-API! ");
154+
prefixedLogger.error(" !! This will break all NBT related modules !! ");
155+
prefixedLogger.error(" ");
156+
prefixedLogger.error(" The reason for this could be: ");
157+
prefixedLogger.error(" - your server version is too new for the ");
158+
prefixedLogger.error(" item-nbt-api-plugin.jar in your plugins ");
159+
prefixedLogger.error(" folder. ");
160+
prefixedLogger.error(" - the item-nbt-api-plugin.jar in your ");
161+
prefixedLogger.error(" plugins folder is bad. ");
162+
prefixedLogger.error(" ");
139163
}
140164

141165
prefixedLogger.info("Registering Permissions");

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/utils/KyoriUtil.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
public final class KyoriUtil {
1010

11-
public static final TextColor AEF_BLUE = TextColor.fromHexString("#00EDFF");
11+
public static final TextColor AEF_BLUE = TextColor.fromHexString("#00EDFF");
1212
public static final TextColor AEF_WHITE = TextColor.fromHexString("#E2FDFF");
13-
public static final TextColor AEF_GOLD = TextColor.fromHexString("#ffc44f");
13+
public static final TextColor AEF_GOLD = TextColor.fromHexString("#ffc44f");
1414

1515
public static Component toUpperCase(Component input, Locale locale) {
1616
return input.replaceText(TextReplacementConfig.builder()
@@ -19,29 +19,29 @@ public static Component toUpperCase(Component input, Locale locale) {
1919
.build());
2020
}
2121

22-
public static String translateChatColor(String string) {
23-
string = string.replace("&0", "<black>");
24-
string = string.replace("&1", "<dark_blue>");
25-
string = string.replace("&2", "<dark_green>");
26-
string = string.replace("&3", "<dark_aqua>");
27-
string = string.replace("&4", "<dark_red>");
28-
string = string.replace("&5", "<dark_purple>");
29-
string = string.replace("&6", "<gold>");
30-
string = string.replace("&7", "<gray>");
31-
string = string.replace("&8", "<dark_gray>");
32-
string = string.replace("&9", "<blue>");
33-
string = string.replace("&a", "<green>");
34-
string = string.replace("&b", "<aqua>");
35-
string = string.replace("&c", "<red>");
36-
string = string.replace("&d", "<light_purple>");
37-
string = string.replace("&e", "<yellow>");
38-
string = string.replace("&f", "<white>");
39-
string = string.replace("&k", "<obfuscated>");
40-
string = string.replace("&l", "<bold>");
41-
string = string.replace("&m", "<strikethrough>");
42-
string = string.replace("&n", "<underlined>");
43-
string = string.replace("&o", "<italic>");
44-
string = string.replace("&r", "<reset>");
45-
return string;
22+
public static String translateChatColor(String input) {
23+
return input
24+
.replace("&0", "<black>" )
25+
.replace("&1", "<dark_blue>" )
26+
.replace("&2", "<dark_green>" )
27+
.replace("&3", "<dark_aqua>" )
28+
.replace("&4", "<dark_red>" )
29+
.replace("&5", "<dark_purple>" )
30+
.replace("&6", "<gold>" )
31+
.replace("&7", "<gray>" )
32+
.replace("&8", "<dark_gray>" )
33+
.replace("&9", "<blue>" )
34+
.replace("&a", "<green>" )
35+
.replace("&b", "<aqua>" )
36+
.replace("&c", "<red>" )
37+
.replace("&d", "<light_purple>" )
38+
.replace("&e", "<yellow>" )
39+
.replace("&f", "<white>" )
40+
.replace("&k", "<obfuscated>" )
41+
.replace("&l", "<bold>" )
42+
.replace("&m", "<strikethrough>")
43+
.replace("&n", "<underlined>" )
44+
.replace("&o", "<italic>" )
45+
.replace("&r", "<reset>" );
4646
}
4747
}

AnarchyExploitFixesFolia/src/main/resources/plugin.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ authors: [ xGinko, moo ]
66
description: ${description}
77
softdepend:
88
- packetevents
9+
- NBTAPI
910
- LuckPerms
1011
- Citizens
11-
api-version: '1.19'
12+
api-version: '1.20'
1213
folia-supported: true
1314
website: ${url}

AnarchyExploitFixesLegacy/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,18 @@ configure<JavaPluginExtension> {
1919
tasks {
2020
shadowJar {
2121
archiveFileName = "${rootProject.name}-${project.name}-${project.version}.${archiveExtension.get()}"
22+
relocate("com.cryptomorin.xseries", "me.xginko.aef.libs.xseries")
2223
exclude(
2324
"com/cryptomorin/xseries/XBiome*",
2425
"com/cryptomorin/xseries/NMSExtras*",
2526
"com/cryptomorin/xseries/NoteBlockMusic*",
2627
"com/cryptomorin/xseries/SkullCacheListener*"
2728
)
2829
relocate("io.github.thatsmusic99.configurationmaster", "me.xginko.aef.libs.configmaster")
30+
relocate("com.github.benmanes.caffeine", "me.xginko.aef.libs.caffeine")
2931
relocate("org.reflections", "me.xginko.aef.libs.reflections")
3032
relocate("com.zaxxer", "me.xginko.aef.libs.zaxxer")
31-
relocate("com.github.benmanes.caffeine", "me.xginko.aef.libs.caffeine")
32-
relocate("de.tr7zw.changeme.nbtapi", "me.xginko.aef.libs.nbtapi")
3333
relocate("org.bstats", "me.xginko.aef.libs.bstats")
34-
relocate("com.cryptomorin.xseries", "me.xginko.aef.libs.xseries")
3534
}
3635

3736
jar {

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

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,26 @@ public void onEnable() {
101101
" https://ci.codemc.io/job/retrooper/job/packetevents/ ",
102102
" "
103103
).forEach(prefixedLogger::error);
104-
getServer().shutdown(); // Don't allow plugman/serverutil users to hot-load this plugin if packetevents is missing.
104+
getServer().shutdown();
105+
return;
106+
}
107+
108+
if (getServer().getPluginManager().getPlugin("NBTAPI") == null) {
109+
Stream.of(" ",
110+
" _ _ _ _ _ ",
111+
" / \\ | |_| |_ ___ _ __ | |_(_) ___ _ __ ",
112+
" / _ \\| __| __/ _ \\ '_ \\| __| |/ _ \\| '_ \\ ",
113+
" / ___ \\ |_| || __/ | | | |_| | (_) | | | | ",
114+
" /_/ \\_\\__|\\__\\___|_| |_|\\__|_|\\___/|_| |_| ",
115+
" ",
116+
" AEF depends on NBT-API to function! ",
117+
" You can either download the latest release on modrinth: ",
118+
" https://modrinth.com/plugin/nbtapi/ ",
119+
" or choose a dev build on github actions: ",
120+
" https://github.com/tr7zw/Item-NBT-API/actions ",
121+
" "
122+
).forEach(prefixedLogger::error);
123+
getServer().shutdown();
105124
return;
106125
}
107126

@@ -133,15 +152,20 @@ public void onEnable() {
133152
return;
134153
}
135154

136-
prefixedLogger.info("Preloading NBT-API ...");
137155
// Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging.
138156
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!");
157+
if (!NBT.preloadApi()) {
158+
prefixedLogger.error(" ");
159+
prefixedLogger.error(" Error preloading NBT-API! ");
160+
prefixedLogger.error(" !! This will break all NBT related modules !! ");
161+
prefixedLogger.error(" ");
162+
prefixedLogger.error(" The reason for this could be: ");
163+
prefixedLogger.error(" - your server version is too new for the ");
164+
prefixedLogger.error(" item-nbt-api-plugin.jar in your plugins ");
165+
prefixedLogger.error(" folder. ");
166+
prefixedLogger.error(" - the item-nbt-api-plugin.jar in your ");
167+
prefixedLogger.error(" plugins folder is bad. ");
168+
prefixedLogger.error(" ");
145169
}
146170

147171
prefixedLogger.info("Registering Permissions");

AnarchyExploitFixesLegacy/src/main/resources/plugin.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ authors: [ xGinko, moo ]
66
description: ${description}
77
softdepend:
88
- packetevents
9+
- NBTAPI
910
- LuckPerms
1011
- Citizens
1112
api-version: '1.13'

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ repositories {
4848
}
4949

5050
dependencies {
51-
compileOnly("com.github.retrooper:packetevents-spigot:2.8.0") // PacketEvents to patch packet based exploits
52-
compileOnly("com.mojang:brigadier:1.0.18")
53-
api("com.github.cryptomorin:XSeries:13.3.2") // Crossversion entitytype, material, potion, item etc support
54-
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.1") // NBT API for cross version nbt handling
51+
compileOnly("org.apache.logging.log4j:log4j-core:2.23.1") // Better logger
52+
compileOnly("com.github.retrooper:packetevents-spigot:2.8.0") // Cross version packet handling
53+
compileOnly("de.tr7zw:item-nbt-api:2.15.1") // Cross version nbt handling
54+
compileOnly("com.mojang:brigadier:1.0.18") // Used in command unregister hack
55+
api("com.github.thatsmusic99:ConfigurationMaster-API:v2.0.0-rc.3") // Enhanced config management
56+
api("com.github.cryptomorin:XSeries:13.3.3") // Crossversion Entity, material, potion, item, etc. handling
5657
api("org.bstats:bstats-bukkit:3.0.2") // Bukkit bStats
57-
api("org.reflections:reflections:0.10.2") // Reflections
58-
compileOnly("org.apache.logging.log4j:log4j-core:2.23.1")
58+
api("org.reflections:reflections:0.10.2") // Good reflections
5959
}
6060

6161
tasks.withType<JavaCompile>() {

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ metadata.format.version = "1.1"
22

33
[versions]
44
runpaperversion = "1.21.5"
5-
foliabundle = "1.21.5-R0.1-SNAPSHOT"
5+
foliabundle = "1.21.6-R0.1-SNAPSHOT"
66

77
[libraries]
8-
folia = "dev.folia:folia-api:1.21.5-R0.1-SNAPSHOT"
8+
folia = "dev.folia:folia-api:1.21.6-R0.1-SNAPSHOT"
99
paper12 = "com.destroystokyo.paper:paper-api:1.12.2-R0.1-SNAPSHOT"
10-
caffeineJ17 = "com.github.ben-manes.caffeine:caffeine:3.2.1"
10+
caffeineJ17 = "com.github.ben-manes.caffeine:caffeine:3.2.2"
1111
caffeineJ8 = "com.github.ben-manes.caffeine:caffeine:2.9.3"
1212
hikaricp = "com.zaxxer:HikariCP:6.3.0"
1313
luckperms = "net.luckperms:api:5.4"
1414

1515
[plugins]
1616
runpaper = { id = "xyz.jpenilla.run-paper", version = "2.3.1" }
17-
shadow = { id = "com.gradleup.shadow", version = "9.0.0-beta16" }
18-
userdev = { id = "io.papermc.paperweight.userdev", version = "2.0.0-beta.17" }
17+
shadow = { id = "com.gradleup.shadow", version = "9.0.0-rc2" }
18+
userdev = { id = "io.papermc.paperweight.userdev", version = "2.0.0-beta.18" }
1919
downgradeJava = { id = "xyz.wagyourtail.jvmdowngrader", version = "1.3.3" }
2020

2121
[bundles]

0 commit comments

Comments
 (0)