[MECH] WorldBorder v1.7.2 - feature-rich world size limiting plugin [BukkitDev]

Discussion in 'Archived: Plugin Releases' started by Brettflan, Apr 4, 2011.

  1. Offline

    Brettflan

  2. Offline

    phondeux

    Installed - fixed it, thanks!
     
  3. Offline

    Brettflan

    I've released v1.1, see the first post for the download link.

    v1.1:
    • moved border checking routine out into a timed task, for even lower server impact
    • added new configurable "delay" value, for the number of ticks it will wait between border checks, the default is 4 ticks (~200ms); each server tick is ~50ms or so
    • added new configurable "knockback" value, for how far back inside the border to move a stray player, the default is 3.0
    • changed world-name encoding method for worlds with dots in the name to use an uncommon high-range ASCII character ("ยจ"), since forward-slash ("/") can occur in world names; don't worry, old 1.0.1 configurations which have the "."->"/" encoding will be automatically and safely converted
    • split command listing to 2 pages for players, since there are too many commands to fit on 1 screen now
    New Commands
    /wb knockback <distance> - how far to move the player back inside the border when they cross it.
    Permission: worldborder.knockback
    /wb delay <amount> - the number of ticks it will wait between border checks, the default is 4 ticks (~200ms); each server tick is roughly ~50ms. For reference, 20 ticks = ~1000ms = ~1 second.
    Permission: worldborder.delay


    Considering WorldBorder is practically guaranteed to be more efficient than BorderGuard Lite/Turbo (having again looked at his 3.00 code), I'm almost tempted to change my topic title to say "also the #1 most efficient map limiter", but I guess that would be a bit childish. :p


    EDIT: by the way, people who are interested in multiple round borders per world, you should keep an eye on Reil's rBorder topic. His last post indicates he's working on that feature for a new rBorder release. I'm still not planning on adding in support for multiple borders per world, so he's probably your best bet.
     
  4. Offline

    OrtwinS

    Hi Brettflan,

    Could you please keep download links available for the last few RBs? I can not follow the RB trend in real time because many plugins take several days to update.
     
  5. Offline

    haldavid

    The "second page" of help isn't displaying, and I'm unable to use /wb knockback, /wb delay, etc.

    Dunno if I'm doinitwrong or if you left out the second half of commands =x

    EDIT: nm apparently the link hadn't yet been updated and i had downloaded 1.01
     
  6. Offline

    XAM

    When someone tries to exit the border sometimes, this error occures causing the server to lock and needs to be restarted:
    Code:
    00:41:12 [SEVERE] java.util.ConcurrentModificationException
    00:41:12 [SEVERE]       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:848)
    00:41:12 [SEVERE]       at java.util.HashMap$KeyIterator.next(HashMap.java:883)
    00:41:12 [SEVERE]       at com.wimbli.WorldBorder.BorderCheckTask.run(BorderCheckTask.java:28)
    00:41:12 [SEVERE]       at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:122)
    00:41:12 [SEVERE]       at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:356)
    00:41:12 [SEVERE]       at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    00:41:12 [SEVERE]       at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    00:41:12 [SEVERE] Unexpected exception
    java.util.ConcurrentModificationException
            at java.util.HashMap$HashIterator.nextEntry(HashMap.java:848)
            at java.util.HashMap$KeyIterator.next(HashMap.java:883)
            at com.wimbli.WorldBorder.BorderCheckTask.run(BorderCheckTask.java:28)
            at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:122)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:356)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    EDIT: Just noticed I didn't have the latest recommended build. Upgrading atm. I'll post again if the error is still there.
     
  7. Offline

    haldavid

  8. Offline

    Brettflan

    Released v1.1.1:
    • Bugfix release for reported ConcurrentModificationException error.

    1.1 and 1.1.1 should still support 617. Either way, all old versions are still available here:
    http://www.wimbli.com/minecraft/WorldBorder/

    Done, I'll post it over there for him.
     
  9. Offline

    EdGruberman

    Has anyone done any real world testing that shows justification for using a Runnable TimerTask to minimize resource usage as comared to an onPlayerMove event?

    It seems checking all players every 200-250ms is going to be just as intensive/if not more as I see it. Is there some general number of players where this approach does start to see benefits? Has anyone determine the max distance someone could travel per ms so you know what knockback to set appropriately?
     
  10. Offline

    Brettflan

    WorldBorder doesn't check all players, it maintains a list of players who have triggered a move event since the last border check and only checks those players. It should pretty much be the best of both worlds, so to speak.

    As for the knockback, it of course knocks them back that far inside the border rather than just knocking them back that far from their current position, so... mostly just a matter of taste.
     
  11. Offline

    haita

    I'm wondering if it would be possible for you to add another configuration option. One to limit console output, as OtherBlocks allows you to do for instance. As it stands the plugin uses five lines on launch. Also alternate message colors would be a nice addition imvho.

    Other than that, your plugin's working out nicely!
     
  12. Offline

    EdGruberman

    Right, I see in the code you update a HashMap (oh yeah, it's linked too... why? does the order in which players move matter that much?) in the onPlayerMove event to filter who has moved. But really most will have moved if not all. Is it really resource saving to maintain a list?

    But again, why a seperate TimerTask for such? I hope you aren't letting that fool Intelli lead the way here (his coding practices are so awful it's clear he is lucky to make anything work at all). My hunch is he did it only because he saw sk89q doing it in WorldGuard. But I'm still not sold that it's a performance savings without seeing more serious benchmarking on it all. Has a performance comparison been done in some other thread people are talking in?

    Good point on the knockback, I keep forgetting it's from the border itself.
     
  13. Offline

    Brettflan

    The list of players is a plain HashMap; the list of borders is the one you're thinking of, which is a LinkedHashMap. The reason for that is that LinkedHashMaps have slightly faster lookup speed than regular HashMaps; they also take longer to add items and such ,but since the border list is almost never updated but is frequently checked, lookup speed is much more important.
    I'd already discussed making a timed task for the border checking routine earlier in this topic, before Intelli added in his timed border checking method to BorderGuard and labelled it turbo (his method actually uses a plain Thread, which is apparently bad practice for threading in Bukkit and can cause crashes, but... anyway).
    I contribute rarely to the Essentials plugin, which uses a timed task for teleport delays based on some of my code (I originally used a TimerTask setup before learning about the potential problems), and I've made a fork of the Nether plugin in which I've used a couple of repeating tasks, so I've found them to be useful before.

    Think of it this way.
    Old method: every time a player moves (1/16 of a block, or even panning their view around a bit) or teleports, it runs a border check for that player.
    New method: every time a player moves or teleports, their name is added to the list. If they're already in the list, they're not added again. Then, every so many ticks, the border checking routine will run a check on every player who's in that list and clear them out as it goes along, or will do nothing if the list is empty.
    So, worst case scenario as I see it, it takes a tiny bit of extra work adding to and referencing the list of players who have moved, and maybe leaves a teleported/rejoined player in their new location for a split second before moving them back inside the border. Expected scenario, it no longer does a border check for every single movement event, and can effectively ignore the bulk of them by now checking in a timed task.
     
  14. Offline

    haldavid

    Using 1.1.1 WorldBorder with CB670, this crashed my server after bouncing two of us back.

    I have a 1000 square radius with 20 knockback. It knocked us back, sent the message I have set, and crashed the server. =(
     
  15. Offline

    EdGruberman

    @haldavid : Do you have any detailed logs you can share? Do you run any other plugins? Can you test with ONLY this plugin installed and see if you can duplicate the problem?

    @Brettflan : Thank you for taking the time to explain so much to me. I'm not new to programming, but I am very new to Java and Bukkit development accordingly. I've learned a lot from looking over your code. It's very well formatted in general and it's enjoyable to to casually read through even.

    I agree the timer approach definitely sounds like a smart approach, but I'm curious on the reality aspect. Depending on how the timer task is managed/etc I was wondering if anyone had any hard evidence on the benefits of such. I know there are quite a few other plugins used fairly extensively that rely on the onPlayerMove event to check things like multiple regions/borders each occurence and I haven't heard any major resource concerns with their implementations. That said such data is spoaradic and not consolidated/analyzed on any official level. So it could in fact be a problem just no one knows type of thing.

    I'm also curious how a low usage server (<20 active players at any time) versus a high usage server (50+ active players consistently) compares on such concerns. My hunch is low usage servers really won't matter much. But this might also be related to the processor/memory dedicated to such servers too. I guess a lot of factors here I was just curious if some hard facts actually existed somewhere.
     
  16. Offline

    Brettflan

    Like EdGruberman said, further details on the crash would be useful. There might be something useful in your server.log file from when it crashed. I've tested the plugin out myself without crashes, so (for the moment) I'm unable to duplicate your problem.

    @EdGruberman Bukkit and writing plugins for it is my first introduction to Java as well, so my direct experience with it is limited. I have many years of experience with other programming languages though, and Java isn't all that different.
    It would indeed be useful to have some way of directly testing performance between one method and the next. Hmm. Maybe just timing each border check and storing that time value, and outputting the elapsed calculation time every so often to the log/console? I might play around with the idea when I get a chance. Pretty busy lately though, so I'm not sure when that will be.
     
  17. Offline

    Lakart

    Whenever I make a border it teleports everybody there at the time of making or at the next time they log in, and then spams the you are at the end of the world message at them without knocking them out.
     
  18. Offline

    Brettflan

    If people are outside the border when you create it, people currently online and people who later login should indeed be moved back inside the border. Players aren't supposed to be knocked out or injured or anything by the process, just moved back inside (knocked back) whenever they move outside of it.
     
  19. Offline

    krnel

    I think have similar.
    It was running on CB 670, no border set.
    I did /wb world set 1200 0 0.
    Went out and got kicked back.
    Server started outputting:
    Running 1.1.1 of this plugin.

    I turned it off and everything is fine. It crashed the server indeed :(
     
  20. Offline

    Brettflan

    Hmm. The error's definitely not much to go on, but I've had that same error happen on my own open server just yesterday and have started trying to track it down. My best guess is that it is something in the timed border checking method which is somehow causing it, so my best recommendation until I can pin it down is to (assuming you don't have any periods "." in your world name) temporarily revert back to v1.0.1.

    EDIT: or, actually, RB 674 was just released to fix a critical bug which could possibly be the root cause of these crashes; you could alternately try updating to RB 674 with WorldBorder 1.1.1 to see if that fixes it.
    Later when I have more players on my server, I'm going to attempt some thorough concerted testing to be sure either way.

    OK, with further testing I pinpointed the problem. It was related to the earlier reported ConcurrentModificationException error, which my last attempted fix didn't handle well enough. So:

    Released v1.1.2:
    • Further bugfix release for server crashes, related to ConcurrentModificationException error.
    I've stress tested with and without this new fix on my open server with assistance from a few players and confirmed that it prevents the potential server crash. I strongly recommend everyone update to this new version.

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

    baunegaard

    Excellent plugin you have made here :) just have one request, could it be possible to have round border for one world, and a square border for another?
     
  22. Offline

    Brettflan

    It's possible, certainly, but why do you want a square border on one world and a round one on another?
     
  23. Offline

    baunegaard

    This is a little hard to explain for me but i try :)

    I have a primary normal world, where i would like a round border, becouse it looks the best.

    Then my other world is a biometerrainmod world, 3000x3000 blocks is pregenerated, and i dont want users to get past the pregenerated terrain, becouse then minecraft starts generating normal terrain. therefor a square border on that world would be excellent. :)

    Hope you understand this
     
  24. Offline

    Brettflan

    Hmm, OK. I prefer consistency in border types (could otherwise be a little confusing to players), but... I might add that capability in the next release.
     
  25. Offline

    OrtwinS

    are we OK for CB733?
    dont think any of the changes affect WB functionality, but I'd like to know for sure before ruining my server :p
     
  26. Offline

    Brettflan

    I just tested it in RB 733 and it's good to go. :)
     
    OrtwinS likes this.
  27. Offline

    danneh

    thanks for this, one guy kept traveling in one direction so i got scared haha xD
     
  28. Is it just me or is the message not compatible with color codes?

    Other than that, perfect! =D
     
  29. Offline

    thecoolwolf

    is it possible to have one world square and the rest round? :)
     
  30. Offline

    Brettflan

    The message is set to red, so if you added another color code at the very start of your message, they would conflict (two color definitions in a row with nothing between them).

    Someone else was requesting that as well. I'll see about adding in an optional per-world border shape definition which would then override the global default shape you have set.
     
    thecoolwolf likes this.
  31. Offline

    Brettflan

    Released v1.2:
    • Got rid of code which kept track of which players had moved, now simply checking all players each time the border-checking task runs; from my efficiency testing, it's actually less work for the server this way
    • Added ability to override shape (round/square) of individual worlds, with new /wb wshape command

    New command:
    /wb wshape [worldname] <square|round> - Override the shape for this world only. The world needs to have already had a border set. The default shape used by other worlds (set via /wb shape) will not be changed by this.
    Permission: worldborder.wshape


    I can now state that WorldBorder is absolutely more efficient than BorderGuard Turbo 3.10. I did some efficiency profiling by having it add up the amount of time used by the border checking routines (added code to both plugins, of course using a decompiled copy of BorderGuard 3.10) and running both plugins through several different scenarios (moving around near center of border, constantly hitting border at edge and corner, both round and square).
    Honestly, having profiled them both, BorderGuard currently is pretty efficient at version 3.10. WorldBorder however is a tad bit more efficient. I'm talking a few hundred milliseconds difference after many many hours of running. So, not much difference.
    My curiosity is sated. :)
     

Share This Page