Help on this code.

Discussion in 'Plugin Development' started by ZePequenoCodes, Jul 11, 2014.

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

    ZePequenoCodes

    Code:java
    1. final Player p = e.getPlayer();
    2. if ((e.getAction() == Action.RIGHT_CLICK_AIR) ||
    3. (e.getAction() == Action.LEFT_CLICK_AIR)) {
    4. ItemStack hand = p.getItemInHand();
    5.  
    6. if ((hand.getType() == Material.TNT) &&
    7. (Main.test.contains(p.getName()))) {
    8. if (Main.reload.contains(p.getName())) {
    9. } else {


    I want to do, when a tnt explodes, execute this action!, its only executing it when got a item on the hand ;/
     
  2. Offline

    Pizza371

    You could try EntityExplodeEvent and check if the entity is TNT?
     
  3. Offline

    izarooni

    Check if the player inventory contains TNT?
     
  4. Offline

    ZePequenoCodes

    I want the player take damage from the explosion of a TNT explosion, without a item to do it
     
  5. Offline

    izarooni

    I don't understand what you mean. What item?
     
  6. Offline

    CynutsBR

    Primeiro você tem que checar se o item que ele clicou não é null depois checar o item...
    First you had to check if the item is null, if not check the item...
     
  7. Offline

    ZePequenoCodes

    Tipo, eu quero que a explosao aconteca quando uma tnt explodir, no caso o evento registrado acima, o evento que eu mostrei so acontece quando vc clica com algum item, no caso esta a tnt, mais eu quero que ele aconteca quando houver uma explosao de tnt ;d
     
  8. Offline

    CynutsBR

    Use EntityExplodeEvent e cheque se a entidade é uma TNT como o cara acima falou...
    User EntityExplodeEvent and check if the entity is a tnt, like Pizza said
     
  9. Offline

    ZePequenoCodes

    blz vlw ;d
     
Thread Status:
Not open for further replies.

Share This Page