2 questions: Logs in Trees and Crafting

Discussion in 'Plugin Development' started by HoloDoc, Jan 25, 2011.

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

    HoloDoc

    Hi all, I'm new to making plugins with bukkit and during my first tries, some questions popped up:
    1. Is here any way to tell whether a Log Block still belongs to a tree?
    2. I'd like to react to the playercrafting something within his inventory? So I guess I could either react when something is placed in the 2x2 craft area or when something is removed from the area containing the finished product... Which event is triggered in these instances?
    3. I want to remove certain items from a player's inventory when he logs out. I tried to do it this way:

    Code:
    public void onPlayerQuit(PlayerEvent event)
    {
        Player player = event.getPlayer();
        System.out.println("Quitting!");
        player.getInventory().clear();
    }
    But it doesn't seem to work. Could it be that the player is actually gone before that?

    Thanks for any help!
     
  2. Offline

    MadMichi

    Hi, unfortunately i can olny help you with 1.:
    there is no attribute of the log block that tells you if it belongs to a tree.
    But you could check if other log and/or leaf blocks are connected to this block. If yes it might be a tree...
    If you have no clue how to do that, please let me know and i will try to give further advice.
     
  3. Offline

    HoloDoc

    Thanks!
    Yes, checking the surroundings of the log block was also something I considered. As for how to do that, I would have used Block.getRelative() ...
     
  4. Offline

    NathanWolf

    Block.getFace() works really nicely for this- lets you work with NORTH, WEST, UP, etc. Good for looking at immediate neighbor blocks.
     
  5. Offline

    Schirf

    HoloDoc,
    In the Mod Request forum I have requested a Forest Fire Clean-Up mod. Included in the post is a non-code description of an algorithm that you may want to consider.
     
Thread Status:
Not open for further replies.

Share This Page