NBT-API

NBT-API

98.9k Downloads

Error loading NBT Injector (reflection failing?)

brandonwamboldt opened this issue ยท 3 comments

commented

Sorry to bug you, but when I call NBTInjector.inject() in my plugin's onEnable function, I'm getting an error with the generated classes:

[15:59:11 INFO]: [NBTINJECTOR] Injecting Entity classes...
[15:59:11 INFO]: [NBTAPI] Found Spigot: v1_8_R3! Trying to find NMS support
[15:59:11 INFO]: [NBTAPI] NMS support 'MC1_8_R3' loaded!
[15:59:11 INFO]: [NBTINJECTOR] Injecting Tile Entity classes...
[15:59:11 ERROR]: Error occurred while enabling SkyblockPlugin v1.0 (Is it up to date?)
org.spigotmc.tr7zw.nbtapi.NbtApiException: org.spigotmc.tr7zw.nbtapi.NbtApiException: Exception while injecting DLDetector
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:74) ~[?:?]
        at com.brandonwamboldt.SkyblockPlugin.SkyblockPlugin.onEnable(SkyblockPlugin.java:42) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:408) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:372) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:327) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:267) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched.jar:git-PaperSpigot-"4c7641d"]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]
Caused by: org.spigotmc.tr7zw.nbtapi.NbtApiException: Exception while injecting DLDetector
        at org.spigotmc.tr7zw.nbtinjector.InternalInjectors.tile1v10Below(InternalInjectors.java:229) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:67) ~[?:?]
        ... 12 more
Caused by: javassist.CannotCompileException: [source error] syntax error near "void null(NBTTagComp"
        at javassist.CtNewMethod.make(CtNewMethod.java:84) ~[?:?]
        at javassist.CtNewMethod.make(CtNewMethod.java:50) ~[?:?]
        at javassist.CtMethod.make(CtMethod.java:140) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapNbtClass(ClassGenerator.java:79) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapTileEntity(ClassGenerator.java:190) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.InternalInjectors.tile1v10Below(InternalInjectors.java:225) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:67) ~[?:?]
        ... 12 more
Caused by: javassist.compiler.SyntaxError: syntax error near "void null(NBTTagComp"
        at javassist.compiler.Parser.parseMember1(Parser.java:76) ~[?:?]
        at javassist.compiler.Javac.compile(Javac.java:98) ~[?:?]
        at javassist.CtNewMethod.make(CtNewMethod.java:79) ~[?:?]
        at javassist.CtNewMethod.make(CtNewMethod.java:50) ~[?:?]
        at javassist.CtMethod.make(CtMethod.java:140) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapNbtClass(ClassGenerator.java:79) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapTileEntity(ClassGenerator.java:190) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.InternalInjectors.tile1v10Below(InternalInjectors.java:225) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:67) ~[?:?]
        ... 12 more

I've looked into it and see where it's failing, but I haven't been able to track down any solution.

Here's my pom.xml if it's relevant:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.brandonwamboldt</groupId>
    <artifactId>SkyblockPlugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>shade</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>de.tr7zw.changeme.nbtapi</pattern>
                            <shadedPattern>org.spigotmc.tr7zw.nbtapi</shadedPattern>
                        </relocation>

                        <relocation>
                            <pattern>de.tr7zw.nbtinjector</pattern>
                            <shadedPattern>org.spigotmc.tr7zw.nbtinjector</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>

        <repository>
            <id>codemc-repo</id>
            <url>https://repo.codemc.org/repository/maven-public/</url>
            <layout>default</layout>
        </repository>

        <repository>
            <id>dmulloy2-repo</id>
            <url>https://repo.dmulloy2.net/nexus/repository/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>de.tr7zw</groupId>
            <artifactId>nbt-injector</artifactId>
            <version>2.4.1</version>
        </dependency>

        <dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>4.5.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.20</version>
        </dependency>
    </dependencies>
</project>
commented

You have to call it during onLoad, not onEnable

commented

Oh my god I feel stupid now, thank you for the quick response!

commented

I hate to bug you again, but I've switched it to onLoad as it should be, but I'm getting the same error as before (failing to inject random entities each time I start):

