ChunkLoad
ChunkLoad
A Bukkit plugin to prevent selected chunks from unloading
Inspired by ForeverALoad by Piedo_bear which is discontinued as of Minecraft 1.2
Requires WorldEdit
Usage:
/chunkload add <name> - adds the chunks of the current selection as region <name> and prevents them from unloading
/chunkload remove <name> - deletes the region, so it may be unloaded again
/chunkload list [page] - lists the currently defined regions
/chunkload select <name> - sets your WorldEdit selection to the chunks of region <name>
/chunkload configure <name> - shows the region and its configuration
/chunkload configure <name> <option> - shows the value of <option>
/chunkload configure <name> <option> true|false|default - turns an option on or off for region <name>
/chunkload configure <name> -<option> - (minus sign in front of the option) sets <option> to its default value (same as /chunkload configure <name> <option> default)
/chunkload options - lists all available options:
- inactive: chunks of inactive regions may be unloaded; this can be used to temporarily disable a region
- load-on-start: load the chunks of this region into memory at server startup
/chunkload reload - rereads the configuration file - TODO: this doesn't work
/cl is an alias to /chunkload
all subcommands except reload can be abbreviated to their first letter
Special Regions:
- __global__: a region containing a complete world
To use ChunkLoad you need either the chunkload.usage permission or (if enabled in the configuration) be an operator on the server
Configuration:
allow-ops - allow operators to use ChunkLoad even if they don't have the required permissions; default: true
worlds.<worldname>.<regionname> - rectangles of chunks to keep loaded, manual editing at your own risk
Todo:
- have a look at the ForeverALoad features and implement them
This plugin is licensed under GPLv2 or (at your option) any later version
The source can be found on my github: https://github.com/Nidan/ChunkLoad
/chunkload add welcomeworld - __global__
/chunkload add welcomeworld - global
/chunkload welcomeworld - __global__
/chunkload add - __global__:welcomeworld
/chunkload - __global__:welcomeworld
/chunkload add - __global__: welcomeworld
/chunkload - __global__: welcomeworld
(those i tried with and without spaces)
and all of those i tried with just the alias of /cl just for giggles to see if there is a difference All I get from these is "Your section in not in this world"
Also I tried adding just one chunk to make sure i was not totally losing my mind I tried to add chunk 14, 32 and it added 0,0 to 15, 15... totally confused
Any ideas?
Thanks for your time and looks like a killer plugin for our server thank you for your efforts
@SoWhoYouStill
fixed in 0.6.3
v0.6.2 for CB 1.3.1-R2.0
On Command:
/cl remove NAME
I get this error:
[SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'cl' in plugin ChunkLoad v0.6.2 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:492) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:878) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:807) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:825) at net.minecraftserverhook.NetServerHandlerProxy.a(NetServerHandlerProxy.java:124) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44) at net.minecraft.server.NetworkManager.b(NetworkManager.java:276) at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:109) at net.minecraft.server.ServerConnection.b(SourceFile:35) at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:581) at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:212) at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406) at net.minecraft.server.ThreadServerApplication.run(SourceFile:539) Caused by: java.lang.NullPointerException at com.github.nidan.chunkload.ChunkLoadPlugin.onCommand(ChunkLoadPlugin.java:313) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
OnCommand:
/chunkload remove NAME
I get this error:
[SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'chunkload' in plugin ChunkLoad v0.6.2 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:492) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:878) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:825) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:807) at net.minecraftserverhook.NetServerHandlerProxy.a(NetServerHandlerProxy.java:124) at net.minecraft.server.NetworkManager.b(NetworkManager.java:276) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44) at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:109) at net.minecraft.server.ServerConnection.b(SourceFile:35) at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30) at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:581) at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:212) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406) at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474) at net.minecraft.server.ThreadServerApplication.run(SourceFile:539) Caused by: java.lang.NullPointerException at com.github.nidan.chunkload.ChunkLoadPlugin.onCommand(ChunkLoadPlugin.java:313) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
I have been looking for this forever. Please keep updating it!
So mining carts are an exception to the chunkload? Because I'm trying to set up a automatic train system so that the train moves when no one is around but the carts stay in limbo as everything else works..
@xXZymosisXx
That seems to be a minecraft feature. My goal is to work around it but I haven't figured out what causes this behavior yet.
@Kirbyarm
That was an error in Nolagg and has been fixed a few days ago.
Thank you for this plugin. It works for me and allowed me to quickly prove my concept. I havs a citizens2 manned postal system that grinds to a halt when players are not near the postal routes, some of them pretty long. ChunkLoad quickly proved that those npc's can be worked even when no one is logged in. Even before anyone logs in. (slave labor?)
Also thank you for making your source available. I have my own chunk loader that apparently doesn't work :-) My loader gathers the waypoints when the server loads and specifically loads them and flags them via the event handler not to unload. Without your region set, the npc's just grind to a halt.
Maybe chunk management needs to be a contiguous, rectangular region? I use the chunk.load(false) to load. I have no problem preventing chunks from unloading, it is the initial pre-loading that has me baffled. Best Regards.
Update: yep - I reorganized to contiguous, rectangular regions and all is good now!
I'm loving the concept of this plugin, but I can't get it to work for the simple task at hand.
Basically, installing NoLagg causes the chunk directly in the center of Spawn City to unload for clients if they travel more than 2 chunks away from it (which is horribly ugly and just not right). So I selected the surrounding cuboid of all involved blocks, performed a "/cl add spawncity" and it confirmed that 6 chunks will remain loaded. The chunk still disappears. There seems to be absolutely nothing I can do about this really horrible bug, and my server just can't live on comfortably without NoLagg.
Since you appear to have expertise in chunk loading, what do you think I could do about this issue? Any ideas at all?
Mackenzie~
EDIT: Here's an image link that may help you understand what I mean...
http://i589.photobucket.com/albums/ss334/Kirbyarm/chunkerror.jpg
It seems my chestcarts cannot move by themselves in loaded chunks... Is this not a feature of the plugin or is a bug?
@micahdg
The bug you found is fixed, I've uploaded a new jar: v0.6.1
But if your server dies because loading those chunks requires too much memory, I don't think
__global__
will help you, as both, global and normal, regions only load existing chunks. The only difference is that normal regions require a bit of bookkeeping to quickly find out to which regions a chunk belongs.@biouxtai
You might want to try v0.6.1, since there was an error in the unloading test in v0.6. If that doesn't help you, causing the server to continue simulating the world if noone is online is out of scope for this plugin
I have a question about loading the entire map into memory... using "v0.6 - untested" on MC 1.3.1 with bukkit #2317 1.3.1-R1.0.
As op, I typed:
/cl add __global__
and it appears to have accepted the command. Do I need to then set the load-on-start option to true for __global__? Or is it understood that __global__ will load on startup automatically? When I do not use the load-on-start option, the server does not appear to use any more ram than it did before adding chunkoad, so I assume it's not loading the entire (4gb) map into memory.
Next I tried enabling the load on start:
/cl c __global__ load-on-start true
The plugin accepted it and changed the config properly, but when I restart the server:
2012-08-10 15:20:15 [INFO] [ChunkLoad] Enabling ChunkLoad v0.6
2012-08-10 15:20:15 [SEVERE] Error occurred while enabling ChunkLoad v0.6 (Is it up to date?)
java.lang.NumberFormatException For input string: "-1.-1.mca"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.github.nidan.chunkload.ChunkLoadPlugin.loadGlobal(ChunkLoadPlugin.java:159)
at com.github.nidan.chunkload.ChunkLoadPlugin.loadData(ChunkLoadPlugin.java:120)
at com.github.nidan.chunkload.ChunkLoadPlugin.loadData(ChunkLoadPlugin.java:106)
at com.github.nidan.chunkload.ChunkLoadPlugin.loadData(ChunkLoadPlugin.java:74)
at com.github.nidan.chunkload.ChunkLoadPlugin.onEnable(ChunkLoadPlugin.java:62)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:365)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:265)
at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:247)
at net.minecraft.server.MinecraftServer.i(MinecraftServer.java:296)
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:275)
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:225)
at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:140)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:380)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
Current config.yml
worlds:
world:
__global__:
config:
load-on-start: true
allow-ops: true
To test whether the plugin is even working, I created a region that encompassed half the world and set it to load-on-start: true. I reset the server and its memory usage quickly climbed past 3gb with no errors in the logs with only one player online. I would prefer to use a __global__ option, if it will work, instead of another parent region.
edit: So I let the server continue loading the test region, whose bounds are 0,0,0 to 30000,255,30000 :O and the server proceeded to gobble 7.5gb ram before getting a java heap memory error and quitting. I think that global option you spoke of, which presumably only loads generated chunks, would be a lot better than what I'm doing here :)
Any help is appreciated! Thanks!
Is it possible to get an option to allow for this plugin to work while players are not logged in? I run a small server with quarries from BC. I tested with 0.6 and the quarry does not process when no players are logged in. I was offline for about an hour and the machine should have processed several layers in that time. Logging back in, I see that it did not. I have 29 chunks set in the area to be kept loaded. The entire quarry and all machines involved in it's operation are within that area.
@7007King0770
Did you select something with Worldedit before using /cl add?
@DrVesalius
Confirmed your problem, but I don't know how to fix it yet. It looks like Minecraft stops moving minecarts a few chunks before they hit the normal "unloading border", while redstone stops at that border. If those stopping minecarts are intentional to avoid moving them into an unloaded chunk I probably can't work around it... can't say for sure right now. The redstone I should be able to fix.
Once I install a java compiler on this netbook (i.e. tomorrow) there'll be an update supporting global regions for those who want to load the whole map. Note that the update will be untested. (This netbook is too weak for minecraft)
How do you use this plugin, can we get a tutorial made? I'm trying to add chunks to the list of permaloaded chunks but It keeps saying "Your selection is not in this world."
I love this plugin!
Works great with mods like industrialcraft and redpower
Hi,
We are building a long distance transport rail network for unmanned storage carts.
At the far end of the rail is a detector rail, linked to a long redstone wire with repeaters running parallel to the track. The idea was that when the cart reaches the end, a light flashes up at the control end to say it has arrived.
To test this, we currently have a car bouncing backwards and forwards on a short track at the end of our network, in order to send regular 2-3 second pulses down the redstone. However, once we get a certain distance away, the pulses stop coming down the wire. If we go a bit closer, they restart. Thus, I assume this is because as we move away the chunk with the cart is unloading, killing the signal source.
I have tried ForeverALoad and Chunkload to keep the chunks holding the whole rail and redstone wire in memory. However, it doesn't seem to help - I assume this is because the moving minecart is an entity and not a block. Does minecraft only keep the *blocks* in these chunks in memory, and doesn't run any entities mobs etc. And in which case, is there any work around or way this could be rectified??
Any newb friendly help is most appreciated! :)
@Fr0zenFr0g
The number of chunks displayed is the size of the region. If most of the chunks haven't been generated yet that doesn't change that number. Looks like you have defined a huge region (250k chunks is 8k x 8k blocks) on a small world. I didn't change anything about the memory usage besides adding some bookkeeping which should be negliable compared to the memory the loaded chunks use.
Will look into adding global regions but it might take a week or two.
please add load all chunks option!!!
-EDIT- is this plugin optimized? because 35000?? chunks was taking 5gb RAM... and another thing my map is ca 2800 chunks but this plugin thinks it is over 250000.......@Nidan0
haha my bad I didn't read into it... I saw "chunk persistance" and thought "chunkload". I didn't see the performancetweaks (aka Ptweaks) thing at the beginning.
@Delbyzz
Can you give more information, e.g. the part of the server log where bukkit tries to load ChunkLoad, server version, contents of your plugins directory, ...?