Posts by yahwho

    That's OK, thought I might have been doing something wrong or someone might have had a workaround for it.


    Really no need to apologise @red51 you're doing some really great work! You have inspired me to start writing code again which I'm enjoying as much as playing the game! :thumbsup: I can only guess at the length `todo` list you guys have!


    I will assume then (unless you state otherwise) that I can carry on with my GUI coding and that I was not doing it wrong and it will work as intended once the listener is fixed ^^

    you do not need that, I do not know if that makes any problems. That's to start plugin events, you have a simple function.

    I would use the static fields constant "KEY_R"


    otherwise that looks coherent, only line 40 I would take out. :thumbup:


    HA! Key constants! Thank you noci! That will make life a lot easier than using integers! Danks! :D


    But yes, it does look like it is bugged. Maybe @red51 could confirm this? My GUI plans are all on hold at the moment due to this problem ;(


    @noci Why would you take out line 40? Because player.registerKeys(new int[]{19}); is enough? edit: just checked - if you take out player.setListenForKeyInput(true); you dont get any input from keys including the registered key(s).

    oops think I missed an @EventMethod ill edit. . .

    I have also tried changing the PlayerGuiElementClickEvent to onPlayerGuiClick


    It's the same behaviour, works fine, but as soon as anyone else disconnects from the server, this is no longer works.

    OK so I have started again on a GUI to try and work this out using the most minimal of code. I have removed the panels and I am just working on one single label that is set to be clickable.


    Here is the complete code for the plugin.


    All it does is listen for a key press (R key). When a player presses R it sets the mouse cursor to visible, so we should be able to click on an element.


    The element is a single label in the bottom left hand corner of the screen with the text "Test text which should be clickable. . ." (of course this is set to setClickable(true).


    Now, when this plugin is run and a player presses the R key the listener onPlayerGuiElementClickEvent is never called whilst clicking on the label?



    zumindest ist es nicht nur ich


    und


    "Ich habe einen PlayerDisconnectEvent hinzugefügt und lasse mir player.isListeningForKeyInput() und z.b. player.Attribute.GuiImage.isClickable() für alle Spieler ausgeben, sie sind nach dem Abmelden eines Spielers TRUE. "


    I had not thought of that - good idea for testing! :)


    Although I suspect I will have the same problem as you. . .

    Yeah the + player.getUID was added as I've tried (desperately) to fix the problem (same issue though with or without it).


    Casting into a label was just done for personal reasons - ease of reading code! (I know they're all objects and dont need the implicit cast).


    Nope I don't use GUIElement.destroy()


    And nope again, I don't get any kind of errors at all.




    See! A really easy logic bug! :D

    Yep there is an onPlayerDisconnectEvent but nothing to do with the GUI in there


    Here's an example of how I have done the set attribute


    Code
    GuiLabel confirm = new GuiLabel(" CONFIRM ", 0.45f, 0.5f, true);
    confirm.setClickable(true);
    player.setAttribute("confirm" + player.getUID(), (Object)confirm);



    Code
    public void onPlayerSpawnEvent(PlayerSpawnEvent event) {
    this.GuiPlayerPanels(player);
    }





    Defo a weird one, it's like the event listeners gets garbage collected when a player disconnects.