Plugin help

Discussion in 'Plugin Development' started by Mattie, Jan 20, 2011.

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



    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. -> MarkLog -> MarkLogPlayerListener -> (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:

    2011-01-20 20:35:54 [WARNING] Failed to handle packet: java.util.ConcurrentModificationException
            at java.util.PriorityQueue$
            at org.bukkit.plugin.SimplePluginManager.callEvent(
            at net.minecraft.server.NetServerHandler.c(
            at net.minecraft.server.NetServerHandler.a(
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(
    It's probaly something really simple but i just don't see it. Any help is welcome!
  2. Offline


    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:

    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:
    String[] sects = event.getMessage().split(" ");
    I will look over a bit more but thats all i have found so far.
    Hope this helps :)
  3. Offline


    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.
  4. Offline


    + 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"."

    So if i use the command "/mark strange error with player xxx" it should get (i hope i get)
    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!

    :eek: IT WORKS so it's not my code. One of my plugins is blocking it....
    Did i do something wrong with priority or something?
  5. Offline


    I'm sorry i got confused i thought you simple wanted to use /mark without anything extra on the end.
  6. Offline



    it was this simple thing"

    if (event.isCancelled())
    Ofcource for a "monitor" plugin it should always execute (and log) it. Kinda strange some other plugin cancelled it but it works like this ;)


    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.
    Last edited by a moderator: May 6, 2016
  7. Offline


    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:

    ********MARK BY: hans ******** time:0********
    21.01.2011 16:30:52 com.mysticx.bukkit.testplugin.PlayerListener onPlayerCommand
    INFO: ********MARK BY: hans ******** time:0********
Thread Status:
Not open for further replies.

Share This Page