diff --git a/CommandGUI V2/pom.xml b/CommandGUI V2/pom.xml
index 7bc263c..6f0eea6 100644
--- a/CommandGUI V2/pom.xml
+++ b/CommandGUI V2/pom.xml
@@ -6,7 +6,7 @@
net.t2code
CommandGUI_V2
- 2.7.2
+ 2.7.3
jar
CommandGUI
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java
index 19e27eb..ae4bad4 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/GUIListener.java
@@ -10,6 +10,8 @@ import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.Main;
+import de.jatitv.commandguiv2.Spigot.system.Papi;
+import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
@@ -149,12 +151,12 @@ public class GUIListener implements Listener {
for (String msg : slot.message) {
if (Main.PaPi) {
if (slot.cost_Enable) {
- player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.price + " " + SelectConfig.Currency));
- } else player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix)));
+ player.sendMessage(Replace.replacePrice(prefix, player, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.Currency));
+ } else player.sendMessage(Replace.replace(prefix, player, Placeholder.replace(msg, player)));
} else {
if (slot.cost_Enable) {
- player.sendMessage(Replace.replacePrice(prefix, msg, slot.price + " " + SelectConfig.Currency));
- } else player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix)));
+ player.sendMessage(Replace.replacePrice(prefix, Placeholder.replace(msg, player), slot.price + " " + SelectConfig.Currency));
+ } else player.sendMessage(Replace.replace(prefix, Placeholder.replace(msg, player)));
}
}
}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java
index 67d7628..e5c5a47 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java
@@ -15,11 +15,7 @@ public class ItemChange {
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
- if (Events.useItemSlotHashMap.get(player.getName()) == null) {
- slot = SelectConfig.UseItem_InventorySlot;
- } else {
- slot = Events.useItemSlotHashMap.get(player.getName());
- }
+ slot = Events.useItemSlotHashMap.get(player.getName());
}
if (!SelectConfig.UseItem_Enable) {
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java
index 6ce8f77..953a712 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/UseItem_Listener/Events.java
@@ -40,7 +40,10 @@ public class Events implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent e) {
useItemHashMap.put(e.getPlayer().getName(), SelectDatabase.selectItemStatus(e.getPlayer()));
- useItemSlotHashMap.put(e.getPlayer().getName(), SelectDatabase.selectSlot(e.getPlayer()));
+ Integer i = SelectDatabase.selectSlot(e.getPlayer());
+ if (i == null) {
+ useItemSlotHashMap.put(e.getPlayer().getName(), SelectConfig.UseItem_InventorySlot);
+ } else useItemSlotHashMap.put(e.getPlayer().getName(), i);
if (CGuiAPI.JoinDisable) {
send.debug(Main.plugin, "JoinDisable");
@@ -169,7 +172,7 @@ public class Events implements Listener {
return;
}
- if (!legacy()) {
+ if (!Main.legacy) {
if (!topInventoryIsEmpty(player)) return;
}
@@ -292,12 +295,6 @@ public class Events implements Listener {
}
}
- private static boolean legacy() {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15 || NMSVersion.v1_16_R1) {
- return true;
- } else return false;
- }
-
private static boolean topInventoryIsEmpty(Player p) {
return p.getOpenInventory().getTopInventory().isEmpty();
}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java
index 6976b71..0c5f6bf 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Main.java
@@ -8,6 +8,8 @@ import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
+import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
+import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@@ -27,6 +29,7 @@ public final class Main extends JavaPlugin {
}
private static Boolean enable = false;
+ public static Boolean legacy = false;
public static String prefix = "§8[§4C§9GUI§8]";
@@ -57,7 +60,10 @@ public final class Main extends JavaPlugin {
plugin = this;
autor = plugin.getDescription().getAuthors();
version = plugin.getDescription().getVersion();
- if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
+ if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15 || NMSVersion.v1_16_R1) {
+ legacy = true;
+ }
+ if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
if (PluginCheck.papi()) {
PaPi = true;
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
index e461a17..66e2111 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
@@ -124,11 +124,7 @@ public class Commands {
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
- if (Events.useItemSlotHashMap.get(player.getName()) == null) {
- slot = SelectConfig.UseItem_InventorySlot;
- } else {
- slot = Events.useItemSlotHashMap.get(player.getName());
- }
+ slot = Events.useItemSlotHashMap.get(player.getName());
}
send.debug(Main.plugin, String.valueOf(slot));
if (player.getInventory().getItem(slot - 1) == null) {
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java
index 557d008..addb4c9 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/config/ConfigCreate.java
@@ -36,7 +36,9 @@ public class ConfigCreate {
Config.set("Plugin.Currency", "$", yamlConfiguration);
Config.set("Plugin.DefaultGUI", "default", yamlConfiguration);
- Config.set("Storage.Type", "SQLITE", yamlConfiguration);
+ if (Main.legacy){
+ Config.set("Storage.Type", "YML", yamlConfiguration);
+ } else Config.set("Storage.Type", "SQLITE", yamlConfiguration);
Config.set("Storage.MySQL.IP", "localhost", yamlConfiguration);
Config.set("Storage.MySQL.Port", 3306, yamlConfiguration);
Config.set("Storage.MySQL.Database", "database", yamlConfiguration);
@@ -133,11 +135,15 @@ public class ConfigCreate {
Config.set("Toggle.Items.OnOrYes.Item.Base64.Enable", false, yamlConfiguration);
Config.set("Toggle.Items.OnOrYes.Item.Base64.Base64Value", "", yamlConfiguration);
- Config.set("Toggle.Items.OnOrYes.Item.Material", ItemVersion.getGreenWool().getType().toString(), yamlConfiguration);
+ if (Main.legacy) {
+ Config.set("Toggle.Items.OnOrYes.Item.Material", "WOOL,5", yamlConfiguration);
+ } else Config.set("Toggle.Items.OnOrYes.Item.Material", ItemVersion.getGreenWool().getType().toString(), yamlConfiguration);
Config.set("Toggle.Items.OffOrNo.Item.Base64.Enable", false, yamlConfiguration);
Config.set("Toggle.Items.OffOrNo.Item.Base64.Base64Value", "", yamlConfiguration);
- Config.set("Toggle.Items.OffOrNo.Item.Material", ItemVersion.getRedWool().getType().toString(), yamlConfiguration);
+ if (Main.legacy) {
+ Config.set("Toggle.Items.OffOrNo.Item.Material", "WOOL,14", yamlConfiguration);
+ } else Config.set("Toggle.Items.OffOrNo.Item.Material", ItemVersion.getRedWool().getType().toString(), yamlConfiguration);
Config.set("Toggle.Permission.Commands.True", "luckperms user [player] permission set [perm] true", yamlConfiguration);
Config.set("Toggle.Permission.Commands.False", "luckperms user [player] permission set [perm] false", yamlConfiguration);
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/functions/CreateFunctions.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/functions/CreateFunctions.java
index 536d230..b79ca01 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/functions/CreateFunctions.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/config/functions/CreateFunctions.java
@@ -21,7 +21,7 @@ public class CreateFunctions {
0, 0.0, Arrays.asList(), false, "");
createFunction("SupportDiscord", false, 1, true, true, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg3M2MxMmJmZmI1MjUxYTBiODhkNWFlNzVjNzI0N2NiMzlhNzVmZjFhODFjYmU0YzhhMzliMzExZGRlZGEifX19",
- false, "", (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) ? "TNT" : "",
+ false, "", "",
"&3Support Discord", Arrays.asList("&8-----------------", "&bIf you need help setting up the plugin,", "&bfeel free to contact me on the Suport Discord.",
"&8-----------------", "&eIf you find any errors or bugs,", "&eplease contact me so I can fix them.", "&8-----------------", "&5Discord: §7http://dc.t2code.net"),
false, false, "", false, 0.0, false, false,
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GuiBuilder.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GuiBuilder.java
index 419cc36..51a13e4 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GuiBuilder.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/GuiBuilder.java
@@ -6,6 +6,8 @@ import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
+import de.jatitv.commandguiv2.Spigot.system.Papi;
+import de.jatitv.commandguiv2.Spigot.system.Placeholder;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
@@ -25,7 +27,11 @@ public class GuiBuilder {
private static String prefix = Util.getPrefix();
protected static void item(Function function, Integer slot, Player player, Inventory inventory) {
- ItemStack item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
+ ItemStack item;
+ if (Main.legacy && function.item.toUpperCase().contains(",")) {
+ String[] split = function.item.toUpperCase().split(",");
+ item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
+ } else item = new ItemStack(Material.valueOf(function.item.toUpperCase().replace(".", "_")));
ItemMeta itemMeta = item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, function);
item.setItemMeta(itemMeta);
@@ -37,8 +43,12 @@ public class GuiBuilder {
inventory.setItem(slot, item);
}
- protected static void item(String material, Function function,Integer slot, Player player, Inventory inventory) {
- ItemStack item = new ItemStack(Material.valueOf(material));
+ protected static void item(String material, Function function, Integer slot, Player player, Inventory inventory) {
+ ItemStack item;
+ if (Main.legacy && material.contains(",")) {
+ String[] split = material.split(",");
+ item = new ItemStack(Material.valueOf(split[0]), 1, Short.parseShort(split[1]));
+ } else item = new ItemStack(Material.valueOf(material));
ItemMeta itemMeta = item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, function);
item.setItemMeta(itemMeta);
@@ -53,11 +63,11 @@ public class GuiBuilder {
private static void setDisplayNameAndLore(ItemMeta itemMeta, Player player, Function slot) {
if (Main.PaPi) {
- itemMeta.setDisplayName(Replace.replace(prefix, player, slot.name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, player, slot.lore, slot.price + " " + SelectConfig.Currency));
+ itemMeta.setDisplayName(Replace.replace(prefix, player, Placeholder.replace(slot.name, player)));
+ itemMeta.setLore(Replace.replacePrice(prefix, player, Placeholder.replace(slot.lore, player), slot.price + " " + SelectConfig.Currency));
} else {
- itemMeta.setDisplayName(Replace.replace(prefix, slot.name.replace("[player]", player.getName())));
- itemMeta.setLore(Replace.replacePrice(prefix, slot.lore, slot.price + " " + SelectConfig.Currency));
+ itemMeta.setDisplayName(Replace.replace(prefix, Placeholder.replace(slot.name,player)));
+ itemMeta.setLore(Replace.replacePrice(prefix, Placeholder.replace(slot.lore,player), slot.price + " " + SelectConfig.Currency));
}
}
@@ -88,11 +98,11 @@ public class GuiBuilder {
}
}
- protected static void base64(Function function,Integer slot, Player player, Inventory inventory) {
- base64(function.base64Value, function,slot, player, inventory);
+ protected static void base64(Function function, Integer slot, Player player, Inventory inventory) {
+ base64(function.base64Value, function, slot, player, inventory);
}
- protected static void playerHead(Function function, Integer slot,Player player, Inventory inventory, String skullName) {
+ protected static void playerHead(Function function, Integer slot, Player player, Inventory inventory, String skullName) {
ItemStack item = ItemVersion.getHeadIS();
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
setDisplayNameAndLore(itemMeta, player, function);
@@ -109,7 +119,7 @@ public class GuiBuilder {
public static void fillItem(Inventory inventory, Gui gui) {
ItemStack glass;
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
- glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.valueOf(gui.guiFillItemItem));
+ glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(gui.guiFillItemItem));
} else glass = new ItemStack(Material.valueOf(gui.guiFillItemItem.toUpperCase().replace(".", "_")));
ItemMeta itemMetaglass = glass.getItemMeta();
itemMetaglass.setDisplayName(" ");
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java
index 25675c2..9b90b2e 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/gui/OpenGUI.java
@@ -102,21 +102,13 @@ public class OpenGUI {
}
} else {
if (function.playerHead_Enable) {
- if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
- send.player(player, prefix + "§c Playerheads are only available from version §61.13§c! §7- §bGUI: §6" +
- Replace.replace(prefix, gui.guiName).toString() + " §bSlot: §6" + (slot.slot + 1) + " §7- " + Replace.replace(prefix, function.name));
- send.error(plugin, "Playerheads are only available from version 1.13!");
- send.console(prefix + " §bGUI: §6" + Replace.replace(prefix, gui.guiName).toString() + " §bSlot: §6" +
- (slot.slot + 1) + " §7- " + Replace.replace(prefix, function.name));
+ if (function.base64_Enable) {
+ GuiBuilder.base64(function, slot.slot, player, inventory);
} else {
- if (function.base64_Enable) {
- GuiBuilder.base64(function, slot.slot, player, inventory);
+ if (function.playerWhoHasOpenedTheGUI) {
+ GuiBuilder.playerHead(function, slot.slot, player, inventory, player.getName());
} else {
- if (function.playerWhoHasOpenedTheGUI) {
- GuiBuilder.playerHead(function, slot.slot, player, inventory, player.getName());
- } else {
- GuiBuilder.playerHead(function, slot.slot, player, inventory, function.playerName);
- }
+ GuiBuilder.playerHead(function, slot.slot, player, inventory, function.playerName);
}
}
} else {
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java
index 326b345..664c0f4 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Load.java
@@ -83,7 +83,7 @@ public class Load {
}
if (PluginCheck.papi()) {
- new Placeholder().register();
+ new Papi().register();
}
try {
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Papi.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Papi.java
new file mode 100644
index 0000000..80fd0a0
--- /dev/null
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Papi.java
@@ -0,0 +1,56 @@
+// This claas was created by JaTiTV
+
+package de.jatitv.commandguiv2.Spigot.system;
+
+import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
+import de.jatitv.commandguiv2.Spigot.Main;
+import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
+import me.clip.placeholderapi.expansion.PlaceholderExpansion;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Papi extends PlaceholderExpansion {
+
+ @Override
+ public String getIdentifier() {
+ return "commandgui";
+ }
+
+ @Override
+ public String getAuthor() {
+ return Main.plugin.getDescription().getAuthors().toString();
+ }
+
+ @Override
+ public String getVersion() {
+ return Main.plugin.getDescription().getVersion();
+ }
+
+ @Override
+ public boolean canRegister() {
+ return true;
+ }
+
+ @Override
+ public boolean persist() {
+ return true;
+ }
+
+ @Override
+ public String onPlaceholderRequest(Player p, String params) {
+ if (params.contains("useitem_boolean")) {
+ Placeholder.useitem_boolean(p);
+ }
+
+ if (params.contains("useitem")) {
+ Placeholder.useitem(p);
+ }
+
+ if (params.contains("slot")) {
+ Placeholder.slot(p);
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Placeholder.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Placeholder.java
index 6b6653e..07cd0ff 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Placeholder.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Placeholder.java
@@ -1,56 +1,38 @@
-// This claas was created by JaTiTV
-
package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events;
-import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
-import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
-public class Placeholder extends PlaceholderExpansion {
+import java.util.ArrayList;
+import java.util.List;
- @Override
- public String getIdentifier() {
- return "commandgui";
+public class Placeholder {
+ public static String useitem(Player p) {
+ if (Events.useItemHashMap.get(p.getName())) {
+ return SelectConfig.placeholderTrue;
+ } else return SelectConfig.placeholderFalse;
}
- @Override
- public String getAuthor() {
- return Main.plugin.getDescription().getAuthors().toString();
+ public static String useitem_boolean(Player p) {
+ return Events.useItemHashMap.get(p.getName()).toString();
}
- @Override
- public String getVersion() {
- return Main.plugin.getDescription().getVersion();
+ public static String slot(Player p) {
+ return Events.useItemSlotHashMap.get(p.getName()).toString();
}
- @Override
- public boolean canRegister() {
- return true;
+ public static String replace(String input, Player player) {
+ return input.replace("[player]", player.getName()).replace("%commandgui_useitem%", useitem(player))
+ .replace("%commandgui_useitem_boolean%", useitem_boolean(player)).replace("%commandgui_useitem_slot%", slot(player));
}
+ public static List replace(List input, Player player) {
+ ArrayList rp = new ArrayList();
- @Override
- public boolean persist() {
- return true;
- }
-
- @Override
- public String onPlaceholderRequest(Player p, String params) {
- if (params.contains("useitem_boolean")) {
- return Events.useItemHashMap.get(p.getName()).toString();
+ for (String s : input) {
+ rp.add(s.replace("[player]", player.getName()).replace("%commandgui_useitem%", useitem(player))
+ .replace("%commandgui_useitem_boolean%", useitem_boolean(player)).replace("%commandgui_useitem_slot%", slot(player)));
}
-
- if (params.contains("useitem")) {
- if (Events.useItemHashMap.get(p.getName())) {
- return SelectConfig.placeholderTrue;
- } else return SelectConfig.placeholderFalse;
- }
-
- if (params.contains("slot")){
- return Events.useItemSlotHashMap.get(p.getName()).toString();
- }
-
- return null;
+ return rp;
}
-}
\ No newline at end of file
+}
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/UseItem.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/UseItem.java
index 50cf67f..33b1d71 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/UseItem.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/UseItem.java
@@ -29,11 +29,7 @@ public class UseItem {
if (SelectConfig.UseItem_InventorySlotEnforce) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
- if (Events.useItemSlotHashMap.get(player.getName()) == null) {
- slot = SelectConfig.UseItem_InventorySlot;
- } else {
- slot = Events.useItemSlotHashMap.get(player.getName());
- }
+ slot = Events.useItemSlotHashMap.get(player.getName());
}
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
player.getInventory().addItem(itemStack(player));
diff --git a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Util.java b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Util.java
index 787f243..9a7fe11 100644
--- a/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Util.java
+++ b/CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Util.java
@@ -2,7 +2,7 @@ package de.jatitv.commandguiv2;
public class Util {
private static Integer configVersion = 5;
- private static double requiredT2CodeLibVersion = 10.3;
+ private static double requiredT2CodeLibVersion = 11.8;
private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840;