me.clip.placeholderapi.PlaceholderHook Java Examples

The following examples show how to use me.clip.placeholderapi.PlaceholderHook. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlaceHolderVariables.java    From ScoreboardStats with MIT License 6 votes vote down vote up
@Override
public void register() {
    Set<String> variables = Sets.newHashSet();

    Collection<PlaceholderHook> hooks = PlaceholderAPI.getPlaceholders().values();
    for (PlaceholderHook hook : hooks) {
        String variablePrefix = null;
        if (hook instanceof EZPlaceholderHook) {
            variablePrefix = ((EZPlaceholderHook) hook).getPlaceholderName();
        } else if (hook instanceof PlaceholderExpansion) {
            variablePrefix = ((PlaceholderExpansion) hook).getIdentifier();
        }

        if (variablePrefix != null) {
            variables.add(variablePrefix + "_*");
        }
    }

    for (String variable : variables) {
        register(variable).supply(player -> PlaceholderAPI.setPlaceholders(player, '%' + variable + '%'));
    }
}
 
Example #2
Source File: ExpansionManager.java    From PlaceholderAPI with GNU General Public License v3.0 5 votes vote down vote up
public PlaceholderExpansion getRegisteredExpansion(String name) {
  for (Entry<String, PlaceholderHook> hook : PlaceholderAPI.getPlaceholders().entrySet()) {
    if (hook.getValue() instanceof PlaceholderExpansion) {
      if (name.equalsIgnoreCase(hook.getKey())) {
        return (PlaceholderExpansion) hook.getValue();
      }
    }
  }

  return null;
}
 
Example #3
Source File: PlaceholderHookUnloadEvent.java    From PlaceholderAPI with GNU General Public License v3.0 4 votes vote down vote up
public PlaceholderHookUnloadEvent(String plugin, PlaceholderHook placeholderHook) {
  this.plugin = plugin;
  this.hook = placeholderHook;
}
 
Example #4
Source File: PlaceholderHookUnloadEvent.java    From PlaceholderAPI with GNU General Public License v3.0 4 votes vote down vote up
public PlaceholderHook getHook() {
  return hook;
}