loadConfiguartion()!?!?

Discussion in 'Plugin Development' started by CraftCreeper6, Jan 27, 2014.

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

    CraftCreeper6

    I have a code that has a config file but when I try and load the config it does not create one. It seems that loadConfiguration(); is underlined and I have no idea why! I have added this to many different places even trying to create a command for it but none have worked :/ Can anyone help?
    Code:java
    1. package me.CraftCreeper6.email;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.plugin.java.JavaPlugin;
    8.  
    9. public class email extends JavaPlugin {
    10.  
    11. public void onEnable() {
    12. getLogger().info("Email Enabled!");
    13.  
    14. }
    15.  
    16. public void onDisable() {
    17.  
    18. getLogger().info("Email Disabled!");
    19.  
    20. }
    21.  
    22. public boolean onCommand(CommandSender sender, Command cmd,
    23. String commandLabel, String[] args) {
    24.  
    25. Player p = (Player) sender;
    26.  
    27. if(commandLabel.equalsIgnoreCase("reloademail")) {
    28. loadConfiguration();
    29. }
    30.  
    31. String mess;
    32. String name;
    33. StringBuilder sb = new StringBuilder();
    34.  
    35. for(int i = 0; i < args.length; i++) {
    36. sb.append(args[i] + " ");
    37.  
    38. }
    39.  
    40. mess = sb.toString();
    41. name = sb.toString();
    42. if (commandLabel.equalsIgnoreCase("emailsend")) {
    43. if(mess == null || name == null);
    44. p.sendMessage(ChatColor.RED + "Invalid argument. Correct usage: /emailsend [name] [message]");
    45. }else{
    46. name.equals(name);
    47. p.sendMessage(ChatColor.BLUE + "Email sent!");
    48. getConfig().set("Messages.message", mess);
    49. getConfig().set("Messages.name", name);
    50. saveConfig();
    51. }
    52. if (commandLabel.equalsIgnoreCase("emailcheck")) {
    53. if(mess == null);
    54. mess = ("You have no email!");
    55. }
    56. p.sendMessage(ChatColor.BLUE + p.getDisplayName() + "'s Mail: " + (mess));
    57. {
    58. return false;
    59.  
    60.  
    61. }
    62. }
    63. }[/i]

    Error: The method loadConfiguration() is undefined for the type email


    Bump :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  2. Where did you define loadConfiguration()?
     
  3. Offline

    ItsLeandro

    Wait you just want to reload the config? Just use: reloadConfig();
    It can be that this isn't what you mean, because I don't really get your problem. Be more specific.
     
  4. Offline

    CraftCreeper6

    Its done now! Turns out I do not need loadConfiguration(); :p
     
Thread Status:
Not open for further replies.

Share This Page