Player Animation's

  • looking for a method in the API to trigger a player animation. only thing i can find that allows anything to do with animations has to do with custom items. is there a way to do this int he API that i may be overlooking?

  • Unfortunately it's not possible to set an animation (this only works in combination with custom items) :/ But this is planned for the new version!

    my work around is to make a custom item for all 7 gestures. gesture 2 being the one craftable (gesture1 would be to offensive a default gesture :wat:). gestures are used with primary action and clicking the secondary action changes between the other customeitem(1 for each gesture).

    will be using a context menu on right click in the future(once i know how to setup/use callbacks).

  • This sounds like a good workaround :) :thumbup:


    will be using a context menu on right click in the future(once i know how to setup/use callbacks).

    Callbacks in the Plugin API basically just contain a method which will be invoked once the server gets a response from the client. The particular data the server receives from the client (in this case the selected entry in the context menu, as a String) will be passed as parameter to that method. You can put your own code inside this method by implementing the "Callback" interface.

    Instead of writing a whole class which implements that interfacec, you can use "anonymous classes": That's basically just a block of code (the code that would otherwise belong into the "onCall()" method) which will then be executed once the server got the response from the client. It could look like this:


    Java
    String[] entries = new String[]{"Option 1", "Option 2", "Option 3"};
    player.showContextMenu(entries, (String entry) -> {
    System.out.println("Selected entry: " + entry);
    });


    This brings up a context menu with 3 entries ("Option 1", "Option 2" and "Option 3"). The parameter passed to the method is the part in brackets "(String entry)". If the player selects one of these entries (e.g. Option 2), the code below will be executed, i.e. the server will print "Selected entry: Option 2" etc.

Participate now!

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