Reloading Config?

Discussion in 'Plugin Development' started by ImPhantom, Mar 8, 2014.

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

    ImPhantom

    So i am trying to reload my config through a command which is /ic reload and my commands are in a different class and package than my main class. But for some reason i get an error when i do /ic reload

    Heres the command code:
    Code:java
    1. InfoCommands ic;
    2.  
    3. @Override
    4. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    5.  
    6. if(cmd.getName().equalsIgnoreCase("ic")) {
    7. if(sender.hasPermission("infocommands.ic")) {
    8. if (args.length == 0)
    9. {
    10. sender.sendMessage("Usage: /ic reload");
    11. return true;
    12. } else if(args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("r")){
    13. if (sender.hasPermission("infocommands.reload"))
    14. {
    15. ic.reloadConfig();
    16. sender.sendMessage(ChatColor.YELLOW + "InfoCommands Config Reloaded.");
    17. return true;
    18. } else {
    19. sender.sendMessage(ChatColor.RED + "You do not have the permission to do that");
    20. return true;
    21. }
    22. }
    23. else
    24. {
    25. sender.sendMessage("[InfoCommands] " + ChatColor.RED + "You do not have permission to run this command.");
    26. }
    27. }
    28. }
    29. return false;
    30. }


    Here is the error in the console. It says the error is at "ic.reloadConfig();" (Line 26):

    http://pastebin.com/41SWWg1k
     
  2. ImPhantom
    'ic' is null, it's uninitialized.
     
Thread Status:
Not open for further replies.

Share This Page