Cancel Strenght 2

Discussion in 'Spigot Plugin Development' started by YoungPvProck, May 16, 2015.

  1. Hello, i'm trying to find the best way to cancel a player from use Strenght 2, the method should check if it's a normal potion or a splash potion, when player tried to consume or throw the player potion then it convert into a bottle of water.

    So now i want know what are the best events to check it, because i tried cancelling PotionSplashEvent and don't seems to work, and when its not a splash potion i tried with PlayerItemConsumeEvent but also don't seems to work..

    Some code that don't work:
    Code (Text):
    public void str (PlayerItemConsumeEvent e){
            ItemStack pot = e.getItem();
            if ((pot.getType() == Material.POTION) && ((pot.getDurability() == 8233))){
                e.setCancelled(true);
            }    
     
  2. Ups, i think i find the problem in the code that i paste up, i forgot @EventHandler. Now it's working with normal potion. So now i need help with the splash potion :l
     
  3. Try the potionsplashevent
     
  4. PotionSplashEvent don't seems to work, because the event starts when the potion explodes and releases the effects. I will try with PlayerInteractEvent. If you have better suggestions i'm open to try.
     
  5. Plugin working. Mods close thread. Thank @sleepipanda for the help.
     
    • Like Like x 1