Jump to content

using the event bus in a bukkit plugin (to listen to chunk load events)


Recommended Posts

im trying to listener to chunk loading events (using the net.minecraftforge.event.world.ChunkEvent.Load event class), but it just instantly crashes my server as soon as the chunk load event fires (when debugging, it passes the event to the rest of the listeners that are mods... but as soon as it hits mine it crashes). im using the compiled searge mappings as a dependency too, thats how i get access to forge stuff. i mainly need to listen to the chunkload events because theres a chunk that sometimes freezes the server during startup, so im just going to listen to chunkload events while the server starts and hope to find that 1 chunk

crash report:

Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Exception getting block type in world
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:893)
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:332)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:782)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:665)
	at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:583)
Caused by: java.lang.NoClassDefFoundError: reghzy/myplugin/listeners/ChunkLoadListener
	at net.minecraftforge.event.ASMEventHandler_191_ChunkLoadListener_onChunkLoad_Load.invoke(.dynamic)
	at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:44)
	at net.minecraftforge.event.EventBus.post(EventBus.java:108)
	at net.minecraft.world.chunk.Chunk.func_76631_c(Chunk.java:1179)
	at org.bukkit.craftbukkit.v1_16_R3.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:44)
	at org.bukkit.craftbukkit.v1_16_R3.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:15)
	at org.bukkit.craftbukkit.v1_16_R3.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:342)
	at org.bukkit.craftbukkit.v1_16_R3.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:300)
	at org.bukkit.craftbukkit.v1_16_R3.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
	at net.minecraft.world.gen.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:186)
	at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:159)
	at net.minecraft.world.gen.ChunkProviderServer.func_73154_d(ChunkProviderServer.java:282)
	at net.minecraft.world.World.func_72964_e(World.java:801)
	at net.minecraft.world.World.func_72798_a(World.java:685)
	at net.minecraft.village.Village.func_75574_f(Village.java:425)
	at net.minecraft.village.Village.func_75557_k(Village.java:406)
	at net.minecraft.village.Village.func_75560_a(Village.java:66)
	at net.minecraft.village.VillageCollection.func_75544_a(VillageCollection.java:77)
	at net.minecraft.world.WorldServer.func_72835_b(WorldServer.java:450)
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:886)
	... 4 more
Caused by: java.lang.ClassNotFoundException: reghzy.myplugin.listeners.ChunkLoadListener
	at java.lang.ClassLoader.findClass(ClassLoader.java:523)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 24 more

the listener itself, im just creating in the plugin's onEnable() method. like so:

// plugin class
public void onEnable() {
    new ChunkLoadListener();

// ChunkLoadListener class
public ChunkLoadListener() {
public void onChunkLoad(ChunkEvent.Load e) {
    Chunk chunk = e.getChunk();
    ConsoleLogger.translatePrefix("&6Chunk loaded at XZ: &c" + chunk.field_76635_g + "&6, &9" + chunk.field_76647_h);


does anyone know why this is happening? i did some research and found that forge has some sort of protection when loading classes, or maybe its using a weird classloader setup where it wont find any classes unless they were loaded by forge (plugins are loaded with a custom plugin classloader so maybe forge wont find them)

Link to comment
Share on other sites

oh... i might be using the wrong craftbukkit sources. im using minecraft 1.6.4, hopefully 1.6.4 craftbukkit might fix it

i know its an old version so it isn't supported anymore... but i wasnt sure where else to ask. bukkit forums doesn't allow mods and im not using spigot so im kinda stuck :(

Edited by reghzy420
Link to comment
Share on other sites

This topic is now closed to further replies.


  • Create New...

Important Information

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