MonsterIRC

MonsterIRC

24.4k Downloads

NPE on /irc say

robxu9 opened this issue ยท 10 comments

commented

2012-01-28 16:43:27 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'irc' in plugin MonsterIRC v1.105
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:386)
at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:777)
at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:737)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:725)
at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:178)
at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:33)
at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:100)
at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:587)
at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:536)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:434)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:465)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
at org.monstercraft.irc.command.gamecommands.Say.execute(Say.java:42)
at org.monstercraft.irc.managers.CommandManager.onGameCommand(CommandManager.java:82)
at org.monstercraft.irc.IRC.onCommand(IRC.java:71)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
... 14 more

Also, with no chat plugin (except bChatManager), no chat is being relayed back :(

commented

That's an array out of bounds exception, not a null pointer exception.

commented

facepalm I apparently couldn't read when I started opened this issue >_>"

commented

I just had a look at the code. It's happening whenever the message you want to say doesn't have a space in it.

'Clever.'

commented

Found it.

https://github.com/Monstercraft/MonsterIRC/blob/master/src/org/monstercraft/irc/command/gamecommands/Say.java

for (IRCChannel c : Variables.channels) {
            if (c.getChannel().equalsIgnoreCase(split[3])) {
                IRC.getHandleManager().getIRCHandler()
                        .sendMessage(result.toString(), c.getChannel());
                if (c.getChatType() == ChatType.HEROCHAT
                        && IRC.getHookManager().getHeroChatHook() != null) {
                    c.getHeroChatChannel().sendMessage(
                            "<" + sender.getName() + ">", result2.toString(),
                            c.getHeroChatChannel().getMsgFormat(), false);
                }
            }
        }

What the hell was the author thinking here?
If you include the full name of the channel in your /irc say as the FOURTH PARAMETER then you will say the THIRD+.

Example channel: #abc
/irc say WTF #abc WTF WTF WTF.

Output to channel:
<yourname> WTF #abc WTF WTF WTF

Fletch, please learn how to use zero indexed arrays!

[0] irc
[1] say
[2] WTF
[3] #abc
[4] WTF
[5] WTF
[6] WTF
commented

hardcoded. wtf. :|

commented

Sorry been busy with exams at school, will fix this..

commented

Besides who uses /irc say anyways lol..

commented

Besides who uses /irc say anyways lol..

That would be the confused people who can't get the plugin to do anything.

commented

Its all fixed, some reason github wasn't sending me email when someone commented or created an issue before but now it is :D

commented

@Psithief +1 lol ;)