H:\Projects\mcserver>java -jar paper-443.jar --port 1337 --online-mode --max-players 50 --world island3
Loading libraries, please wait...
2020-07-10 09:03:21,953 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.internal.Kernel32
        at org.fusesource.jansi.internal.WindowsSupport.getConsoleMode(WindowsSupport.java:50)
        at org.bukkit.craftbukkit.libs.jline.WindowsTerminal.getConsoleMode(WindowsTerminal.java:204)
        at org.bukkit.craftbukkit.libs.jline.WindowsTerminal.init(WindowsTerminal.java:82)
        at org.bukkit.craftbukkit.libs.jline.TerminalFactory.create(TerminalFactory.java:101)
        at org.bukkit.craftbukkit.libs.jline.TerminalFactory.get(TerminalFactory.java:158)
        at org.bukkit.craftbukkit.libs.jline.console.ConsoleReader.<init>(ConsoleReader.java:229)
        at org.bukkit.craftbukkit.libs.jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
        at org.bukkit.craftbukkit.libs.jline.console.ConsoleReader.<init>(ConsoleReader.java:213)
        at net.minecraft.server.v1_8_R3.MinecraftServer.<init>(MinecraftServer.java:141)
        at net.minecraft.server.v1_8_R3.DedicatedServer.<init>(DedicatedServer.java:43)
        at net.minecraft.server.v1_8_R3.MinecraftServer.main(MinecraftServer.java:984)
        at org.bukkit.craftbukkit.Main.main(Main.java:201)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.destroystokyo.paperclip.Paperclip.main(Paperclip.java:177)

[09:03:24 INFO]: Starting minecraft server version 1.8.8
[09:03:24 INFO]: Loading properties
[09:03:24 INFO]: Default game type: SURVIVAL
[09:03:24 INFO]: This server is running CraftBukkit version git-PaperSpigot-"4c7641d" (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
[09:03:24 INFO]: Debug logging is disabled
[09:03:24 INFO]: Server Ping Player Sample Count: 12
[09:03:24 INFO]: Using 4 threads for Netty based IO
[09:03:24 INFO]: Spigot Timings: true - Verbose: true - Interval: 5m - Length: 60m
[09:03:24 INFO]: Data value allowed items:
[09:03:24 INFO]: Generating keypair
[09:03:24 INFO]: Starting Minecraft server on *:1337
[09:03:24 INFO]: Using default channel type
[09:03:24 INFO]: Set PluginClassLoader as parallel capable
[09:03:24 INFO]: [ProtocolLib] Loading ProtocolLib v4.5.1
[09:03:25 INFO]: [SkyblockPlugin] Loading SkyblockPlugin v1.0
[09:03:25 INFO]: [NBTINJECTOR] Injecting Entity classes...
[09:03:25 INFO]: [NBTAPI] Found Spigot: v1_8_R3! Trying to find NMS support
[09:03:25 INFO]: [NBTAPI] NMS support 'MC1_8_R3' loaded!
[09:03:25 INFO]: [NBTAPI] Using the plugin 'ProtocolLib' to create a bStats instance!
[09:03:25 INFO]: [NBTINJECTOR] Injecting Tile Entity classes...
[09:03:25 ERROR]: org.spigotmc.tr7zw.nbtapi.NbtApiException: Exception while injecting Cauldron initializing SkyblockPlugin v1.0 (Is it up to date?)
org.spigotmc.tr7zw.nbtapi.NbtApiException: org.spigotmc.tr7zw.nbtapi.NbtApiException: Exception while injecting Cauldron
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:74) ~[?:?]
        at com.brandonwamboldt.SkyblockPlugin.SkyblockPlugin.onLoad(SkyblockPlugin.java:45) ~[?:?]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:298) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:202) [patched.jar:git-PaperSpigot-"4c7641d"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched.jar:git-PaperSpigot-"4c7641d"]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]
Caused by: org.spigotmc.tr7zw.nbtapi.NbtApiException: Exception while injecting Cauldron
        at org.spigotmc.tr7zw.nbtinjector.InternalInjectors.tile1v10Below(InternalInjectors.java:229) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:67) ~[?:?]
        ... 5 more
Caused by: javassist.CannotCompileException: [source error] syntax error near "void null(NBTTagComp"
        at javassist.CtNewMethod.make(CtNewMethod.java:84) ~[?:?]
        at javassist.CtNewMethod.make(CtNewMethod.java:50) ~[?:?]
        at javassist.CtMethod.make(CtMethod.java:140) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapNbtClass(ClassGenerator.java:79) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapTileEntity(ClassGenerator.java:190) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.InternalInjectors.tile1v10Below(InternalInjectors.java:225) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:67) ~[?:?]
        ... 5 more
Caused by: javassist.compiler.SyntaxError: syntax error near "void null(NBTTagComp"
        at javassist.compiler.Parser.parseMember1(Parser.java:76) ~[?:?]
        at javassist.compiler.Javac.compile(Javac.java:98) ~[?:?]
        at javassist.CtNewMethod.make(CtNewMethod.java:79) ~[?:?]
        at javassist.CtNewMethod.make(CtNewMethod.java:50) ~[?:?]
        at javassist.CtMethod.make(CtMethod.java:140) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapNbtClass(ClassGenerator.java:79) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.ClassGenerator.wrapTileEntity(ClassGenerator.java:190) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.InternalInjectors.tile1v10Below(InternalInjectors.java:225) ~[?:?]
        at org.spigotmc.tr7zw.nbtinjector.NBTInjector.inject(NBTInjector.java:67) ~[?:?]
        ... 5 more