[MECH/FIX] Pumpkins v1.03 - Pumpkins grow like mushrooms [1060]

Discussion in 'Inactive/Unsupported Plugins' started by scarletomato, Aug 22, 2011.

  1. Offline

    scarletomato

    <font color="rgb(51, 51, 153)">Pumpkins</font>
    Make pumpkins grow
    Version 1.03
    Description
    This plugin allows pumpkins to grow very similar to mushrooms. Every 3 minutes, it finds all the rooted (on top of dirt) pumpkins in the loaded chunks and checks a block from the immediate area. If that block is grassy, it plants a new pumpkin.

    <Edit by Moderator: Redacted mediafire url>
    <Edit by Moderator: Redacted mediafire url>

    Show Spoiler
    #Worlds that allow pumpkins to grow
    monitoredWorlds:
    - world
    #How many blocks a pumpkin will spread
    horizontalSpread: 3
    verticalSpread: 1
    #Valid block IDs that a pumpkin will spread to
    growthIds:
    - 2
    #Block IDs that a pumpkin must be sitting on to grow
    #Keeping this at only dirt will force the pumpkin to 'root' (change the grass to dirt) before it spreads
    rootIds:
    - 3
    #Pumpkin ID
    blockId: 86
    #Time to wait between growths. 3minutes*20ticksPerSecond = 3600 ticks
    delay: '3600'
    #Time to wait before the first growth. 3seconds*20ticksPerSecond = 60 ticks
    initialDelay: '60'
    #Height of the world
    chunkHeight: 128


    My newbie questions
    As this is my first plugin, I've still got plenty of questions on the bukkit lexicon. Most I have been able to find answers to through tutorials and the javadocs but some have still eluded me. I'll try and keep the questions current here in the first post. If anyone knows the answer to these or can point me to resources that I obviously haven't seen yet, that'd be awesome.
    * Java's Logger class has fine\finer\finest messages. Is there a way to get bukkit to listen to those types instead of just info?
    * Is there a way to check and see if the map is currently saving?
    * Regarding asynchronous threads, is there any cleanup I should practice when the plugin is disabled?

    Features:
    * Configurable growth rate and spread
    * Configurable growth conditions.
    * Define multiple worlds to allow pumpkins to grow in.
    * Multi-Threaded

    Bugs:
    * Possible conflict when finding chunks while the map is saving.

    Changelog:
    * <Edit by Moderator: Redacted mediafire url>

    - * First run adds all existing non-nether worlds instead of just "world"
    - <Edit by Moderator: Redacted mediafire url>
    * Added proper multi-world support
    * Spreads the tasks out evenly over the delay period so not all the worlds are growing at once
    * Added check to make sure the world names match actual worlds on the server
    - <Edit by Moderator: Redacted mediafire url>
    * Added catch for null world
    * Added commands to stop all pumpkin tasks and start a grow thread manually.
    - <Edit by Moderator: Redacted mediafire url>
    * Added multi-world support
    * Forced growth to check for air before setting the new block to a pumpkin
    * Added config file options (worlds, task delay, spread radius, valid growth blocks)
    * Cleaned up the code to make it easier to read
    - <Edit by Moderator: Redacted mediafire url>
    * Release plugin
    * Push block finding code over to an asynchronous thread

    ToDo:
    * Instead of using a default list of worlds the first time, find all active worlds on the server.
     
    Last edited by a moderator: Nov 12, 2016
  2. Offline

    user_43347

    You need to add a changelog, and try making the headers bold. Good job though, I you possibly upload a source?
     
  3. Offline

    scarletomato

    Thanks!
    Source is up, If anyone knows a good walk-though on uploading to github, I rather use that. I like the interface it offers. I downloaded their upload program but haven't really been able to make heads or tails of it yet.

    For anyone interested in how it works I'll try and keep the source well commented.

    V1.0 is up, I added all the features I wanted, so unless someone else comes along and has a great idea it's probably going to stay pretty much like this.

    Is there anything i should do in the onDisable method to stop the scheduled tasks, or do they stop automatically?

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

    fatmarley

    I proudly give you the "Slow Clap"
     
  5. Offline

    MikeA

    Stop being an asshole.
     
  6. Offline

    fatmarley

    wow. your a douche...I get the misunderstanding though,. but my intention was this.


    slow clap


    A gradual building of applause, usually starting with one person clapping slowly, and ending with an enthusiastic standing ovation. Generally shows approval for an underdog in a come from behind victory or after losing with pride intact.

    What info do you need to know for bugfixes?

    This is with Bukkit 1060

    2011-08-23 01:15:06 [INFO] ConsoleCommandSender: Forcing save..
    2011-08-23 01:15:06 [WARNING] Task of 'Pumpkins' generated an exception
    java.lang.NullPointerException
    at me.ScarleTomato.Pumpkins.FindChunksTask.run(Pumpkins.java:93)
    at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:428)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:363)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)

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

    scarletomato

    It's cool guys, no harm no foul.

    What plugins are you running? By the look of it, it was in the process of saving when Pumpkins started looking for active chunks. There may be some kind of conflict with finding chunks while the map is saving. Was this a one time thing or does it happen every time?

    Technically, from what I can gather it says there was a null pointer exception thrown when the task tried to get the loaded chunks. If getLoadedChunks() was giving a null object it should have conked out after line 93, on line 95 when it actually tried to access the Chunk array. As far as I can tell the null was thrown from inside the world.getLoadedChunks() method (Though if that were the case it usually would tell me that in the stack trace). I assume it's because it was getting chunks during a forced world save. NVM here, it was probably because world was the null object, again probably because the save was happening. I would have hoped that the scheduler would have put the pumpkin grow task on hold until the current task was done. I'll need to figure out what plugin gave you this line
    "2011-08-23 01:15:06 [INFO] ConsoleCommandSender: Forcing save.."
    because it seems to be saving differently than the 'save-all' command.

    I'll put a check in to make sure that the world is not null, and cancel the current growth if it is. Lemme know if you get any warnings from the new one.
     
  8. Offline

    fatmarley

    I have about 40+ running, but I think the one in particular causing this is NoMorRollBacks.

    And just to note, i probably have about 20+ years on most of the people who post here, so for me a slowclap is a good thing and being called an asshole is a bad thing.
     
  9. Offline

    Jacek

    What is the performance impact of scanning all loaded chunks every three minutes ?
     
  10. Offline

    scarletomato

    As far as i can tell it's not too bad, but I don't have a busy server to test it on. It takes about 10 seconds to scan ~650 chunks. So that one part was pushed off onto a separate thread.

    The most rigorous performance test I have is a seven year old laptop running the server and the client together. It seems to do alright.
     
  11. Offline

    Jacek

    That's not too bad I guess, just curious because I need to do something similar.
     
  12. Offline

    scarletomato

    You're more than welcome to snag the block finding tasks from this plugin. I had hoped there was a getBlocksByID method already but this worked out better than expected.

    I was able to get the NoMoreRollBacks mod and dropped the save interval down to 1 minute with pumpkins growing every 20 seconds.(I can happily add that the server was still very responsive!) No errors though.
    I did see that my multiworld and name check code didn't make it into the 1.00 version though. Do you have a world named "world" on your server, and if not have you added in your world names into the config?

    Upped 1.03. I think this version should get rid of the error you had fatmarley.

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

    fatmarley

    Indeed the error is gone, this is what i see in its place.

    2011-08-24 14:15:25 [INFO] Forcing save..
    2011-08-24 14:15:25 [INFO] ConsoleCommandSender: Forcing save..
    2011-08-24 14:15:25 [WARNING] [Pumpkins] FindChunksTask::run(): world was a null object.
    2011-08-24 14:15:26 [INFO] Save complete.
     
  14. Offline

    scarletomato

    hmm, that still means it was not finding the world by name. If you delete the config file and restart does it find all of your worlds correctly? (It should spit out something to the log.)
     
  15. Offline

    fatmarley

    Just to let you know, works great...just deleted the old config and SHABAM...now pumpkins are the most annoying thing on my server...
     
  16. Offline

    NavinF

    Hey do you think you can do something like set the growth rate to 1/(number of pumpkins in chunk+1) ? That way, The pumpkins will spread out instead of filling up all the land near where they are placed [​IMG]
     
  17. Offline

    fatmarley

    I had that happen as well...I had to set growth to once every week!
     
  18. Offline

    godsarmy9797

    Man, this.....This is amazing. I thought Pumpkins would grow like this to begin with. I LOVE THIS PLUGIN!
     

Share This Page