Solved Config not applying ingame after changes?

Discussion in 'Plugin Development' started by x_Jake_s, Feb 19, 2015.

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

    x_Jake_s

    Alright so here is my reload code:
    Code:
      if ((command.getName().toLowerCase().equalsIgnoreCase("careload")) &&
      (sender.hasPermission("chatadmin.reload")))
      {  
      sender.sendMessage(ChatColor.GREEN + "[ChatAdmin] " +  
      ChatColor.GOLD + "is reloading.");
      this.saveDefaultConfig();
      this.reloadConfig();
      sender.sendMessage(ChatColor.GREEN + "[ChatAdmin] " +
      ChatColor.GOLD + "has been reloaded.");
      }
    
    whenever i do this and i go into my config and change a variable for instance my overall prefix and then i do /careload it reloads it saves the config with the changes but when i check to see that the prefix changed it didnt it only changes when i full reload the server? any ideas?
     
  2. Offline

    pie_flavor

    @x_Jake_s Just out of curiosity, it must be a pain in the posterior to say getConfig().getString("overall-prefix") every time you send someone a message. I'm going to guess that you created a String variable, and set it to the prefix, so you can just type 'prefix' every time you send the message.
    It doesn't automatically update. In the method (if this is what you are doing) to reload, reset the variable to the new value.
     
  3. Offline

    mine-care

    Command.getName().toLowerCase().equalsIgnoreCase(...)
    Why going lowercase and then checking of it is equal with a string ignoring the case?!?
    Also
    @pie_flavor has the answer...
     
  4. Offline

    x_Jake_s

    Wow i should've known that thank your very much i prob would have figured that out eventually and yes i did the getConfig().getString("") variable.

    umm i dont know why i do that its prob because sometimes i just put in toLowerCase() or just put equalsIgnoreCase() but it doesnt hurt the code so if i type both of them by accident i just tend to leave it and then usually when i go to add more features ill remove it.
     
    mine-care likes this.
  5. Offline

    mine-care

    @x_Jake_s well to the tiny bit of efficiency it does hurt code, you do operations that are unneeded =. Inefficient :- ) but its not something major =]
     
  6. Offline

    x_Jake_s

    i guess so it does cause slight deficiency but its not like a whole couple strings of unneeded code but for the bugging i already removed those unneeded .toLowerCase() from my code.
     
Thread Status:
Not open for further replies.

Share This Page