Holographic Displays

Holographic Displays

3M Downloads

Add patern to placeholder

orblazer opened this issue ยท 2 comments

commented

Hello,
I make that issue for propose implement pattern for custom placeholder (like world or bungeecord placeholder).
This is useful for pass variable to placeholder.

For me i see that usage :

  1. With matcher
    HologramsAPI.registerPlaceholder(plugin, pattern, refresfreshRate, (matcher) -> {});
  2. With directly matches
    HologramsAPI.registerPlaceholder(plugin, pattern, refresfreshRate, (matches) -> {});

The usage that new format :

  1.  HologramsAPI.registerPlaceholder(this, Pattern.compile("\{serverMap\:(\w+)\}"), 1, (matcher) -> {
         return getServerMap(matcher.group(1));
     });
  2.  HologramsAPI.registerPlaceholder(this, Pattern.compile("\{serverMap\:(\w+)\}"), 1, (matches) -> {
         return getServerMap(matches[1]);
     });

Thanks.

commented

Implemented in the new beta API, it needs to be improved and documented.

commented

This is a good idea, and will be most likely implemented in Holographic Displays 3.0. I plan to make a lot of refactoring, that will allow me to easily improve placeholders.