Possible solution for placeholders that register externally before PlaceholderAPI registers expansions

This commit is contained in:
extendedclip
2019-05-05 13:21:28 -04:00
parent 5386b7c23d
commit a2d408aea9
2 changed files with 14 additions and 0 deletions

View File

@@ -140,7 +140,14 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
@Override
public void run() {
getLogger().info("Placeholder expansion registration initializing...");
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
getExpansionManager().registerAllExpansions();
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
alreadyRegistered.entrySet().stream().forEach(hook -> {
PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue());
});
}
}
}, 20*15);
}