Implement renderable components & fix player component #1105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implemented a new
RenderableComponent
interface, which allows components that render themselves (they define arender
method) for each viewing player.The first (and main) implementation for it, is
PlayerComponent
, which no longer is a fancy-wrapper over TextComponent, instead, it now returns a PlayerComponent, and will convert to TextComponents when sent to the audiences, based on who the viewer is. That means each viewer may see the name differently (eg: different friendship status, or may be able to see or not see nicks).Audience now creates a BukkitAudiences with our custom renderer, which will try to render our custom components first, then delegate to the default adventure translating renderer.
Main changes:
RenderableComponent
interface &ComponentRenderer
(they're generic so we can do more custom components in the future, TeamComponent maybe?)PlayerComponent
now has arender(CommandSender)
method, to implement the RenderableComponent interfaceTextTranslations
to translate/translateLegacy using the new rendererAudiences
to create aBukkitAudiences
that uses the new rendererNameStyle.CONCISE
, it only existed to be FANCY, but without revealing, now that's automatically done by the per-player rendering