Solved Particle Effect

Discussion in 'Plugin Development' started by rhunter, Oct 16, 2016.

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

    rhunter

    Hey im trying to make a particle effect play when someone shift right-clicks with something in their hand.
    Heres my code:
    Code:
    @EventHandler
        public void onCocaineUse(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        if(player.hasPermission("drugs.use")){
        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK){
            if(player.getInventory().getItemInMainHand().getType() == Material.SUGAR){
                if(player.getInventory().getItemInMainHand().getItemMeta().getLore().contains("Drug")){
                player.sendMessage(ChatColor.GOLD+"You snorted cocaine!");
                ItemStack cocaineInv = player.getInventory().getItemInMainHand();
                int cocaineAmount = cocaineInv.getAmount();
                if (cocaineAmount > 1) {
                    cocaineInv.setAmount(cocaineAmount - 1);
                    player.getInventory().setItemInMainHand(cocaineInv);
                    }
                if (cocaineAmount == 1) {
                    player.getInventory().setItemInMainHand(null);
                    }
                player.addPotionEffect(new org.bukkit.potion.PotionEffect(PotionEffectType.SPEED, 20000, 1));
                player.addPotionEffect(new org.bukkit.potion.PotionEffect(PotionEffectType.FAST_DIGGING, 20000, 1));
                player.addPotionEffect(new org.bukkit.potion.PotionEffect(PotionEffectType.GLOWING, 20000, 1));
                player.playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 5);
            }
            }
        }}
    }
    There is an error on the playEffect part that says the method from the type player is deprecated.
     
  2. Offline

    Whoneedspacee

    Pretty sure its player.getWorld().playEffect()
     
Thread Status:
Not open for further replies.

Share This Page