Hi, I'm working on my first (verry) simple plugin. When you do "/mark" it should 'mark' the logfile. You can use it if you need to check a logfile and want to see quick where it was. http://mattie.pastebin.com/pCGmX17S -> MarkLog http://mattie.pastebin.com/kx12f4kv -> MarkLogPlayerListener http://mattie.pastebin.com/a8XqBFSK -> (not used) MarkLogBlockListener The problem: When i execute a command it doesn't work (i don't get any response). The load works because i can see the "plugin loaded" message. However if I /plugin reload (or /plugin enable) my client disconnects due "internal server error" with this message in the server log: Code: 2011-01-20 20:35:54 [WARNING] Failed to handle packet: java.util.ConcurrentModificationException java.util.ConcurrentModificationException at java.util.PriorityQueue$Itr.next(PriorityQueue.java:481) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:195) at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:547) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:523) at net.minecraft.server.Packet3Chat.a(SourceFile:24) at net.minecraft.server.NetworkManager.a(SourceFile:232) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65) at net.minecraft.server.NetworkListenThread.a(SourceFile:104) at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:261) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:197) at net.minecraft.server.ThreadServerApplication.run(SourceFile:512) It's probaly something really simple but i just don't see it. Any help is welcome!
Seems you havn't had many replies. Okay i took a look at it and i believe the error is in the playerlistener class. First off update to the latest builds is the first port of call if that still fails: Code: String[] sects = event.getMessage().split(" +", 2); What is the necessity of the + ? (maybe a typo). I assume you just want it to spilt up the message at spaces: Code: String[] sects = event.getMessage().split(" "); I will look over a bit more but thats all i have found so far. Hope this helps
Yeah, I also had a quick look over your code. Everything seems to be just fine, I did a quick test run (only in eclipse) and called onPlayerCommand with Events containing "/LOG tests" and "/MARK test", both worked fine. Maybe update your bukkit, like Samkio said. I think the + is part of the regular expression, and should be ok here.
+ The plus sign indicates that there is one or more of the preceding element. For example, ab+c matches "abc", "abbc", "abbbc", and so on, but not "ac". http://en.wikipedia.org/wiki/Regular_expression" So if i use the command "/mark strange error with player xxx" it should get (i hope i get) sects[0]=/mark sects[1]=strange error with player xxx (instead of: [1]=strange [2]=error [3]=with ........) I've updated to the lasted bukkit and craftbukkit still nog luck. Perhaps an other plugin is disabeling mine somehow. I'll try a clean-server and let you know in a minute! edit: IT WORKS so it's not my code. One of my plugins is blocking it.... Did i do something wrong with priority or something?
AH IT WORKS it was this simple thing" Code: if (event.isCancelled()) return; Ofcource for a "monitor" plugin it should always execute (and log) it. Kinda strange some other plugin cancelled it but it works like this edit: server output: Works like a charm! THANKS FOR ALL YOUR HELP i'll release my plugin tomorow when i have a change to update it with some other functions. --- merged: Jan 20, 2011 10:18 PM --- No problem, thanks for your help! btw, how do you call the hooks using eclipse??? Do you 'run' somekind of small server? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
http://pastebin.com/CXAwdWJn Code is a bit messed up, as i'm using anonymous inner classes to set Server and Player as this was just a real quick test. I'm basically calling the onCommand method of the Listener via a main method from inside Eclipse (Well, you could build a jar from this, etc.., but I think you know what I mean) Console output would be: Code: ********MARK BY: hans ******** time:0******** 21.01.2011 16:30:52 com.mysticx.bukkit.testplugin.PlayerListener onPlayerCommand INFO: ********MARK BY: hans ******** time:0********