Magic item

Discussion in 'Plugin Development' started by GreySwordz, Apr 19, 2013.

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

    GreySwordz

    Hello, everyone!

    I'm incredibly new to bukkit coding, and would like a little bit of help. I have two questions:

    The first one is, how can I check an items lore and scroll to see if they're what I want, and then perform an action?

    Which brings me to my second question, how can I create fire around the player, consuming the item and the fire putting itself out after a certain time. What I have so far:
    Code:
            if (evt.getAction() == Action.RIGHT_CLICK_AIR || evt.getAction() == Action.RIGHT_CLICK_BLOCK) {
                if(evt.getPlayer().getItemInHand()/*What Should I put to check display name and lore?*/ == true){
                //Code to create fire at a radius and time (fire puts itself out after a time) specified by the lore on the item
                }
            }
     
  2. Offline

    JWhy

    Code:
            if (evt.getAction() == Action.RIGHT_CLICK_AIR || evt.getAction() == Action.RIGHT_CLICK_BLOCK) {
                Player pl = evt.getPlayer();
                if(pl.getItemInHand().getType() instanceof Material.WRITTEN_BOOK){
                        BookMeta bm = (BookMeta) pl.getItemInHand().getItemMeta();
                        if(bm.getTitle.equals("Admin Book"){
                              pl.getLocation(); //...
                        }
                }
            }
    Basically you put the code for the fire as described here:
    http://forums.bukkit.org/threads/setting-a-block-on-fire.76270/#post-1125310
     
Thread Status:
Not open for further replies.

Share This Page