[EDIT] AntiTower v1.0 - Remove those eyesores [1060]

Discussion in 'Inactive/Unsupported Plugins' started by Clavus, Apr 28, 2011.

  1. Offline

    Clavus

    AntiTower
    Version: v1.0

    I whipped up this plugin in a single evening to fight some of the (to me) most annoying things in SMP: one block towers and abadoned megaprojects. This tool allows you to instantly remove them from your sight!

    I'll let the images do the talking:
    Show Spoiler

    [​IMG] [​IMG] [​IMG]


    Features:
    • Config file where the used tool id (default: iron boots) and authorized players can be specified (start your server once to let the file be generated)
    • Left click with tool: remove targeted block and everything above it. Useful for one-block towers left behind by lazy players.
    • Right click with tool: recursively counts all directly connected blocks in horizontal and upwards direction. Safety limit at 20.000 blocks to prevent read time-outs or accidentally selecting large landmasses. Right click again to remove.
    Download:
    Jar file
    Source

    Changelog:
    Version 1.0
    • Release
     

    Attached Files:

  2. Offline

    captainawesome7

    Add downloads from an external site like dropbox or mediafire. Try putting the images in a spoiler tag. Also, you need a version tag in your title (1.0) and a cb build tag [733].
     
  3. Offline

    Clavus

    Alrighty, guess that isn't too much trouble.

    Also why provide on-site hosting if you're going to recommend downloads from external sites anyway?
     
  4. Offline

    captainawesome7

    Because Plague always says to use external sites. I think it included in the forum software.
     
  5. Offline

    shadrxninga

    @Clavus
    He says that because only forums members can download attachments. Some people who use bukkit might not want to have to join the forums to get a plugin.
     
  6. Offline

    przerwap

    Oh god, this is so recursivelly unnecessary. I just cant imagine how slow this must be with an ArrayList.
    If your just proacticing recursion this is really not the place to use it. An ArrayList is simply not the Structure you want here.
    An ArrayList is simply an array with a controll structure. Every time you add something to an ArrayList it creates a new Array as in:
    T[] new = new T[old.length+1];
    and than fills it in with the values of the old array + the new Object being added.
    A much better aproach would be creating an array of your own
    Block[] = new Block[20000];
    and your own add
    Code:
    public void add(Block b) {
      if(currentSlot < list.length) {
          currentSlot++;
          list[currentSlot] = b;
      }
    }
    But your best bet, as to not hog up RAM with a 20k size array every use, is to use a structure as a LinkList which is a dynamically resizable Data structure.
    You can remove a vertical tower with 3 lines of code inside a while loop
     
  7. Offline

    ZachBora

    Maybe find a way to add possibility to undo? Like on worldedit.
     
  8. Offline

    Afforess

    Incorrect.

    ArrayLists start with an array of 10, once it gets full, it creates a new array the size of (previousSize * 1.5), and copies the old elements over, and starts adding to that. Additionally, you can give ArrayLists a default size when creating them.
     
    NotoriousPyro likes this.
  9. Offline

    captainawesome7

    Get pwned by afforess
     
    NotoriousPyro, thecoolwolf and Tordur like this.
  10. Offline

    clash

    That's not how ArrayList works. It increases the size of the internal array by ~50% each time.
    There's also the ensureCapacity(size) method and/or the contract that lets you specify the initial capacity.

    LinkedList, on the other hand, allocates a new entry object every time you add an item.
    This adds many small objects to the heap, and can be a greater strain on the server via garbage collection.

    I've not seen the code for this plugin, so I won't comment on its performance, but I did want to clarify how the ArrayList and LinkedList classes work and the trade-offs involved. :)

    EDIT: Oh darn. I started this post before lunch, and when I come back, Afforess already beat me to it.
     
  11. Offline

    Clavus

    I am very much aware of the fact that it can be more optimized (I also count the blocks twice for tower removal). I didn't really put much effort in that, because it worked and the counting is done in less than a second in any scenario anyway. Programmer time is more valuable than processor time in the end. :p
     
  12. Offline

    ZachBora

    Tell that to my server hosting 52 players and 1 event out of 5 says the server is overloaded >.>
    But I probably isn't that much CPU usage anyway.
    Edit: I mean theres other plugins out there using a lot more CPU than this.
     
  13. Offline

    papand13

    The one block and everything above it thing (left-click) works perfectly. But everytime i try and use the right-click thing for larger things. It tells me this on my server console:
    Code:
    2011-04-30 00:14:22 [SEVERE] Could not pass event PLAYER_INTERACT to AntiTower
     
  14. Offline

    przerwap

    Well HerpDerp, excuse me for not passing the point along obviously.
    Either way whether it increases every time, or every time it reaches the end it has to physically copy all the entries to the new array.
    I know of insuring capacity, hence why I put the example of making the array of size 20k yourself.

    Not quite, more like listen to him point out a minute detail that has nothing to do with the point of the constructive criticism presented in the post.

    The shit Garbage 'collector' of Java is not my issue.


    Now lets not flame up a guy's Thread over some constructive criticism.
     
  15. Offline

    ST-DDT

    übrigens ist
    int lange=a.length
    for (...lange)
    deutlich performanter als
    for (.... a.length)
    und zwar fast um den Faktor a.length-1, soweit ich mich jetzt nicht bei der Implementierung irre
     
  16. Offline

    Afforess

    He could just initialize the arraylist with 20000, and it would be exactly the same as your advice, but with all the benefits of an arraylist over an array.

    Java's garbage collector is widely believed to be one of the best out there.
     
    NotoriousPyro likes this.
  17. Offline

    TruffleDucks

    Thanks for making this plugin. I can now use an alternative for Tpack plugin and clobber them ugly builders
     
  18. Offline

    o0AzzA0o

    mocking code for this plugin is amusing its excellent it doesnt generate any addional lag with 50/50 online.....
     
  19. Offline

    Clavus

    I have no experience with these kind of errors. Maybe another plugin overrides it?

    It's only called on the interact event when you're actually holding the tool and you're an authorized player to use it, so there's really no way it influences server performance constantly. The server might only hang for a split second when gathering the blocks in a tower structure, but who notices that in such a wonderfully optimized game like Minecraft?
     
  20. Offline

    o0AzzA0o

    lol :) aye wonderfully
     
  21. Offline

    TheGurw

    I love this!

    Waiting to see how everyone else likes it before I fully implement it on my server.
     
  22. Offline

    Haduke

    AWESOME IDEA! I really like this plugin. I was able to delete an entire cemetary that I had set up to use with the Tomb plugin that just doesn't work. Great idea. Koodos to you.
     
  23. Offline

    Juze

    Nice Hey0's mod port, thanks.
     
  24. Offline

    Clever Trevor

    Is there an "undo" button? Just in case I take out something wrong.
     
  25. Offline

    Ryan Hensley

    You can go through bedrock if you destroy something above it then quickly move down and aim at bedrock
     
  26. Offline

    Haduke

    I would like to add another person to use this, but everytime I do the gamelog says they can use it, but it makes it where neither of us can use it. Could you explain how to add another user please? Thanks!
     
  27. Offline

    MonsieurApple

    Considered inactive.
     
  28. Offline

    Clavus

    I rebuild the plugin with bukkit #716 and it seems to be fully compatible with craftbukkit #860 still.

    EDIT: still functional on craftbukkit #974 too. Finally read that you need to use the report button to be put back.
     
  29. Offline

    Plague

    And most importantly you must keep the thread title edited to reflect the fact irt works, edit the tag to latest working recommended
     
  30. Offline

    ChrizC

    Thread title must include the latest RECOMMENDED build of CraftBukkit unless there is an explicit reason your plugin needs a non-recommended build.
     

Share This Page