Jump to content

Attempt to use a Spigot/Bukkit plugin from a Forge mod.


BadBoy6767

Recommended Posts

Here's the story (Sorry for it being so long, It's like this so there'll be less questions):

I have been working on a small server and I noticed that ComputerCraft turtles are able to grief areas protected by the WorldGuard plugin.
The reason was obvious (to me at least) and so I searched and found out that ComputerCraft has a small API.
Using this API I can force turtles to not dig blocks (interfaces and polymorphism and all that crap).
So in a Bukkit plugin I'm making, I added the ComputerCraft JAR to the classpath and called it from my plugin.

After quitting due to dependency hell (The interface method had an argument of type net.minecraft.world.World, and for some reason the server JAR did not have that class), I tried doing it the other way.
So I made a small server-only mod that used this ComputerCraft API. Everything compiled flawlessly and I put it in my servers "mods" folder.
Everything was working until my test turtle tried to dig a block. The server crashed.

The reason was that a WorldGuard class was not found.

 

I assumed that all Forge/Bukkit mods would be in the same classpath at runtime. Seems that that is false.

java.lang.NoClassDefFoundError: com/sk89q/worldguard/bukkit/WGBukkit
	at org.midnightas.axaxa.serverside.AxaxaServerside.isBlockEditable(AxaxaServerside.java:39) ~[AxaxaServerside.class:?]
	at dan200.computercraft.ComputerCraft.isBlockEditable(ComputerCraft.java:456) ~[ComputerCraft.class:?]
	at dan200.computercraft.shared.turtle.upgrades.TurtleTool.dig(TurtleTool.java:207) ~[TurtleTool.class:?]
	at dan200.computercraft.shared.turtle.upgrades.TurtleTool.useTool(TurtleTool.java:97) ~[TurtleTool.class:?]
	at dan200.computercraft.shared.turtle.core.TurtleToolCommand.execute(TurtleToolCommand.java:36) ~[TurtleToolCommand.class:?]
	at dan200.computercraft.shared.turtle.core.TurtleBrain.updateCommands(TurtleBrain.java:995) ~[TurtleBrain.class:?]
	at dan200.computercraft.shared.turtle.core.TurtleBrain.update(TurtleBrain.java:183) ~[TurtleBrain.class:?]
	at dan200.computercraft.shared.turtle.blocks.TileTurtle.func_145845_h(TileTurtle.java:278) ~[TileTurtle.class:?]
	at net.minecraft.world.World.func_72939_s(World.java:2548) ~[ahb.class:?]
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:673) ~[mt.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:976) ~[MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431) ~[lt.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:831) ~[MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:683) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.lang.ClassNotFoundException: com.sk89q.worldguard.bukkit.WGBukkit
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_111]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_111]
	... 15 more
Caused by: java.lang.NullPointerException

The exception says that my isBlockEditable (the interface method) was called, and line 39 is a line which uses the com.sk89q.worldguard.bukkit.WGBukkit class.

Link to comment
Share on other sites

On 3/5/2017 at 9:33 AM, BadBoy6767 said:

Caused by: java.lang.ClassNotFoundException: com.sk89q.worldguard.bukkit.WGBukkit

Hmmmmmm

Edited by Leomelonseeds

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Link to comment
Share on other sites

Because Bukkit/Spigot plugins have nothing to do with Forge mods. There is an argument in the @Mod annotation for a Bukkit class but I don't know if that works.

Link to comment
Share on other sites

The question is, why do you think it would be on the classpath?

Nothing adds it? Pretty sure that Sponge/Bukkit hide all plugin classes from all other plugins/whatever.

You'll have to ask whoever you're using for your Bukkit API on the server.

 

As for the 'Dependancy hell' yes... Minecraft is a dependancy of Mods... that's how it works...

And you can't depend on minecraft code from Bukkit plugins that's the entire point.

The reason the 'net.minecraft.world.World' class doesn't exist in your server is because it isn't named that. Bukkit uses their own mappings for classes, methods, and fields.

When we get Minecraft from Mojang, everything is obfusicated, class names like 'a', 'b', 'aba', We translate them into useable names.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.