Get potion name and duration from config?

Discussion in 'Plugin Development' started by alf980103, May 26, 2013.

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

    alf980103

    Hi bukkit comunity, it's me again :( i want to check in the config if a string, for example called Effects.Weed. if there is a potion name or duration, like this:

    Effects:
    Weed:
    EffectType: SPEED
    Duration: '80'
    Amplifier: '60'

    How can i do this?
     
  2. Offline

    SoThatsIt

    getConfig().getConfigurationSection().getKeys(); Gives you a list of Weed, and any other custom effects you have and then you can loop through them and add weed to effectType or duration, etc... to figure out all the rest
     
  3. Offline

    alf980103

    Code:
        p.addPotionEffect(new PotionEffect(PotionEffectType
                                    .getByName(plugin.getConfig().getString(
                                            "Efectos.Marihuana.Efecto")), plugin
                                    .getConfig().getInt(
                                            "Efectos.Marihuana.Duracion"), plugin
                                    .getConfig().getInt(
                                            "Efectos.Marihuana.Amplificador")));
    Have tryed whit this, but when the event occurs the consolo says:


    What can i do?
     
Thread Status:
Not open for further replies.

Share This Page