diff --git a/pom.xml b/pom.xml index 4d0697a25..b54f57c9b 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,6 @@ 1.7 1.7 2.10.5 - master-SNAPSHOT d5f5e0bbd8 3.0-SNAPSHOT 7.0.0 @@ -250,15 +249,6 @@ ${placeholderapi.version} provided - - - com.github.BentoBoxWorld - MVdWPlaceholderAPI - ${mvdwplaceholderapi.version} - provided - us.dynmap diff --git a/src/main/java/world/bentobox/bentobox/BentoBox.java b/src/main/java/world/bentobox/bentobox/BentoBox.java index ecd27c6a2..ae2b2f6df 100644 --- a/src/main/java/world/bentobox/bentobox/BentoBox.java +++ b/src/main/java/world/bentobox/bentobox/BentoBox.java @@ -24,7 +24,6 @@ import world.bentobox.bentobox.hooks.DynmapHook; import world.bentobox.bentobox.hooks.MultiverseCoreHook; import world.bentobox.bentobox.hooks.VaultHook; import world.bentobox.bentobox.hooks.WorldEditHook; -import world.bentobox.bentobox.hooks.placeholders.MVdWPlaceholderAPIHook; import world.bentobox.bentobox.hooks.placeholders.PlaceholderAPIHook; import world.bentobox.bentobox.listeners.BannedCommands; import world.bentobox.bentobox.listeners.BlockEndDragon; @@ -169,7 +168,6 @@ public class BentoBox extends JavaPlugin { Bukkit.getScheduler().runTask(instance, () -> { final long enableStart = System.currentTimeMillis(); hooksManager.registerHook(new PlaceholderAPIHook()); - hooksManager.registerHook(new MVdWPlaceholderAPIHook()); // Setup the Placeholders manager placeholdersManager = new PlaceholdersManager(this); diff --git a/src/main/java/world/bentobox/bentobox/hooks/placeholders/MVdWPlaceholderAPIHook.java b/src/main/java/world/bentobox/bentobox/hooks/placeholders/MVdWPlaceholderAPIHook.java deleted file mode 100644 index 9d4f1b203..000000000 --- a/src/main/java/world/bentobox/bentobox/hooks/placeholders/MVdWPlaceholderAPIHook.java +++ /dev/null @@ -1,87 +0,0 @@ -package world.bentobox.bentobox.hooks.placeholders; - -import org.bukkit.entity.Player; -import org.eclipse.jdt.annotation.NonNull; - -import be.maximvdw.placeholderapi.PlaceholderAPI; -import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.api.addons.Addon; -import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer; -import world.bentobox.bentobox.api.user.User; - -/** - * Provides interfacing needed to register and get placeholders from MVdWPlaceholderAPI. - * @author Poslovitch - * @since 1.5.0 - */ -public class MVdWPlaceholderAPIHook extends PlaceholderHook { - - public MVdWPlaceholderAPIHook() { - super("MVdWPlaceholderAPI"); - } - - @Override - public boolean hook() { - return true; // There are no special checks to run when hooking into MVdWPlaceholderAPI. - } - - @Override - public String getFailureCause() { - return "the version of MVdWPlaceholderAPI you're using is incompatible with this hook"; - } - - /** - * {@inheritDoc} - */ - @Override - public void registerPlaceholder(@NonNull String placeholder, @NonNull PlaceholderReplacer replacer) { - PlaceholderAPI.registerPlaceholder(BentoBox.getInstance(), "bentobox_" + placeholder, - event -> replacer.onReplace(User.getInstance(event.getPlayer()))); - } - - /** - * {@inheritDoc} - */ - @Override - public void registerPlaceholder(@NonNull Addon addon, @NonNull String placeholder, @NonNull PlaceholderReplacer replacer) { - PlaceholderAPI.registerPlaceholder(BentoBox.getInstance(), addon.getDescription().getName().toLowerCase() + "_" + placeholder, - event -> replacer.onReplace(User.getInstance(event.getPlayer()))); - } - - /** - * {@inheritDoc} - * This is not supported by MVdWPlaceholderAPI. #HighQualityContent. - */ - @Override - public void unregisterPlaceholder(@NonNull String placeholder) { - // Do nothing: not supported by MVdW. #HighQualityContent - } - - /** - * {@inheritDoc} - * This is not supported by MVdWPlaceholderAPI. #HighQualityContent. - */ - @Override - public void unregisterPlaceholder(@NonNull Addon addon, @NonNull String placeholder) { - // Do nothing: not supported by MVdW. #HighQualityContent - } - - /** - * {@inheritDoc} - * This is not supported by MVdWPlaceholderAPI. #HighQualityContent. - * As a result, this will always return {@code false}. - */ - @Override - public boolean isPlaceholder(@NonNull Addon addon, @NonNull String placeholder) { - return false; // Do nothing: not supported by MVdW. #HighQualityContent - } - - /** - * {@inheritDoc} - */ - @Override - @NonNull - public String replacePlaceholders(@NonNull Player player, @NonNull String string) { - return PlaceholderAPI.replacePlaceholders(player, string); - } -} diff --git a/src/main/java/world/bentobox/bentobox/managers/PlaceholdersManager.java b/src/main/java/world/bentobox/bentobox/managers/PlaceholdersManager.java index 5b89f970d..e5527b49f 100644 --- a/src/main/java/world/bentobox/bentobox/managers/PlaceholdersManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/PlaceholdersManager.java @@ -11,7 +11,6 @@ import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.addons.Addon; import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer; -import world.bentobox.bentobox.hooks.placeholders.MVdWPlaceholderAPIHook; import world.bentobox.bentobox.hooks.placeholders.PlaceholderAPIHook; import world.bentobox.bentobox.lists.GameModePlaceholder; @@ -37,8 +36,6 @@ public class PlaceholdersManager { public void registerPlaceholder(@NonNull String placeholder, @NonNull PlaceholderReplacer replacer) { // Register it in PlaceholderAPI getPlaceholderAPIHook().ifPresent(hook -> hook.registerPlaceholder(placeholder, replacer)); - // Register it in MVdWPlaceholderAPI - getMVdWPlaceholderAPIHook().ifPresent(hook -> hook.registerPlaceholder(placeholder, replacer)); } /** @@ -56,8 +53,6 @@ public class PlaceholdersManager { } // Register it in PlaceholderAPI getPlaceholderAPIHook().ifPresent(hook -> hook.registerPlaceholder(addon, placeholder, replacer)); - // Register it in MVdWPlaceholderAPI - getMVdWPlaceholderAPIHook().ifPresent(hook -> hook.registerPlaceholder(addon, placeholder, replacer)); } /** @@ -80,7 +75,6 @@ public class PlaceholdersManager { public void unregisterPlaceholder(@NonNull String placeholder) { // Unregister it from PlaceholderAPI getPlaceholderAPIHook().ifPresent(hook -> hook.unregisterPlaceholder(placeholder)); - // Not supported by MVdW } /** @@ -97,7 +91,6 @@ public class PlaceholdersManager { } // Unregister it from PlaceholderAPI getPlaceholderAPIHook().ifPresent(hook -> hook.unregisterPlaceholder(addon, placeholder)); - // Not supported by MVdW } /** @@ -110,16 +103,6 @@ public class PlaceholdersManager { return plugin.getHooks().getHook("PlaceholderAPI").map(hook -> (PlaceholderAPIHook) hook); } - /** - * Returns an Optional containing the MVdWPlaceholderAPIHook instance, or an empty Optional otherwise. - * @return Optional containing the MVdWPlaceholderAPIHook instance or an empty Optional otherwise. - * @since 1.5.0 - */ - @NonNull - private Optional getMVdWPlaceholderAPIHook() { - return plugin.getHooks().getHook("MVdWPlaceholderAPI").map(hook -> (MVdWPlaceholderAPIHook) hook); - } - /** * Checks if a placeholder with this name is already registered * @param addon the addon, not null @@ -128,7 +111,6 @@ public class PlaceholdersManager { * @since 1.4.0 */ public boolean isPlaceholder(@NonNull Addon addon, @NonNull String placeholder) { - // MVdW will always return false return getPlaceholderAPIHook().map(h -> h.isPlaceholder(addon, placeholder)).orElse(false); } @@ -144,12 +126,6 @@ public class PlaceholdersManager { if (papi.isPresent()) { string = papi.get().replacePlaceholders(player, string); } - - Optional mvdw = getMVdWPlaceholderAPIHook(); - if (mvdw.isPresent()) { - string = mvdw.get().replacePlaceholders(player, string); - } - return string; } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index fed649f85..ca3b84c2f 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -11,7 +11,7 @@ load: STARTUP loadbefore: [Multiverse-Core, Residence] -softdepend: [Vault, PlaceholderAPI, MVdWPlaceholderAPI, dynmap, WorldEdit, WorldBorderAPI] +softdepend: [Vault, PlaceholderAPI, dynmap, WorldEdit, WorldBorderAPI] permissions: bentobox.admin: diff --git a/src/test/java/world/bentobox/bentobox/managers/PlaceholdersManagerTest.java b/src/test/java/world/bentobox/bentobox/managers/PlaceholdersManagerTest.java index cf63d458f..bb8f51c16 100644 --- a/src/test/java/world/bentobox/bentobox/managers/PlaceholdersManagerTest.java +++ b/src/test/java/world/bentobox/bentobox/managers/PlaceholdersManagerTest.java @@ -23,7 +23,6 @@ import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.addons.AddonDescription; import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.api.hooks.Hook; -import world.bentobox.bentobox.hooks.placeholders.MVdWPlaceholderAPIHook; import world.bentobox.bentobox.hooks.placeholders.PlaceholderAPIHook; import world.bentobox.bentobox.lists.GameModePlaceholder; @@ -44,8 +43,6 @@ public class PlaceholdersManagerTest { private HooksManager hm; @Mock private PlaceholderAPIHook hook; - @Mock - private MVdWPlaceholderAPIHook hook2; @Before public void setUp() throws Exception { @@ -63,8 +60,6 @@ public class PlaceholdersManagerTest { Optional optionalHook = Optional.of(hook); when(hm.getHook(eq("PlaceholderAPI"))).thenReturn(optionalHook); when(hook.isPlaceholder(any(), any())).thenReturn(false); - Optional optionalHook2 = Optional.of(hook2); - when(hm.getHook(eq("MVdWPlaceholderAPI"))).thenReturn(optionalHook2); // Placeholder manager pm = new PlaceholdersManager(plugin); @@ -82,7 +77,6 @@ public class PlaceholdersManagerTest { public void testRegisterGameModePlaceholdersAllDefaults() { pm.registerDefaultPlaceholders(addon); verify(hook, times(GameModePlaceholder.values().length)).registerPlaceholder(any(), anyString(), any()); - verify(hook2, times(GameModePlaceholder.values().length)).registerPlaceholder(any(), anyString(), any()); } /**