MutiMessage problem

Discussion in 'Plugin Development' started by javoris767, Dec 31, 2012.

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

    javoris767

    Hey, I have opened this topic up many times and people have given me great responses. When I try them it doesn't really work :/

    Code:
    01:45:26 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'sign
    up' in plugin TheAuraPack v0.4
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    6)
            at org.bukkit.craftbukkit.v1_4_6.CraftServer.dispatchCommand(CraftServer
    .java:510)
            at net.minecraft.server.v1_4_6.PlayerConnection.handleCommand(PlayerConn
    ection.java:980)
            at net.minecraft.server.v1_4_6.PlayerConnection.chat(PlayerConnection.ja
    va:898)
            at net.minecraft.server.v1_4_6.PlayerConnection.a(PlayerConnection.java:
    853)
            at net.minecraft.server.v1_4_6.Packet3Chat.handle(Packet3Chat.java:44)
            at net.minecraft.server.v1_4_6.NetworkManager.b(NetworkManager.java:290)
    
            at net.minecraft.server.v1_4_6.PlayerConnection.d(PlayerConnection.java:
    112)
            at net.minecraft.server.v1_4_6.ServerConnection.b(SourceFile:39)
            at net.minecraft.server.v1_4_6.DedicatedServerConnection.b(SourceFile:30
    )
            at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:59
    8)
            at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:22
    4)
            at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:49
    4)
            at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:
    427)
            at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:84
    9)
    Caused by: java.lang.NullPointerException
            at info.auracraft.theaurapack.SignupCommand.onCommand(SignupCommand.java
    :26)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
            ... 15 more
    >
    
    Code:
        public boolean onCommand(CommandSender sender, Command cmd, String commandLable, String[] args) {
            if (!(sender instanceof Player)) {
                sender.sendMessage("Must be a player to use this command");
                return false;
            }
            if (sender.hasPermission("aura.signup")) {
                if (args.length == 0) {
                    List<String> signup = plugin.getConfig().getStringList("TheAuraPack.signup");
    
                    for(String site : signup) {
    
                        site = site.replaceAll("&([0-9a-fA-F])", "ยง$1");
    
                        sender.sendMessage(new StringBuilder().append(site).toString());
                    }
                }
                else sender.sendMessage(ChatColor.AQUA + "You have already been promoted!");
    
                if (args.length > 0) {
                    sender.sendMessage(ChatColor.RED + "Too many args!");
                }
            }
            return false;
        }
    }
     
  2. Offline

    pkt

    which line of code is 26?
     
  3. Offline

    javoris767

    Code:
     List<String> signup = plugin.getConfig().getStringList("TheAuraPack.signup");
     
  4. Offline

    pkt

    I'm not sure... but I think it's cause the List in the config is null or it just can't find it
     
  5. Offline

    Jogy34

    For one you are never checking what the command was. for 2 I would guess that the error is being thrown on plugin. If this is in your main class you can replace it with 'this' otherwise add a null check on it. If that isn't the problem then add a null check on plugin.getConfig()
     
  6. Offline

    CeramicTitan

    does your config generate? If it doesn't thats probably your problem.
     
  7. Offline

    Jogy34

    It wouldn't be returning an error on that line as storing null into the list is a viable option. It would be giving an error on the line that he tries to use it in the for loop.
     
Thread Status:
Not open for further replies.

Share This Page