Skip to content

Commit

Permalink
fix issue in NMS class fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Dec 9, 2024
1 parent ae52226 commit 7b986cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static int patchNumber() {
@SneakyThrows
public static @NotNull Class<?> findNmsClass(@NotNull String name) {
if (supports(1, UNVERSION_NMS)) {
return Class.forName("net.minecraft.server." + name);
return Class.forName("net.minecraft." + name);
}
int dotIndex = name.lastIndexOf('.');
if (dotIndex == -1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,8 @@ final class ReflectionCommodore extends Commodore {
final Class<?> minecraftServer;
final Class<?> commandDispatcher;

if (BukkitVersion.supports(1, 16)) {
minecraftServer = BukkitVersion.findNmsClass("server.MinecraftServer");
commandDispatcher = BukkitVersion.findNmsClass("commands.CommandDispatcher");
} else {
minecraftServer = BukkitVersion.findNmsClass("MinecraftServer");
commandDispatcher = BukkitVersion.findNmsClass("CommandDispatcher");
}

minecraftServer = BukkitVersion.findNmsClass("server.MinecraftServer");
commandDispatcher = BukkitVersion.findNmsClass("commands.CommandDispatcher");
Class<?> craftServer = BukkitVersion.findOcbClass("CraftServer");
CONSOLE_FIELD = craftServer.getDeclaredField("console");
CONSOLE_FIELD.setAccessible(true);
Expand Down

0 comments on commit 7b986cb

Please sign in to comment.