diff --git a/.gitignore b/.gitignore
index 4788b4b..e646911 100644
--- a/.gitignore
+++ b/.gitignore
@@ -111,3 +111,5 @@ buildNumber.properties
# Common working directory
run/
+
+build_out/*
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 6bc0ff7..05ffab2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.xapu1337.recodes
trollgui
- 2.01
+ 2.1
jar
TrollGUI
@@ -19,7 +19,7 @@
- C:\Users\XapuR\OneDrive\spigot-server-test\plugins
+ ${project.basedir}/build_out
@@ -37,7 +37,7 @@
2.0
ms3
- C:\Users\XapuR\OneDrive\spigot-server-test\plugins
+ ${project.basedir}/build_out
@@ -54,12 +54,12 @@
com.cryptomorin.xseries
- me.xapu.trollgui.utils
+ me.xapu1337.trollgui.compatability
org.bstats
- me.xapu.trollgui.utils
+ me.xapu1337.trollgui.metrics
@@ -103,25 +103,30 @@
org.spigotmc
spigot-api
- 1.18.1-R0.1-SNAPSHOT
+ 1.19-R0.1-SNAPSHOT
provided
com.github.cryptomorin
XSeries
- 8.6.0.0.1
+ 9.0.0
org.bstats
bstats-bukkit
- 2.2.1
+ 3.0.0
compile
org.jetbrains
annotations
- 22.0.0
+ 23.0.0
compile
+
+ io.github.classgraph
+ classgraph
+ 4.8.149
+
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Commands/TrollCommand.java b/src/main/java/me/xapu1337/recodes/trollgui/Commands/TrollCommand.java
index 88088f5..f72c46e 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Commands/TrollCommand.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Commands/TrollCommand.java
@@ -5,7 +5,6 @@
import me.xapu1337.recodes.trollgui.Inventorys.PlayerSelector;
import me.xapu1337.recodes.trollgui.Inventorys.Settings;
import me.xapu1337.recodes.trollgui.Utilities.UpdateChecker;
-import org.apache.commons.lang.ArrayUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Cores/Core.java b/src/main/java/me/xapu1337/recodes/trollgui/Cores/Core.java
index dd48e50..f572b7f 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Cores/Core.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Cores/Core.java
@@ -22,7 +22,6 @@ public class Core extends JavaPlugin implements Listener {
public boolean usingUUID;
public Util utils = new Util();
public Singleton singletons = new Singleton();
-
public Core() {
if(instance == null)
instance = this;
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollHandler.java b/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollHandler.java
index 74d7833..58bb4f7 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollHandler.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollHandler.java
@@ -1,16 +1,31 @@
package me.xapu1337.recodes.trollgui.Handlers;
+import me.xapu1337.recodes.trollgui.Cores.Core;
+import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public abstract class TrollHandler {
public Player caller;
public Player victim;
+ public TrollItemMetaData metaData;
- public TrollHandler(Player caller, Player victim) {
+ public T Init() {
+ Core.instance.singletons.holdingTrolls.put(this.getClass().getName(), this);
+ this.metaData = setMetaData();
+
+ return (T) this;
+ }
+
+ public abstract TrollItemMetaData setMetaData();
+
+ public T setPlayers(Player caller, Player victim) {
this.caller = caller;
this.victim = victim;
+
+ return (T) this;
}
+
/**
* The method that gets executed on item click
*/
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollItemMetaData.java b/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollItemMetaData.java
new file mode 100644
index 0000000..cb911e8
--- /dev/null
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Handlers/TrollItemMetaData.java
@@ -0,0 +1,150 @@
+package me.xapu1337.recodes.trollgui.Handlers;
+
+import com.cryptomorin.xseries.XEnchantment;
+import com.cryptomorin.xseries.XMaterial;
+import me.xapu1337.recodes.trollgui.Cores.Core;
+import org.bukkit.Bukkit;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.Arrays;
+import java.util.function.Supplier;
+
+public class TrollItemMetaData {
+
+ public boolean isToggable = false;
+
+ public boolean isToggled = false;
+
+ public String displayName = " - PLACEHOLDER - ";
+
+ public String[] lore = { " - PLACEHOLDER - " };
+
+ private XMaterial _item;
+
+ private ItemStack _itemStack;
+
+ private ItemMeta _itemMeta;
+
+ public TrollItemMetaData setToggable(boolean toggable) {
+ isToggable = toggable;
+ return this;
+ }
+
+ public TrollItemMetaData setToggled(Supplier toggledCallback){
+ isToggled = toggledCallback.get();
+
+ if (isToggled)
+ _itemMeta.addEnchant(XEnchantment.DURABILITY.getEnchant(), 1, true);
+ else
+ _itemMeta.removeEnchant(XEnchantment.DURABILITY.getEnchant());
+
+ // Append either disabled or enabled text to current lore
+
+ lore = Arrays.copyOf(lore, lore.length + 1);
+ lore[lore.length - 1] = isToggled ? Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isEnabled") : Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isDisabled");
+ _itemMeta.setLore(Arrays.asList(lore));
+
+ _itemStack.setItemMeta(_itemMeta);
+
+ return this;
+ }
+
+ public TrollItemMetaData setToggled(){
+ isToggled = !isToggled;
+
+ if (isToggled)
+ _itemMeta.addEnchant(XEnchantment.DURABILITY.getEnchant(), 1, true);
+ else
+ _itemMeta.removeEnchant(XEnchantment.DURABILITY.getEnchant());
+
+ lore = Arrays.copyOf(lore, lore.length + 1);
+ lore[lore.length - 1] = isToggled ? Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isEnabled") : Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isDisabled");
+ _itemMeta.setLore(Arrays.asList(lore));
+
+ _itemStack.setItemMeta(_itemMeta);
+
+ return this;
+ }
+
+ public TrollItemMetaData setDisplayName(String displayName){
+ this.displayName = displayName;
+
+ this._itemMeta.setDisplayName(displayName);
+
+ _itemStack.setItemMeta(_itemMeta);
+ return this;
+ }
+
+ public TrollItemMetaData setLore(String ...lore){
+ this.lore = lore;
+
+ _itemMeta.setLore(Arrays
+ .asList(
+
+ lore
+
+ )
+ );
+
+ _itemStack.setItemMeta(_itemMeta);
+
+ return this;
+ }
+
+ public TrollItemMetaData setConfigData(String itemConfigName){
+ try {
+ this.setDisplayName(Core.instance.utils.getConfigPath("MenuItems.trollMenu." + itemConfigName + ".name"));
+ this.setLore(Core.instance.utils.getConfigPath("MenuItems.trollMenu." + itemConfigName + ".lore").split("\\|"));
+ } catch (NullPointerException e) {
+ Bukkit.getLogger().warning("[TrollGUI] Could not find config data for item: " + itemConfigName + " (either .name or .lore is missing)");
+ e.printStackTrace();
+ }
+
+
+
+ return this;
+ }
+
+ public TrollItemMetaData setItem(XMaterial item){
+ _item = item;
+
+ _itemStack = new ItemStack(item.parseMaterial(), 1);
+
+ _itemMeta = _itemStack.getItemMeta();
+
+ _itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
+ _itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
+ _itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
+
+ _itemStack.setItemMeta(_itemMeta);
+ return this;
+ }
+
+ // A function to replace placeholders in the current lore with values
+ public TrollItemMetaData formatPlaceholders(String placeholders, String ...values){
+ String[] lore = this.lore;
+ for (int i = 0; i < lore.length; i++) {
+ lore[i] = lore[i].replace(placeholders, values[i]);
+ }
+ _itemMeta.setLore(Arrays.asList(lore));
+ _itemStack.setItemMeta(_itemMeta);
+
+ return this;
+ }
+
+
+ // Getters
+ public XMaterial getItem(){
+ return _item;
+ }
+
+ public ItemStack getItemStack(){
+ return _itemStack;
+ }
+
+ public ItemMeta getItemMeta(){
+ return _itemMeta;
+ }
+}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/PlayerSelector.java b/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/PlayerSelector.java
index cb578b6..06b6d5d 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/PlayerSelector.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/PlayerSelector.java
@@ -2,7 +2,6 @@
import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
-import org.apache.commons.lang.ArrayUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.NamespacedKey;
@@ -15,7 +14,6 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.persistence.PersistentDataType;
-import sun.jvm.hotspot.oops.Array;
import java.util.ArrayList;
import java.util.Arrays;
@@ -52,10 +50,10 @@ public PlayerSelector(Player player) {
public void initializeItems(){
ArrayList players = new ArrayList<>(Core.instance.getServer().getOnlinePlayers());
for(int i = 45; i < 54; i++)
- GUI.setItem(i, Core.instance.utils.createItem(XMaterial.GRAY_STAINED_GLASS_PANE, false, " "));
- GUI.setItem(48, Core.instance.utils.createItem(XMaterial.OAK_BUTTON, false, Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.lore")));
- GUI.setItem(49, Core.instance.utils.createItem(XMaterial.BARRIER, false, Core.instance.utils.getConfigPath("MenuItems.playerSelector.close.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.close.lore")));
- GUI.setItem(50, Core.instance.utils.createItem(XMaterial.OAK_BUTTON, false, Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.lore")));
+ GUI.setItem(i, Core.instance.utils.createItem(XMaterial.GRAY_STAINED_GLASS_PANE, " "));
+ GUI.setItem(48, Core.instance.utils.createItem(XMaterial.OAK_BUTTON, Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.lore")));
+ GUI.setItem(49, Core.instance.utils.createItem(XMaterial.BARRIER, Core.instance.utils.getConfigPath("MenuItems.playerSelector.close.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.close.lore")));
+ GUI.setItem(50, Core.instance.utils.createItem(XMaterial.OAK_BUTTON, Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.lore")));
if(players != null && !players.isEmpty()) {
for(int i = 0; i < maxItemsPerPage; i++) {
@@ -95,7 +93,7 @@ public void onInventoryClicked(InventoryClickEvent event) {
if (clickedItem.getType() == XMaterial.PLAYER_HEAD.parseMaterial()) {
Player selectedPlayer = Bukkit.getPlayer(UUID.fromString(clickedItem.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(Core.instance, "uuid"), PersistentDataType.STRING)));
- if(selectedPlayer == null) { event.getWhoClicked().sendMessage(Core.instance.utils.getConfigPath("Messages.playerNotAvaliable", true)); return; }
+ if(selectedPlayer == null) { event.getWhoClicked().sendMessage(Core.instance.utils.getConfigPath("Messages. playerNotAvailable", true).replaceAll("%PLAYER%", clickedItem.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(Core.instance, "uuid"), PersistentDataType.STRING) )); return; }
player.openInventory(new TrollGUI((Player) event.getWhoClicked(), selectedPlayer).getInventory());
} else if (clickedItem.getType() == XMaterial.BARRIER.parseMaterial()) {
player.closeInventory();
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/Settings.java b/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/Settings.java
index 3ccc645..674023c 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/Settings.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/Settings.java
@@ -3,7 +3,6 @@
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import me.xapu1337.recodes.trollgui.Cores.Core;
-import me.xapu1337.recodes.trollgui.Utilities.Util;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
@@ -33,12 +32,12 @@ public Settings() {
Bukkit.getPluginManager().registerEvents(this, Core.instance);
GUI = Bukkit.createInventory(this, 9, centerTitle(Core.instance.utils.getConfigPath("MenuTitles.settings")));
for(int i = 0; i < GUI.getSize(); i++)
- GUI.setItem(i, Core.instance.utils.createItem(XMaterial.GRAY_STAINED_GLASS_PANE, false, " "));
+ GUI.setItem(i, Core.instance.utils.createItem(XMaterial.GRAY_STAINED_GLASS_PANE, "§r"));
initializeItems();
}
public void initializeItems(){
- GUI.setItem(4, Core.instance.utils.createItem(XMaterial.REDSTONE_BLOCK, false, Core.instance.utils.getConfigPath("MenuItems.settingsMenu.reload.name"), Core.instance.utils.getConfigPath("MenuItems.settingsMenu.reload.lore")));
+ GUI.setItem(4, Core.instance.utils.createItem(XMaterial.REDSTONE_BLOCK, Core.instance.utils.getConfigPath("MenuItems.settingsMenu.reload.name"), Core.instance.utils.getConfigPath("MenuItems.settingsMenu.reload.lore")));
}
@Override
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/TrollGUI.java b/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/TrollGUI.java
index 20dfe27..2feea72 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/TrollGUI.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Inventorys/TrollGUI.java
@@ -1,8 +1,12 @@
package me.xapu1337.recodes.trollgui.Inventorys;
import com.cryptomorin.xseries.XMaterial;
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ClassInfo;
+import io.github.classgraph.ClassInfoList;
+import io.github.classgraph.ScanResult;
import me.xapu1337.recodes.trollgui.Cores.Core;
-import me.xapu1337.recodes.trollgui.Trolls.*;
+import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -14,9 +18,35 @@
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
+import java.lang.reflect.InvocationTargetException;
+
public class TrollGUI implements Listener, InventoryHolder {
- private final Player caller;
- private final Player victim;
+ private final Player _caller;
+ private final Player _victim;
+
+ private final ItemStack _trollItemFiller = Core.instance.utils.createItem(XMaterial.STONE, "TROLL_ITEM_PLACEHOLDER_PLACE_ITEMS_HERE");
+ private final int INVENTORY_SIZE_X = 9;
+ private final int INVENTORY_SIZE_Y = 6;
+
+ private final int INVENTORY_SIZE = (INVENTORY_SIZE_X * INVENTORY_SIZE_Y);
+
+ private final int MAX_ITEMS_PER_PAGE = 7 * 4;
+ private int CURRENT_PAGE = 0;
+ private int CURRENT_INDEX = 0;
+
+
+ /***
+ * [][][][][][][][][] <-- Padding
+ * [] <-- Trolls
+ * [] []
+ * [] []
+ * [] []
+ * [] []
+ * [] []
+ * [] []
+ * [][][][][][][][][PS] <-- Player Selector (PS)
+ */
+
public Inventory GUI;
public String centerTitle(String title) {
StringBuilder result = new StringBuilder();
@@ -28,214 +58,156 @@ public String centerTitle(String title) {
return result.append(title).toString();
}
- public TrollGUI(Player caller, Player victim) {
- this.victim = victim;
- this.caller = caller;
+
+ private final void setItemXY(int x, int y, ItemStack item) {
+ int index = (y * INVENTORY_SIZE_X) + x;
+ if (index < INVENTORY_SIZE && index >= 0)
+ this.getInventory().setItem(index, item);
+ }
+
+ private final void setBackground() {
+ int PADDING_SIZE = 1;
+
+ for (int x = 0; x < INVENTORY_SIZE_X - PADDING_SIZE * 2; x++)
+ for (int y = 0; y < INVENTORY_SIZE_Y - PADDING_SIZE * 2; y++)
+ setItemXY(x + PADDING_SIZE, y + PADDING_SIZE, _trollItemFiller);
+
+ for (int i = 0; i < INVENTORY_SIZE; i++) {
+ if (this.getInventory().getItem(i) == null || this.getInventory().getItem(i).getType() == XMaterial.AIR.parseMaterial()) {
+ this.getInventory().setItem(i, Core.instance.utils.createItem(XMaterial.BLACK_STAINED_GLASS_PANE, "§r"));
+ // Check if we hit the last row, if we do so change nothing except if the caller is the victim, then we need to add a warning message
+ if (i >= INVENTORY_SIZE_X * (INVENTORY_SIZE_Y - 1)) {
+ if (_caller.equals(_victim)) {
+ this.getInventory().setItem(i, Core.instance.utils.createItem(XMaterial.RED_STAINED_GLASS_PANE, Core.instance.utils.getConfigPath("Messages.targetSelfWarning")));
+ }
+ }
+ } else {
+ if (this.getInventory().getItem(i).equals(_trollItemFiller))
+ this.getInventory().setItem(i, XMaterial.AIR.parseItem());
+ }
+ }
+ }
+
+ public TrollGUI(Player _caller, Player _victim) {
+ this._victim = _victim;
+ this._caller = _caller;
+
+ Core.instance.singletons.currentPlayersTrolling.put(_caller, this);
+
Bukkit.getPluginManager().registerEvents(this, Core.instance);
- GUI = Bukkit.createInventory(this, 54, centerTitle(
+ GUI = Bukkit.createInventory(this, INVENTORY_SIZE, centerTitle(
Core.instance.utils.getConfigPath("MenuTitles.trollGUI")
- .replace("%VICTIM%", victim.getName())
- .replace("%PLAYER%", caller.getName())
+ .replace("%VICTIM%", _victim.getName())
+ .replace("%PLAYER%", _caller.getName())
)
);
+
initializeItems();
}
public void initializeItems(){
- for(int i = 0; i < GUI.getSize(); i++)
- GUI.setItem(i, Core.instance.utils.createItem(XMaterial.GRAY_STAINED_GLASS_PANE, false, " "));
-
- GUI.setItem(10, Core.instance.utils.createItem(XMaterial.BLAZE_POWDER, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.burnPlayer.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.burnPlayer.lore")));
-
- GUI.setItem(11, Core.instance.utils.createItem(XMaterial.BARRIER, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.closeGUI.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.closeGUI.lore")));
-
- GUI.setItem(12, Core.instance.utils.createItem(XMaterial.CAULDRON, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.dropAll.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.dropAll.lore")));
-
- GUI.setItem(13, Core.instance.utils.createItem(XMaterial.WATER_BUCKET, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.dropItem.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.dropItem.lore")));
-
- GUI.setItem(14, Core.instance.utils.createItem(XMaterial.TNT, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.explodePlayer.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.explodePlayer.lore")));
-
- XMaterial customMatForFakeBlock;
-
- if(XMaterial.matchXMaterial(Core.instance.config.getString("MenuItems.trollMenu.fakeBlock.options.block")).isPresent())
- customMatForFakeBlock = XMaterial.matchXMaterial(Core.instance.config.getString("MenuItems.trollMenu.fakeBlock.options.block")).get();
- else
- customMatForFakeBlock = XMaterial.TNT;
-
- GUI.setItem(15, Core.instance.utils.createItem(customMatForFakeBlock, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.fakeBlock.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.fakeBlock.lore")));
-
- GUI.setItem(16, Core.instance.utils.createItem(XMaterial.PUFFERFISH, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.fakeClear.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.fakeClear.lore").replace("%TIME%", String.valueOf(Core.instance.config.getInt("MenuItems.trollMenu.fakeClear.options.fakeClearDelay")))));
-
- GUI.setItem(19, Core.instance.utils.createItem(XMaterial.LIGHT_GRAY_DYE, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.fakeOperator.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.fakeOperator.lore")));
-
- GUI.setItem(20, Core.instance.utils.createItem(XMaterial.SNOWBALL, Core.instance.singletons.frozenPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID)),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.freezePlayer.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.freezePlayer.lore"),
- Core.instance.singletons.frozenPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
- ?
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isEnabled")
- :
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isDisabled")
- ));
-
- GUI.setItem(21, Core.instance.utils.createItem(XMaterial.TRAPPED_CHEST, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.invSee.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.invSee.lore")));
-
- GUI.setItem(22, Core.instance.utils.createItem(XMaterial.ENDER_CHEST, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.invShare.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.invShare.lore")));
-
- GUI.setItem(23, Core.instance.utils.createItem(XMaterial.FIREWORK_ROCKET, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.launchPlayer.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.launchPlayer.lore")));
-
- GUI.setItem(24, Core.instance.utils.createItem(XMaterial.GRASS_BLOCK, Core.instance.singletons.noBuildPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID)),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.noBuild.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.noBuild.lore"),
- Core.instance.singletons.noBuildPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
- ?
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isEnabled")
- :
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isDisabled")
- ));
-
- GUI.setItem(25, Core.instance.utils.createItem(XMaterial.STONE, Core.instance.singletons.noBreakPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID)),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.noBreak.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.noBreak.lore"),
- Core.instance.singletons.noBreakPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
- ?
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isEnabled")
- :
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isDisabled")
- ));
-
- GUI.setItem(29, Core.instance.utils.createItem(XMaterial.BARRIER, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.randomLook.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.randomLook.lore")));
-
- GUI.setItem(30, Core.instance.utils.createItem(XMaterial.PAPER, Core.instance.singletons.reverseMessagePlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID)),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.reverseMessage.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.reverseMessage.lore"),
- Core.instance.singletons.reverseMessagePlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
- ?
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isEnabled")
- :
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.extras.isDisabled")
- ));
-
- GUI.setItem(31, Core.instance.utils.createItem(XMaterial.CARVED_PUMPKIN, false,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.scarePlayer.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.scarePlayer.lore")));
-
- GUI.setItem(32, Core.instance.utils.createItem(XMaterial.PRISMARINE_SHARD, true,
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.thunder.name"),
- Core.instance.utils.getConfigPath("MenuItems.trollMenu.thunder.lore")));
-
-
- GUI.setItem(53, Core.instance.utils.createItem(XMaterial.BARRIER, true,
+
+ try (ScanResult scanResult = new ClassGraph().enableAllInfo().acceptPackages("me.xapu1337.recodes.trollgui").scan()) {
+ ClassInfoList controlClasses = scanResult.getSubclasses("me.xapu1337.recodes.trollgui.Handlers.TrollHandler");
+ for (ClassInfo classInfo : controlClasses) {
+ try {
+ Class> clazz = classInfo.loadClass();
+ ( (TrollHandler) clazz.getConstructor().newInstance()).setPlayers(_caller, _victim).Init();
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ GUI.clear();
+
+ setBackground();
+
+ for(int i = 0; i < MAX_ITEMS_PER_PAGE; i++) {
+ CURRENT_INDEX = MAX_ITEMS_PER_PAGE * CURRENT_PAGE + i;
+ if(CURRENT_INDEX >= Core.instance.singletons.holdingTrolls.size()) break;
+ if (Core.instance.singletons.holdingTrolls.getValueAt(CURRENT_INDEX) != null) {
+
+ GUI.addItem(Core.instance.singletons.holdingTrolls.getValueAt(CURRENT_INDEX).metaData.getItemStack());
+
+ }
+ }
+
+ GUI.setItem(49, Core.instance.utils.createItem(XMaterial.BARRIER,
Core.instance.utils.getConfigPath("MenuItems.trollMenu.returnToPlayerSelector.name"),
Core.instance.utils.getConfigPath("MenuItems.trollMenu.returnToPlayerSelector.lore")));
+
+ GUI.setItem(50, Core.instance.utils.createItem(XMaterial.OAK_BUTTON, Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.lore")));
+ GUI.setItem(48, Core.instance.utils.createItem(XMaterial.OAK_BUTTON, Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.name"), Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.lore")));
}
@Override
@NotNull
public Inventory getInventory() { return GUI; }
+ // Getters
+ @NotNull
+ public Player getVictim() { return _victim; }
+
+ @NotNull
+ public Player getCaller() { return _caller; }
+
@EventHandler
public void onInventoryClicked(InventoryClickEvent event) {
- if (event.getInventory().getHolder() != this) return; // IF the inventory belongs not to this class dismiss.
- event.setCancelled(true); // Disable the item to be draggable.
+ if (event.getInventory().getHolder() != this) return;
+ event.setCancelled(true);
final ItemStack clickedItem = event.getCurrentItem();
- if (clickedItem == null || clickedItem.getType() == XMaterial.AIR.parseMaterial()) return;
-
- switch (event.getRawSlot()){
- case 10:
- new BurnPlayerTroll(caller, victim).execute();
- break;
- case 11:
- new CloseGUITroll(caller, victim).execute();
- break;
- case 12:
- new DropAllTroll(caller, victim).execute();
- break;
- case 13:
- new DropItemTroll(caller, victim).execute();
- break;
- case 14:
- new ExplodePlayerTroll(caller, victim).execute();
- break;
- case 15:
- new FakeBlockTroll(caller, victim).execute();
- break;
- case 16:
- new FakeClearTroll(caller, victim).execute();
- break;
- case 19:
- new FakeOperatorTroll(caller, victim).execute();
- break;
- case 20:
- new FreezeTroll(caller, victim).execute();
- GUI.clear();
- initializeItems();
- break;
- case 21:
- new InvSeeTroll(caller, victim).execute();
- break;
- case 22:
- new InvShareTroll(caller, victim).execute();
- break;
- case 23:
- new LaunchPlayerTroll(caller, victim).execute();
- break;
- case 24:
- new NoBuildTroll(caller, victim).execute();
- GUI.clear();
- initializeItems();
- break;
- case 25:
- new NoBreakTroll(caller, victim).execute();
- GUI.clear();
- initializeItems();
- break;
- case 29:
- new RandomLookTroll(caller, victim).execute();
- break;
- case 30:
- new ReverseMessageTroll(caller, victim).execute();
- GUI.clear();
- initializeItems();
- break;
- case 31:
- new ScareTroll(caller, victim).execute();
- break;
- case 32:
- new ThunderPlayerTroll(caller, victim).execute();
- break;
- case 53:
- caller.openInventory(new PlayerSelector(caller).getInventory());
- break;
- }
+ if (clickedItem == null || clickedItem.getType() == XMaterial.AIR.parseMaterial() || clickedItem.isSimilar(Core.instance.utils.createItem(XMaterial.BLACK_STAINED_GLASS_PANE, "§r"))) return;
+
+
+
+ if(
+ !Core.instance.singletons.holdingTrolls.values().stream().anyMatch(
+ trollHandler -> trollHandler.metaData.getItemStack().isSimilar(clickedItem)
+ )
+ ) {
+ if (clickedItem.isSimilar(Core.instance.utils.createItem(XMaterial.BARRIER,
+ Core.instance.utils.getConfigPath("MenuItems.trollMenu.returnToPlayerSelector.name"),
+ Core.instance.utils.getConfigPath("MenuItems.trollMenu.returnToPlayerSelector.lore")))) {
+ _caller.openInventory(new PlayerSelector(_caller).getInventory());
+ }
+
+ if (clickedItem.getType().equals(XMaterial.OAK_BUTTON.parseMaterial())) {
+ if (ChatColor.stripColor(clickedItem.getItemMeta().getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(Core.instance.utils.getConfigPath("MenuItems.playerSelector.left.name")))) {
+ if (CURRENT_PAGE == 0) _caller.sendMessage(Core.instance.utils.getConfigPath("Messages.alreadyOnFirstPage"));
+ else {
+ CURRENT_PAGE--;
+ GUI.clear();
+ initializeItems();
+ }
+ } else if (ChatColor.stripColor(clickedItem.getItemMeta().getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(Core.instance.utils.getConfigPath("MenuItems.playerSelector.right.name")))) {
+ if (!((CURRENT_INDEX + 1) >= Core.instance.singletons.holdingTrolls.size())) {
+ CURRENT_PAGE++;
+ GUI.clear();
+ initializeItems();
+ } else _caller.sendMessage(Core.instance.utils.getConfigPath("Messages.alreadyOnLastPage"));
+ }
+ }
+ };
+
+
+ Core.instance.singletons.holdingTrolls.forEach((className, trollHandler) -> {
+ if (trollHandler.metaData.getItemStack().equals(clickedItem)) {
+ trollHandler.execute();
+ if (trollHandler.metaData.isToggable) {
+ initializeItems();
+
+ }
+ }
+ });
+
+
+
}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Listeners/EventListener.java b/src/main/java/me/xapu1337/recodes/trollgui/Listeners/EventListener.java
index 1e81df3..40f2006 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Listeners/EventListener.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Listeners/EventListener.java
@@ -1,16 +1,21 @@
package me.xapu1337.recodes.trollgui.Listeners;
import me.xapu1337.recodes.trollgui.Cores.Core;
+import me.xapu1337.recodes.trollgui.Inventorys.TrollGUI;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
import org.jetbrains.annotations.NotNull;
+import java.util.stream.Collectors;
+
public class EventListener implements Listener {
@EventHandler
@@ -40,4 +45,30 @@ public void onChat(@NotNull AsyncPlayerChatEvent e){
}
}
+ @EventHandler
+ public void onPlayerQuit(PlayerQuitEvent e) {
+
+ if (Core.instance.singletons.currentPlayersTrolling.size() > 0) {
+ // Find the current TrollGUI with the player that left as a victim.
+ TrollGUI currentTrollGUI = Core.instance.singletons.currentPlayersTrolling.values().stream()
+ .filter(trollGUI -> trollGUI.getVictim().getUniqueId().equals(e.getPlayer().getUniqueId()))
+ .findFirst()
+ .orElse(null);
+
+ if (currentTrollGUI == null) return;
+
+ currentTrollGUI.getCaller().closeInventory();
+ currentTrollGUI.getCaller().sendMessage(Core.instance.utils.getConfigPath("Messages.playerNotAvailable", true).replaceAll("%PLAYER%", e.getPlayer().getName()));
+ }
+
+ }
+
+ @EventHandler
+ public void onInventoryClose(InventoryCloseEvent e) {
+ if (Core.instance.singletons.currentPlayersTrolling.values().stream().map(TrollGUI::getInventory).collect(Collectors.toList()).contains(e.getInventory())) {
+ Core.instance.singletons.currentPlayersTrolling.remove(Core.instance.singletons.currentPlayersTrolling.values().stream().filter(trollGUI -> trollGUI.getInventory() == e.getInventory()).collect(Collectors.toList()).stream().findFirst().get());
+ }
+ }
+
+
}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/AllEffectsTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/AllEffectsTroll.java
new file mode 100644
index 0000000..9191811
--- /dev/null
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/AllEffectsTroll.java
@@ -0,0 +1,36 @@
+package me.xapu1337.recodes.trollgui.Trolls;
+
+import com.cryptomorin.xseries.XMaterial;
+import com.cryptomorin.xseries.XPotion;
+import me.xapu1337.recodes.trollgui.Cores.Core;
+import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+public class AllEffectsTroll extends TrollHandler {
+
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.LINGERING_POTION)
+ .setConfigData("allEffects")
+
+
+ );
+ }
+
+
+ @Override
+ public void execute() {
+ Arrays.stream(XPotion.VALUES).collect(Collectors.toList()).forEach(effect -> {
+
+ if (effect == null || !effect.isSupported()) return;
+
+ victim.addPotionEffect(effect.buildPotionEffect(Core.instance.config.getInt("MenuItems.trollMenu.allEffects.options.effectDuration") * 20, 0));
+ });
+ }
+}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/BurnPlayerTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/BurnPlayerTroll.java
index eb88f69..ce2b1f3 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/BurnPlayerTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/BurnPlayerTroll.java
@@ -1,12 +1,20 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class BurnPlayerTroll extends TrollHandler {
- public BurnPlayerTroll(Player caller, Player victim) {
- super(caller, victim);
+
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return
+ new TrollItemMetaData()
+ .setItem(XMaterial.BLAZE_POWDER)
+ .setConfigData("burnPlayer");
}
@Override
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/CloseGUITroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/CloseGUITroll.java
index 0ee113e..c765836 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/CloseGUITroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/CloseGUITroll.java
@@ -1,11 +1,20 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class CloseGUITroll extends TrollHandler {
- public CloseGUITroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.BARRIER)
+ .setConfigData("closeGUI")
+
+ );
}
@Override
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropAllTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropAllTroll.java
index d34d301..d8da483 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropAllTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropAllTroll.java
@@ -2,6 +2,7 @@
import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@@ -11,10 +12,17 @@
public class DropAllTroll extends TrollHandler {
- public DropAllTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.CAULDRON)
+ .setConfigData("dropAll")
+
+ );
}
+
/**
* Executed from the TrollGUI Class everything inside this function gets executed.
*/
@@ -26,5 +34,6 @@ public void execute() {
victim.getWorld().dropItemNaturally(victim.getLocation(), itemStack);
}
victim.getInventory().clear();
+
}
}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropItemTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropItemTroll.java
index ae0e916..b036d98 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropItemTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/DropItemTroll.java
@@ -3,6 +3,7 @@
import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
@@ -11,8 +12,15 @@
import java.util.Objects;
public class DropItemTroll extends TrollHandler {
- public DropItemTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.WATER_BUCKET)
+ .setConfigData("dropItem")
+
+ );
}
/**
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ExplodePlayerTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ExplodePlayerTroll.java
index 5b3b12e..98a88fd 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ExplodePlayerTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ExplodePlayerTroll.java
@@ -1,7 +1,9 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -9,10 +11,19 @@
public class ExplodePlayerTroll extends TrollHandler {
Random random = new Random();
- public ExplodePlayerTroll(Player caller, Player victim) {
- super(caller, victim);
+
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.TNT)
+ .setConfigData("explodePlayer")
+
+ );
}
+
/**
* Executed from the TrollGUI Class everything inside this function gets executed.
*/
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeBlockTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeBlockTroll.java
index b66a3f3..d7b5329 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeBlockTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeBlockTroll.java
@@ -4,6 +4,7 @@
import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -13,10 +14,27 @@
import java.util.Objects;
public class FakeBlockTroll extends TrollHandler {
- public FakeBlockTroll(Player caller, Player victim) {
- super(caller, victim);
+
+
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ XMaterial customMatForFakeBlock;
+
+ if(XMaterial.matchXMaterial(Core.instance.config.getString("MenuItems.trollMenu.fakeBlock.options.block")).isPresent())
+ customMatForFakeBlock = XMaterial.matchXMaterial(Core.instance.config.getString("MenuItems.trollMenu.fakeBlock.options.block")).get();
+ else
+ customMatForFakeBlock = XMaterial.TNT;
+
+ return (
+ new TrollItemMetaData()
+ .setItem(customMatForFakeBlock)
+ .setConfigData("fakeBlock")
+
+ );
}
+
/**
* Executed from the TrollGUI Class everything inside this function gets executed.
*/
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeClearTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeClearTroll.java
index cb2ccbe..d7222ba 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeClearTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeClearTroll.java
@@ -1,7 +1,9 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -10,10 +12,19 @@
public class FakeClearTroll extends TrollHandler {
- public FakeClearTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.PUFFERFISH)
+ .setConfigData("fakeClear")
+ .formatPlaceholders("%TIME%", String.valueOf(Core.instance.getConfig().getInt("MenuItems.trollMenu.fakeClear.options.fakeClearDelay")))
+
+ );
}
+
/**
* the:
*
@@ -21,7 +32,7 @@ public FakeClearTroll(Player caller, Player victim) {
* if(Core.instance.utils.uuidOrName(victim.getPlayer(), Core.instance.getServer().getOnlineMode()))...
*
*
- * may seem weird but basically I'm making it offline & online mode friendly and avoiding issues.
+ * may seem weird, but basically I'm making it offline & online mode friendly and avoiding issues.
*/
@Override
public void execute() {
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeOperatorTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeOperatorTroll.java
index 862523c..ca81e9e 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeOperatorTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FakeOperatorTroll.java
@@ -1,16 +1,25 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class FakeOperatorTroll extends TrollHandler {
- public FakeOperatorTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.COMMAND_BLOCK)
+ .setConfigData("fakeOperator")
+
+ );
}
+
@Override
public void execute() {
if(!victim.isOp())
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FreezeTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FreezeTroll.java
index 35e92c8..d50686d 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FreezeTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/FreezeTroll.java
@@ -1,15 +1,28 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class FreezeTroll extends TrollHandler {
- public FreezeTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.SNOWBALL)
+ .setConfigData("freezePlayer")
+ .setToggable(true)
+ .setToggled(
+ () -> Core.instance.singletons.frozenPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
+ )
+
+ );
}
+
@Override
public void execute() {
Core.instance.utils.addOrRemove(Core.instance.singletons.frozenPlayers, victim);
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvSeeTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvSeeTroll.java
index c5114e5..b0b94e8 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvSeeTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvSeeTroll.java
@@ -1,14 +1,23 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class InvSeeTroll extends TrollHandler {
- public InvSeeTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.TRAPPED_CHEST)
+ .setConfigData("invSee")
+
+ );
}
+
@Override
public void execute() {
caller.openInventory(victim.getInventory());
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvShareTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvShareTroll.java
index 1e9482e..06bd579 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvShareTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/InvShareTroll.java
@@ -1,17 +1,37 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class InvShareTroll extends TrollHandler {
- public InvShareTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.ENDER_CHEST)
+ .setConfigData("invShare")
+
+ );
}
+
@Override
public void execute() {
- Core.instance.getServer().getOnlinePlayers().forEach((player -> {if(player != victim) player.openInventory(victim.getInventory()); }));
+ Core.instance.getServer().getOnlinePlayers().forEach((player -> {
+ // Check if any of the players are currently trolling the victim.
+ if (Core.instance.singletons.currentPlayersTrolling.containsKey(player)) {
+ // If so, check if the player is trolling the victim.
+ if (Core.instance.singletons.currentPlayersTrolling.get(player).getVictim().getUniqueId().equals(victim.getUniqueId())) {
+ // If so, abort the troll.
+ return;
+ }
+ }
+
+ if(player != victim) player.openInventory(victim.getInventory());
+ }));
}
}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/LaunchPlayerTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/LaunchPlayerTroll.java
index 0efa912..763928e 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/LaunchPlayerTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/LaunchPlayerTroll.java
@@ -1,17 +1,26 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class LaunchPlayerTroll extends TrollHandler {
- public LaunchPlayerTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.FIREWORK_ROCKET)
+ .setConfigData("launchPlayer")
+
+ );
}
+
@Override
public void execute() {
victim.setVelocity(new Vector(0f, 5f, 0f));
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBreakTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBreakTroll.java
index 3a90207..15084fb 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBreakTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBreakTroll.java
@@ -1,15 +1,28 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class NoBreakTroll extends TrollHandler {
- public NoBreakTroll(Player caller, Player victim) {
- super(caller, victim);
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.STONE)
+ .setConfigData("noBreak")
+ .setToggable(true)
+ .setToggled(
+ () -> Core.instance.singletons.noBreakPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
+ )
+
+ );
}
+
@Override
public void execute() {
Core.instance.utils.addOrRemove(Core.instance.singletons.noBreakPlayers, victim);
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBuildTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBuildTroll.java
index 77a570b..3eafdbf 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBuildTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/NoBuildTroll.java
@@ -1,15 +1,29 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class NoBuildTroll extends TrollHandler {
- public NoBuildTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.GRASS_BLOCK)
+ .setConfigData("noBuild")
+ .setToggable(true)
+ .setToggled(
+ () -> Core.instance.singletons.noBuildPlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
+ )
+
+ );
}
+
@Override
public void execute() {
Core.instance.utils.addOrRemove(Core.instance.singletons.noBuildPlayers, victim);
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/RandomLookTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/RandomLookTroll.java
index 803c96a..444013f 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/RandomLookTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/RandomLookTroll.java
@@ -1,7 +1,9 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@@ -11,10 +13,18 @@
public class RandomLookTroll extends TrollHandler {
Random random = new Random();
- public RandomLookTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.BARRIER)
+ .setConfigData("randomLook")
+
+ );
}
+
@Override
public void execute() {
Location loc = victim.getLocation();
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ReverseMessageTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ReverseMessageTroll.java
index dc7c9d4..9b12ca5 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ReverseMessageTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ReverseMessageTroll.java
@@ -1,15 +1,29 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Cores.Core;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.entity.Player;
public class ReverseMessageTroll extends TrollHandler {
- public ReverseMessageTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.PAPER)
+ .setConfigData("reverseMessage")
+ .setToggable(true)
+ .setToggled(
+ () -> Core.instance.singletons.reverseMessagePlayers.containsKey(Core.instance.utils.uuidOrName(victim, Core.instance.usingUUID))
+ )
+
+ );
}
+
@Override
public void execute() {
Core.instance.utils.addOrRemove(Core.instance.singletons.reverseMessagePlayers, victim);
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ScareTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ScareTroll.java
index b69e9a5..ac44233 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ScareTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ScareTroll.java
@@ -1,26 +1,40 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
+import com.cryptomorin.xseries.XPotion;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.particles.XParticle;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
+import org.bukkit.SoundCategory;
import org.bukkit.entity.Player;
public class ScareTroll extends TrollHandler {
- public ScareTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.CARVED_PUMPKIN)
+ .setConfigData("scarePlayer")
+
+ );
}
+
@Override
public void execute() {
- victim.spawnParticle(XParticle.getParticle("MOB_APPEARANCE"), victim.getLocation(), 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_CURSE.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_AMBIENT.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_DEATH.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_DEATH_LAND.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_FLOP.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_HURT.parseSound(), 100, 1);
- victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_HURT_LAND.parseSound(), 100, 1);
+ victim.spawnParticle(XParticle.getParticle("MOB_APPEARANCE"), victim.getLocation(), 1, 0, 0, 0, 0);
+
+ victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_CURSE.parseSound(), SoundCategory.MASTER, 1, 1);
+ victim.addPotionEffect(XPotion.BLINDNESS.buildPotionEffect(60, 1));
+ for (int i = 0; i < 32; i++) {
+ victim.playSound(victim.getLocation(), XSound.ITEM_TOTEM_USE.parseSound(), SoundCategory.MASTER, 1, 1);
+ victim.playSound(victim.getLocation(), XSound.ENTITY_GHAST_HURT.parseSound(), SoundCategory.MASTER, 1, 1);
+ victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_DEATH.parseSound(), 1, 1);
+ victim.playSound(victim.getLocation(), XSound.ENTITY_ELDER_GUARDIAN_CURSE.parseSound(), 1, 1);
+ }
+
}
}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/TestClientSpam.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/TestClientSpam.java
deleted file mode 100644
index 659d671..0000000
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/TestClientSpam.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package me.xapu1337.recodes.trollgui.Trolls;
-
-import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
-import org.bukkit.entity.Player;
-
-public class TestClientSpam extends TrollHandler {
-
- public TestClientSpam(Player caller, Player victim) {
- super(caller, victim);
- }
-
- @Override
- public void execute() {
-
- }
-}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/TestTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/TestTroll.java
deleted file mode 100644
index ce92c80..0000000
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/TestTroll.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package me.xapu1337.recodes.trollgui.Trolls;
-
-import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
-import org.bukkit.entity.Player;
-
-public class TestTroll extends TrollHandler {
-
- public TestTroll(Player caller, Player victim) {
- super(caller, victim);
- }
-
- @Override
- public void execute() {
- victim.sendMessage("FRICK YOU!");
- caller.sendMessage("Wholesome uwu");
- }
-}
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ThunderPlayerTroll.java b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ThunderPlayerTroll.java
index d9700a3..e713ac5 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ThunderPlayerTroll.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Trolls/ThunderPlayerTroll.java
@@ -1,16 +1,26 @@
package me.xapu1337.recodes.trollgui.Trolls;
+import com.cryptomorin.xseries.XMaterial;
import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Handlers.TrollItemMetaData;
import org.bukkit.Bukkit;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class ThunderPlayerTroll extends TrollHandler {
- public ThunderPlayerTroll(Player caller, Player victim) {
- super(caller, victim);
+
+ @Override
+ public TrollItemMetaData setMetaData() {
+ return (
+ new TrollItemMetaData()
+ .setItem(XMaterial.PRISMARINE_SHARD)
+ .setConfigData("thunder")
+
+ );
}
+
@Override
public void execute() {
victim.getWorld().spawnEntity(victim.getLocation(), EntityType.LIGHTNING);
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Utilities/IndexableMap.java b/src/main/java/me/xapu1337/recodes/trollgui/Utilities/IndexableMap.java
new file mode 100644
index 0000000..96253a5
--- /dev/null
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Utilities/IndexableMap.java
@@ -0,0 +1,52 @@
+package me.xapu1337.recodes.trollgui.Utilities;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class IndexableMap extends HashMap {
+
+ private final LinkedList keyList = new LinkedList<>();
+
+ @Override
+ public V put(K key, V value) {
+ if (!keyList.contains(key))
+ keyList.add(key);
+ return super.put(key, value);
+ }
+
+ @Override
+ public void putAll(Map extends K, ? extends V> m) {
+ for (Entry extends K, ? extends V> entry : m.entrySet()) {
+ put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ @Override
+ public void clear() {
+ keyList.clear();
+ super.clear();
+ }
+
+ public List getKeys() {
+ return keyList;
+ }
+
+ public int getKeyIndex(K key) {
+ return keyList.indexOf(key);
+ }
+
+ public K getKeyAt(int index) {
+ if (keyList.size() > index)
+ return keyList.get(index);
+ return null;
+ }
+
+ public V getValueAt(int index) {
+ K key = getKeyAt(index);
+ if (key != null)
+ return get(key);
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Singleton.java b/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Singleton.java
index fb01c24..607165d 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Singleton.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Singleton.java
@@ -1,5 +1,9 @@
package me.xapu1337.recodes.trollgui.Utilities;
+import me.xapu1337.recodes.trollgui.Handlers.TrollHandler;
+import me.xapu1337.recodes.trollgui.Inventorys.TrollGUI;
+import org.bukkit.entity.Player;
+
import java.util.HashMap;
public class Singleton {
@@ -8,8 +12,15 @@ public class Singleton {
public final HashMap frozenPlayers = new HashMap();
public final HashMap noBuildPlayers = new HashMap();
public final HashMap noBreakPlayers = new HashMap();
+
+ public final HashMap noDropPlayers = new HashMap();
public final HashMap reverseMessagePlayers = new HashMap();
+ // Simple map holding owners of currently open inventories.
+ public final HashMap currentPlayersTrolling = new HashMap();
+
+ public final IndexableMap holdingTrolls = new IndexableMap();
+
public Singleton(){
if(instance == null)
instance = this;
diff --git a/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Util.java b/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Util.java
index 8de5fef..1a62714 100644
--- a/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Util.java
+++ b/src/main/java/me/xapu1337/recodes/trollgui/Utilities/Util.java
@@ -17,16 +17,24 @@
public class Util {
- public ItemStack createItem(final XMaterial xMat, final Boolean isEnchanted , final String name, final String... lore) {
+ public ItemStack createItem(final XMaterial xMat, final String name) {
final ItemStack item = new ItemStack(xMat.parseMaterial(), 1);
final ItemMeta meta = item.getItemMeta();
meta.setDisplayName(name);
- if(isEnchanted){
- meta.addEnchant(XEnchantment.DURABILITY.getEnchant(), 1, true);
- meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
- }
- // Set the lore of the ite
+
+
+ item.setItemMeta(meta);
+
+ return item;
+ }
+
+ public ItemStack createItem(final XMaterial xMat, final String name, final String ...lore) {
+ final ItemStack item = new ItemStack(xMat.parseMaterial(), 1);
+ final ItemMeta meta = item.getItemMeta();
+
+ meta.setDisplayName(name);
+
meta.setLore(Arrays.asList(lore));
item.setItemMeta(meta);
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 8002cb7..df46865 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -42,10 +42,16 @@ Messages:
noItemInHand: '&7Player &b%PLAYER%&7 isn''t holding an item in their hand.'
alreadyOnFirstPage: '&cYou are already on the first page.'
alreadyOnLastPage: '&cYou are already on the last page.'
- playerNotAvaliable: '&cPlayer either disconnected or is not available'
+ playerNotAvailable: '&cPlayer &7&l%PLAYER%&c either disconnected or is not available anymore.'
+ targetSelfWarning: '&cYou currently have the target set to yourself.'
MenuItems:
trollMenu:
+ allEffects:
+ name: '&5&lAll Effects'
+ lore: '&7How did you get here?'
+ options:
+ effectDuration: 10 # x seconds until the effect is removed
burnPlayer:
name: '&6Burn the player'
lore: '&7Summon Ragnarok the god of fire to punish him!'