Solved Potion effect problem

Discussion in 'Plugin Development' started by nastasescu, Jun 28, 2014.

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

    nastasescu

    So... I'm here again.
    I have this code:

    String potion1 = getConfig().getString("Kits." + s + ".Potion-1");
    Integer potion1seconds = getConfig().getInt("Kits." + s + ".PotionSeconds-1");

    player.addPotionEffect(new PotionEffect(PotionEffectType.valueOf(potion1), potion1seconds*20, 0));

    The underlined function don't work, it says
    What can i do?

    P.S.: I want on player death to spawn a skeleton or another mob, what's the code?
     
  2. I'm pretty sure you need to use PotionEffectType.getByName() instead of PotionEffectType.valueOf()
     
    nastasescu likes this.
  3. Offline

    nastasescu

    RenegadeEagle thanks, now i want on player death to spawn a skeleton, what's the code?
     
  4. Code:
     @EventHandler
        public void onPlayerDeath(PlayerDeathEvent event){
            Entity mob = event.getEntity().getLocation().getWorld().spawnEntity(event.getEntity().getLocation(), EntityType.SKELETON);   
            //Do whatever you want to the mob.
        }
    
     
    nastasescu likes this.
  5. Offline

    nastasescu

Thread Status:
Not open for further replies.

Share This Page