Inactive [FIX/ADMN] NoLagg v1.88.1 - Prevent common lag causes on your server [2338]

Discussion in 'Inactive/Unsupported Plugins' started by bergerkiller, Sep 17, 2011.

  1. Offline


    I had already made this plugin before after having a major lag issue. (lots of torches being filled, turned into items, lag for 20 minutes) It also works for 1060.

    Some feature ideas are taken over from PerformanceTweaks by @LexManos so some credit goes to him. Code, however, written from scratch by me. :)


    If you get a warning message [NoLagg TLN] followed up with a stack trace in the log, this has to do with the main thread not having responded within 10 seconds. When a plugin takes more than this time to enable, it will show that. The warning is NOT an error and is no bug, and not a bug related to NoLagg. To disable this feature, disable 'threadlocknotifier' in the config.yml. This feature is mainly intended to notify you what plugin is causing the server to freeze, may it ever happen. It is used to debug plugins in general, as they may get stuck for whatever reason.

    NoLagg's features in a nutshell


    Prevent lag caused by many items

    Every time an item gets spawned, it is buffered per chunk. For example, you spawn 30 items using Q and the maximum allowed items per chunk is 20, then the 10 remaining items are not spawned. They are spawned as soon the item count in this chunk is < 20 again.


    Form item stacks - fully automatically

    Whenever two or more (configurable) items or experience orbs get near each other, they form a single stack of that item type. If someone drops 64 dirt blocks on the ground using Q, it will show a single item of 64 dirt instead.


    Prevent lag caused by TNT

    This plugin takes over tnt ignition caused by explosions. When exploding stacks of tnt, it does not rush all tnts into a single tick, but detonate them nicely in sync. This results in pretty awesome fireworks. :)


    Prevent lag caused by lighting glitches

    Whenever a new chunk is generated, it's lighting information is generated and all nearby players receive the updated chunk data. If the auto-method fails, you can use /nolagg fix to do it manually. This fixing fixes, for example, dark spots in and around caves lagging the client.


    Set entity spawn limits

    You can set a spawn limit on virtually every entity in the game. From mobs to items to TNT. Only thing being excluded is Players, since I can't simply kick someone 'like that'. :)
    Note: It removes already spawned entities too. So, if you want to keep your animals alive, don't set mob or animal limits, or it will possibly clear your farm animals. (or you can disable the spawn limiter all together)

    I recommend finding an alternative plugin for this instead. Removing entities after they are spawned causes more lag than it prevents!

    Global auto-saver

    Since asynchronous chunk saving is now implemented internally, it is no longer a problem to save entire worlds frequently. You can set auto-save intervals in the configuration. If used with an interval higher than 400 ticks (20 seconds) it will use a scheduled task instead of the internal saver to prevent chunks never getting saved. Another benefit is that player information is also auto-saved, preventing your players losing their inventory state.

    New chunk sending mechanics

    Instead of loading chunks all around the player, the player direction is used to load the visible chunks first. This means that players can expect chunks in front of them to load quickly, while chunks on the sides take a bit longer to appear. When the player looks into another direction, the direction changes and thus the new visible chunks get loaded first. Only if all chunks ahead of the player are loaded, chunks around the player are sent. This all can be configured using a simple minimum and maximum sending rate.


    Examining the server tick rate

    If you encounter very low tick rates and you want to find out what plugin is causing it, you can use the examine component to find it out. It comes with a graphic viewer, which makes bug tracking the easiest thing ever.


    Prevent cross-thread access for events

    As it seems, some plugins don't follow the rules and use Bukkit methods in another thread. This plugin will notify you and cancel if possible whenever this happens so other plugins understand their mistake. If you encounter a lot of spam in the console, first check the stack trace for the plugin that caused the error. Report this error to the author or remove the plugin, if you have questions you are free to ask.

    Configuration (on BukkitDev)

    Commands and Permissions (on BukkitDev)

    Synchronized code accessed by another thread? (BukkitDev)


    Video by brandcool86


    - Help I experience missing chunks
    If you are using Spout, don't use Reloads. This is also the reason why Spout added a warning when a player tries to reload the server. Not using Spout, then it's a bug which you can report.

    - Can this plugin be used with PTweaks
    (this message was really old...) Yes, they are compatible, but if certain features overlap, make sure you disable these features in either plugin.

    - I get a warning about the async auto save and interval. Wat do?
    Change the autoSaveInterval value in the configuration to a value higher than 400, like 600. The warning is to prevent endless autosaves to occur, clogging up CPU.

    - I have experienced CPU usage
    CPU usage is not the same as lag. NoLagg uses multiple (2-3) extra threads to prevent tick and network lag. If a lot has to be done, it does this quicker, but this takes more CPU obviously.

    - I have lag when using NoLagg
    See also the FAQ above. Explain what type of lag you have: tick lag, client lag, network lag and/or 'block placement' lag. You can use /nolagg monitor to check the tick rate. If this is normal (>15), then you have network lag. Client lag is when the FPS drops. Block placement lag is lag when the tick rate is normal and other network messages, like chat, are instant.

    - WorldEdit causes lag...
    YES because it is unsafe to take over the main thread while another plugin is having hold over it. I can try fixing this, but it could ultimately lead to some serious concurrency exceptions. Don't expect this to be implemented very soon...

    - Do spawn limits interfere with mob-spawning plugins like MobArena?
    No, it does not. It only limits mobs spawned by 'nature': all custom creature spawns are ignored throughout the run of the plugin. Only after you reload will it lose track of these entities and will it remove custom-spawned mobs. If you use MobArena, be sure nothing is going on when you reload the server.

    - Does item stacking interfere with Showcase or BleedingMobs?
    It supports Showcase and ShowcaseStandalone entirely. (showcased items are completely ignored at all times) The same applies to the 'particles' created by the BleedingMobs plugin. Know of a plugin where it stacks items which should not be stacked? Post the plugin name so I can add support. You are an owner and want to add support? Only having a function in your plugin to check if an item is 'ignored' is enough.

    - Can this plugin be used with Chunk Manager
    If you want to use the Chunk Manager with Nolagg, disable the chunk sending of Nolagg first. If you don't do that, this plugin will do that by itself and send a warning in the log. Of course, compare the results first. :)

    - What are the best settings if I have a lot of RAM memory?
    This plugin does not deal with reduced RAM memory. If I could, I would, but you simply can't reduce the amount of memory Java uses. This data is locked and secured, so I can't simply throw away bits of data or write and read data from/to disk. Any plugin claiming to reduce RAM usage on a server, is probably 'garbage collecting'. This fakes having less RAM usage by removing unused data, but Java does this by itself as well once it hits a certain limit. All these plugins will do is make the Garbage Collector run in overdrive, which will only kill your tick rate and/or CPU speeds. A bad thing.

    - I get a lot of 'Synchronized code accessed from another thread' errors
    Find out what plugin is acting up by inspecting the stack trace. If the plugin that causes this is inactive, all you can do is wait for a refurnished version or someone to fix it for you, or use an alternative plugin. If it's still under development, notify the author of this, it IS an error caused by that plugin. If you can't find out the cause, PM me or post in this thread.

    Before you begin writing a lag issue

    This is very important, just posting a 'it causuz lagz und shitz' won't do, won't help and I won't be able to help you any further either. Question is if I even want to help you, if you post such a message without anything worth looking at. Things to include in your message:
    - Errors in the log if possible
    - What CB version you use and what NoLagg version you use
    - When this lag occurs. Tick rate drop in general?
    - The configuration you used when running this plugin
    - What type of lag if applicable. Options are: tick lag, client lag, network lag (see above)

    Important links

    NoLagg Download page and others at Dev Bukkit
    View the source code of NoLagg at GitHub

    Use an archive extracting program (WinRar, WinZip) to open the archive.

    - Add option to disable physics when the tick delay becomes too high


    Show your appreciation for my plugins by donating
  2. Offline


    Oh, Looks simple enough.
  3. Offline


    @Afforess It would be a bit useless to report the same issue twice, so:
    It's still not (entirely) working. I registered the packet listener for ID 51 and handled it in the listener. This:
        public boolean checkPacket(Player player, MCPacket mcpacket) {
            if (mcpacket instanceof MCPacket51MapChunk) {
                if (!(mcpacket instanceof MCPacket51MapChunkUncompressed)) {
                    MCPacket51MapChunk packet = (MCPacket51MapChunk) mcpacket;
                    if (packet.getCompressedChunkData() == null) {
                        System.out.println("NO DATA!");
                    } else {
            return true;
    Only outputs 'NO DATA!'. When you log-in it does output 'DATA!' (because at that point the packet is compressed directly before sending), but when walking around I never catch compressed packets.
    SpoutManager.getPacketManager().addListener(51, packetListener);
  4. Offline


    Is the autoSaveInterval measured in minutes or seconds?
  5. Offline


    @cruisecho in ticks, one tick is around 20 seconds. So, for 1 minute, you'd need to set it to 60 * 20 = 1200.

    Ugh why do I ALWAYS make such stupid mistakes?!
                //any players near?
                int view = 20;
                for (Player p : c.getWorld().getPlayers()) {
                    int cx = p.getLocation().getBlockX() >> 4;
                    int cz = p.getLocation().getBlockX() >> 4;
                    if (Math.abs(cx - c.getX()) > view) continue;
                    if (Math.abs(cz - c.getZ()) > view) continue;
                    near = true;
                //any players near?
                int view = [B]Bukkit.getServer().getViewDistance()[/B];
                for (Player p : c.getWorld().getPlayers()) {
                    int cx = p.getLocation().getBlockX() >> 4;
                    int cz = p.getLocation().getBlock[B]Z[/B]() >> 4;
                    if (Math.abs(cx - c.getX()) > view) continue;
                    if (Math.abs(cz - c.getZ()) > view) continue;
                    near = true;
    Obviously it fails if I only compare the X-coordinate...sigh.
    NoLagg update in a few seconds...


    Github is having some issues..hang on :)


    Renamed the archived thingo to make Github update it. Until Github works again, you can only download 1.31 using the 'archived' link. (you need WinRar or WinZip or others to open it btw)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 19, 2016
  6. Offline


    So...I'd like to try out your plugin, but can't.

    The title of this thread indicates v1.31 for CB1317, but the download link gets a 404 at github. Your Bukkit-Dev page has a down-rev .jar tied to the download link and your github page only shows version commits up to v1.3.

    My question is: What is the correct version and where is it? It would help eliminate confusion if you synchronized your plugin/dev pages and repository. ;) Also, it would be a good idea to include the plugin version in your filename so that there is no version miscommunication. Thx!


    OK - so I just saw the message above. I will look at the .rar. But, why are you saving in .rar format - just use standard zip that doesn't require a custom tool to unzip in either linux or windows.
  7. Offline



    The archive (.rar) contains the latest version. Github is confused and shows the 1.30 download when I upload 1.31. (same name issue I guess) Unfortunately Github has no 'report bug here' part where I can report this annoying issue...
  8. Offline


    @bergerkiller - thx. I tried it out and it works great! Good job! One of my players got a little frisky with worldedit, if you know what I mean. Also, if you have to un-rar, I recommend 7zip. Works great, and free.
  9. Offline


    i tested over 100000 tnt
    it dosnt lag because it blow up slowly :D
  10. Offline


    the idea of the Chunk sending mechanism is really nice and working great, but it take very long loading the chunks when someone teleports to his/her home. Could you fix this somehow?
  11. Offline


    @hiivin Yeah, then I need to change the algorithm for a bit to prioritize players with less chunks near.


    Got the Github upload issue solved too now. :)
  12. Offline


    I'm just testing NoLaggChunks and it's really great to push the performance for relatively small servers! But unfortunately teleporting is a big issue which makes it unusable the moment.
  13. Offline


    @k3zon I'll look into it then. Luckily I already prepared a function for it...but saw a way better way of doing it in Bukkit. (list.sort in combi. with a Comparator)
  14. Offline


    Erm it's kind of strange. When I teleport the chunks around me don't load at all. If I wasn't flying in creative mode I would fall out of the map.
  15. Offline


    Ow forgot to mention...waiting for Spout to introduce correct packet listeners. Sadly haven't heard of @Afforess in a while, latest 'test-build' he showed didn't really seem to work. :/
  16. Offline


    Does that mean we have to wait for spout? :) I'm excited for this plugin to work properly, I was searching for something like this for a while now.
  17. Offline


    @k3zon yup I got to wait. As for right now, chunk packets are received AFTER the smaller bits like signs and block changes. This causes severe issues when entering world regions being generated, since the blocks added by the populator (trees, canyons, etc.) are getting wiped by the chunk sent before. I need to buffer the compressed chunks to properly fix this.
  18. Offline


    i have a huge cpu usage only 3 players online
    i use cb1240
    my configs

    autoSaveInterval: -1
    explosionRate: 5
    useSpawnLimits: false
    tntDetonationRate: 10
    bufferTNT: true
    bufferItems: false
    useChunkUnloadDelay: true
    updateInterval: 20
    tntDetonationInterval: 1
    chunkUnloadDelay: 10000
    formItemStacks: true
    chunkSendInterval: 5.0
    maxItemsPerChunk: 60
    defaultChunkDownloadSize: 5
    defaultChunkViewDistance: 7
    globalChunkSendMaxRate: 2
            chunkSendInterval: 4
            chunkSendRate: 1
            chunkDownloadSize: 5
            chunkViewDistance: 7
    globalChunkSendInterval: 1
    defaultChunkSendRate: 1
    defaultChunkSendInterval: 4
    any suggestions ?
  19. Offline


    Don't do this. Either set autosaving off (/save-off) or set it incredibly high. Right now it saves the world every tick.
  20. Offline


    Er, 24 hours is a long time? Do you just write bukkit plugins all day? :p

    I'll look into it in a few hours.
  21. Offline


    @Afforess Thanks, and yeah, hanging around in Battlefield 2 SWOF for the moment being :p
  22. Offline


    Do you have any older versions?
    I'm running CB 1185. I recieve exceptions from your plugin in my console. I assume this is because my server is too 'old' to run a 1317 build plugin. I don't really know though, but here is the gist of it:
    It merely says "The task of NoLagg generated an exception."
    The log states:
    2011-10-14 19:05:02 [WARNING] Task of 'NoLagg' generated an exception
    java.lang.NoSuchMethodError: org.bukkit.entity.Item.getPickupDelay()I
    	at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    	at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    	at com.bergerkiller.bukkit.nolagg.StackFormer.update(
    	at com.bergerkiller.bukkit.nolagg.NoLagg$
    	at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(
    	at net.minecraft.server.MinecraftServer.h(

    2011-10-14 19:05:02 [WARNING] Task of 'NoLagg' generated an exception
    java.lang.NoSuchMethodError: org.bukkit.entity.Item.getPickupDelay()I
    at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    at com.bergerkiller.bukkit.nolagg.StackFormer.update(
    at com.bergerkiller.bukkit.nolagg.NoLagg$
    at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(
    at net.minecraft.server.MinecraftServer.h(

    Can you maybe explain this to me, and maybe how to fix it?

    EDIT: Reviewed it a bit better , I think the red 'I' at the end of '()' might be wrong there..
    I can't be bothered to decompile it right now, though. It's 4AM..

    - Lildirt
  23. Offline


    @Lildirt yup, a compatibility error. Well spotted. I'll add some try-catch coding to add backwards compatibility.


    Are you sure you got the latest (v1.31) version? The stack trace doesn't match the coding I have here.
  24. Offline


    I'm pretty sure, I re-downloaded it last night to test it again and make sure my JAR wasn't corrupted..
    It might have been the fact that I was running Java 6? I haven't tried running NoLagg since I updated to Java 7.
    I'll try to re-download it with a updated Java, and see if it generates anymore exceptions.

    EDIT: Yep, it generated another exception. I'll post it here in a second.
  25. Offline


    @Lildirt Github was having issues when uploading (for a while) and 1.30 was up while it said 1.31 here. It could be this is why it doesn't match.
  26. Offline


    2011-10-15 13:50:59 [WARNING] Task of 'NoLagg' generated an exception
    java.lang.NoSuchMethodError: org.bukkit.entity.Item.getPickupDelay()I
    	at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    	at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    	at com.bergerkiller.bukkit.nolagg.StackFormer.update(
    	at com.bergerkiller.bukkit.nolagg.NoLagg$
    	at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(
    	at net.minecraft.server.MinecraftServer.h(
    It's the exact same error as before. I'm clueless on Java, but that I isn't supposed to be there!! ._.

    EDIT: I did check out the source in the JAR, and it didn't appear to have any coding errors to what I could tell.. to what I could tell.. to what I could tell.. ._.
    EDIT2: I'm horrible at typing a post in one go.. but, *cue common sense*, this has to be the item handler

    java.lang.NoSuchMethodError: org.bukkit.entity.Item.getPickupDelay()I
    at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    at com.bergerkiller.bukkit.nolagg.StackFormer.update(

    I assume that the blue-colored text is simply saying:
    "Hey! I can't tell what the stack was before they picked up the item! What now?!"

    And the red-colored text is simply saying:
    "Huh.. 'StackFormer' is sending an error, that means I can't work properly then.."

    I don't understand the green-colored text though. I don't see it's purpose. getPickupDelay?

    Am I wrong? (Yes)
  27. Offline


    @Lildirt yup it now points to the correct line. I bet the NoSuchmethodError is not an extension of Exception...I'll change it to Throwable.
  28. Offline


    I can't make a post work in 1 go.. I edited it three times, Lol.
    I'll try it out in about 30mins, so I know you're done updating. :p
  29. Offline


    Ok updated it to v1.32 changing exception to throwable and a minor change in the explosion coding. (added fire and 0 as denied IDs instead of checking them afterwards)

    GitHub still hates me for some reason, so I had to remove the individual download links. NoLagg and the add-on are both in one download now and you need WinRar/WinZip/others to open it. I might make a separate directory in the repository instead...friggen' downloads feature is failing.
  30. Offline


    Alright! I'll give it a shot and report to you later! :)
  31. Offline


    @bergerkiller I'm following this thread with great interest. It seems once the remaining kinks are ironed out, you've got a great plugin here and I'm looking forward to trying it out soon.

Share This Page