Search in sources :

Example 1 with PlayerMenuOptionsChanged

use of net.runelite.api.events.PlayerMenuOptionsChanged in project runelite by runelite.

the class RSClientMixin method playerOptionsChanged.

@FieldHook("playerOptions")
@Inject
public static void playerOptionsChanged(int idx) {
    // Reset the menu type
    MenuAction[] playerActions = { PLAYER_FIRST_OPTION, PLAYER_SECOND_OPTION, PLAYER_THIRD_OPTION, PLAYER_FOURTH_OPTION, PLAYER_FIFTH_OPTION, PLAYER_SIXTH_OPTION, PLAYER_SEVENTH_OPTION, PLAYER_EIGTH_OPTION };
    if (idx >= 0 && idx < playerActions.length) {
        MenuAction playerAction = playerActions[idx];
        client.getPlayerMenuTypes()[idx] = playerAction.getId();
    }
    PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
    optionsChanged.setIndex(idx);
    eventBus.post(optionsChanged);
}
Also used : MenuAction(net.runelite.api.MenuAction) PlayerMenuOptionsChanged(net.runelite.api.events.PlayerMenuOptionsChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Aggregations

MenuAction (net.runelite.api.MenuAction)1 PlayerMenuOptionsChanged (net.runelite.api.events.PlayerMenuOptionsChanged)1 FieldHook (net.runelite.api.mixins.FieldHook)1 Inject (net.runelite.api.mixins.Inject)1