Skip to content

Commit 698dd4d

Browse files
author
charlyg31
committed
fix: support Paper 26.x unversioned craftbukkit package
Paper 26.x removed the version suffix from the craftbukkit package. Check IS_PAPER first and try without version prefix, then fall back to the versioned package for older/non-Paper servers. Fixes #196
1 parent e85df53 commit 698dd4d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/com/extendedclip/deluxemenus/utils/VersionHelper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ public static Class<?> getNMSClass(final String pkg, final String className) thr
217217
* @return The craft class.
218218
*/
219219
public static Class<?> getCraftClass(@NotNull final String name) throws ClassNotFoundException {
220+
if (IS_PAPER) {
221+
try {
222+
return Class.forName("org.bukkit.craftbukkit." + name);
223+
} catch (ClassNotFoundException ignored) { }
224+
}
220225
return Class.forName("org.bukkit.craftbukkit." + NMS_VERSION + "." + name);
221226
}
222227

0 commit comments

Comments
 (0)