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

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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