From 51599c404478c18452720c5c6dab3b425ee63b12 Mon Sep 17 00:00:00 2001 From: extendedclip Date: Thu, 19 Sep 2019 14:22:08 -0400 Subject: [PATCH] Allow cancelling expansion registration --- src/main/java/me/clip/placeholderapi/PlaceholderAPI.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java index e5e1974..86a6cfd 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java @@ -323,11 +323,12 @@ public class PlaceholderAPI { } public static boolean registerExpansion(PlaceholderExpansion ex) { - if (registerPlaceholderHook(ex.getIdentifier(), ex)) { - Bukkit.getPluginManager().callEvent(new ExpansionRegisterEvent(ex)); - return true; + ExpansionRegisterEvent ev = new ExpansionRegisterEvent(ex); + Bukkit.getPluginManager().callEvent(ev); + if (ev.isCancelled()) { + return false; } - return false; + return registerPlaceholderHook(ex.getIdentifier(), ex); } public static boolean unregisterExpansion(PlaceholderExpansion ex) {