Solved Config IF - IMPORTANT (or not)

Discussion in 'Plugin Development' started by Flexion, Oct 25, 2014.

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

    Flexion

    Hello,
    i programmed a plugin and I would like to make configurable languages. I did everything I had to do. But here is my code:
    Code:java
    1. String reinigen = getConfig().getString("language");
    2.  
    3. if(reinigen == "EN") {
    4. sender.sendMessage(ChatColor.AQUA + "Sorry, but this player isn't online.");
    5. } else {
    6. sender.sendMessage(ChatColor.AQUA + "Sorry, aber der Spieler ist nicht online.");
    7. }

    (Dont be confused, the string name is German)
    My config.yml:
    Code:
    language: 'EN'
    Here is the problem:
    When i try the plugin, it creates the config, but it ALWAYS sends me the German message.
    What can i do?
     
  2. Offline

    Rocoty

    You're comparing strings wrongly. Use .equals
     
    Flexion likes this.
  3. Offline

    Flexion

Thread Status:
Not open for further replies.

Share This Page