Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add player receives actionbar event #2326

Merged
merged 2 commits into from Feb 28, 2022

Conversation

mergu
Copy link
Contributor

@mergu mergu commented Feb 27, 2022

Tested via:

my_events:
  type: world
  events:
    on player receives actionbar:
      - announce to_console "Player <player.name> received actionbar: <context.message>"
      - announce to_console "Raw json: <context.raw_json>"
      #- determine cancelled
      #- determine 'raw_json:{"text":"determined raw json","color":"#61C2FF"}'
      - determine "message:<&color[#ffa3e2]><&l>[MY_PREFIX] <&r><context.message>"

with commands:

/ex actionbar "<&color[#61C2FF]>this is a test"
/ex actionbar "<&color[#61C2FF]><element[this is a test].font[illageralt]>"
/title @a actionbar {"text":"this is a test","color":"#61C2FF"}

everything works as expected and also handles custom fonts and rgb colors. some output: https://paste.denizenscript.com/View/93878

ClientboundSetActionBarTextPacket newPacket = new ClientboundSetActionBarTextPacket(component);
oldManager.send(newPacket, genericfuturelistener);
}
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overrides the packet even if the event doesn't fire and/or doesn't determine anything.
It should only override if there's a modification.

@mcmonkey4eva mcmonkey4eva merged commit 11ce7ef into DenizenScript:dev Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants