Solved Config Help

Discussion in 'Plugin Development' started by SpiderLink, Jan 17, 2013.

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

    SpiderLink

    Hi guis! I have a problem:
    i have this syntax: player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 500, 1));
    I want to make the effect configurable with a config.yml file...what syntax should i use? i tried with getConfig().getString("<effectname>") but it doesn;t work....
    Please help me :)
     
  2. Offline

    DarkBladee12

    SpiderLink add a section named "effectname: BLINDNESS" in your config then do "player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(getConfig().getString("effectname"), 500, 1));"
     
    SpiderLink likes this.
  3. Offline

    SpiderLink

    Thank that worked! :)

    I have another problem.....i want to make the cooldowns configurable...what syntax should i use inside the: Thread.sleep(<here>);
    ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  4. Offline

    DarkBladee12

    SpiderLink you should setup a ArrayList<String> for the player names and add his name if he has drunken a potion then you start a scheduler with a specific amount of time, which will remove the player from the list ;)
     
  5. Offline

    SpiderLink

    DarkBladee12 i did that...what i was asking was : How can i make that time configurable via a config.yml file (the duration of the cooldown).

    To make myself more clear this is the code section for the timer :
    public class CountDown implements Runnable{
    public Player player1 = null;
    public List<Player> cooldown1 = new ArrayList<Player>();
    public void setPlayer(Player player){
    this.player1 = player;

    }
    public void setList(List<Player> list){
    cooldown1 = list;
    }
    public List<Player> getList(){
    returncooldown1;
    }
    public void run(){
    try{
    Thread.sleep(10000);
    cooldown1.remove(player1);
    }catch(Exception ignored){

    }

    }
    }

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  6. Offline

    SpiderLink

    I figured it out!!! No help needed anymore.....
     
Thread Status:
Not open for further replies.

Share This Page