possable bug with EventMethods?

  • i have been toying a little with the api and have run across an issue. when using any EventMethods i get errors and it doesnt work when being used on my server. plugin works as expected in single player. sorry in advance if its just me!



  • Also ich arbeite derzeit nur für Server und habe in der Sub-Class:

    ---

    So I'm currently only working for servers and have in the sub-class:

    Code
    public MyListener(Plugin plugin){
        this.plugin = plugin;
        plugin.registerEventListener(this);
    }

    Das klappt ohne Fehler

    ---

    This works without errors


    Dann aber auch ohne diese Zeile

    ---

    But then also without this line

    Code
    @Override
    public void onEnable() {
        MyListener lt = new MyListener(plugin);
        registerEventListener(lt);
    }

    Aber ob das nicht auch so gehen soll wie du das gemacht hast, weiß ich nicht, vieleicht ist das doch ein fehler

    ---

    But I don't know whether it shouldn't work the way you did it, maybe that's a mistake

  • That code should basically work, at least it worked on my end (pressing U printed a red text to the chat) :thinking: The only "issue" is that "plugin" (line 14 of the first snippet) is null (because the "plugin" variable has never been initialized), that doesn't matter in this code (because that parameter isn't used in the snippet anyway), but probably this was unintended?


    It's weird if this only works in singleplayer, but not on the server :wat: Could you maybe send me the full server log (either post it here, or send it via PM to me)?

  • i tested it my way and also have 100% the same problem as James, works fine in single player, but not if used on a server

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Rising Cities @ ip 52.53.149.132:4255 ServerName (Rising Cities) Unity :thumbsup:

    If you want to run a server how about using my AutoServerInstallers go here to download >>>RWAutoServerInstaller for Unity And Java<<<

    If at first your code does not work call it version 0.1 with the odd bug :thinking:




    31245-logo-png
  • Thanks for the log james1bow ! It looks like the PlayerKeyEvent isn't triggered correctly in multiplayer :wat: We will fix that ASAP! Other events should work fine though ;)

    Thanks you! i had had a lot more in there and removed it trying to figure out what was going on. That's why the initialized plugin variable was still there.

    .

  • Not a biggie James, but when you use colour XML syntax it should be closed too afaik.


    Code
    player.sendTextMessage("<color=red>test text</color>");

    thanks for the reminder!

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!