Potion Effects On Item (KITS)

Discussion in 'Plugin Development' started by ToPoEdiTs, Jul 19, 2014.

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

    ToPoEdiTs

    Hey look I'm creating a plugin such kits and the kits are already created but I want to put effects such potions example sword pasting nausias run the effect as serious or you can leave me an example would be very helpful ATT: topoedits
     
  2. Offline

    Gater12

    ToPoEdiTs
    You mean whenever someone hits someone with by specific sword, give them a potion effect?
     
  3. Offline

    ToPoEdiTs

    for example if a person hit with the sword or the item is and I infected with a effect of a potion
     
  4. Offline

    ZodiacTheories

    ToPoEdiTs

    Check if the sword's meta is the same as you set it to, then use:

    Code:java
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.POTION_TYPE));
     
  5. Offline

    ToPoEdiTs

    Kit it is:
    Code:
    CONEJO(Material.COOKIE) {
            {
                spawnItems.add(new ItemStack(Material.IRON_SWORD));
                spawnItems.add(new ItemStack(Material.WOOD_PICKAXE));
                spawnItems.add(new ItemStack(Material.GOLD_AXE));
                spawnItems.add(new ItemStack(Material.STICK));
                spawnItems.add(new Potion(PotionType.INSTANT_HEAL, 1)
                        .toItemStack(3));
                spawnItems.get(0).addEnchantment(Enchantment.FIRE_ASPECT, 1);
                lore.add("§cESTE KIT SOLO ES PARA§4§l VIPS");
                lore.add(ChatColor.GREEN + "Este Kit Trae Una Variedad De");
                lore.add(ChatColor.GOLD + "Materiales Esenciales Para Tu");
                lore.add(ChatColor.YELLOW + "Partida. Tienen Algunos Efectos");
                lore.add(ChatColor.BLUE + "Bastantes Essenciales Pruebalos!");
            }
        };
    I've been testing this but nothing:
    Code:
        @EventHandler
        public void sickStick(EntityDamageByEntityEvent pevent){
            Entity damagee = pevent.getEntity();
            Entity damager = pevent.getDamager();
            if(damager instanceof Player){
                Player damagerpl = ((Player) damager).getPlayer();
                if(damagee instanceof Player){
                    if (damagerpl.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("Sick Stick")){
                        if(damagerpl.getInventory().contains(Material.EMERALD)){
                            ((Player) damagee).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1, 10));
                            damagerpl.getInventory().remove(Material.EMERALD);
                        }
     
     
                    }
                }
            }
        }
     
  6. Offline

    Gater12

  7. Offline

    ToPoEdiTs


    not not understand the error took about 1:30 hour and not get anything to put an effect to an item you can me give an example: (
     
  8. Offline

    Necrodoom

    The kit sword is never named "sick stick", so it won't be its display name.
     
  9. Offline

    ToPoEdiTs

    so what's the problem?
     
  10. Offline

    ZodiacTheories

    ToPoEdiTs

    You have to do:

    Code:java
    1. yourstickmeta.setDisplayName("Sick Stick");
     
  11. Offline

    ToPoEdiTs

    as I have to replace this:
    Code:
    if (damagerpl.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("Stick")){
    For This?:
    Code:
    yourstickmeta.setDisplayName("Sick Stick");
     
  12. Offline

    ZodiacTheories

    ToPoEdiTs

    No, where you create your stick item, insert that
     
  13. Offline

    ToPoEdiTs

    what's esque am Spanish and do not understand: (what could I put on and I copy and paste and figo me where is the error that is not right but I've been all day with it: (
     
Thread Status:
Not open for further replies.

Share This Page