Is there a method for this?

Discussion in 'Plugin Development' started by Deleted user, Jul 13, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Deleted user

    Is there a method for planting a seed or something? Someway I can make crops grow instantly?
     
  2. Offline

    ZeusAllMighty11

    I thought it would be BlockPlaceEvent.

    Try doing a check:

    @EventHandler
    public void onSeedPlace(BlockPlaceEvent e){
    if (e.getBlock().getType() == material.SEEDS){
    System.out.print("placed seeds");
    }
    }
     
  3. Offline

    Deleted user

    What arguments do I use for the generateTree method?
     
  4. Offline

    VeryBIgCorp

    It should be in the API docs ;)
     
  5. Offline

    Deleted user

    For some reason this code isn't working:

    Code:
     
    @EventHandler
    public void onFarmerPlant(BlockPlaceEvent event) {
     
    Player p = event.getPlayer();
    Location l = event.getBlockPlaced().getLocation();
     
    if (event.getBlockPlaced().getType() == Material.SAPLING) {
    l.getWorld().generateTree(l, TreeType.TREE);
    }
    }
     
    
    and idk even how to begin to make it so that planting seeds makes it insta-grow.
     
  6. Offline

    VeryBIgCorp

    Maybe the other tree types work. Have you tried those?
     
  7. Offline

    Theodossis

    Did you registered the event?
     
  8. Offline

    mcgamer99

    Try to add:
    Code:
    return;
    After:
    Code:
    l.getWorld().generateTree(l, TreeType.TREE);
     
Thread Status:
Not open for further replies.

Share This Page