Plugin Help If-query - Yaml

Discussion in 'Plugin Help/Development/Requests' started by ScorixEar, Jun 6, 2015.

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

    ScorixEar

    Hello guys and girls,
    my problem is the yml and the Yaml-Handler.
    I set with a command this to permanent:
    Code:
    Bansystem.getInstance().getBanFile().set(e.getPlayer().getUniqueId().toString()+".Dauer", "permanent");
    But if I test it later:
    Code:
    if(Bansystem.getInstance().getBanFile().get(e.getPlayer().getUniqueId().toString()+".Dauer")=="permanent")
    this will be after a reload or a restart not true... But why?
    How can i fix this
    I also used this:
    Code:
    if(Bansystem.getInstance().getBanFile().get(e.getPlayer().getUniqueId().toString()+".Dauer").toString()=="permanent")
    and this:
    Code:
    if(Bansystem.getInstance().getBanFile().getString(e.getPlayer().getUniqueId().toString()+".Dauer")=="permanent")
    aaand this:
    Code:
    if(Bansystem.getInstance().getBanFile().getString(e.getPlayer().getUniqueId().toString()+".Dauer").toString()=="permanent")
    and this:
    Code:
    String s = Bansystem.getInstance().getBanFile().getString(e.getPlayer().getUniqueId().toString()+".Dauer");
    if(s=="permanent")
    thank you for your help (or childhood :D)
     
  2. Offline

    nlthijs48

    @ScorixEar Comparing Strings with == does not compare the content of the String, instead it compares the memory location. Therefore it does not work in your code, try using .equals().
     
  3. Offline

    ScorixEar

    Oh, now I understand :D
     
Thread Status:
Not open for further replies.

Share This Page