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

Placeholder support #27

Closed
Zenya4 opened this issue Dec 11, 2018 · 9 comments
Closed

Placeholder support #27

Zenya4 opened this issue Dec 11, 2018 · 9 comments
Assignees

Comments

@Zenya4
Copy link

Zenya4 commented Dec 11, 2018

Is there a placeholder for chat formatting (EssentialsX) for this level addon?

@tastybento
Copy link
Member

No, there isn't.

@Poslovitch Is there a way for the add-on to register placeholders?

@Poslovitch
Copy link
Member

Yes, but that'll need some boilerplate code. But that's possible .

@Poslovitch
Copy link
Member

More and more users are asking for this.
@tastybento Registering a placeholder can be done using this code:

BentoBox.getInstance().getPlaceholdersManager().registerPlaceholder(Addon, String, PlaceholderReplacer);

See the Javadoc for reference.

@tastybento
Copy link
Member

@Poslovitch Thanks. I'll look into this now.

@tastybento tastybento self-assigned this Feb 2, 2019
@tastybento
Copy link
Member

Okay, added in commit 8eaca60
It needs testing.

tastybento added a commit that referenced this issue Feb 2, 2019
@tastybento
Copy link
Member

tastybento commented Feb 3, 2019

UPDATED with latest commit:

Added these placeholders (BSkyBlock examples):

Level Placeholder
%Level_bskyblock-island-level% - the player's level

Top Ten Placeholders
%Level_bskyblock-island-level-top-value-x% where x is a number between 1 and 10
%Level_bskyblock-island-level-top-name-x% where x is a number between 1 and 10

If the top ten is less than 10 players then the placeholder will return an empty string.

To get the the values for other game modes, for example AcidIsland or CaveBlock, use the same format but with the Addon name in lower case, e.g. %Level_acidisland-island-level%

Tested using Placeholder API's parse command and they work.

e.g.

papi parse LSPVicky level %Level_bskyblock-island-level-top-value-10%
[21:37:20 INFO]: level
papi parse LSPVicky level %Level_bskyblock-island-level-top-value-1%
[21:37:23 INFO]: level 28
papi parse LSPVicky level %Level_bskyblock-island-level%
[21:37:38 INFO]: level 28

@tastybento
Copy link
Member

commit 97fb434

@tastybento
Copy link
Member

This issue relates to this discussion: BentoBoxWorld/BentoBox#322

tastybento added a commit that referenced this issue Feb 4, 2019
When upgrading, must delete config.yml to get new version.

Also changes placeholder names to be prefixed with GameModeAddon name in
lower case. e.g, %bskyblock-island-level%

#39
BentoBoxWorld/BentoBox#322
#27
@tastybento
Copy link
Member

Note placeholder names now have the game mode in them so you can get them for any game mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants