
BadBoy6767
Members-
Posts
58 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
BadBoy6767's Achievements

Stone Miner (3/8)
1
Reputation
-
Attempt to use a Spigot/Bukkit plugin from a Forge mod.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
Oh my god I know about that, I know how to read exceptions. My question is why is WGBukkit not in the classpath when you run the server? -
Attempt to use a Spigot/Bukkit plugin from a Forge mod.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
Nothing? -
Attempt to use a Spigot/Bukkit plugin from a Forge mod.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
The problem is not with my code. It is the classpath of my project and how it's different at runtime. -
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.
-
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
One question, do you need to send the discriminator from the server? -
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
I want to slam my own face against a door. It was Spigot with the problem. Damn List taking an Object for the contains method instead of <E> ! -
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
Here is my Spigot code: Bukkit.getMessenger().registerIncomingPluginChannel(this, "MCJS", new PluginMessageListener() { @Override public void onPluginMessageReceived(String channel, Player player, byte[] bytes) { System.out.println("HAHA"); ByteBuf buf = Unpooled.copiedBuffer(bytes); int type = buf.readByte(); if (type == TYPE_THIS_IS_THE_MCLUA_MOD_SPEAKING_HERE___OVER) { verifiedMCJSUsers.add(player.getUniqueId()); } } }); The plugin kicks the player off the server if my packet isn't received within 10 seconds. -
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
After switching ClientTickEvent.getPhase to just the phase field, the server still does not receive the message. Here is the main class code if it helps: package com.example.examplemod; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import javax.script.ScriptException; import org.python.core.Py; import org.python.core.PyFunction; import org.python.util.PythonInterpreter; import net.minecraft.util.Tuple; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.network.FMLNetworkEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; @Mod(modid = MCJS.MODID, version = MCJS.VERSION, name = "MCPY") public class MCJS { static MCJS instance; public static final String MODID = "mcpy"; public static final String VERSION = "1.0"; private PythonInterpreter python; public MCJSHook hooks; public SimpleNetworkWrapper simpleNetworkWrapper; public List<Runnable> tickQueue = new ArrayList<Runnable>(); public HashMap<String, MCJSPlayer> players = new HashMap<String, MCJSPlayer>(); @EventHandler public void preInit(FMLPreInitializationEvent event) throws ScriptException { this.instance = this; prepareForServer(); this.python.exec("def a():\n\tpass"); this.python.exec("hook.add(\"PlayerJoin\", \"test\", a)"); for (Tuple<String, Tuple<String, PyFunction>> tuple : hooks.hooks) System.out.println(tuple); MinecraftForge.EVENT_BUS.register(this); simpleNetworkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("MCJS"); simpleNetworkWrapper.registerMessage(MCJSMessage.Handler.class, MCJSMessage.class, 84, Side.SERVER); } public PythonInterpreter prepareForServer() { this.python = new PythonInterpreter(); hooks = new MCJSHook(); this.python.set("hook", Py.java2py(hooks)); return getPython(); } public PythonInterpreter getPython() { return this.python == null ? prepareForServer() : this.python; } @SubscribeEvent public void joinServer(FMLNetworkEvent.ClientConnectedToServerEvent e) { prepareForServer(); tickQueue.add(new Runnable() { public void run() { System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); simpleNetworkWrapper .sendToServer(new MCJSMessage(MCJSMessage.TYPE_THIS_IS_THE_MCLUA_MOD_SPEAKING_HERE___OVER, "")); } }); } @SubscribeEvent public void clientTick(ClientTickEvent e) { if (tickQueue.size() > 0 && e.phase == Phase.START) tickQueue.remove(0).run(); } } -
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
event.getPhase(); is returning an EventPriority for some reason. Although I've managed to make a List of Runnable s and have the first one in the list be called, but the server still does not see the packet. -
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
Any good way to wait a tick in the main class? -
Spigot server not receiving custom packets.
BadBoy6767 replied to BadBoy6767's topic in Modder Support
I don't like the idea of having multiple messages. I saw another tutorial use 84, and I kind of automatically typed that in. Spigot is the server, The client is what will execute Python code. Already know about that. Okay, thank you, will do! Because Spigot is the server, it will not use Forge. -
I have this custom packet: public class MCJSMessage implements IMessage { public static class Handler implements IMessageHandler<MCJSMessage, IMessage> { @Override public IMessage onMessage(MCJSMessage message, MessageContext ctx) { if (message.type == TYPE_LOAD_LUA) { MCJS.instance.getPython().exec(message.string); } else if (message.type == TYPE_HOOK_PLAYER_JOIN) { MCJS.instance.hooks.call("PlayerJoin", new Object[] { new MCJSPlayer(FMLCommonHandler.instance().getMinecraftServerInstance() .getPlayerList().getPlayerByUUID(UUID.fromString(message.string))) }); } return null; } } public static final int TYPE_EMPTY = 0, TYPE_LOAD_LUA = 1, TYPE_HOOK_PLAYER_JOIN = 2, TYPE_THIS_IS_THE_MCLUA_MOD_SPEAKING_HERE___OVER = 3; int type = TYPE_EMPTY; String string = ""; public MCJSMessage() { } public MCJSMessage(int type, String string) { this.string = string; this.type = type; } @Override public void fromBytes(ByteBuf buf) { type = buf.readByte(); if (type != TYPE_THIS_IS_THE_MCLUA_MOD_SPEAKING_HERE___OVER) string = ByteBufUtils.readUTF8String(buf.readBytes(buf.readableBytes())); } @Override public void toBytes(ByteBuf buf) { buf.writeByte(type); if (type != TYPE_THIS_IS_THE_MCLUA_MOD_SPEAKING_HERE___OVER) buf.writeBytes(string.getBytes()); } } And it's being registered with simpleNetworkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("MCJS"); simpleNetworkWrapper.registerMessage(MCJSMessage.Handler.class, MCJSMessage.class, 84, Side.SERVER); After connecting to a server, the client is supposed to send a packet to the server telling it that the client is modified with my mod. If the server does not detect the packet, it's supposed to kick the player off the server. I think I send it normally: @SubscribeEvent public void joinServer(FMLNetworkEvent.ClientConnectedToServerEvent e) { resetPython(); System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); simpleNetworkWrapper.sendToServer(new MCJSMessage(MCJSMessage.TYPE_THIS_IS_THE_MCLUA_MOD_SPEAKING_HERE___OVER, "")); } But the server is not detecting this packet. I think it's something wrong with my Forge code. Am I doing something wrong here?
-
Specifically Java. I have intermediate knowledge of Java and have looked at many Minecraft launcher's source codes and couldn't understand anything. Is there a way to run Minecraft (with forge and mods) from the command line or Runtime.getRuntime().exec?