betterphp / InfinitePlots

A plugin for Bukkit based Minecraft server that can generate infinite square plots of a configurable size.
http://dev.bukkit.org/server-mods/infiniteplots/
3 stars 4 forks source link

InfinitePlots breaks on reload #48

Closed DrastiCraft closed 10 years ago

DrastiCraft commented 10 years ago

For both of these, I ran /plot claim.

After reload 2013-09-28_07 19 17 Before reload: 2013-09-28_07 18 42

Full trace:

2013-09-28 07:18:42 [SEVERE] Error occurred while enabling InfinitePlots v0.9-SNAPSHOT (Is it up to date?)
java.lang.ClassCastException: uk.co.jacekk.bukkit.infiniteplots.generation.PlotsGenerator
        at uk.co.jacekk.bukkit.infiniteplots.plot.Plot.<init>(Plot.java:44)
        at uk.co.jacekk.bukkit.infiniteplots.plot.PlotManager.loadPlotsFor(PlotManager.java:40)
        at uk.co.jacekk.bukkit.infiniteplots.InfinitePlots.onEnable(InfinitePlots.java:62)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.java:282)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.java:264)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.reload(CraftServer.java:608)
        at org.bukkit.Bukkit.reload(Bukkit.java:278)
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:24)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:192)
        at org.bukkit.craftbukkit.v1_6_R3.CraftServer.dispatchCommand(CraftServer.java:523)
        at net.minecraft.server.v1_6_R3.PlayerConnection.handleCommand(PlayerConnection.java:959)
        at net.minecraft.server.v1_6_R3.PlayerConnection.chat(PlayerConnection.java:878)
        at net.minecraft.server.v1_6_R3.PlayerConnection.a(PlayerConnection.java:837)
        at net.minecraft.server.v1_6_R3.Packet3Chat.handle(SourceFile:50)
        at net.minecraft.server.v1_6_R3.NetworkManager.b(NetworkManager.java:296)
        at net.minecraft.server.v1_6_R3.PlayerConnection.e(PlayerConnection.java:117)
        at net.minecraft.server.v1_6_R3.ServerConnection.b(SourceFile:37)
        at net.minecraft.server.v1_6_R3.DedicatedServerConnection.b(SourceFile:31)
        at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:227)
        at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:489)
        at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
        at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:584)

I am using Build #94 from the Jenkins service @ jacekk.co.uk

betterphp commented 10 years ago

That's going to happen with /reload for anything that checks the generator for a world.

In a few places I need to check if something happened in a plot world or not, I do that using

if (world.getGenerator() instanceof PlotGenerator){

PlotGenerator is the class that generates the paths.

The problem is that /reload will unload the PlotGenerator class and load a new one with the same name but a different internal identifier. Java checks that when doing an instanceof and the half matching causes a bit of confusion.

Basically, can't be fixed easily. Don't use /reload ;)