Towers to the sky (1x1 block) deletion system

Discussion in 'Archived: Plugin Requests' started by Eddiekins, Mar 31, 2011.

  1. Offline

    Eddiekins

    [​IMG]
    You all know these eyesores. I'm wondering if there is a way to automatically detect and remove them.
    Anyone who manages or frequents a creative/free-to-build server understands how unsightly they are. Yes, they're useful for a certain amount of time; but players frequently build them, use them to build a giant game of Space Invaders, jump off and forget all about this awful tower.

    A potential method for how this plugin could function is this:
    1. listen for same type of block placement in quick succession and/or rapid increase in player y co-ordinate.
    2. evaluate whether any other blocks touch it's north, south, east or westerly sides. if none, then it must be a 1x1 tower.
    3. check to see if any surrounding player's height coordinate (roughly) matches that of the highest block in the tower.
    4. if a player is atop the tower: remember the player's height and the height of the tower. refresh every few seconds and if the players height has changed drastically, assume they've jumped off, and delete the tower.
      if there is no player atop the tower (or within 5 blocks radius, as they may build a sideways extension): delete it.
    An alternative is to notify the player identified in Step 3 that the server thinks they're on a sky tower and allow them to respond (type in chat: /towerdetect ignoreme) and the server caches that the tower is in use and ignores the tower until the player either types /towerdetect done, logs out or jumps off.

    Just an idea, if this is over-complicated or impractical (I realise it may be tricky) then no worries. The idea just came to me and I though this would make a neat idea.
     
  2. Offline

    MisanthropX

    another solution would be to turn these 1x1 pillars into cacti,
    so if you manually destroy the lowest block the whole pillar gets destroyed.
     
  3. Offline

    NuxlyStardust

    I'd use WorldEdit. Select the bottom block and expand upward, then set 0 .
     
  4. Offline

    Eddiekins

    This is how I do it currently, however allowing moderators access to the entire WorldEdit plugin when all will do is delete sky towers seems unnecessary.


    I'm looking for a more automated approach to this problem (and it really is a problem on some very active servers.)
     
  5. Offline

    NuxlyStardust

    Ok I'm new in the world of plugin development so I might be wrong, but I don't think you can have a fully automated way to get rid of towers.
    A plugin that scans the world to find them would slow down the server. And in any case, you will have a problem: people who actually have a use for their tower might lose them while they still need them.

    I've made this for you: http://hotfile.com/dl/112964766/c4f1f11/CraftKong.zip.html
    Basically you just click a block and it removes all the blocks above it. So you can use it to remove towers by clicking the base block.
    There's a config file in which you can set the item with which you should click the tower (default: flint) and the persons who are allowed to use the plugin.
     
  6. Offline

    Eddiekins

    No - my idea is that the plugin is simply monitoring the players height co-ordinate, when it notices a sharp increase, it commences the step-by-step process I detailed in the original post. I have also accounted for the problem of players that have a genuine requirement for their tower - the plugin could ask the player if they want the tower to be deleted.

    However, it seems like this may be incredibly complex and not something the community believes to be a necessity; heck, I don't even know if this is possible.

    I'm installing your CraftKong plugin now and that will most likely be sufficient (just means I've gotta do quite a lot of legwork!) Thank you very much.
     
  7. Offline

    opatut

    Ok well this sounds interesting. I'm gonna give it a try now. It wouldn't be my first plugin but my first official :D I think I have to check for towers every time a block is placed, right? Give me an hour :D

    Try this first test build. You can adjust your settings in the plugins/AntiTower/config.yml file.

    can_keep: if players can use the /keeptower command (default: true)
    only_same_material: if towers are only recognized if made from the same material. If players change the material while building the pillar, only the top part is removed (default:false)
    min_tower_height: the height a tower must reach before being recognized as such (default:3)

    Download here, and please give feedback. I'd be happy to adjust it to your needs :D If you want Permissions support give me a quick hint, I will implement that.

    Download: http://ompldr.org/vODQyZQ/AntiTower.jar

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

    Eddiekins

    This works brilliantly!
    I do have a few points of critique:
    • allow customisation of the messages the player sees (maybe in config.yml?)
    • /deletetower command
    • /keeptower could only keep the tower for X minutes, at which point it asks the player again if possible or delete automatically if they've logged out
    • is it possible to watch for a rapid decrease in their height? That might be a good way to determine automatic removal if they don't type /deletetower or /keeptower. If this cannot be done, then delete any towers not flagged to kept after X minutes of storing them in the cache (I presume there is a cache as when I logged out and back in my tower was deleted as soon as I began building a second).
    Also, after playing around with this on my test server (build 617) I found that I was getting time out errors on login and can no longer connect at all but I doubt that's a result of your plugin because the console error messages I received didn't mention it.

    Other than that feedback (I hope it's not too much) this is a brilliant plugin. Thanks very much.
     
  9. Offline

    cholo71796

    I'm no plugin developer, but I imagine it wouldn't be too difficult to detect the jumping off- for all players who have created a tower that has not been /deletetower-ed or /keeptower-ed, listen to the players Y vector. Once it reaches the falling level, make sure it persists for long enough and then subsequently delete the tower. ("Long enough" may depend on the height of the detected tower, and really short towers might need a different vector to be detected.)

    This is a really nice idea for a plugin.
     
  10. Offline

    opatut

    Well I thought of the player position thing, but it would mean a bit less performance because I can only listen to ANY player movement. The customization of messages however is easy, I can do that pretty soon, give me some minutes. /Deletetower is also simple, but any kind of timeout is tricky because Bukkit does not support this. I will think about what I can do and post the results. Thanks for your feedback anyways.

    Furthermore I dont think the plugin causes your timeouts, I tested it at my local machine and it works pretty good, and it is technically very simple (one listener, a few methods to get the height of the tower etc.). If you could test it a little further and see if you still have the timeout issue without the plugin, that would be great :D

    At least it basically works. I will add the customization of messages and /deletetower for sure and see what I can do about the /keeptower and jumpoff.

    New download: http://ompldr.org/vODQ2cg/AntiTower.jar

    Try this one, now you have customizable messages and the /deletetower command. Still no deletion when the player jumps of the pillar.

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

    Eddiekins

    Can't test this because I'm nowhere near my server and it's still having problems, but I will do it ASAP. If there is no way to automatically delete all "unflagged" (as in, towers that the user hasn't /keep'd) towers, could they maybe be stored into a SQL/flatfile database and then purged by an admin typing /deletealltowers? Or is that too much work (it's okay if so)? The towers are obviously held in some cache somewhere. I just worry that there may be some towers that slip through the net: if a player jumps off and then doesn't place any block, the tower will remain.
     
  12. Offline

    opatut

    Well youre right I didnt plan the plugin to be super safe. Its just a help so you dont need to remove every tower by hand. They will not be removed if you stop the server becaused they are only hwld in RAM. Its very simple yet, i will think about improvements for you :)
     
  13. Offline

    ViZiT

    Hey can u reload link please or upload a new version =)

    where is config.yml ? plugin works great but bon't see a config=(

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

    opatut

    It should be in plugins/AntiTower/config.yml... Though it might only appear after you have run the plugin once. If not, I guess it is incompatible with the current bukkit version. Sorry, but I don't have the time to work into the new stuff and look over the plugin again at the moment...

    I just realized I don't even have the source code anymore. I guess. Maybe I will find it somewhere on the internet ;)

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

Share This Page