mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
updated local manager to allow for reregistering expansions
This commit is contained in:
parent
5861f9fe6a
commit
85b9fc36da
@ -186,14 +186,22 @@ public final class LocalExpansionManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
final ExpansionRegisterEvent event = new ExpansionRegisterEvent(expansion);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || expansions.put(expansion.getIdentifier(), expansion) != null)
|
||||
final PlaceholderExpansion removed = expansions.get(expansion.getIdentifier());
|
||||
if (removed != null && !unregister(removed))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ExpansionRegisterEvent event = new ExpansionRegisterEvent(expansion);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
expansions.put(expansion.getIdentifier(), expansion);
|
||||
|
||||
if (expansion instanceof Listener)
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
|
||||
|
Loading…
Reference in New Issue
Block a user