From a53729bed042780c04f1ba22bdd8f537575e1381 Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Tue, 14 Jul 2020 19:40:23 +0200 Subject: [PATCH] Initial rework to Placeholder Manager --- .../skyblock/placeholder/wip/Placeholder.java | 20 ++++++++++ .../placeholder/wip/PlaceholderManager.java | 4 ++ .../placeholder/wip/PlaceholderProcessor.java | 13 ++++++ .../placeholder/wip/hook/MVdWPlaceholder.java | 4 ++ .../placeholder/wip/hook/PlaceholderAPI.java | 40 +++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 src/main/java/com/songoda/skyblock/placeholder/wip/Placeholder.java create mode 100644 src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderManager.java create mode 100644 src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderProcessor.java create mode 100644 src/main/java/com/songoda/skyblock/placeholder/wip/hook/MVdWPlaceholder.java create mode 100644 src/main/java/com/songoda/skyblock/placeholder/wip/hook/PlaceholderAPI.java diff --git a/src/main/java/com/songoda/skyblock/placeholder/wip/Placeholder.java b/src/main/java/com/songoda/skyblock/placeholder/wip/Placeholder.java new file mode 100644 index 00000000..6debe567 --- /dev/null +++ b/src/main/java/com/songoda/skyblock/placeholder/wip/Placeholder.java @@ -0,0 +1,20 @@ +package com.songoda.skyblock.placeholder.wip; + +public class Placeholder { + + private final String placeholder; + private final String result; + + public Placeholder(String placeholder, String result) { + this.placeholder = placeholder; + this.result = result; + } + + public String getPlaceholder() { + return placeholder; + } + + public String getResult() { + return result; + } +} \ No newline at end of file diff --git a/src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderManager.java b/src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderManager.java new file mode 100644 index 00000000..5fa424c6 --- /dev/null +++ b/src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderManager.java @@ -0,0 +1,4 @@ +package com.songoda.skyblock.placeholder.wip; + +public class PlaceholderManager { +} diff --git a/src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderProcessor.java b/src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderProcessor.java new file mode 100644 index 00000000..dda79fd7 --- /dev/null +++ b/src/main/java/com/songoda/skyblock/placeholder/wip/PlaceholderProcessor.java @@ -0,0 +1,13 @@ +package com.songoda.skyblock.placeholder.wip; + +import org.bukkit.entity.Player; + +public class PlaceholderProcessor { + + public static String processPlaceholder(Player player, String placeholder) { + if(player == null || placeholder == null) { + return ""; + } + return "To be implemented"; + } +} diff --git a/src/main/java/com/songoda/skyblock/placeholder/wip/hook/MVdWPlaceholder.java b/src/main/java/com/songoda/skyblock/placeholder/wip/hook/MVdWPlaceholder.java new file mode 100644 index 00000000..24ef95db --- /dev/null +++ b/src/main/java/com/songoda/skyblock/placeholder/wip/hook/MVdWPlaceholder.java @@ -0,0 +1,4 @@ +package com.songoda.skyblock.placeholder.wip.hook; + +public class MVdWPlaceholder { +} diff --git a/src/main/java/com/songoda/skyblock/placeholder/wip/hook/PlaceholderAPI.java b/src/main/java/com/songoda/skyblock/placeholder/wip/hook/PlaceholderAPI.java new file mode 100644 index 00000000..f11fb13b --- /dev/null +++ b/src/main/java/com/songoda/skyblock/placeholder/wip/hook/PlaceholderAPI.java @@ -0,0 +1,40 @@ +package com.songoda.skyblock.placeholder.wip.hook; + +import com.songoda.skyblock.SkyBlock; +import com.songoda.skyblock.placeholder.wip.PlaceholderProcessor; +import me.clip.placeholderapi.expansion.PlaceholderExpansion; +import org.bukkit.entity.Player; + +public class PlaceholderAPI extends PlaceholderExpansion { + + private final SkyBlock plugin; + + public PlaceholderAPI(SkyBlock plugin) { + this.plugin = plugin; + } + + public String getIdentifier() { + return "fabledskyblock"; + } + + public String getPlugin() { + return null; + } + + public String getAuthor() { + return plugin.getDescription().getAuthors().get(0); + } + + public String getVersion() { + return plugin.getDescription().getVersion(); + } + + public boolean persist() { + return true; + } + + public String onPlaceholderRequest(Player player, String identifier) { + + return PlaceholderProcessor.processPlaceholder(player, "fabledskyblock_" + identifier); + } +}