Cocaine Plugin not working

Discussion in 'Plugin Development' started by OrnateApocalypse, Apr 8, 2020.

Thread Status:
Not open for further replies.
  1. package me.OrnateApocalypse.Cocaine;

    import org.bukkit.Material;
    import org.bukkit.entity.Item;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;

    public class Events implements Listener {
    @EventHandler
    public void onPlayerInteract(final PlayerInteractEvent e) {
    if(!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
    if(!(e.getItem().getType() == Material.SUGAR)) return;
    Player pl = e.getPlayer();
    Item it = (Item) pl.getItemInHand();
    pl.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1800, 2));
    pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1800, 2));
    pl.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 1800, 1));
    pl.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1200, 1));
    it.remove();
    }
    }

    There is a problem with PlayerInteractEvent

    Its Bukkit 1.8
     
  2. Offline

    CraftCreeper6

    @OrnateApocalypse
    You have not given enough information.

    What is it supposed to do?
    What does it actually do?

    I'm going out on a limb here and saying you haven't registered your events.

    Also, why is your PlayerInteractEvent set as final?
     
Thread Status:
Not open for further replies.

Share This Page