Solved User data stats.rank == Mod

Discussion in 'Plugin Development' started by FireBuster12, Jun 28, 2017.

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

    FireBuster12

    Hello bukkit,

    I've made that if a user gets a separate joint that he then config containing his data.

    I have now also in that config the rank but now I want to make it so that if the rank == Mod that he is going to do something.

    My config:
    Code:
    Code:java
    1.  
    2. String playerName = p. getName ();
    3. User data file = new File (Bukkit. getServer (). getPluginManager (). getDataFolder ("BlockCraft"). getPlugin (), File. separator + "Players");
    4. File f = new File (user data, File. separator + playerName + "file");
    5. FileConfiguration (f) YamlConfiguration = playerData. loadConfiguration;
    6.  
    7. //---------------------------------------------------------------------------------------------------------------
    8.  
    9. if(playerData.getString("stats.rank") == "Mod")
    10. {
    11. event.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.RED + "MODERATOR" + ChatColor.DARK_GRAY + "] " + ChatColor.RED + p.getDisplayName() + ChatColor.DARK_GRAY + ": " + ChatColor.WHITE + event.getMessage());
    12.  
    13. }
    14.  
    15.  
     
  2. Offline

    timtower Administrator Administrator Moderator

    @FireBuster12 Strings are compared with equals or equalsIgnoreCase
     
    InstanceofDeath likes this.
  3. Offline

    FireBuster12

    Tnx ;), But how do I make it working?
     
  4. Offline

    timtower Administrator Administrator Moderator

    @FireBuster12 You replace == with an String#equals or String#equalsIgnoreCase check
     
  5. Offline

    FireBuster12

    Love you <3 Thank you so much!
     
Thread Status:
Not open for further replies.

Share This Page