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


    @Sepulzera I use my custom GUI wrapper and had to copy-paste some arguments of that into a batch file, so I forgot to change some things :)
  3. Offline


    sorry if this has already been asked but i can't read 64 pages right now.

    if someone on the server had a nice animal farm going and then logged out and logged in or left the arena and returned again could it despawn some of the animals if there was lots of them? would it despawn all of the animals or just a selected few to make it under the limit? and if there were lots of animals loaded in different chunks of the server and a lot of the chunks with them in it were loaded at similar times could it cause someones tiny little 4 animal farm to get despawned to compensate for the rush of animals being loaded into memory from the rest of the map?

    thanks in advance
  4. Offline


    There is a bug in minecraft where animals can go through fences (they enter the block to the mid, as the fence allows it, and when the area gets loaded again animals are on the other side).

    Thus you should build farms with real blocks, like glass.
  5. Offline


    @tysonzero Yes, if the total mob count exceeds the global/default/world limit, it will despawn mobs in the order they got spawned. So the oldest mobs despawn the first. If you don't want that, don't set mob/animal limits but only monster and other entity limits. This way animals are completely ignored.
  6. Offline


    Just what I got right now after /nolagg fix
  7. Offline


    @Sepulzera as it seems it has issues with semi-transparent blocks. (I saw the same with glass and ice)
  8. Offline


    Not sure, could be possible it conflicts with a plugin i use.
    Maybe BlocksOnGlass, it has some tasks for fences, too.

    Will try it later.
  9. Offline


    @Sepulzera no no I am pretty sure that is the issue. The current method only checks for 'dark' light of AIR blocks. I changed it a bit to use a block state (isTransparent)
    if (c.getTypeId(x, y, z) == 0) {
    if (!Block.o[c.getTypeId(x, y, z)]) {
    I'll upload the first debug version of 1.53.4, tell me if it fixes that issue. *done


    lol new lighting method is 100% correct...yet the water is now from the Carribiens :)

    @Sepulzera um how conflicting? What is going on?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Sep 9, 2018
  10. Offline


    Your debug version didn't fix this issue.
    Some weird fact: When i rightclick the fence, it gets fixed.

    Edit: Ok checked it now. It is NOT conflicting with any plugin here.
  11. Offline


    @Sepulzera I already have a new lighting method (which checks any state of lighting), but right now it turns the ocean too bright.
  12. Offline


    Maybe you want me to test your new lighting method, to check if it fixes my f*cked up fences now? :)
  13. Offline


    @Sepulzera done, see the new DEBUG2 on GitHub. It should now do everything correctly, since it even managed to fix lightin at the bottom of the sea :O
  14. Offline


    Seems to work, but (now) it is really conflicting with BlocksOnGlass.
    Could you take a look at this? I do really need this plugin :)

    blocks the plugin is modifying arent lighted, or lets say just buggy lighted. Just watch the screenshot I posted above ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 10, 2018
  15. Offline


    @Sepulzera And performing a /nolagg fix 1 doesn't fix it? BTW: there are a lot of vanilla lighting glitches. For example, if you place two pieces of leaves in the air and remove the top one, the shadow underneath suddenly turns darker.

    @Sepulzera It uses an algorithm to find out the real light value, and if this ends up higher than the actual value, it changes it. Very plain and simple. But, can you explain what 'BlocksOnGlass' does? It simply allows you to place torches, fences etc to be placed on glass? Or other?


    See the new DEBUG version. This one also fixes lighting issues occurring when a semi-transparent block changes. (gets rid of black spots under decaying trees, I'll make a comparison video soon)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 10, 2018
  16. Offline


    Sadly not. Guess I will have a talk with the dev of BlocksOnGlass, it seems he did something wrong, as it even occurs without any other plugin :\

    Hmm, even when I remove BlocksOnGlass, Nolagg fix won't fix these lighting issues automatically. I have to update the lighting manually (placing a torch or a block near it) to fix it.

    This should definitely be fixed by your command, shouldn't it? :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  17. Offline


    @Sepulzera it isn't possible that it simply acts like that because it is native? To me it seems as if it simply subtracted one from the light level and set that to the block.
  18. Offline


    [​IMG] think this is native?
  19. Offline


    @Sepulzera what about the blocks underneath the dark fences? Are they dirt or grass?
  20. Offline


    Both, or to be more exact: it doesn't matter.
    It just need to be a block used by BlocksOnGlass.

    I don't really understand why /nolagg fix won't solve such lighting issues (after I've removed the corrupting plugin).
    That is what the command is supposed to do, isn't it?

    Yea it makes it possible, to place anything on glass, fences, leaves, glowstone and such stuff where you usually can't place things. Useful to create rails etc...

    But I don't know why it causes such weird lighting issues. Older versions didn't, just the most recent.
    So I'm using an older version now, but my fences and glasses still suffer from lighting issues, until I update the lighting state manually.

    And thats the point I don't understand: Why doesn't your algorithm find these corrupted light values?
    Seems you should check it. :p

    Could you send me a version where your lighting fix checks all blocks?
    Would like to try this.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Feb 15, 2019
  21. Offline


    @Sepulzera Well I can't use another system than Minecraft's (else it would break as soon a new block gets added)
        public static boolean fixBlockLighting(final Chunk chunk, final int x, final int y, final int z) {
            final int typeid = chunk.getTypeId(x, y, z);
            if (!Block.o[typeid]) {
                final int factor = Math.max(1, Block.q[typeid]);
                final int light = chunk.h.a(x, y, z);
                //actual editing here
                int newlight = light + factor;
                if (x > 0) newlight = Math.max(newlight, chunk.h.a(x - 1, y, z));
                if (z > 0) newlight = Math.max(newlight, chunk.h.a(x, y, z - 1));
                if (y > 0) newlight = Math.max(newlight, chunk.h.a(x, y - 1, z));
                if (x < 15) newlight = Math.max(newlight, chunk.h.a(x + 1, y, z));
                if (z < 15) newlight = Math.max(newlight, chunk.h.a(x, y, z + 1));
                if (y < 127) newlight = Math.max(newlight, chunk.h.a(x, y + 1, z));
                newlight -= factor;
                //when exceeding in loops, just pick the highest value
                if (newlight > light) {
                    chunk.h.a(x, y, z, newlight);
                    return true;
            return false;
    it simply checks if the block is NOT a solid block and then checks all surrounding blocks for a higher light value. If found, it will set the new light. This is done recursively until all blocks return false in the above function. (max 20 times)

    It is possible that the plugin changed glass/fence to a solid block, causing my function to fail. That is a very bad way to do it, but who knows?
    (Plus, this Block.o[type] is also used for the internal lighting, so if that plugin alters it: prepare your anus.)


    Ok prepare your anus. xd

    The a() and b() booleans are used for lighting too. (they eventually fill the o array)
    Why doesn't this plugin simply use the canBlockplace event?!)
  22. Offline


    I don't know anything about the minecraft code, so I didn't understand anything you wrote, thought I got some knowledge about programming.

    But maybe you can contact him with your advice, so he can fix these things.

    However: After I've removed BlocksOnGlass, your lighting fix should work, shouldn't it? Doesn't, except I update the light value manually.
  23. Offline


    @Sepulzera It will fail if all surrounding blocks have a light value lower than normal. Since the fence has light level 0, and so do the other 3 faces, the block will stay dark. I can only think of manually updating it.

    However, newly-generated chunks will be perfectly fine, since the fence has a normal light value then.

    Also note that a server restart is probably required, since the plugin permanently changes the block.
  24. Offline


    If there is a row of fences with a light level 0, adjacent on the left and right side to fence blocks with the normal light level, the adjacent fences with light level 0 near these fences with normal light level have 1 fence with a light level 0 and 1 fence with a light level normal around them.
    Then these should be updated / fixed, shouldn't they?
  25. Offline


    @Sepulzera I don't know, it's quite possible that the fence simply got glitched.
  26. Offline


    @Sepulzera Your fence has air on top, thus it will always be able to fix the lighting of it. If it doesn't, then something weird is going on... Ow and the latest version already fixes all blocks (auto-fix is also forced enabled now)
    I have no idea why the fence doesn't get fixed (I don't have the world where I can try to fix this through code)

    If possible, could you upload the world where it happens? (and post the coordinates where it happens)
  27. Offline


  28. Offline


    The world limit is based on mobs in active chunks isn't it? is there a way to make it so that instead of despawning animals will just get saved in memory and act just like invisible blocks and not move kind of like they are when they are not within anyones render distance? because that would be a nice way to prevent you loosing animals and just make sure the server knows not to worry if the animals disappear they will get reloaded once you get below the max animal limit.
  29. Offline


    @tysonzero it's a solution, but the downside is that this will cause a lot of new animals to spawn to fill up the gap. Since the creature spawn event seems to be failing, I can't stop that wave of animals. This will result in animal duping, which will only increase lag.

    But, I'll see what I can come up with, I could make it buffer them like I did with items.
  30. Offline


    Sounds like a good plugin gonna try it in the morning :)
  31. Offline


    Can I also disable the spawn limiter?

Share This Page