Slow Cocoa Pod Growth

Discussion in 'Archived: Plugin Requests' started by np98765, Sep 28, 2012.

  1. Offline

    np98765

    Hey there,

    I'm looking for someone to create a plugin that will slow down cocoa pod growth, as it seems like they grow extremely fast.

    Sorry I can't give any details, as I'm not exactly sure how this would work (BlockGrowEvent, if cocoa pod, event setSpeed (?) would be my best guess). I'm assuming you could use some sort of multiplier; please make that configurable so I can test with whatever values feel comfortable. If you'd like to just paste, I'll compile and test and all of that. :)

    Thanks!
     
  2. Offline

    HyrulesLegend

    Please read the "Read Me First" post. ;)
     
    np98765 likes this.
  3. Offline

    np98765

    No.
     
    Alvarez96 likes this.
  4. Offline

    HyrulesLegend

    Yus. ;)
     
  5. Offline

    Necrodoom

     
  6. Offline

    np98765

    necrodoom
    No. I know when to format it and when not to.

    Formatting is a guideline, not a rule. For example, when there is no category, no commands, no permissions, no missing information, and no deadline, that's when you know you don't have to format. ;)

    Unless you're trying to troll, which in that case... No. It's 1:00 AM. :3

    EDIT: Well, I'm off to bed. G'night, world o' Bukkit. [creeper]
     
  7. Offline

    Necrodoom

    just wanted to help. im interested in this request aswell.
     
  8. Offline

    Hoolean Retired Staff

    Read the read-me-first (I have highlighted the correct section for you)
    BTW I can confirm this is possible!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
    np98765 likes this.
  9. Offline

    np98765

  10. Offline

    RingOfStorms

    If no one does this I have a few ideas on how to make this simply, just make a random number generator, and use a range that can be configured in a config. so if range is 100 then the rnd # gen would get a number from 0-99 and if it is equal to 0 then grow, else cancel. You can make it more likely by making the range smaller like 5. 0-4, if it is zero then it would grow, etc.
     
  11. Offline

    JazzaG

    np98765

    This is untested, but give it a try anyway ;)

    Code:
    public class Restrictor extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener {
     
    private double percentage;
     
    public void onEnable() {
    getDataFolder().mkdir();
    java.io.File c = new java.io.File(getDataFolder(), "config.yml");
    if(!c.exists())
    saveDefaultConfig();
     
    this.percentage = getConfig().getDouble("percentage");
     
    getServer().getPluginManager().registerEvents(this, this);
    }
     
    @org.bukkit.event.EventHandler
    public void onGrow(org.bukkit.event.block.BlockGrowEvent e) {
    if(e.getNewState().getType() != org.bukkit.Material.COCOA)
    return;
     
    double rand = (double)(Math.random() * 101.0);
    if(rand > this.percentage)
    e.setCancelled(true);
    }
    }
    
     
    np98765 likes this.
  12. Offline

    Mitizmitiz

    I don't think the BlockGrowEvent covers cocoa. At least it didn't last time I played around with it.
     
  13. Offline

    JazzaG

    Eh, doesn't hurt to test :p
     
  14. Offline

    calebbfmv

    Actually, I almost died testing that code.
     
  15. Offline

    RingOfStorms

    what was the verdict?
     

Share This Page