Discussion in 'Archived: Plugin Requests' started by Switch0r, Jan 5, 2013.

  1. Offline


    Can someone revive this plugin please?

    This plugin remove all mob spawners(Block id 52)
    Instead of scaning all chunks over and over again for block 52.
    It just check if mob is spawned by spawner,
    if yes it will remove closest spawner.

    Just put NoSpawners.jar to ..../plugins/ folder and it will create config at .../plugins/NoSpawners/config.yml
    To get it to Work you need type your world name in this line
    'enabledworlds:': world,world_nether,etc

    NoSpawners is enabled by default!
    • /nospawners disable -disable plugin to next reload/restart/enable command
    • /nospawners enable -enable plugin
  2. Offline


    Support for revive
  3. Offline


    Looks like that plugin was based off one of my old ones. I'll go ahead and update my plugin this was based off of, but it won't have the commands, just so you know.
  4. Offline


    Thank you very much NuclearW
    Are you going to release it on ?
  5. Offline


    I have tried this myself but it doesn't seem possible. Removing spawners through code seems to crash the server, this is due to the TileEntity not being removed and then the server performing some actions on it.

    If anybody gets this to work in the API, please post it! I'd love to see how you did it.
  6. I am currently doing this, but I am just making a toggle for Mob spawners on/off, Should be done when I get home.
  7. Offline


    Yeah, it's already got a page there that I'll link to once I've gotten it up to date.

    lemon42 Interesting, never had this problem before, but if it becomes a problem I'll have to look into it.

    XlegitXcrazymanX Cool, looking forward to seeing your version.
  8. Just a simple toggle between the event on and off my friend. I could disable spawners in general but their is no fun in this. Loop through the chunks, replace 52 with like, stone, or air. Then just cancel the event of mob spawners. But there isn't any fun in that. I will make it if anyone asks for it but I like the toggle idea better.
  9. Offline


    The OP didn't ask for something that cancels the mob spawn event, that can easily be done, but also for something that removes the mob spawner when an entity spawns from it.

    My basic code outline is:
    1) Mob spawns > check if it's from a mob spawner
    2) If it is, proceed. Else, do nothing.
    3) Loop blocks in a 5x5x5 cuboid near the entity. Check for mob spawners.
    4) If none found, proceed to next step.
    If found, set the mob spawner to Material.AIR.
    5) Cancel the event, hence preventing the entity to spawn.

    Problem with that is step 4, there is an issue in Minecraft's server code that prevents us from changing a mob spawner's block type, since it has a TileEntity attached to it and prevents the block from being changed. If you try to, it will change it but crash the server at the next entity check which happens every tick, if I recall well, making this plugin unstable and crashing the whole server. The fix is on Bukkit/Mojang's end, not ours.

    I haven't been able to do my plugin due to this crash.

    Here's the crash log if anyone is interested:
  10. Offline


    Here you go:

    Alright, sounds like you got a plan.

    I did in fact run into that same problem! I solved it by using a queue to hold all mob spawners I wanted to get rid of, then used a sync task to get rid of them. I technically probably should have had each one spin up it's own thread, but I just have one repeating task that polls the queue every 5 ticks, I can't see it being too much of a performance hit, but it's less than ideal. The source of the plugin is linked on the BukkitDev page, so you're more than welcome to go through it and see how I did it exactly in code.
    lemon42 likes this.
  11. Offline


    Why didn't you use a delayed task instead to run 5 ticks later? Wouldn't that have been way better as a task wouldn't have run run and take CPU cycles every 5 ticks? Also, what difference does it make it run it 5 ticks later or immediately? How does it work? I still don't understand why we can't simply set it to AIR in the event, is there something Bukkit does that prevents us from doing so? Thanks for the fix though, I probably wouldn't have thought of doing this myself, on the other hand I don't know why you did that though, could you explain? :)

    Also, isn't there a probability of it adding the item to the queue, and then the queue checker immediately removing the block right after, therefore causing a crash?
  12. Offline


    I believe the issue has to do with removing it in the middle of an event that still contains the spawner and it's entity.

    As for why I didn't just spin up a task to remove it some x ticks later for whenever I needed to, in a larger scenario with lots of spawners, that would cause a lot of lag, whereas this solution takes a constant amount of time, and will not cause a lag spike at any time. That said, for almost all situations I would imagine that making a new task to be the superior option, I just didn't do it because I'm an awful programmer.

    As for why I picked 5 ticks, it's partly because I don't want the task running every tick, and because I read in my research that in some situations a spawner will continually attempt to spawn more mobs every tick, and I wanted to nip that in the bud fairly quickly. 20 ticks would still be fine, I would imagine, but I wanted to proof mine against a lag spikes.

    Heck, if you want to, make the every 5 tick vs new task be an option in the config and code it up and submit a PR :)
  13. Offline


    We're all awful to programming, it just depends what you compare yourself to ;)

    However, I must disapprove your point of view: mob spawners will only spawn a mob if you are standing in a 16 block range near them.The spawners aren't continually spawning mobs... only when you are close to them. Your larger scenario would only be plausible if you had about a 100 players, logging in or teleporting at the exact same tick, and spawning each near different spawners... I don't think many players are that organised as to sync up perfectly with their network connection and server ticks per second to get it done right. If there were a lag spike, it would only be minimal unless of course we are talking in way larger proportions here... don't you think? :)
  14. Offline


    Thank you very much
  15. Offline


    Glad you like it, hope you don't mind lemon42 and I having a development discussion on your thread, though.

    Probably, as I said it's probably the new task is the superior option. But I'm lazy to fix something that is working well enough without causing issues. But if you want to, go for it!

Share This Page