(HELP) How can i make flint and steel disappearing after a few seconds.

Discussion in 'Plugin Development' started by AngelopoulosfilmsYT, Oct 30, 2014.

Thread Status:
Not open for further replies.
  1. Here is my code i've made for custom durability uses.
    Code:
    @EventHandler
        public void onInteract(PlayerInteractEvent e){
          if(e.getMaterial() == Material.FLINT_AND_STEEL){
          if(e.getAction() != Action.RIGHT_CLICK_BLOCK){
        return;
            }
     
    ItemStack item = e.getItem();
      short use = 45;
        if((item.getDurability() + use) < 90){
          item.setDurability((short) (item.getDurability() + use));
              e.getPlayer().setItemInHand(item);
        }else{
              e.getPlayer().setItemInHand(null);
            }
        }
     
    }
     
  2. Offline

    Abs0rbed

    If you're removing an item from a player, I believe you need to call updateInventory()
     
  3. Hard to understand. Please make it simple. :)
     
  4. Offline

    Abs0rbed

    That's literally the simplest I could've made it. After you remove/add items, you need to update their inventory.
    Read this
    It's deprecated, but I believe that's just because bukkit doesn't yet have a better way to do it. You can get the player with e.getPlayer() then just call .updateInventory() on it
     
  5. I will check it our thanks :)

    Oh wait. I mean how to make the fire of flind and steel disappearing lol

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  6. Offline

    Abs0rbed

    Do you just not want fire at all? Or do you want it to be around for a couple seconds then go away?
     
  7. I want the fire only :3
     
  8. Offline

    Abs0rbed

    Could you explain a bit more? You want the fire, but what do you want to happen with it exactly? No damage to players who walk in it or something like that? Or do you want it to go away after a while, because normal fire does that, provided it's not on netherrack
     
  9. I just want the fire to be disappeared after a few seconds...
     
  10. Offline

    Abs0rbed

  11. Why is it so hard to understand? ;-;
     
Thread Status:
Not open for further replies.

Share This Page