From 1c74928c27b72fe81179f66b803040fab3e694fb Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 02:20:17 -0800 Subject: [PATCH 001/261] Start work on async functions FunctionUtil still needs to be completed so this is very much still a w.i.p. Start of #219 --- .../scheduler/bukkit/BukkitScheduler.java | 23 +++- .../server/bukkit/FakeBukkitServer.java | 5 + .../dynamicgui/function/Function.java | 5 + .../{util => function}/FunctionUtil.java | 81 ++++++++----- .../function/impl/gui/GuiFunction.java | 14 ++- .../dynamicgui/listener/GuiListener.java | 2 +- .../listener/InventoryInteractListener.java | 2 +- .../manager/dynamicgui/GuiManager.java | 108 ++++++++++-------- .../manager/dynamicgui/SlotManager.java | 2 +- .../dynamicgui/scheduler/Scheduler.java | 8 +- .../dynamicgui/server/FakeServer.java | 2 + .../dynamicgui/util/ThreadUtil.java | 25 ++++ 12 files changed, 188 insertions(+), 89 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/{util => function}/FunctionUtil.java (57%) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java index 1f3e9e4f2..0c6b1fb24 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java @@ -15,6 +15,7 @@ */ package com.clubobsidian.dynamicgui.scheduler.bukkit; +import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.scheduler.Scheduler; import org.bukkit.Bukkit; @@ -23,17 +24,27 @@ public class BukkitScheduler extends Scheduler { @Override - public void scheduleSyncDelayedTask(DynamicGuiPlugin plugin, Runnable runnable, Long delay) { - Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) plugin, runnable, delay); + public void runSyncDelayedTask(Runnable runnable, long delay) { + Bukkit.getScheduler() + .scheduleSyncDelayedTask((Plugin) DynamicGui.get().getPlugin(), runnable, delay); } @Override - public void scheduleSyncRepeatingTask(DynamicGuiPlugin plugin, Runnable runnable, Long delayInitial, Long delayRepeating) { - Bukkit.getScheduler().scheduleSyncRepeatingTask((Plugin) plugin, runnable, delayInitial, delayRepeating); + public void runAsynchronousDelayedTask(Runnable runnable, long delay) { + Bukkit.getScheduler() + .runTaskLaterAsynchronously((Plugin) DynamicGui.get().getPlugin(), runnable, delay); } @Override - public void scheduleAsyncRepeatingTask(DynamicGuiPlugin plugin, Runnable runnable, Long delayInitial, Long delayRepeating) { - Bukkit.getServer().getScheduler().runTaskTimerAsynchronously((Plugin) plugin, runnable, delayInitial, delayRepeating); + public void scheduleSyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating) { + Bukkit.getScheduler() + .scheduleSyncRepeatingTask((Plugin) DynamicGui.get().getPlugin(), runnable, delayInitial, delayRepeating); + } + + @Override + public void scheduleAsyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating) { + Bukkit.getServer().getScheduler() + .runTaskTimerAsynchronously((Plugin) DynamicGui.get().getPlugin(), + runnable, delayInitial, delayRepeating); } } \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java index 9f485fe61..9da0635c1 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java @@ -45,6 +45,11 @@ public FakeBukkitServer() { super(new BukkitScheduler()); } + @Override + public boolean isMainThread() { + return Bukkit.getServer().isPrimaryThread(); + } + @Override public void broadcastMessage(String message) { Bukkit.getServer().broadcastMessage(message); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java index 81e24bb93..4af7b8cbc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java @@ -21,6 +21,7 @@ import org.apache.commons.lang3.SerializationUtils; import java.io.Serializable; +import java.util.concurrent.CompletableFuture; public abstract class Function implements Cloneable, Serializable { @@ -48,6 +49,10 @@ public Function(Function function) { public abstract boolean function(PlayerWrapper playerWrapper); + public boolean isAsync() { + return false; + } + public String getName() { return this.name; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/FunctionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java similarity index 57% rename from core/src/main/java/com/clubobsidian/dynamicgui/util/FunctionUtil.java rename to core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java index e9cb2223d..c75dff875 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/FunctionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util; +package com.clubobsidian.dynamicgui.function; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.gui.FunctionOwner; import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; @@ -26,19 +25,23 @@ import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; +import com.clubobsidian.dynamicgui.util.ThreadUtil; +import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; public final class FunctionUtil { private FunctionUtil() { } - public static boolean tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { + public static CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper); } - private static boolean recurFunctionNodes(FunctionResponse fail, FunctionOwner owner, List functionNodes, FunctionType type, PlayerWrapper playerWrapper) { + private static CompletableFuture recurFunctionNodes(FunctionResponse fail, FunctionOwner owner, List functionNodes, FunctionType type, PlayerWrapper playerWrapper) { for(FunctionNode node : functionNodes) { FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); @@ -66,37 +69,57 @@ private static boolean recurFunctionNodes(FunctionResponse fail, FunctionOwner o } } } - return true; } - private static FunctionResponse runFunctionData(FunctionOwner owner, List datas, PlayerWrapper playerWrapper) { - for(FunctionData data : datas) { - String functionName = data.getName(); - String functionData = data.getData(); - Function function = FunctionManager.get().getFunctionByName(functionName); - if(function == null) { - DynamicGui.get().getLogger().error("Invalid function " + data.getName()); - return new FunctionResponse(false); - } - - function.setOwner(owner); - - if(data.getData() != null) { - String newData = ReplacerManager.get().replace(functionData, playerWrapper); - function.setData(newData); - } + private static CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { + CompletableFuture response = new CompletableFuture<>(); + ThreadUtil.run(() -> { + for(int i = 0; i < functionDataList.size(); i++) { + FunctionData data = functionDataList.get(i); + String functionName = data.getName(); + String functionData = data.getData(); + Function function = FunctionManager.get().getFunctionByName(functionName); + if(function == null) { + DynamicGui.get().getLogger().error("Invalid function " + data.getName()); + response.complete(new FunctionResponse(false)); + } + function.setOwner(owner); - boolean ran = function.function(playerWrapper); - if(data.getModifier() == FunctionModifier.NOT) { - ran = !ran; - } + if(data.getData() != null) { + String newData = ReplacerManager.get().replace(functionData, playerWrapper); + function.setData(newData); + } - if(!ran) { - return new FunctionResponse(false, functionName, functionData); + boolean async = function.isAsync(); + List futureData = async ? new ArrayList<>(functionDataList.size()) : functionDataList; + if(async) { + for(int j = i + 1; j < functionDataList.size(); i++) { + futureData.add(functionDataList.get(i)); + } + } + ThreadUtil.run(() -> { + boolean ran = function.function(playerWrapper); + if(data.getModifier() == FunctionModifier.NOT) { + ran = !ran; + } + if(!ran) { + response.complete(new FunctionResponse(false, functionName, functionData)); + } else if (async) { + try { + response.complete(runFunctionData(owner, futureData, playerWrapper).get()); + } catch(InterruptedException | ExecutionException ex) { + ex.printStackTrace(); + } + } + }, async); + if(async) { + break; + } } - } - return new FunctionResponse(true); + response.complete(new FunctionResponse(true)); + }, false); + return response; } private static boolean isFail(FunctionResponse response, FunctionToken token) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java index b7a552e6a..31cabb725 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java @@ -22,6 +22,8 @@ import com.clubobsidian.dynamicgui.gui.Slot; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import java.util.concurrent.ExecutionException; + public class GuiFunction extends Function { /** @@ -57,6 +59,16 @@ public boolean function(final PlayerWrapper playerWrapper) { slot.setClose(false); } back.setClose(false); - return GuiManager.get().openGui(playerWrapper, gui, back); + try { + return GuiManager.get().openGui(playerWrapper, gui, back).get(); + } catch(InterruptedException | ExecutionException e) { + e.printStackTrace(); + return false; + } + } + + @Override + public boolean isAsync() { + return true; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java index 281da5e3a..32abb8741 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java @@ -21,7 +21,7 @@ import com.clubobsidian.dynamicgui.gui.Gui; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.util.FunctionUtil; +import com.clubobsidian.dynamicgui.function.FunctionUtil; import com.clubobsidian.trident.EventHandler; import java.util.HashSet; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java index fd243e719..9c8190b27 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java @@ -27,7 +27,7 @@ import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; -import com.clubobsidian.dynamicgui.util.FunctionUtil; +import com.clubobsidian.dynamicgui.function.FunctionUtil; import com.clubobsidian.trident.EventHandler; import java.util.Iterator; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java index 4bce351b6..e9670eb06 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java @@ -36,8 +36,9 @@ import com.clubobsidian.dynamicgui.server.FakeServer; import com.clubobsidian.dynamicgui.server.ServerType; import com.clubobsidian.dynamicgui.util.ChatColor; -import com.clubobsidian.dynamicgui.util.FunctionUtil; +import com.clubobsidian.dynamicgui.function.FunctionUtil; import com.clubobsidian.dynamicgui.util.HashUtil; +import com.clubobsidian.dynamicgui.util.ThreadUtil; import com.clubobsidian.dynamicgui.world.LocationWrapper; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; @@ -57,6 +58,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; public class GuiManager { @@ -152,75 +154,87 @@ public Gui getCurrentGui(PlayerWrapper playerWrapper) { return this.playerGuis.get(playerWrapper.getUniqueId()); } - public boolean openGui(Object player, String guiName) { + public CompletableFuture openGui(Object player, String guiName) { return this.openGui(EntityManager.get().createPlayerWrapper(player), guiName); } - public boolean openGui(Object player, Gui gui) { + public CompletableFuture openGui(Object player, Gui gui) { return this.openGui(EntityManager.get().createPlayerWrapper(player), gui); } - public boolean openGui(PlayerWrapper playerWrapper, String guiName) { + public CompletableFuture openGui(PlayerWrapper playerWrapper, String guiName) { return this.openGui(playerWrapper, guiName, null); } - public boolean openGui(PlayerWrapper playerWrapper, String guiName, Gui back) { + public CompletableFuture openGui(PlayerWrapper playerWrapper, String guiName, Gui back) { return this.openGui(playerWrapper, this.getGuiByName(guiName), back); } - public boolean openGui(PlayerWrapper playerWrapper, Gui gui) { + public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gui) { return this.openGui(playerWrapper, gui, null); } - public boolean openGui(PlayerWrapper playerWrapper, Gui gui, Gui back) { - if(gui == null) { - playerWrapper.sendMessage(DynamicGui.get().getNoGui()); - return false; - } + public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gui, Gui back) { + CompletableFuture future = new CompletableFuture<>(); + future.exceptionally((ex) -> { + ex.printStackTrace(); + return null; + }); + ThreadUtil.run(() -> { + if(gui == null) { + playerWrapper.sendMessage(DynamicGui.get().getNoGui()); + future.complete(false); + return; + } - Gui clonedGui = gui.clone(); - if(back != null) { - clonedGui.setBack(back.clone()); - } + Gui clonedGui = gui.clone(); + if(back != null) { + clonedGui.setBack(back.clone()); + } - GuiPreloadEvent preloadEvent = new GuiPreloadEvent(clonedGui, playerWrapper); - DynamicGui.get().getEventBus().callEvent(preloadEvent); + GuiPreloadEvent preloadEvent = new GuiPreloadEvent(clonedGui, playerWrapper); + DynamicGui.get().getEventBus().callEvent(preloadEvent); - //Run gui load functions - boolean ran = FunctionUtil.tryFunctions(clonedGui, FunctionType.LOAD, playerWrapper); - GuiLoadEvent event = new GuiLoadEvent(clonedGui, playerWrapper); - if(!ran) { - event.setCancelled(true); - } - DynamicGui.get().getEventBus().callEvent(event); + //Run gui load functions + CompletableFuture result = FunctionUtil.tryFunctions(clonedGui, FunctionType.LOAD, playerWrapper); + result.thenAccept((ran) -> ThreadUtil.run(() -> { + GuiLoadEvent event = new GuiLoadEvent(clonedGui, playerWrapper); + if(!ran) { + event.setCancelled(true); + } + DynamicGui.get().getEventBus().callEvent(event); - if(ran) { - InventoryWrapper inventoryWrapper = clonedGui.buildInventory(playerWrapper); + if(ran) { + InventoryWrapper inventoryWrapper = clonedGui.buildInventory(playerWrapper); - //Run slot load functions - for(Slot slot : clonedGui.getSlots()) { - FunctionUtil.tryFunctions(slot, FunctionType.LOAD, playerWrapper); - } + //Run slot load functions + for(Slot slot : clonedGui.getSlots()) { + FunctionUtil.tryFunctions(slot, FunctionType.LOAD, playerWrapper); + } - if(inventoryWrapper == null) { - return false; - } + if(inventoryWrapper == null) { + future.complete(false); + return; + } - FakeServer server = DynamicGui.get().getServer(); - if(server.getType() == ServerType.SPONGE) { - server.getScheduler().scheduleSyncDelayedTask(DynamicGui.get().getPlugin(), () -> { - playerWrapper.openInventory(inventoryWrapper); - }, 1L); - } else { - playerWrapper.openInventory(inventoryWrapper); - } + FakeServer server = DynamicGui.get().getServer(); + if(server.getType() == ServerType.SPONGE) { + server.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.openInventory(inventoryWrapper); + }, 1L); + } else { + playerWrapper.openInventory(inventoryWrapper); + } - this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); - DynamicGui.get().getServer().getScheduler().scheduleSyncDelayedTask(DynamicGui.get().getPlugin(), () -> { - playerWrapper.updateInventory(); - }, 2L); - } - return ran; + this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); + DynamicGui.get().getServer().getScheduler().runSyncDelayedTask(() -> { + playerWrapper.updateInventory(); + }, 2L); + } + future.complete(ran); + }, false)); + }, false); + return future; } private void loadGlobalMacroFromFile(File file) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java index 9701d253f..640533176 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java @@ -22,7 +22,7 @@ import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.util.FunctionUtil; +import com.clubobsidian.dynamicgui.function.FunctionUtil; import java.util.Iterator; import java.util.Map.Entry; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java b/core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java index 2652684a9..3e98982f1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java @@ -19,9 +19,11 @@ public abstract class Scheduler { - public abstract void scheduleSyncDelayedTask(DynamicGuiPlugin plugin, Runnable runnable, Long delay); + public abstract void runSyncDelayedTask(Runnable runnable, long delay); - public abstract void scheduleSyncRepeatingTask(DynamicGuiPlugin plugin, Runnable runnable, Long delayInitial, Long delayRepeating); + public abstract void runAsynchronousDelayedTask(Runnable runnable, long delay); - public abstract void scheduleAsyncRepeatingTask(DynamicGuiPlugin plugin, Runnable runnable, Long delayInitial, Long delayRepeating); + public abstract void scheduleSyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating); + + public abstract void scheduleAsyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java b/core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java index 33244012b..354c40465 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java @@ -36,6 +36,8 @@ public Scheduler getScheduler() { return this.scheduler; } + public abstract boolean isMainThread(); + public abstract void broadcastMessage(String message); public abstract void broadcastJsonMessage(String json); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java new file mode 100644 index 000000000..ea1991fad --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java @@ -0,0 +1,25 @@ +package com.clubobsidian.dynamicgui.util; + +import com.clubobsidian.dynamicgui.DynamicGui; +import com.clubobsidian.dynamicgui.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.server.FakeServer; + +public final class ThreadUtil { + + public static void run(Runnable runnable, boolean isAsync) { + FakeServer server = DynamicGui.get().getServer(); + Scheduler scheduler = server.getScheduler(); + if(isAsync) { + scheduler.runAsynchronousDelayedTask(runnable, 0); + } else { + if(!server.isMainThread()) { + scheduler.runSyncDelayedTask(runnable, 0); + } else { + runnable.run(); + } + } + } + + private ThreadUtil() { + } +} From a0f8f443a5cee5951e7dcebcf8ff705dd2308431 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 02:26:52 -0800 Subject: [PATCH 002/261] Start replacing internals with CompletableFuture --- .../command/bukkit/CustomCommandExecutor.java | 3 ++- .../function/impl/gui/BackFunction.java | 17 ++++++++++++----- .../function/impl/gui/SetBackFunction.java | 2 -- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java index 9ec0d5db7..e716387ae 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java @@ -36,7 +36,8 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String if(sender instanceof Player) { Player player = (Player) sender; PlayerWrapper playerWrapper = new BukkitPlayerWrapper<>(player); - return GuiManager.get().openGui(playerWrapper, this.gui); + GuiManager.get().openGui(playerWrapper, this.gui); + return true; } return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java index 93ffdf8c8..31657622f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java @@ -22,6 +22,8 @@ import com.clubobsidian.dynamicgui.gui.Slot; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import java.util.concurrent.ExecutionException; + public class BackFunction extends Function { /** @@ -45,7 +47,6 @@ public boolean function(PlayerWrapper playerWrapper) { gui = (Gui) owner; } - Gui back = gui.getBack(); if(back != null) { if(this.getData() != null) { @@ -61,11 +62,17 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } } - - GuiManager.get().openGui(playerWrapper, back); - return true; + try { + return GuiManager.get().openGui(playerWrapper, back).get(); + } catch(InterruptedException | ExecutionException e) { + e.printStackTrace(); + } } - return false; } + + @Override + public boolean isAsync() { + return true; + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java index 05d65d4b7..6984691a2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java @@ -54,9 +54,7 @@ public boolean function(PlayerWrapper playerWrapper) { if(backGui == null) { return false; } - gui.setBack(backGui); - return true; } } \ No newline at end of file From 93df7d6f315cd4b2c3e753b549e87e9d516ded9f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 02:28:36 -0800 Subject: [PATCH 003/261] Refactor plugin out of scheduler methods --- .../main/java/com/clubobsidian/dynamicgui/DynamicGui.java | 3 +-- .../dynamicgui/manager/dynamicgui/SlotManager.java | 2 +- .../manager/dynamicgui/cooldown/CooldownManager.java | 6 ++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index 8e61bb9c3..70ef375f4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -352,7 +352,7 @@ private void loadFunctions() { } private void startPlayerCountTimer() { - this.getServer().getScheduler().scheduleSyncRepeatingTask(this.getPlugin(), () -> { + this.getServer().getScheduler().scheduleSyncRepeatingTask(() -> { for(String server : serverPlayerCount.keySet()) { PlayerWrapper player = Iterables.getFirst(this.getServer().getOnlinePlayers(), null); if(player != null) { @@ -363,7 +363,6 @@ private void startPlayerCountTimer() { if(this.proxy == Proxy.REDIS_BUNGEE) { sendTo = "RedisBungee"; } - player.sendPluginMessage(this.getPlugin(), sendTo, out.toByteArray()); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java index 640533176..7538cc671 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java @@ -45,7 +45,7 @@ private SlotManager() { } private void updateSlots() { - DynamicGui.get().getServer().getScheduler().scheduleSyncRepeatingTask(DynamicGui.get().getPlugin(), () -> { + DynamicGui.get().getServer().getScheduler().scheduleSyncRepeatingTask(() -> { Iterator> it = GuiManager.get().getPlayerGuis().entrySet().iterator(); while(it.hasNext()) { Entry next = it.next(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java index 87621d5c7..6790858f3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java @@ -233,18 +233,16 @@ private void updateCache() { private void scheduleCooldownUpdate() { DynamicGui dynamicGui = DynamicGui.get(); - DynamicGuiPlugin plugin = dynamicGui.getPlugin(); FakeServer server = dynamicGui.getServer(); - server.getScheduler().scheduleSyncRepeatingTask(plugin, () -> { + server.getScheduler().scheduleSyncRepeatingTask(() -> { this.updateCache(); }, 1L, 1L); } private void scheduleConfigUpdate() { DynamicGui dynamicGui = DynamicGui.get(); - DynamicGuiPlugin plugin = dynamicGui.getPlugin(); FakeServer server = dynamicGui.getServer(); - server.getScheduler().scheduleAsyncRepeatingTask(plugin, () -> { + server.getScheduler().scheduleAsyncRepeatingTask(() -> { if(this.updateConfig.get()) { this.updateConfig.set(false); this.updateAndSaveConfig(); From e8379e2ae2c2a7e753e82971d8b04df074fb3a4a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 20:03:37 -0800 Subject: [PATCH 004/261] If the function is async terminate the loop by returning Return instead of break so we don't fall through to the last completion --- .../java/com/clubobsidian/dynamicgui/function/FunctionUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java index c75dff875..bd78a09f6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java @@ -114,7 +114,7 @@ private static CompletableFuture runFunctionData(FunctionOwner } }, async); if(async) { - break; + return; } } response.complete(new FunctionResponse(true)); From 179f2d4d3d08f18388e4eed7ee231dc963a15971 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 20:22:12 -0800 Subject: [PATCH 005/261] Start working on recur nodes --- .../dynamicgui/function/FunctionUtil.java | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java index bd78a09f6..a9699e067 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java @@ -27,8 +27,11 @@ import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; import com.clubobsidian.dynamicgui.util.ThreadUtil; +import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Queue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -41,35 +44,44 @@ public static CompletableFuture tryFunctions(FunctionOwner owner, Funct return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper); } - private static CompletableFuture recurFunctionNodes(FunctionResponse fail, FunctionOwner owner, List functionNodes, FunctionType type, PlayerWrapper playerWrapper) { - for(FunctionNode node : functionNodes) { + private static CompletableFuture recurFunctionNodes(FunctionResponse fail, + FunctionOwner owner, + Collection functionNodes, + FunctionType type, + PlayerWrapper playerWrapper) { + Queue nodeQueue = new ArrayDeque<>(functionNodes); + CompletableFuture future = new CompletableFuture<>(); + FunctionNode node = nodeQueue.poll(); + if(node != null) { FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); if(types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { if(type != FunctionType.FAIL) { - FunctionResponse response = runFunctionData(owner, functionToken.getFunctions(), playerWrapper); - - if(!response.result) { - if(response.failedFunction == null) { - return false; + runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { + if(!response.result) { + if(response.failedFunction == null) { + future.complete(false); + } else { + recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper) + .thenAccept((value) -> future.complete(false)); + } + } else { + recurFunctionNodes(response, owner, node.getChildren(), type, playerWrapper); } - - recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper); - return false; - } else { - recurFunctionNodes(response, owner, node.getChildren(), type, playerWrapper); - } + }); } else if(type == FunctionType.FAIL) { if(isFail(fail, functionToken)) { - FunctionResponse response = runFunctionData(owner, functionToken.getFunctions(), playerWrapper); - if(!response.result) { - recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper); - } + runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { + if(!response.result) { + recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper); + } + }); } } } } - return true; + future.complete(true); + return future; } private static CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { @@ -93,7 +105,7 @@ private static CompletableFuture runFunctionData(FunctionOwner boolean async = function.isAsync(); List futureData = async ? new ArrayList<>(functionDataList.size()) : functionDataList; - if(async) { + if(async) { //Load functions into new arraylist if the function is async for(int j = i + 1; j < functionDataList.size(); i++) { futureData.add(functionDataList.get(i)); } @@ -113,6 +125,9 @@ private static CompletableFuture runFunctionData(FunctionOwner } } }, async); + //Return if function is async since the async caller will hand + //control back to this method after completion or the function will + //fail and then complete if(async) { return; } From ac30ad8e7c8e71c8eec128d4e46a98fc0bc78f69 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 20:23:18 -0800 Subject: [PATCH 006/261] Bump version to 5.0.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index baa786606..34ebf7ea5 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ subprojects { apply plugin: 'com.github.johnrengelman.shadow' group 'com.clubobsidian' - version '4.1.0' + version '5.0.0' tasks.withType(JavaCompile) { sourceCompatibility = JavaVersion.VERSION_11 From 310629061cbfbf713da1101de9605d756bc3731c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 20:36:29 -0800 Subject: [PATCH 007/261] Initial test of async seems to be working The initial test of async seems to be working, some of the edge cases in #219 will still need to be worked out --- .../clubobsidian/dynamicgui/DynamicGui.java | 3 ++ .../dynamicgui/function/FunctionUtil.java | 4 +-- .../function/impl/BlockingFunction.java | 31 +++++++++++++++++++ .../listener/InventoryInteractListener.java | 5 ++- 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index 70ef375f4..d4ba1ea3f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -17,6 +17,7 @@ import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.function.impl.AddPermissionFunction; +import com.clubobsidian.dynamicgui.function.impl.BlockingFunction; import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; @@ -349,6 +350,8 @@ private void loadFunctions() { FunctionManager.get().addFunction(new CopyBackMetadataFunction("copybackmetadata")); FunctionManager.get().addFunction(new IsBedrockPlayerFunction("isbedrockplayer")); + + FunctionManager.get().addFunction(new BlockingFunction("block")); } private void startPlayerCountTimer() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java index a9699e067..42ef60343 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java @@ -106,8 +106,8 @@ private static CompletableFuture runFunctionData(FunctionOwner boolean async = function.isAsync(); List futureData = async ? new ArrayList<>(functionDataList.size()) : functionDataList; if(async) { //Load functions into new arraylist if the function is async - for(int j = i + 1; j < functionDataList.size(); i++) { - futureData.add(functionDataList.get(i)); + for(int j = i + 1; j < functionDataList.size(); j++) { + futureData.add(functionDataList.get(j)); } } ThreadUtil.run(() -> { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java new file mode 100644 index 000000000..0a8414b82 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java @@ -0,0 +1,31 @@ +package com.clubobsidian.dynamicgui.function.impl; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import org.apache.commons.lang3.math.NumberUtils; + +public class BlockingFunction extends Function { + + public BlockingFunction(String name) { + super(name); + } + + @Override + public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null || !NumberUtils.isParsable(this.getData())) { + return false; + } + try { + Thread.sleep(Integer.parseInt(this.getData())); + return true; + } catch(InterruptedException e) { + e.printStackTrace(); + return false; + } + } + + @Override + public boolean isAsync() { + return true; + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java index 9c8190b27..d2d209d46 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java @@ -52,8 +52,7 @@ public void invClick(final InventoryClickEvent e) { } ItemStackWrapper item = e.getItemStackWrapper(); - if(e.getClick() == null) //For other types of clicks besides left, right, middle - { + if(e.getClick() == null) { //For other types of clicks besides left, right, middle e.setCancelled(true); return; } else if(item.getItemStack() == null) { @@ -79,7 +78,7 @@ public void invClick(final InventoryClickEvent e) { e.setCancelled(true); } - Boolean close = null; + Boolean close; if(slot.getClose() != null) { close = slot.getClose(); } else if(gui.getClose() != null) { From e4df06db7da83430c5c6627fc04796a7a2230907 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 20:57:23 -0800 Subject: [PATCH 008/261] Return if function is invalid If a function is not found, it is invalid, return after completing the future instead of falling through which causes an npe. --- .../java/com/clubobsidian/dynamicgui/function/FunctionUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java index 42ef60343..2c19de6a3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java @@ -95,6 +95,7 @@ private static CompletableFuture runFunctionData(FunctionOwner if(function == null) { DynamicGui.get().getLogger().error("Invalid function " + data.getName()); response.complete(new FunctionResponse(false)); + return; } function.setOwner(owner); From b61e25f5f02ef691720d1eb583d35471afeef65e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 3 Feb 2022 21:28:59 -0800 Subject: [PATCH 009/261] Rename blocking to delay --- .../main/java/com/clubobsidian/dynamicgui/DynamicGui.java | 4 ++-- .../impl/{BlockingFunction.java => DelayFunction.java} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/function/impl/{BlockingFunction.java => DelayFunction.java} (86%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index d4ba1ea3f..ba3fd9ca5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -17,7 +17,7 @@ import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.function.impl.AddPermissionFunction; -import com.clubobsidian.dynamicgui.function.impl.BlockingFunction; +import com.clubobsidian.dynamicgui.function.impl.DelayFunction; import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; @@ -351,7 +351,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new IsBedrockPlayerFunction("isbedrockplayer")); - FunctionManager.get().addFunction(new BlockingFunction("block")); + FunctionManager.get().addFunction(new DelayFunction()); } private void startPlayerCountTimer() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java index 0a8414b82..e588e2c7b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/BlockingFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java @@ -4,10 +4,10 @@ import com.clubobsidian.dynamicgui.function.Function; import org.apache.commons.lang3.math.NumberUtils; -public class BlockingFunction extends Function { +public class DelayFunction extends Function { - public BlockingFunction(String name) { - super(name); + public DelayFunction() { + super("delay"); } @Override From 483e30410f52e64129d9786f897def22fa7af480 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 4 Feb 2022 21:01:07 -0800 Subject: [PATCH 010/261] Refactor isAsync method Pass async via the constructor instead --- .../clubobsidian/dynamicgui/function/Function.java | 14 ++++++++++++-- .../dynamicgui/function/impl/DelayFunction.java | 7 +------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java index 4af7b8cbc..022a7a4f4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java @@ -31,12 +31,22 @@ public abstract class Function implements Cloneable, Serializable { private static final long serialVersionUID = 1492427006104061443L; private final String name; private String data; + private final boolean async; private FunctionOwner owner; private int index = -1; - public Function(String name, String data) { + public Function(String name, String data, boolean async) { this.name = StringFuzz.normalize(name); this.data = data; + this.async = async; + } + + public Function(String name, String data) { + this(name, data, false); + } + + public Function(String name, boolean async) { + this(name, null, async); } public Function(String name) { @@ -50,7 +60,7 @@ public Function(Function function) { public abstract boolean function(PlayerWrapper playerWrapper); public boolean isAsync() { - return false; + return this.async; } public String getName() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java index e588e2c7b..0a336b571 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java @@ -7,7 +7,7 @@ public class DelayFunction extends Function { public DelayFunction() { - super("delay"); + super("delay", true); } @Override @@ -23,9 +23,4 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } } - - @Override - public boolean isAsync() { - return true; - } } From 110d75725bab871253011a5240bd92a6d8bf47aa Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 00:13:15 -0800 Subject: [PATCH 011/261] Refactor FunctionUtil into FunctionManager Closes #222 --- .../dynamicgui/function/FunctionUtil.java | 170 ------------------ .../dynamicgui/listener/GuiListener.java | 6 +- .../listener/InventoryInteractListener.java | 4 +- .../manager/dynamicgui/FunctionManager.java | 142 +++++++++++++++ .../manager/dynamicgui/GuiManager.java | 6 +- .../manager/dynamicgui/SlotManager.java | 3 +- 6 files changed, 151 insertions(+), 180 deletions(-) delete mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java deleted file mode 100644 index 2c19de6a3..000000000 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/FunctionUtil.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2021 Club Obsidian and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.clubobsidian.dynamicgui.function; - -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.parser.function.FunctionData; -import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; -import com.clubobsidian.dynamicgui.parser.function.FunctionToken; -import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; -import com.clubobsidian.dynamicgui.util.ThreadUtil; - -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Queue; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -public final class FunctionUtil { - - private FunctionUtil() { - } - - public static CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { - return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper); - } - - private static CompletableFuture recurFunctionNodes(FunctionResponse fail, - FunctionOwner owner, - Collection functionNodes, - FunctionType type, - PlayerWrapper playerWrapper) { - Queue nodeQueue = new ArrayDeque<>(functionNodes); - CompletableFuture future = new CompletableFuture<>(); - FunctionNode node = nodeQueue.poll(); - if(node != null) { - FunctionToken functionToken = node.getToken(); - List types = functionToken.getTypes(); - if(types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { - if(type != FunctionType.FAIL) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { - if(!response.result) { - if(response.failedFunction == null) { - future.complete(false); - } else { - recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper) - .thenAccept((value) -> future.complete(false)); - } - } else { - recurFunctionNodes(response, owner, node.getChildren(), type, playerWrapper); - } - }); - } else if(type == FunctionType.FAIL) { - if(isFail(fail, functionToken)) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { - if(!response.result) { - recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper); - } - }); - } - } - } - } - future.complete(true); - return future; - } - - private static CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { - CompletableFuture response = new CompletableFuture<>(); - ThreadUtil.run(() -> { - for(int i = 0; i < functionDataList.size(); i++) { - FunctionData data = functionDataList.get(i); - String functionName = data.getName(); - String functionData = data.getData(); - Function function = FunctionManager.get().getFunctionByName(functionName); - if(function == null) { - DynamicGui.get().getLogger().error("Invalid function " + data.getName()); - response.complete(new FunctionResponse(false)); - return; - } - function.setOwner(owner); - - if(data.getData() != null) { - String newData = ReplacerManager.get().replace(functionData, playerWrapper); - function.setData(newData); - } - - boolean async = function.isAsync(); - List futureData = async ? new ArrayList<>(functionDataList.size()) : functionDataList; - if(async) { //Load functions into new arraylist if the function is async - for(int j = i + 1; j < functionDataList.size(); j++) { - futureData.add(functionDataList.get(j)); - } - } - ThreadUtil.run(() -> { - boolean ran = function.function(playerWrapper); - if(data.getModifier() == FunctionModifier.NOT) { - ran = !ran; - } - if(!ran) { - response.complete(new FunctionResponse(false, functionName, functionData)); - } else if (async) { - try { - response.complete(runFunctionData(owner, futureData, playerWrapper).get()); - } catch(InterruptedException | ExecutionException ex) { - ex.printStackTrace(); - } - } - }, async); - //Return if function is async since the async caller will hand - //control back to this method after completion or the function will - //fail and then complete - if(async) { - return; - } - } - response.complete(new FunctionResponse(true)); - }, false); - return response; - } - - private static boolean isFail(FunctionResponse response, FunctionToken token) { - for(FunctionData data : token.getFailOnFunctions()) { - if(data.getName().equals(response.failedFunction)) { - if(data.getData() == null) { - return true; - } else if(data.getData().equals(response.data)) { - return true; - } - } - } - - return false; - } - - private static class FunctionResponse { - private final boolean result; - private final String failedFunction; - private final String data; - - public FunctionResponse(boolean result) { - this(result, null, null); - } - - public FunctionResponse(boolean result, String failedFunction, String data) { - this.result = result; - this.failedFunction = failedFunction; - this.data = data; - } - } -} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java index 32abb8741..e093f5ada 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java @@ -19,9 +19,9 @@ import com.clubobsidian.dynamicgui.event.inventory.GuiLoadEvent; import com.clubobsidian.dynamicgui.event.inventory.InventoryCloseEvent; import com.clubobsidian.dynamicgui.gui.Gui; +import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.function.FunctionUtil; import com.clubobsidian.trident.EventHandler; import java.util.HashSet; @@ -45,7 +45,7 @@ public void onGuiOpen(GuiLoadEvent event) { if(open) { UUID uuid = wrapper.getUniqueId(); this.users.add(uuid); - FunctionUtil.tryFunctions(gui, FunctionType.SWITCH_MENU, playerWrapper); + FunctionManager.get().tryFunctions(gui, FunctionType.SWITCH_MENU, playerWrapper); } } @@ -56,7 +56,7 @@ public void onClose(InventoryCloseEvent event) { if(!this.users.remove(uuid)) { Gui gui = GuiManager.get().getCurrentGui(playerWrapper); if(gui != null) { - FunctionUtil.tryFunctions(gui, FunctionType.EXIT_MENU, playerWrapper); + FunctionManager.get().tryFunctions(gui, FunctionType.EXIT_MENU, playerWrapper); } } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java index d2d209d46..f57d12dd1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java @@ -24,10 +24,10 @@ import com.clubobsidian.dynamicgui.gui.Slot; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; -import com.clubobsidian.dynamicgui.function.FunctionUtil; import com.clubobsidian.trident.EventHandler; import java.util.Iterator; @@ -71,7 +71,7 @@ public void invClick(final InventoryClickEvent e) { List functions = slot.getFunctions().getRootNodes(); if(functions.size() > 0) { String clickString = e.getClick().toString(); - FunctionUtil.tryFunctions(slot, FunctionType.valueOf(clickString), player); + FunctionManager.get().tryFunctions(slot, FunctionType.valueOf(clickString), player); } if(!slot.isMoveable()) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java index 060bba63d..1d4d8491a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java @@ -15,13 +15,27 @@ */ package com.clubobsidian.dynamicgui.manager.dynamicgui; +import com.clubobsidian.dynamicgui.DynamicGui; +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.parser.function.FunctionData; +import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; +import com.clubobsidian.dynamicgui.parser.function.FunctionToken; +import com.clubobsidian.dynamicgui.parser.function.FunctionType; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; +import com.clubobsidian.dynamicgui.util.ThreadUtil; import com.clubobsidian.fuzzutil.StringFuzz; +import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Queue; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; public class FunctionManager { @@ -64,4 +78,132 @@ public boolean removeFunctionByName(String functionName) { String normalized = StringFuzz.normalize(functionName); return this.functions.keySet().remove(normalized); } + + public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { + return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper); + } + + private CompletableFuture recurFunctionNodes(FunctionResponse fail, + FunctionOwner owner, + Collection functionNodes, + FunctionType type, + PlayerWrapper playerWrapper) { + Queue nodeQueue = new ArrayDeque<>(functionNodes); + CompletableFuture future = new CompletableFuture<>(); + FunctionNode node = nodeQueue.poll(); + if(node != null) { + FunctionToken functionToken = node.getToken(); + List types = functionToken.getTypes(); + if(types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { + if(type != FunctionType.FAIL) { + runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { + if(!response.result) { + if(response.failedFunction == null) { + future.complete(false); + } else { + recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper) + .thenAccept((value) -> future.complete(false)); + } + } else { + recurFunctionNodes(response, owner, node.getChildren(), type, playerWrapper); + } + }); + } else if(type == FunctionType.FAIL) { + if(isFail(fail, functionToken)) { + runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { + if(!response.result) { + recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper); + } + }); + } + } + } + } + future.complete(true); + return future; + } + + private CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { + CompletableFuture response = new CompletableFuture<>(); + ThreadUtil.run(() -> { + for(int i = 0; i < functionDataList.size(); i++) { + FunctionData data = functionDataList.get(i); + String functionName = data.getName(); + String functionData = data.getData(); + Function function = FunctionManager.get().getFunctionByName(functionName); + if(function == null) { + DynamicGui.get().getLogger().error("Invalid function " + data.getName()); + response.complete(new FunctionResponse(false)); + return; + } + function.setOwner(owner); + + if(data.getData() != null) { + String newData = ReplacerManager.get().replace(functionData, playerWrapper); + function.setData(newData); + } + + boolean async = function.isAsync(); + List futureData = async ? new ArrayList<>(functionDataList.size()) : functionDataList; + if(async) { //Load functions into new arraylist if the function is async + for(int j = i + 1; j < functionDataList.size(); j++) { + futureData.add(functionDataList.get(j)); + } + } + ThreadUtil.run(() -> { + boolean ran = function.function(playerWrapper); + if(data.getModifier() == FunctionModifier.NOT) { + ran = !ran; + } + if(!ran) { + response.complete(new FunctionResponse(false, functionName, functionData)); + } else if (async) { + try { + response.complete(runFunctionData(owner, futureData, playerWrapper).get()); + } catch(InterruptedException | ExecutionException ex) { + ex.printStackTrace(); + } + } + }, async); + //Return if function is async since the async caller will hand + //control back to this method after completion or the function will + //fail and then complete + if(async) { + return; + } + } + response.complete(new FunctionResponse(true)); + }, false); + return response; + } + + private boolean isFail(FunctionResponse response, FunctionToken token) { + for(FunctionData data : token.getFailOnFunctions()) { + if(data.getName().equals(response.failedFunction)) { + if(data.getData() == null) { + return true; + } else if(data.getData().equals(response.data)) { + return true; + } + } + } + + return false; + } + + private class FunctionResponse { + private final boolean result; + private final String failedFunction; + private final String data; + + public FunctionResponse(boolean result) { + this(result, null, null); + } + + public FunctionResponse(boolean result, String failedFunction, String data) { + this.result = result; + this.failedFunction = failedFunction; + this.data = data; + } + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java index e9670eb06..84be6718c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java @@ -36,7 +36,7 @@ import com.clubobsidian.dynamicgui.server.FakeServer; import com.clubobsidian.dynamicgui.server.ServerType; import com.clubobsidian.dynamicgui.util.ChatColor; -import com.clubobsidian.dynamicgui.function.FunctionUtil; + import com.clubobsidian.dynamicgui.util.HashUtil; import com.clubobsidian.dynamicgui.util.ThreadUtil; import com.clubobsidian.dynamicgui.world.LocationWrapper; @@ -196,7 +196,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu DynamicGui.get().getEventBus().callEvent(preloadEvent); //Run gui load functions - CompletableFuture result = FunctionUtil.tryFunctions(clonedGui, FunctionType.LOAD, playerWrapper); + CompletableFuture result = FunctionManager.get().tryFunctions(clonedGui, FunctionType.LOAD, playerWrapper); result.thenAccept((ran) -> ThreadUtil.run(() -> { GuiLoadEvent event = new GuiLoadEvent(clonedGui, playerWrapper); if(!ran) { @@ -209,7 +209,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu //Run slot load functions for(Slot slot : clonedGui.getSlots()) { - FunctionUtil.tryFunctions(slot, FunctionType.LOAD, playerWrapper); + FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper); } if(inventoryWrapper == null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java index 7538cc671..2af9d5298 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java @@ -22,7 +22,6 @@ import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.function.FunctionUtil; import java.util.Iterator; import java.util.Map.Entry; @@ -66,7 +65,7 @@ private void updateSlots() { InventoryWrapper inventoryWrapper = slot.getOwner().getInventoryWrapper(); inventoryWrapper.setItem(slotIndex, itemStackWrapper); - FunctionUtil.tryFunctions(slot, FunctionType.LOAD, playerWrapper); + FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper); if(!slot.getItemStack().getType().equalsIgnoreCase(Slot.IGNORE_MATERIAL)) { inventoryWrapper.updateItem(slotIndex, playerWrapper); } From 8f0c7fe90cb1d908cb65dd2fef7bb84fb7d67db3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 01:15:58 -0800 Subject: [PATCH 012/261] Create test framework --- build.gradle | 1 + .../function/impl/AddPermissionFunction.java | 3 ++ .../function/AddPermissionFunctionTest.java | 20 ++++++++ .../dynamicgui/test/mock/MockFactory.java | 21 +++++++++ .../dynamicgui/test/mock/MockPlayer.java | 47 +++++++++++++++++++ .../test/mock/MockPlayerWrapper.java | 34 ++++++++++++++ .../dynamicgui/test/mock/package-info.java | 1 + .../dynamicgui/test/package-info.java | 1 + 8 files changed, 128 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java diff --git a/build.gradle b/build.gradle index 34ebf7ea5..e20ae4da0 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,7 @@ subprojects { dependencies { testImplementation 'junit:junit:4.13.2' + testImplementation 'org.mockito:mockito-core:4.3.1' api 'org.apache.commons:commons-lang3:3.12.0' api 'com.github.clubobsidian:wrappy:2.3.2' } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java index c2352c31b..d0a84306a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java @@ -31,6 +31,9 @@ public AddPermissionFunction(String name) { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } return playerWrapper.addPermission(this.getData()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java new file mode 100644 index 000000000..06ef2c22d --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java @@ -0,0 +1,20 @@ +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.AddPermissionFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; + +public class AddPermissionFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testNullPermission() { + Function function = new AddPermissionFunction("addpermission"); + assertFalse(function.function(this.factory.createPlayer())); + } + +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java new file mode 100644 index 000000000..ad7103cca --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -0,0 +1,21 @@ +package com.clubobsidian.dynamicgui.test.mock; + +import org.mockito.Mockito; + +public class MockFactory { + + public T mock(Class mockClazz) { + return Mockito.mock(mockClazz, Mockito.withSettings() + .useConstructor() + .defaultAnswer(Mockito.CALLS_REAL_METHODS)); + } + + public T mock(Class mockClazz, Object... args) { + return Mockito.mock(mockClazz, Mockito.withSettings().useConstructor(args) + .defaultAnswer(Mockito.CALLS_REAL_METHODS)); + } + + public MockPlayerWrapper createPlayer() { + return this.mock(MockPlayerWrapper.class); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java new file mode 100644 index 000000000..5d747d796 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java @@ -0,0 +1,47 @@ +package com.clubobsidian.dynamicgui.test.mock; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.UUID; + +public class MockPlayer { + + private final String name; + private final UUID uuid; + private final List incomingChat = new ArrayList<>(); + private final List outgoingChat = new ArrayList<>(); + + public MockPlayer(String name, UUID uuid) { + this.name = name; + this.uuid = uuid; + } + + public MockPlayer() { + this("test", UUID.randomUUID()); + } + + public String getName() { + return this.name; + } + + public UUID getUniqueId() { + return this.uuid; + } + + public void chat(String message) { + this.outgoingChat.add(message); + } + + public void sendMessage(String message) { + this.incomingChat.add(message); + } + + public List getIncomingChat() { + return this.incomingChat; + } + + public List getOutgoingChat() { + return this.outgoingChat; + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java new file mode 100644 index 000000000..c24957162 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java @@ -0,0 +1,34 @@ +package com.clubobsidian.dynamicgui.test.mock; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; + +import java.util.UUID; + +public abstract class MockPlayerWrapper extends PlayerWrapper { + + public MockPlayerWrapper() { + this(new MockPlayer()); + } + + public MockPlayerWrapper(MockPlayer player) { + super(player); + } + + public String getName() { + return this.getPlayer().getName(); + } + + public UUID getUniqueId() { + return this.getPlayer().getUniqueId(); + } + + public void chat(String message) { + this.getPlayer().chat(message); + } + + public void sendMessage(String message) { + this.getPlayer().sendMessage(message); + } + + +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java new file mode 100644 index 000000000..3a7fe7085 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java @@ -0,0 +1 @@ +package com.clubobsidian.dynamicgui.test.mock; \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java new file mode 100644 index 000000000..18c7f9dc3 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java @@ -0,0 +1 @@ +package com.clubobsidian.dynamicgui.test; \ No newline at end of file From 2456ecd52d87b360eebef196722bbf6073651bf7 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 01:39:31 -0800 Subject: [PATCH 013/261] Refactor name into function, add aliasing Refactored the name into each function class instead of constructing the function with the name in the DynamicGui class. As a result aliasing is now also implemented so that functions can have a name and then multiple aliases as well --- .../clubobsidian/dynamicgui/DynamicGui.java | 126 +++++++++--------- .../dynamicgui/function/Function.java | 25 +++- .../function/impl/AddPermissionFunction.java | 4 +- .../impl/CheckItemTypeInHandFunction.java | 4 +- .../function/impl/CheckLevelFunction.java | 10 +- .../function/impl/CheckMoveableFunction.java | 4 +- .../impl/CheckPlayerWorldFunction.java | 4 +- .../function/impl/ConsoleCmdFunction.java | 4 +- .../function/impl/GetGameRuleFunction.java | 4 +- .../impl/IsBedrockPlayerFunction.java | 4 +- .../dynamicgui/function/impl/LogFunction.java | 4 +- .../function/impl/MoneyBalanceFunction.java | 4 +- .../function/impl/MoneyDepositFunction.java | 4 +- .../function/impl/MoneyWithdrawFunction.java | 4 +- .../function/impl/NoPermissionFunction.java | 4 +- .../function/impl/ParticleFunction.java | 4 +- .../function/impl/PermissionFunction.java | 4 +- .../function/impl/PlayerCmdFunction.java | 4 +- .../function/impl/PlayerMiniMsgFunction.java | 4 +- .../function/impl/PlayerMsgFunction.java | 4 +- .../function/impl/RandomFunction.java | 4 +- .../impl/RemovePermissionFunction.java | 4 +- .../function/impl/RemoveSlotFunction.java | 4 +- .../function/impl/ResetFrameFunction.java | 4 +- .../function/impl/ResetTickFunction.java | 4 +- .../function/impl/SendFunction.java | 4 +- .../impl/ServerBroadcastFunction.java | 4 +- .../impl/ServerMiniBroadcastFunction.java | 4 +- .../function/impl/SetAmountFunction.java | 4 +- .../function/impl/SetCloseFunction.java | 4 +- .../function/impl/SetDataFunction.java | 4 +- .../function/impl/SetEnchantsFunction.java | 4 +- .../function/impl/SetGameRuleFunction.java | 4 +- .../function/impl/SetGlowFunction.java | 4 +- .../function/impl/SetLoreFunction.java | 5 +- .../function/impl/SetMoveableFunction.java | 4 +- .../function/impl/SetNBTFunction.java | 4 +- .../function/impl/SetNameFunction.java | 4 +- .../function/impl/SetTypeFunction.java | 4 +- .../function/impl/SoundFunction.java | 4 +- .../function/impl/StatisticFunction.java | 4 +- .../impl/condition/CheckTickFunction.java | 4 +- .../impl/condition/ConditionFunction.java | 4 +- .../cooldown/IsNotOnCooldownFunction.java | 4 +- .../impl/cooldown/IsOnCooldownFunction.java | 4 +- .../impl/cooldown/SetCooldownFunction.java | 4 +- .../function/impl/gui/BackFunction.java | 4 +- .../function/impl/gui/GuiFunction.java | 4 +- .../function/impl/gui/HasBackFunction.java | 4 +- .../function/impl/gui/RefreshGuiFunction.java | 4 +- .../impl/gui/RefreshSlotFunction.java | 4 +- .../function/impl/gui/SetBackFunction.java | 4 +- .../impl/meta/CopyBackMetadataFunction.java | 4 +- .../impl/meta/HasMetadataFunction.java | 4 +- .../impl/meta/SetMetadataFunction.java | 4 +- .../manager/dynamicgui/FunctionManager.java | 8 +- .../function/AddPermissionFunctionTest.java | 2 +- 57 files changed, 198 insertions(+), 182 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index ba3fd9ca5..c57a04f1d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -281,75 +281,73 @@ private void registerListeners() { } private void loadFunctions() { - FunctionManager.get().addFunction(new CheckTickFunction("checktick")); - FunctionManager.get().addFunction(new ConditionFunction("condition")); - FunctionManager.get().addFunction(new ResetFrameFunction("resetframe")); - FunctionManager.get().addFunction(new ResetTickFunction("resettick")); + FunctionManager.get().addFunction(new CheckTickFunction()); + FunctionManager.get().addFunction(new ConditionFunction()); + FunctionManager.get().addFunction(new ResetFrameFunction()); + FunctionManager.get().addFunction(new ResetTickFunction()); - FunctionManager.get().addFunction(new ConsoleCmdFunction("executec")); - FunctionManager.get().addFunction(new PlayerCmdFunction("executep")); + FunctionManager.get().addFunction(new ConsoleCmdFunction()); + FunctionManager.get().addFunction(new PlayerCmdFunction()); //FunctionApi.get().addFunction(new ExpPayFunction("payexp")); - FunctionManager.get().addFunction(new SetCooldownFunction("setcooldown")); - FunctionManager.get().addFunction(new IsOnCooldownFunction("isoncooldown")); - FunctionManager.get().addFunction(new IsNotOnCooldownFunction("isnotoncooldown")); - - FunctionManager.get().addFunction(new GuiFunction("gui")); - FunctionManager.get().addFunction(new BackFunction("back")); - FunctionManager.get().addFunction(new HasBackFunction("hasback")); - FunctionManager.get().addFunction(new SetBackFunction("setback")); - - FunctionManager.get().addFunction(new RefreshGuiFunction("refreshgui")); - FunctionManager.get().addFunction(new RefreshSlotFunction("refreshslot")); - - FunctionManager.get().addFunction(new MoneyWithdrawFunction("moneywithdraw")); - FunctionManager.get().addFunction(new MoneyDepositFunction("moneydeposit")); - FunctionManager.get().addFunction(new MoneyBalanceFunction("moneybalance")); - - FunctionManager.get().addFunction(new NoPermissionFunction("nopermission")); - FunctionManager.get().addFunction(new PermissionFunction("permission")); - FunctionManager.get().addFunction(new PermissionFunction("haspermission")); - FunctionManager.get().addFunction(new AddPermissionFunction("addpermission")); - FunctionManager.get().addFunction(new RemovePermissionFunction("removepermission")); - FunctionManager.get().addFunction(new PlayerMsgFunction("pmsg")); - FunctionManager.get().addFunction(new RandomFunction("random")); - FunctionManager.get().addFunction(new SendFunction("send")); - FunctionManager.get().addFunction(new ServerBroadcastFunction("broadcast")); - FunctionManager.get().addFunction(new ParticleFunction("particles")); - FunctionManager.get().addFunction(new SoundFunction("sound")); - FunctionManager.get().addFunction(new SetNameFunction("setname")); - FunctionManager.get().addFunction(new SetLoreFunction("setlore")); - FunctionManager.get().addFunction(new SetTypeFunction("settype")); - FunctionManager.get().addFunction(new SetDataFunction("setdata")); - FunctionManager.get().addFunction(new SetAmountFunction("setamount")); - FunctionManager.get().addFunction(new SetNBTFunction("setnbt")); - FunctionManager.get().addFunction(new SetGlowFunction("setglow")); - FunctionManager.get().addFunction(new CheckMoveableFunction("checkmoveable")); - FunctionManager.get().addFunction(new SetMoveableFunction("setmoveable")); - FunctionManager.get().addFunction(new SetEnchantsFunction("setenchants")); - FunctionManager.get().addFunction(new SetCloseFunction("setclose")); - FunctionManager.get().addFunction(new RemoveSlotFunction("removeslot")); - FunctionManager.get().addFunction(new StatisticFunction("statistic")); - FunctionManager.get().addFunction(new CheckLevelFunction("checklevel")); - FunctionManager.get().addFunction(new LogFunction("log")); - - FunctionManager.get().addFunction(new CheckItemTypeInHandFunction("checkitemtypeinhand")); - - FunctionManager.get().addFunction(new SetGameRuleFunction("setgamerule")); - FunctionManager.get().addFunction(new GetGameRuleFunction("getgamerule")); - - FunctionManager.get().addFunction(new CheckPlayerWorldFunction("checkplayerworld")); - - FunctionManager.get().addFunction(new PlayerMiniMsgFunction("minimsg")); - FunctionManager.get().addFunction(new ServerMiniBroadcastFunction("minibroadcast")); - - FunctionManager.get().addFunction(new HasMetadataFunction("hasmetadata")); - FunctionManager.get().addFunction(new HasMetadataFunction("getmetadata")); - FunctionManager.get().addFunction(new SetMetadataFunction("setmetadata")); + FunctionManager.get().addFunction(new SetCooldownFunction()); + FunctionManager.get().addFunction(new IsOnCooldownFunction()); + FunctionManager.get().addFunction(new IsNotOnCooldownFunction()); + + FunctionManager.get().addFunction(new GuiFunction()); + FunctionManager.get().addFunction(new BackFunction()); + FunctionManager.get().addFunction(new HasBackFunction()); + FunctionManager.get().addFunction(new SetBackFunction()); + + FunctionManager.get().addFunction(new RefreshGuiFunction()); + FunctionManager.get().addFunction(new RefreshSlotFunction()); + + FunctionManager.get().addFunction(new MoneyWithdrawFunction()); + FunctionManager.get().addFunction(new MoneyDepositFunction()); + FunctionManager.get().addFunction(new MoneyBalanceFunction()); + + FunctionManager.get().addFunction(new NoPermissionFunction()); + FunctionManager.get().addFunction(new PermissionFunction()); + FunctionManager.get().addFunction(new AddPermissionFunction()); + FunctionManager.get().addFunction(new RemovePermissionFunction()); + FunctionManager.get().addFunction(new PlayerMsgFunction()); + FunctionManager.get().addFunction(new RandomFunction()); + FunctionManager.get().addFunction(new SendFunction()); + FunctionManager.get().addFunction(new ServerBroadcastFunction()); + FunctionManager.get().addFunction(new ParticleFunction()); + FunctionManager.get().addFunction(new SoundFunction()); + FunctionManager.get().addFunction(new SetNameFunction()); + FunctionManager.get().addFunction(new SetLoreFunction()); + FunctionManager.get().addFunction(new SetTypeFunction()); + FunctionManager.get().addFunction(new SetDataFunction()); + FunctionManager.get().addFunction(new SetAmountFunction()); + FunctionManager.get().addFunction(new SetNBTFunction()); + FunctionManager.get().addFunction(new SetGlowFunction()); + FunctionManager.get().addFunction(new CheckMoveableFunction()); + FunctionManager.get().addFunction(new SetMoveableFunction()); + FunctionManager.get().addFunction(new SetEnchantsFunction()); + FunctionManager.get().addFunction(new SetCloseFunction()); + FunctionManager.get().addFunction(new RemoveSlotFunction()); + FunctionManager.get().addFunction(new StatisticFunction()); + FunctionManager.get().addFunction(new CheckLevelFunction()); + FunctionManager.get().addFunction(new LogFunction()); + + FunctionManager.get().addFunction(new CheckItemTypeInHandFunction()); + + FunctionManager.get().addFunction(new SetGameRuleFunction()); + FunctionManager.get().addFunction(new GetGameRuleFunction()); + + FunctionManager.get().addFunction(new CheckPlayerWorldFunction()); + + FunctionManager.get().addFunction(new PlayerMiniMsgFunction()); + FunctionManager.get().addFunction(new ServerMiniBroadcastFunction()); + + FunctionManager.get().addFunction(new HasMetadataFunction()); + FunctionManager.get().addFunction(new SetMetadataFunction()); FunctionManager.get().addFunction(new IsGuiMetadataSet()); - FunctionManager.get().addFunction(new CopyBackMetadataFunction("copybackmetadata")); + FunctionManager.get().addFunction(new CopyBackMetadataFunction()); - FunctionManager.get().addFunction(new IsBedrockPlayerFunction("isbedrockplayer")); + FunctionManager.get().addFunction(new IsBedrockPlayerFunction()); FunctionManager.get().addFunction(new DelayFunction()); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java index 022a7a4f4..0873cb03b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java @@ -29,24 +29,33 @@ public abstract class Function implements Cloneable, Serializable { * */ private static final long serialVersionUID = 1492427006104061443L; + + private static String[] normalizeAliases(String[] aliases) { + for(int i = 0; i < aliases.length; i++) { + aliases[i] = StringFuzz.normalize(aliases[i]); + } + return aliases; + } + private final String name; private String data; private final boolean async; private FunctionOwner owner; + private final String[] aliases; private int index = -1; - public Function(String name, String data, boolean async) { + public Function(String name, String[] aliases, boolean async) { this.name = StringFuzz.normalize(name); - this.data = data; + this.aliases = normalizeAliases(aliases); this.async = async; } - public Function(String name, String data) { - this(name, data, false); + public Function(String name, boolean async) { + this(name, new String[0], async); } - public Function(String name, boolean async) { - this(name, null, async); + public Function(String... aliases) { + this(aliases[0], aliases, false); } public Function(String name) { @@ -67,6 +76,10 @@ public String getName() { return this.name; } + public String[] getAliases() { + return this.aliases; + } + public String getData() { return this.data; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java index d0a84306a..e46244d36 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java @@ -25,8 +25,8 @@ public class AddPermissionFunction extends Function { */ private static final long serialVersionUID = 6578996849784218130L; - public AddPermissionFunction(String name) { - super(name); + public AddPermissionFunction() { + super("addpermission"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java index 0532fac3a..d1bdc15f8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java @@ -30,8 +30,8 @@ public class CheckItemTypeInHandFunction extends Function { */ private static final long serialVersionUID = -2308186311331769892L; - public CheckItemTypeInHandFunction(String name) { - super(name); + public CheckItemTypeInHandFunction() { + super("checkitemtypeinhand"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java index 653506023..4f74a4d85 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java @@ -25,20 +25,20 @@ public class CheckLevelFunction extends Function { */ private static final long serialVersionUID = 4927665292013293816L; - public CheckLevelFunction(String name) { - super(name); + public CheckLevelFunction() { + super("checklevel"); } @Override public boolean function(PlayerWrapper playerWrapper) { - int level = -1; try { - level = Integer.parseInt(this.getData()); + int level = Integer.parseInt(this.getData()); + return playerWrapper.getLevel() >= level; } catch(NumberFormatException ex) { ex.printStackTrace(); return false; } - return playerWrapper.getLevel() >= level; + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java index 527d06486..e305fdb34 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java @@ -28,8 +28,8 @@ public class CheckMoveableFunction extends Function { */ private static final long serialVersionUID = 1037806025228025407L; - public CheckMoveableFunction(String name) { - super(name); + public CheckMoveableFunction() { + super("checkmoveable"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java index fb13cd3e4..10458d0e9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java @@ -26,8 +26,8 @@ public class CheckPlayerWorldFunction extends Function { */ private static final long serialVersionUID = -7760274986999938696L; - public CheckPlayerWorldFunction(String name) { - super(name); + public CheckPlayerWorldFunction() { + super("checkplayerworld"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java index 8e305bc63..32127f746 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java @@ -27,8 +27,8 @@ public class ConsoleCmdFunction extends Function { */ private static final long serialVersionUID = -4802600274176592465L; - public ConsoleCmdFunction(String name) { - super(name); + public ConsoleCmdFunction() { + super("executec"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java index a1f9cc36f..a2ad27e81 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java @@ -28,8 +28,8 @@ public class GetGameRuleFunction extends Function { */ private static final long serialVersionUID = -5840073572003297982L; - public GetGameRuleFunction(String name) { - super(name); + public GetGameRuleFunction() { + super("getgamerule"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java index b98acf2a2..493be73ec 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java @@ -23,8 +23,8 @@ public class IsBedrockPlayerFunction extends Function { private static final long serialVersionUID = -2186429958998223776L; - public IsBedrockPlayerFunction(String name) { - super(name); + public IsBedrockPlayerFunction() { + super("isbedrockplayer"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java index b96aa8678..53e16167b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java @@ -26,8 +26,8 @@ public class LogFunction extends Function { */ private static final long serialVersionUID = 848178368629667482L; - public LogFunction(String name) { - super(name); + public LogFunction() { + super("log", "logger"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java index 69893b26c..fdc23c9d2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java @@ -29,8 +29,8 @@ public class MoneyBalanceFunction extends Function { */ private static final long serialVersionUID = -2637510737725573158L; - public MoneyBalanceFunction(String name) { - super(name); + public MoneyBalanceFunction() { + super("moneybalance"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java index 18a958fa8..0104d7743 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java @@ -29,8 +29,8 @@ public class MoneyDepositFunction extends Function { */ private static final long serialVersionUID = -2637510737725573158L; - public MoneyDepositFunction(String name) { - super(name); + public MoneyDepositFunction() { + super("moneydeposit"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java index aac94f965..658b3f29d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java @@ -28,8 +28,8 @@ public class MoneyWithdrawFunction extends Function { */ private static final long serialVersionUID = -8941864727381394744L; - public MoneyWithdrawFunction(String name) { - super(name); + public MoneyWithdrawFunction() { + super("moneywithdraw"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java index 12973702a..1f9357ed4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java @@ -25,8 +25,8 @@ public class NoPermissionFunction extends Function { */ private static final long serialVersionUID = 6907686728880861860L; - public NoPermissionFunction(String name) { - super(name); + public NoPermissionFunction() { + super("nopermission"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java index 8fa503fcd..f227ec5c0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java @@ -26,8 +26,8 @@ public class ParticleFunction extends Function { */ private static final long serialVersionUID = 6719256169872302172L; - public ParticleFunction(String name) { - super(name); + public ParticleFunction() { + super("particles", "particle"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java index 16fa7882a..a7b1aaeaf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java @@ -25,8 +25,8 @@ public class PermissionFunction extends Function { */ private static final long serialVersionUID = 6578996849784218130L; - public PermissionFunction(String name) { - super(name); + public PermissionFunction() { + super("permission", "haspermission"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java index eb41e7638..6dfda824b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java @@ -26,8 +26,8 @@ public class PlayerCmdFunction extends Function { */ private static final long serialVersionUID = 220426382325192292L; - public PlayerCmdFunction(String name) { - super(name); + public PlayerCmdFunction() { + super("executep"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java index 450f58bde..e5fc3e519 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java @@ -27,8 +27,8 @@ public class PlayerMiniMsgFunction extends Function { */ private static final long serialVersionUID = 9216295481570082778L; - public PlayerMiniMsgFunction(String name) { - super(name); + public PlayerMiniMsgFunction() { + super("minimsg"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java index ce392e0b7..90b8d90d3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java @@ -27,8 +27,8 @@ public class PlayerMsgFunction extends Function { */ private static final long serialVersionUID = 6244543904061733902L; - public PlayerMsgFunction(String name) { - super(name); + public PlayerMsgFunction() { + super("msg", "pmsg"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java index c65e43604..83df6242a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java @@ -27,8 +27,8 @@ public class RandomFunction extends Function { */ private static final long serialVersionUID = -8056953555096911217L; - public RandomFunction(String name) { - super(name); + public RandomFunction() { + super("random", "rand"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java index 9b41a815e..da529cf4e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java @@ -25,8 +25,8 @@ public class RemovePermissionFunction extends Function { */ private static final long serialVersionUID = 6578996849784218130L; - public RemovePermissionFunction(String name) { - super(name); + public RemovePermissionFunction() { + super("removepermission"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java index 795e0d03e..a890513ca 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java @@ -30,8 +30,8 @@ public class RemoveSlotFunction extends Function { */ private static final long serialVersionUID = -88925446185236878L; - public RemoveSlotFunction(String name) { - super(name); + public RemoveSlotFunction() { + super("removeslot"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java index d3d9f77f4..15573a168 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java @@ -26,8 +26,8 @@ public class ResetFrameFunction extends Function { */ private static final long serialVersionUID = -2386244760460728686L; - public ResetFrameFunction(String name) { - super(name); + public ResetFrameFunction() { + super("resetframe"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java index 54145edf7..d68c2c5c5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java @@ -26,8 +26,8 @@ public class ResetTickFunction extends Function { */ private static final long serialVersionUID = 6376946053337191934L; - public ResetTickFunction(String name) { - super(name); + public ResetTickFunction() { + super("resettick"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java index 3031ad51f..c8a2885e0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java @@ -26,8 +26,8 @@ public class SendFunction extends Function { */ private static final long serialVersionUID = 2329250573729355253L; - public SendFunction(String name) { - super(name); + public SendFunction() { + super("send"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java index 709ac4a44..39782ff33 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java @@ -29,8 +29,8 @@ public class ServerBroadcastFunction extends Function { */ private static final long serialVersionUID = 8252199196221271208L; - public ServerBroadcastFunction(String name) { - super(name); + public ServerBroadcastFunction() { + super("broadcast"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java index 7a967ca1a..d280bbe12 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java @@ -28,8 +28,8 @@ public class ServerMiniBroadcastFunction extends Function { */ private static final long serialVersionUID = 9216295481570082778L; - public ServerMiniBroadcastFunction(String name) { - super(name); + public ServerMiniBroadcastFunction() { + super("minibroadcast"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java index 0194589bd..064481ee0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java @@ -31,8 +31,8 @@ public class SetAmountFunction extends Function { */ private static final long serialVersionUID = 6943230273788425141L; - public SetAmountFunction(String name) { - super(name); + public SetAmountFunction() { + super("setamount"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java index 0e2eab335..6ae4b540c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java @@ -28,8 +28,8 @@ public class SetCloseFunction extends Function { */ private static final long serialVersionUID = -5671625221707551692L; - public SetCloseFunction(String name) { - super(name); + public SetCloseFunction() { + super("setclose"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java index 8c538407a..435b16d67 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java @@ -31,8 +31,8 @@ public class SetDataFunction extends Function { */ private static final long serialVersionUID = 6943230273788425141L; - public SetDataFunction(String name) { - super(name); + public SetDataFunction() { + super("setdata"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java index e3872847c..2262b45ee 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java @@ -35,8 +35,8 @@ public class SetEnchantsFunction extends Function { */ private static final long serialVersionUID = 8291956007296368761L; - public SetEnchantsFunction(String name) { - super(name); + public SetEnchantsFunction() { + super("setenchants"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java index a29ae30d6..405a348d8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java @@ -27,8 +27,8 @@ public class SetGameRuleFunction extends Function { */ private static final long serialVersionUID = 664632502310692150L; - public SetGameRuleFunction(String name) { - super(name); + public SetGameRuleFunction() { + super("setgamerule"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java index 0fa912051..b845c4882 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java @@ -31,8 +31,8 @@ public class SetGlowFunction extends Function { */ private static final long serialVersionUID = -3727112026677117024L; - public SetGlowFunction(String name) { - super(name); + public SetGlowFunction() { + super("setglow"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java index 7eba63d03..020105903 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java @@ -37,8 +37,8 @@ public class SetLoreFunction extends Function { */ private static final long serialVersionUID = -6723628078978301156L; - public SetLoreFunction(String name) { - super(name); + public SetLoreFunction() { + super("setlore"); } @Override @@ -52,7 +52,6 @@ public boolean function(PlayerWrapper playerWrapper) { InventoryWrapper inv = gui.getInventoryWrapper(); if(inv != null) { ItemStackWrapper item = slot.getItemStack(); - List lore = new ArrayList<>(); if(this.getData() == null) { lore = null; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java index 7fe04c478..12ee535ce 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java @@ -29,8 +29,8 @@ public class SetMoveableFunction extends Function { */ private static final long serialVersionUID = 453447798953153174L; - public SetMoveableFunction(String name) { - super(name); + public SetMoveableFunction() { + super("setmoveable"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java index bf319e3ef..4b2759151 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java @@ -30,8 +30,8 @@ public class SetNBTFunction extends Function { */ private static final long serialVersionUID = 6943230273788425141L; - public SetNBTFunction(String name) { - super(name); + public SetNBTFunction() { + super("setnbt"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java index bc50c6a28..eb2410b7b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java @@ -33,8 +33,8 @@ public class SetNameFunction extends Function { */ private static final long serialVersionUID = -5599516930903780834L; - public SetNameFunction(String name) { - super(name); + public SetNameFunction() { + super("setname"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java index 412ba02f6..ad2bdcd5f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java @@ -30,8 +30,8 @@ public class SetTypeFunction extends Function { */ private static final long serialVersionUID = 6943230273788425141L; - public SetTypeFunction(String name) { - super(name); + public SetTypeFunction() { + super("settype"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java index b70275c41..0d6bbfd6b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java @@ -26,8 +26,8 @@ public class SoundFunction extends Function { */ private static final long serialVersionUID = -8363807525418126179L; - public SoundFunction(String name) { - super(name); + public SoundFunction() { + super("sound"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java index 5c35c0375..e76ec37b5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java @@ -27,8 +27,8 @@ public class StatisticFunction extends Function { */ private static final long serialVersionUID = -8624786841614185001L; - public StatisticFunction(String name) { - super(name); + public StatisticFunction() { + super("statistic"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java index f40263160..646e0ad12 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java @@ -28,8 +28,8 @@ public class CheckTickFunction extends Function { */ private static final long serialVersionUID = 9209750645416892269L; - public CheckTickFunction(String name) { - super(name); + public CheckTickFunction() { + super("checktick"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java index 5a31f1c96..c1067f512 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java @@ -29,8 +29,8 @@ public class ConditionFunction extends Function { */ private static final long serialVersionUID = -3905599553938205838L; - public ConditionFunction(String name) { - super(name); + public ConditionFunction() { + super("condition"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java index 8fde4f7dd..1e7d89adf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java @@ -27,8 +27,8 @@ public class IsNotOnCooldownFunction extends Function { */ private static final long serialVersionUID = 2369277150280303056L; - public IsNotOnCooldownFunction(String name) { - super(name); + public IsNotOnCooldownFunction() { + super("isnotoncooldown"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java index ac10a1eb4..20f73a99e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java @@ -27,8 +27,8 @@ public class IsOnCooldownFunction extends Function { */ private static final long serialVersionUID = 2369277150280303056L; - public IsOnCooldownFunction(String name) { - super(name); + public IsOnCooldownFunction() { + super("isoncooldown"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java index 52817e796..ab6d002fe 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java @@ -26,8 +26,8 @@ public class SetCooldownFunction extends Function { */ private static final long serialVersionUID = -3204581055961888388L; - public SetCooldownFunction(String name) { - super(name); + public SetCooldownFunction() { + super("setcooldown"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java index 31657622f..9c9df59a9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java @@ -31,8 +31,8 @@ public class BackFunction extends Function { */ private static final long serialVersionUID = 7851730396417693718L; - public BackFunction(String name) { - super(name); + public BackFunction() { + super("back"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java index 31cabb725..1fefbb28e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java @@ -31,8 +31,8 @@ public class GuiFunction extends Function { */ private static final long serialVersionUID = 848178368629667482L; - public GuiFunction(String name) { - super(name); + public GuiFunction() { + super("gui"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java index 564cf1ff3..40b80c1b9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java @@ -29,8 +29,8 @@ public class HasBackFunction extends Function { */ private static final long serialVersionUID = -6693867193877376679L; - public HasBackFunction(String name) { - super(name); + public HasBackFunction() { + super("hasback"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java index 9913e75d6..ea7e2edc4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java @@ -28,8 +28,8 @@ public class RefreshGuiFunction extends Function { */ private static final long serialVersionUID = -8608158103976585358L; - public RefreshGuiFunction(String name) { - super(name); + public RefreshGuiFunction() { + super("refreshgui"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java index 630294e1f..8dd96ffcc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java @@ -31,8 +31,8 @@ public class RefreshSlotFunction extends Function { */ private static final long serialVersionUID = 1079816229207205846L; - public RefreshSlotFunction(String name) { - super(name); + public RefreshSlotFunction() { + super("refreshslot"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java index 6984691a2..845185555 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java @@ -29,8 +29,8 @@ public class SetBackFunction extends Function { */ private static final long serialVersionUID = 4999698612673673935L; - public SetBackFunction(String name) { - super(name); + public SetBackFunction() { + super("setback"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java index bda145a0f..2e1fb7c30 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java @@ -25,8 +25,8 @@ public class CopyBackMetadataFunction extends Function { private static final long serialVersionUID = -4524513696416744522L; - public CopyBackMetadataFunction(String name) { - super(name); + public CopyBackMetadataFunction() { + super("copybackmetadata"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java index 21631fa72..ccd357971 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java @@ -31,8 +31,8 @@ public class HasMetadataFunction extends Function { */ private static final long serialVersionUID = -1651909249573158848L; - public HasMetadataFunction(String name) { - super(name); + public HasMetadataFunction() { + super("hasmetadata", "getmetadata"); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java index 042a8321e..cf10f1a3f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java @@ -31,8 +31,8 @@ public class SetMetadataFunction extends Function { */ private static final long serialVersionUID = -2376716466726111306L; - public SetMetadataFunction(String name) { - super(name); + public SetMetadataFunction() { + super("setmetadata"); } //SetMetadata (index/gui),key,value diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java index 1d4d8491a..ca43dde1b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java @@ -71,7 +71,13 @@ public List getFunctions() { } public boolean addFunction(Function function) { - return this.functions.put(function.getName(), function) != null; + boolean wasNotNull = this.functions.put(function.getName(), function) != null; + for(String alias : function.getAliases()) { + if(this.functions.put(alias, function) != null) { + wasNotNull = true; + } + } + return wasNotNull; } public boolean removeFunctionByName(String functionName) { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java index 06ef2c22d..c77ab48cc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java @@ -13,7 +13,7 @@ public class AddPermissionFunctionTest { @Test public void testNullPermission() { - Function function = new AddPermissionFunction("addpermission"); + Function function = new AddPermissionFunction(); assertFalse(function.function(this.factory.createPlayer())); } From 54f85053d4f97f8c1ea33f58b7794e692811b168 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 01:40:57 -0800 Subject: [PATCH 014/261] Drop javassist hack code Drop code checking for java 8 which then would use the javassist event bus or else it would fallback to the reflection event bus. Since we use the MethodHandleEventBus this is no longer needed. --- .../com/clubobsidian/dynamicgui/DynamicGui.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index c57a04f1d..b07aa0957 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -425,19 +425,6 @@ public Injector getInjector() { return this.injector; } - //Hack for checking for Java 8, temp work around for trident - /*private EventBus getVersionEventBus() - { - String version = System.getProperty("java.version"); - if(version.startsWith("1.8") && !this.useReflectionEventBus) - { - return new JavassistEventBus(); - } - - this.loggerWrapper.info("Falling back to the reflection eventbus for better compatability"); - return new ReflectionEventBus(); - }*/ - private Proxy findProxyByString(String proxyStr) { if(proxyStr.equalsIgnoreCase("bungee") || proxyStr.equalsIgnoreCase("bungeecord")) { return Proxy.BUNGEECORD; From c2d7a60cefd15acad1a8822238dfda62cb2a9958 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 01:50:49 -0800 Subject: [PATCH 015/261] Test AddPermissionFunction --- .../function/AddPermissionFunctionTest.java | 22 ++++++++++++++++++- .../dynamicgui/test/mock/MockPlayer.java | 11 ++++++++++ .../test/mock/MockPlayerWrapper.java | 8 ++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java index c77ab48cc..e91a1a62b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java @@ -1,11 +1,13 @@ package com.clubobsidian.dynamicgui.test.function; +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import org.junit.Test; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class AddPermissionFunctionTest { @@ -17,4 +19,22 @@ public void testNullPermission() { assertFalse(function.function(this.factory.createPlayer())); } -} + @Test + public void testPermissionAdded() { + String permission = "test"; + Function function = new AddPermissionFunction(); + function.setData(permission); + PlayerWrapper player = this.factory.createPlayer(); + assertTrue(function.function(player)); + } + + @Test + public void testPermissionNotAdded() { + String permission = "test"; + Function function = new AddPermissionFunction(); + function.setData(permission); + PlayerWrapper player = this.factory.createPlayer(); + player.addPermission(permission); + assertFalse(function.function(player)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java index 5d747d796..6a459f3e9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.UUID; @@ -11,6 +12,7 @@ public class MockPlayer { private final UUID uuid; private final List incomingChat = new ArrayList<>(); private final List outgoingChat = new ArrayList<>(); + private final Collection permissions = new HashSet<>(); public MockPlayer(String name, UUID uuid) { this.name = name; @@ -44,4 +46,13 @@ public List getIncomingChat() { public List getOutgoingChat() { return this.outgoingChat; } + + public boolean hasPermission(String permission) { + return this.permissions.contains(permission); + } + + public boolean addPermission(String permission) { + return this.permissions.add(permission); + } + } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java index c24957162..8544d1fd4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java @@ -30,5 +30,11 @@ public void sendMessage(String message) { this.getPlayer().sendMessage(message); } + public boolean hasPermission(String permission) { + return this.getPlayer().hasPermission(permission); + } -} + public boolean addPermission(String permission) { + return this.getPlayer().addPermission(permission); + } +} \ No newline at end of file From 4a56f77da3e9f1ef0b3904fabdf835f924836538 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 20:57:08 -0800 Subject: [PATCH 016/261] Test CheckItemTypeInHandFunction --- .../impl/CheckItemTypeInHandFunction.java | 3 ++ .../CheckItemInTypeHandFunctionTest.java | 49 +++++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 5 ++ .../dynamicgui/test/mock/MockItemStack.java | 14 ++++++ .../test/mock/MockItemStackWrapper.java | 15 ++++++ .../dynamicgui/test/mock/MockPlayer.java | 10 ++++ .../test/mock/MockPlayerWrapper.java | 18 +++++++ .../dynamicgui/test/mock/package-info.java | 1 - 8 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java delete mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java index d1bdc15f8..9a5a87ed4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java @@ -36,6 +36,9 @@ public CheckItemTypeInHandFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } List types = new ArrayList<>(); types.add(this.getData()); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java new file mode 100644 index 000000000..34610a85e --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java @@ -0,0 +1,49 @@ +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; +import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class CheckItemInTypeHandFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testNull() { + String material = "stone"; + Function function = new CheckItemTypeInHandFunction(); + ItemStackWrapper hand = this.factory.createItemStack(material); + MockPlayerWrapper player = this.factory.createPlayer(); + player.setItemInHand(hand); + assertFalse(function.function(player)); + } + + @Test + public void testOneType() { + String material = "stone"; + Function function = new CheckItemTypeInHandFunction(); + function.setData(material); + ItemStackWrapper hand = this.factory.createItemStack(material); + MockPlayerWrapper player = this.factory.createPlayer(); + player.setItemInHand(hand); + assertTrue(function.function(player)); + } + + @Test + public void testTwoTypes() { + String handMaterial = "stone"; + String functionMaterials = "dirt,stone"; + Function function = new CheckItemTypeInHandFunction(); + function.setData(functionMaterials); + ItemStackWrapper hand = this.factory.createItemStack(handMaterial); + MockPlayerWrapper player = this.factory.createPlayer(); + player.setItemInHand(hand); + assertTrue(function.function(player)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index ad7103cca..ed49beb1d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -18,4 +18,9 @@ public T mock(Class mockClazz, Object... args) { public MockPlayerWrapper createPlayer() { return this.mock(MockPlayerWrapper.class); } + + public MockItemStackWrapper createItemStack(String type) { + MockItemStack itemStack = this.mock(MockItemStack.class, type); + return this.mock(MockItemStackWrapper.class, itemStack); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java new file mode 100644 index 000000000..8b282d581 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java @@ -0,0 +1,14 @@ +package com.clubobsidian.dynamicgui.test.mock; + +public class MockItemStack { + + private final String type; + + public MockItemStack(String type) { + this.type = type; + } + + public String getType() { + return this.type; + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java new file mode 100644 index 000000000..81fa100d6 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java @@ -0,0 +1,15 @@ +package com.clubobsidian.dynamicgui.test.mock; + +import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; + +public abstract class MockItemStackWrapper extends ItemStackWrapper { + + public MockItemStackWrapper(MockItemStack itemStack) { + super(itemStack); + } + + @Override + public String getType() { + return this.getItemStack().getType(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java index 6a459f3e9..d0ed820bc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java @@ -1,5 +1,7 @@ package com.clubobsidian.dynamicgui.test.mock; +import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; + import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -13,6 +15,7 @@ public class MockPlayer { private final List incomingChat = new ArrayList<>(); private final List outgoingChat = new ArrayList<>(); private final Collection permissions = new HashSet<>(); + private ItemStackWrapper hand; public MockPlayer(String name, UUID uuid) { this.name = name; @@ -55,4 +58,11 @@ public boolean addPermission(String permission) { return this.permissions.add(permission); } + public ItemStackWrapper getItemInHand() { + return this.hand; + } + + public void setItemInHand(ItemStackWrapper hand) { + this.hand = hand; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java index 8544d1fd4..cffdde840 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java @@ -1,11 +1,14 @@ package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import java.util.UUID; public abstract class MockPlayerWrapper extends PlayerWrapper { + private ItemStackWrapper hand; + public MockPlayerWrapper() { this(new MockPlayer()); } @@ -14,27 +17,42 @@ public MockPlayerWrapper(MockPlayer player) { super(player); } + @Override public String getName() { return this.getPlayer().getName(); } + @Override public UUID getUniqueId() { return this.getPlayer().getUniqueId(); } + @Override public void chat(String message) { this.getPlayer().chat(message); } + @Override public void sendMessage(String message) { this.getPlayer().sendMessage(message); } + @Override public boolean hasPermission(String permission) { return this.getPlayer().hasPermission(permission); } + @Override public boolean addPermission(String permission) { return this.getPlayer().addPermission(permission); } + + @Override + public ItemStackWrapper getItemInHand() { + return this.getPlayer().getItemInHand(); + } + + public void setItemInHand(ItemStackWrapper hand) { + this.getPlayer().setItemInHand(hand); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java deleted file mode 100644 index 3a7fe7085..000000000 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.clubobsidian.dynamicgui.test.mock; \ No newline at end of file From e79f2194773c8440833d931d7ef3457f3dd5ac6b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 21:04:40 -0800 Subject: [PATCH 017/261] Test CheckLevelFunction --- .../function/impl/CheckLevelFunction.java | 5 +- .../test/function/CheckLevelFunctionTest.java | 59 +++++++++++++++++++ .../dynamicgui/test/mock/MockPlayer.java | 9 +++ .../test/mock/MockPlayerWrapper.java | 9 +++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java index 4f74a4d85..c58ef7862 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java @@ -31,6 +31,9 @@ public CheckLevelFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } try { int level = Integer.parseInt(this.getData()); return playerWrapper.getLevel() >= level; @@ -38,7 +41,5 @@ public boolean function(PlayerWrapper playerWrapper) { ex.printStackTrace(); return false; } - - } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java new file mode 100644 index 000000000..3226239c7 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java @@ -0,0 +1,59 @@ +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.MockPlayer; +import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class CheckLevelFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testNull() { + MockPlayerWrapper wrapper = this.factory.createPlayer(); + Function function = new CheckLevelFunction(); + assertFalse(function.function(wrapper)); + } + + @Test + public void testLevelGreater() { + MockPlayerWrapper wrapper = this.factory.createPlayer(); + wrapper.setLevel(10); + Function function = new CheckLevelFunction(); + function.setData("1"); + assertTrue(function.function(wrapper)); + } + + @Test + public void testLevelEqual() { + MockPlayerWrapper wrapper = this.factory.createPlayer(); + wrapper.setLevel(10); + Function function = new CheckLevelFunction(); + function.setData("10"); + assertTrue(function.function(wrapper)); + } + + @Test + public void testLevelLessThan() { + MockPlayerWrapper wrapper = this.factory.createPlayer(); + wrapper.setLevel(1); + Function function = new CheckLevelFunction(); + function.setData("10"); + assertFalse(function.function(wrapper)); + } + + @Test + public void testInvalidFormat() { + MockPlayerWrapper wrapper = this.factory.createPlayer(); + wrapper.setLevel(1); + Function function = new CheckLevelFunction(); + function.setData("a"); + assertFalse(function.function(wrapper)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java index d0ed820bc..44a874c46 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java @@ -16,6 +16,7 @@ public class MockPlayer { private final List outgoingChat = new ArrayList<>(); private final Collection permissions = new HashSet<>(); private ItemStackWrapper hand; + private int level = 0; public MockPlayer(String name, UUID uuid) { this.name = name; @@ -65,4 +66,12 @@ public ItemStackWrapper getItemInHand() { public void setItemInHand(ItemStackWrapper hand) { this.hand = hand; } + + public int getLevel() { + return this.level; + } + + public void setLevel(int level) { + this.level = level; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java index cffdde840..94279fcdc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java @@ -55,4 +55,13 @@ public ItemStackWrapper getItemInHand() { public void setItemInHand(ItemStackWrapper hand) { this.getPlayer().setItemInHand(hand); } + + @Override + public int getLevel() { + return this.getPlayer().getLevel(); + } + + public void setLevel(int level) { + this.getPlayer().setLevel(level); + } } \ No newline at end of file From 475fa9d07b9d30ec44431db0cda2ac1591ee09ff Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 21:23:29 -0800 Subject: [PATCH 018/261] Test CheckMoveableFunction --- .../function/impl/CheckMoveableFunction.java | 4 -- .../function/CheckMoveableFunctionTest.java | 42 +++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 46 +++++++++++++++++++ 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java index e305fdb34..deae89526 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java @@ -45,10 +45,6 @@ public boolean function(PlayerWrapper playerWrapper) { Slot slot = (Slot) owner; Boolean value = Boolean.valueOf(this.getData()); - if(value == null) { - return false; - } - return value.equals(slot.isMoveable()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java new file mode 100644 index 000000000..afebc91e2 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java @@ -0,0 +1,42 @@ +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; +import com.clubobsidian.dynamicgui.gui.Gui; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.MockPlayer; +import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class CheckMoveableFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new CheckMoveableFunction(); + MockPlayerWrapper wrapper = this.factory.createPlayer(); + assertFalse(function.function(wrapper)); + } + + @Test + public void ownerNotSlotTest() { + Function function = new CheckMoveableFunction(); + function.setData("true"); + function.setOwner(this.factory.createGui("test")); + MockPlayerWrapper wrapper = this.factory.createPlayer(); + assertFalse(function.function(wrapper)); + } + + @Test + public void isMovableTest() { + Function function = new CheckMoveableFunction(); + function.setData("true"); + function.setOwner(this.factory.createSlot("STONE", true)); + MockPlayerWrapper wrapper = this.factory.createPlayer(); + assertTrue(function.function(wrapper)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index ed49beb1d..9a01b339d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -1,7 +1,15 @@ package com.clubobsidian.dynamicgui.test.mock; +import com.clubobsidian.dynamicgui.gui.Gui; +import com.clubobsidian.dynamicgui.gui.InventoryType; +import com.clubobsidian.dynamicgui.gui.ModeEnum; +import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import org.mockito.Mockito; +import java.util.ArrayList; +import java.util.HashMap; + public class MockFactory { public T mock(Class mockClazz) { @@ -23,4 +31,42 @@ public MockItemStackWrapper createItemStack(String type) { MockItemStack itemStack = this.mock(MockItemStack.class, type); return this.mock(MockItemStackWrapper.class, itemStack); } + + public Gui createGui(String title) { + return new Gui(title, + InventoryType.CHEST.toString(), + title, + 6, + true, + ModeEnum.SET, + new HashMap<>(), + new ArrayList<>(), + new ArrayList<>(), + new FunctionTree(), + new HashMap<>()); + } + + public Slot createSlot(String type) { + return this.createSlot(type, false); + } + + public Slot createSlot(String type, boolean movable) { + return new Slot(0, + 1, + type, + "test", + null, + (short) 0, + false, + movable, + false, + new ArrayList<>(), + new ArrayList<>(), + new ArrayList<>(), + null, + null, + new FunctionTree(), + 0, + new HashMap<>()); + } } \ No newline at end of file From ec6dfbaf6d4c71f4a54e103c0b9d65a257ea7194 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 21:28:48 -0800 Subject: [PATCH 019/261] Add missing license headers --- .../impl/condition/AfterDateLazyFunction.java | 16 ++++++++++++++++ .../test/function/AddPermissionFunctionTest.java | 16 ++++++++++++++++ .../CheckItemInTypeHandFunctionTest.java | 16 ++++++++++++++++ .../test/function/CheckLevelFunctionTest.java | 16 ++++++++++++++++ .../test/function/CheckMoveableFunctionTest.java | 16 ++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 16 ++++++++++++++++ .../dynamicgui/test/mock/MockItemStack.java | 16 ++++++++++++++++ .../test/mock/MockItemStackWrapper.java | 16 ++++++++++++++++ .../dynamicgui/test/mock/MockPlayer.java | 16 ++++++++++++++++ .../dynamicgui/test/mock/MockPlayerWrapper.java | 16 ++++++++++++++++ .../dynamicgui/test/package-info.java | 16 ++++++++++++++++ 11 files changed, 176 insertions(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java index 72e5800f7..af810f781 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.function.impl.condition; import com.clubobsidian.dynamicgui.DynamicGui; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java index e91a1a62b..56cc2fcc9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.function; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java index 34610a85e..55e3453ba 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.function; import com.clubobsidian.dynamicgui.function.Function; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java index 3226239c7..5c7a022a8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.function; import com.clubobsidian.dynamicgui.function.Function; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java index afebc91e2..93cc82b73 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.function; import com.clubobsidian.dynamicgui.function.Function; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index 9a01b339d..0086af455 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.gui.Gui; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java index 8b282d581..83f3a4a80 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.mock; public class MockItemStack { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java index 81fa100d6..7d0ea0fca 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java index 44a874c46..da540df26 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java index 94279fcdc..9f622b026 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java @@ -1,3 +1,19 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java index 18c7f9dc3..a67693dc4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java @@ -1 +1,17 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.test; \ No newline at end of file From 6bdd2f4ecc9873721ff3baad19d6fb1186dbc42d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 23:41:50 -0800 Subject: [PATCH 020/261] Create CheckPlayerWorldFunction test --- .../impl/CheckPlayerWorldFunction.java | 1 - .../CheckPlayerWorldFunctionTest.java | 48 ++++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 11 ++++ .../dynamicgui/test/mock/MockPlayer.java | 10 ++++ .../test/mock/MockPlayerWrapper.java | 10 ++++ .../test/mock/world/MockLocation.java | 50 +++++++++++++++++++ .../test/mock/world/MockLocationWrapper.java | 26 ++++++++++ .../dynamicgui/test/mock/world/MockWorld.java | 42 ++++++++++++++++ .../test/mock/world/MockWorldWrapper.java | 44 ++++++++++++++++ 9 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java index 10458d0e9..d43b92400 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java @@ -35,7 +35,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - String worldName = this.getData(); WorldWrapper worldWrapper = playerWrapper.getLocation().getWorld(); return worldName.equals(worldWrapper.getName()); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java new file mode 100644 index 000000000..90b658145 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.CheckPlayerWorldFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class CheckPlayerWorldFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new CheckPlayerWorldFunction(); + MockPlayerWrapper player = this.factory.createPlayer(); + assertFalse(function.function(player)); + } + + @Test + public void worldEqualsTest() { + String worldName = "test"; + Function function = new CheckPlayerWorldFunction(); + function.setData(worldName); + MockPlayerWrapper player = this.factory.createPlayer(); + player.setLocation(this.factory.createLocation(0, 0, 0, worldName)); + assertTrue(function.function(player)); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index 0086af455..861685251 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -21,6 +21,10 @@ import com.clubobsidian.dynamicgui.gui.ModeEnum; import com.clubobsidian.dynamicgui.gui.Slot; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; +import com.clubobsidian.dynamicgui.test.mock.world.MockLocation; +import com.clubobsidian.dynamicgui.test.mock.world.MockLocationWrapper; +import com.clubobsidian.dynamicgui.test.mock.world.MockWorld; +import com.clubobsidian.dynamicgui.test.mock.world.MockWorldWrapper; import org.mockito.Mockito; import java.util.ArrayList; @@ -85,4 +89,11 @@ public Slot createSlot(String type, boolean movable) { 0, new HashMap<>()); } + + public MockLocationWrapper createLocation(int x, int y, int z, String worldName) { + MockWorld mockWorld = new MockWorld(worldName); + MockWorldWrapper worldWrapper = new MockWorldWrapper(mockWorld); + MockLocation mockLocation = new MockLocation(x, y, z, worldWrapper); + return new MockLocationWrapper(mockLocation); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java index da540df26..dedcf21e4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java @@ -17,6 +17,7 @@ package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.world.LocationWrapper; import java.util.ArrayList; import java.util.Collection; @@ -33,6 +34,7 @@ public class MockPlayer { private final Collection permissions = new HashSet<>(); private ItemStackWrapper hand; private int level = 0; + private LocationWrapper location; public MockPlayer(String name, UUID uuid) { this.name = name; @@ -90,4 +92,12 @@ public int getLevel() { public void setLevel(int level) { this.level = level; } + + public LocationWrapper getLocation() { + return this.location; + } + + public void setLocation(LocationWrapper location) { + this.location = location; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java index 9f622b026..72935c7e3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.world.LocationWrapper; import java.util.UUID; @@ -80,4 +81,13 @@ public int getLevel() { public void setLevel(int level) { this.getPlayer().setLevel(level); } + + @Override + public LocationWrapper getLocation() { + return this.getPlayer().getLocation(); + } + + public void setLocation(LocationWrapper location) { + this.getPlayer().setLocation(location); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java new file mode 100644 index 000000000..ed04d5c43 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.world; + +import com.clubobsidian.dynamicgui.world.WorldWrapper; + +public class MockLocation { + + private final int x; + private final int y; + private final int z; + private final WorldWrapper world; + + public MockLocation(int x, int y, int z, WorldWrapper world) { + this.x = x; + this.y = y; + this.z = z; + this.world = world; + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public int getZ() { + return this.z; + } + + public WorldWrapper getWorld() { + return this.world; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java new file mode 100644 index 000000000..562f7db62 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java @@ -0,0 +1,26 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.world; + +import com.clubobsidian.dynamicgui.world.LocationWrapper; + +public class MockLocationWrapper extends LocationWrapper { + + public MockLocationWrapper(MockLocation location) { + super(location.getX(), location.getY(), location.getZ(), location.getWorld()); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java new file mode 100644 index 000000000..1be3afedc --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java @@ -0,0 +1,42 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.world; + +import java.util.HashMap; +import java.util.Map; + +public class MockWorld { + + private final String name; + private final Map gameRules = new HashMap<>(); + + public MockWorld(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + + public void setGameRule(String rule, String value) { + this.gameRules.put(rule, value); + } + + public String getGameRule(String rule) { + return this.gameRules.get(rule); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java new file mode 100644 index 000000000..868657a2a --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java @@ -0,0 +1,44 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.world; + +import com.clubobsidian.dynamicgui.world.WorldWrapper; + +public class MockWorldWrapper extends WorldWrapper { + + private final MockWorld world; + + public MockWorldWrapper(MockWorld world) { + super(world.getName()); + this.world = world; + } + + @Override + public MockWorld getWorld() { + return this.world; + } + + @Override + public void setGameRule(String rule, String value) { + this.world.setGameRule(rule, value); + } + + @Override + public String getGameRule(String rule) { + return this.world.getGameRule(rule); + } +} From 456672356bba63deb77c1474879ec53a4215e776 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 23:42:21 -0800 Subject: [PATCH 021/261] Refactor mock code into packages --- .../test/function/CheckItemInTypeHandFunctionTest.java | 2 +- .../dynamicgui/test/function/CheckLevelFunctionTest.java | 3 +-- .../dynamicgui/test/function/CheckMoveableFunctionTest.java | 4 +--- .../test/function/CheckPlayerWorldFunctionTest.java | 2 +- .../com/clubobsidian/dynamicgui/test/mock/MockFactory.java | 3 +++ .../dynamicgui/test/mock/{ => entity}/MockPlayer.java | 2 +- .../dynamicgui/test/mock/{ => entity}/MockPlayerWrapper.java | 2 +- .../dynamicgui/test/mock/{ => inventory}/MockItemStack.java | 2 +- .../test/mock/{ => inventory}/MockItemStackWrapper.java | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) rename core/src/test/java/com/clubobsidian/dynamicgui/test/mock/{ => entity}/MockPlayer.java (98%) rename core/src/test/java/com/clubobsidian/dynamicgui/test/mock/{ => entity}/MockPlayerWrapper.java (97%) rename core/src/test/java/com/clubobsidian/dynamicgui/test/mock/{ => inventory}/MockItemStack.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/test/mock/{ => inventory}/MockItemStackWrapper.java (94%) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java index 55e3453ba..6d19c3487 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java @@ -20,7 +20,7 @@ import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java index 5c7a022a8..7f83af772 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java @@ -19,8 +19,7 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.MockPlayer; -import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java index 93cc82b73..1eb450fd6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java @@ -18,10 +18,8 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; -import com.clubobsidian.dynamicgui.gui.Gui; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.MockPlayer; -import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java index 90b658145..e150dadcd 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index 861685251..b6619e6c9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -21,6 +21,9 @@ import com.clubobsidian.dynamicgui.gui.ModeEnum; import com.clubobsidian.dynamicgui.gui.Slot; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStack; +import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStackWrapper; import com.clubobsidian.dynamicgui.test.mock.world.MockLocation; import com.clubobsidian.dynamicgui.test.mock.world.MockLocationWrapper; import com.clubobsidian.dynamicgui.test.mock.world.MockWorld; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayer.java similarity index 98% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java rename to core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayer.java index dedcf21e4..b2061de50 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock; +package com.clubobsidian.dynamicgui.test.mock.entity; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.world.LocationWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayerWrapper.java similarity index 97% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayerWrapper.java index 72935c7e3..6b85963e0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayerWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock; +package com.clubobsidian.dynamicgui.test.mock.entity; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStack.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java rename to core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStack.java index 83f3a4a80..6afaf80d8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStack.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock; +package com.clubobsidian.dynamicgui.test.mock.inventory; public class MockItemStack { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java index 7d0ea0fca..9c7ffe14e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock; +package com.clubobsidian.dynamicgui.test.mock.inventory; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; From f202f5a9f4c8929c804b68317d718d1d5f1b27ab Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 23:46:57 -0800 Subject: [PATCH 022/261] FakeServer -> Platform Refactor FakeServer to Platform. This should hopefully be a bit more clear that these are operations that are implemented per platform instead of FakeServer which is ambiguous. --- .../bukkit/BukkitPlatform.java} | 8 +++--- .../plugin/bukkit/BukkitPlugin.java | 4 +-- .../clubobsidian/dynamicgui/DynamicGui.java | 28 +++++++++---------- .../function/impl/ConsoleCmdFunction.java | 2 +- .../function/impl/GetGameRuleFunction.java | 2 +- .../impl/ServerBroadcastFunction.java | 2 +- .../impl/ServerBroadcastJsonFunction.java | 2 +- .../impl/ServerMiniBroadcastFunction.java | 2 +- .../function/impl/SetGameRuleFunction.java | 2 +- .../inject/module/PluginModule.java | 10 +++---- .../manager/dynamicgui/GuiManager.java | 6 ++-- .../manager/dynamicgui/SlotManager.java | 4 +-- .../dynamicgui/cooldown/CooldownManager.java | 7 ++--- .../impl/GlobalPlayerCountReplacer.java | 2 +- .../replacer/impl/OnlinePlayersReplacer.java | 2 +- .../server/{FakeServer.java => Platform.java} | 4 +-- .../dynamicgui/util/ThreadUtil.java | 4 +-- 17 files changed, 45 insertions(+), 46 deletions(-) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{server/bukkit/FakeBukkitServer.java => platform/bukkit/BukkitPlatform.java} (95%) rename core/src/main/java/com/clubobsidian/dynamicgui/server/{FakeServer.java => Platform.java} (96%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/platform/bukkit/BukkitPlatform.java similarity index 95% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/platform/bukkit/BukkitPlatform.java index 9da0635c1..e18f18327 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/server/bukkit/FakeBukkitServer.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/platform/bukkit/BukkitPlatform.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.server.bukkit; +package com.clubobsidian.dynamicgui.platform.bukkit; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; @@ -22,7 +22,7 @@ import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.proxy.Proxy; import com.clubobsidian.dynamicgui.scheduler.bukkit.BukkitScheduler; -import com.clubobsidian.dynamicgui.server.FakeServer; +import com.clubobsidian.dynamicgui.server.Platform; import com.clubobsidian.dynamicgui.server.ServerType; import com.clubobsidian.dynamicgui.world.WorldWrapper; import com.clubobsidian.dynamicgui.world.bukkit.BukkitWorldWrapper; @@ -39,9 +39,9 @@ import java.util.List; import java.util.UUID; -public class FakeBukkitServer extends FakeServer { +public class BukkitPlatform extends Platform { - public FakeBukkitServer() { + public BukkitPlatform() { super(new BukkitScheduler()); } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java index 9979fdfa7..ab48f570f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java @@ -45,7 +45,7 @@ import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; import com.clubobsidian.dynamicgui.registry.npc.bukkit.CitizensRegistry; import com.clubobsidian.dynamicgui.registry.replacer.bukkit.PlaceholderApiReplacerRegistry; -import com.clubobsidian.dynamicgui.server.bukkit.FakeBukkitServer; +import com.clubobsidian.dynamicgui.platform.bukkit.BukkitPlatform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.SimpleCommandMap; @@ -90,7 +90,7 @@ public void start() { .setMaterial(BukkitMaterialManager.class) .setLogger(new JavaLoggerWrapper<>(this.getLogger())) .setPlugin(this) - .setServer(new FakeBukkitServer()) + .setPlatform(new BukkitPlatform()) .bootstrap(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index b07aa0957..56c67be8f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -92,7 +92,7 @@ import com.clubobsidian.dynamicgui.registry.replacer.impl.DynamicGuiReplacerRegistry; import com.clubobsidian.dynamicgui.registry.replacer.impl.MetadataReplacerRegistry; import com.clubobsidian.dynamicgui.replacer.Replacer; -import com.clubobsidian.dynamicgui.server.FakeServer; +import com.clubobsidian.dynamicgui.server.Platform; import com.clubobsidian.dynamicgui.util.ChatColor; import com.clubobsidian.trident.EventBus; import com.clubobsidian.trident.eventbus.methodhandle.MethodHandleEventBus; @@ -129,15 +129,15 @@ public static DynamicGui get() { private final Map serverPlayerCount; private final EventBus eventManager; private final DynamicGuiPlugin plugin; - private final FakeServer server; + private final Platform platform; private final LoggerWrapper loggerWrapper; private final Injector injector; private boolean initialized; @Inject - private DynamicGui(DynamicGuiPlugin plugin, FakeServer server, LoggerWrapper loggerWrapper, Injector injector) { + private DynamicGui(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper loggerWrapper, Injector injector) { this.plugin = plugin; - this.server = server; + this.platform = platform; this.loggerWrapper = loggerWrapper; this.injector = injector; this.serverPlayerCount = new ConcurrentHashMap<>(); @@ -255,13 +255,13 @@ public void checkForProxy() { if(this.proxy == Proxy.BUNGEECORD) { this.getLogger().info("BungeeCord is enabled!"); - this.getServer().registerOutgoingPluginChannel(this.getPlugin(), "BungeeCord"); - this.getServer().registerIncomingPluginChannel(this.getPlugin(), "BungeeCord", runnable); + this.getPlatform().registerOutgoingPluginChannel(this.getPlugin(), "BungeeCord"); + this.getPlatform().registerIncomingPluginChannel(this.getPlugin(), "BungeeCord", runnable); } else if(this.proxy == Proxy.REDIS_BUNGEE) { this.getLogger().info("RedisBungee is enabled"); - this.getServer().registerOutgoingPluginChannel(this.getPlugin(), "RedisBungee"); - this.getServer().registerOutgoingPluginChannel(this.getPlugin(), "BungeeCord"); - this.getServer().registerIncomingPluginChannel(this.getPlugin(), "RedisBungee", runnable); + this.getPlatform().registerOutgoingPluginChannel(this.getPlugin(), "RedisBungee"); + this.getPlatform().registerOutgoingPluginChannel(this.getPlugin(), "BungeeCord"); + this.getPlatform().registerIncomingPluginChannel(this.getPlugin(), "RedisBungee", runnable); } else { this.getLogger().info("A proxy is not in use, please configure the proxy config value if you need proxy support!"); } @@ -353,9 +353,9 @@ private void loadFunctions() { } private void startPlayerCountTimer() { - this.getServer().getScheduler().scheduleSyncRepeatingTask(() -> { + this.getPlatform().getScheduler().scheduleSyncRepeatingTask(() -> { for(String server : serverPlayerCount.keySet()) { - PlayerWrapper player = Iterables.getFirst(this.getServer().getOnlinePlayers(), null); + PlayerWrapper player = Iterables.getFirst(this.getPlatform().getOnlinePlayers(), null); if(player != null) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("PlayerCount"); @@ -400,8 +400,8 @@ public EventBus getEventBus() { return this.eventManager; } - public FakeServer getServer() { - return this.server; + public Platform getPlatform() { + return this.platform; } public LoggerWrapper getLogger() { @@ -436,7 +436,7 @@ private Proxy findProxyByString(String proxyStr) { } public boolean sendToServer(PlayerWrapper playerWrapper, String server) { - if(this.server == null) { + if(this.platform == null) { return false; } else if(this.proxy == Proxy.BUNGEECORD || this.proxy == Proxy.REDIS_BUNGEE) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java index 32127f746..eac6dcfe7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java @@ -33,7 +33,7 @@ public ConsoleCmdFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - DynamicGui.get().getServer().dispatchServerCommand(ReplacerManager.get().replace(this.getData(), playerWrapper)); + DynamicGui.get().getPlatform().dispatchServerCommand(ReplacerManager.get().replace(this.getData(), playerWrapper)); return true; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java index a2ad27e81..e1d2d9c91 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java @@ -43,7 +43,7 @@ public boolean function(PlayerWrapper playerWrapper) { String[] split = this.getData().split(","); if(split.length == 3) { String worldName = split[0]; - WorldWrapper world = DynamicGui.get().getServer().getWorld(worldName); + WorldWrapper world = DynamicGui.get().getPlatform().getWorld(worldName); if(world == null) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java index 39782ff33..f2502ed24 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java @@ -35,7 +35,7 @@ public ServerBroadcastFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - DynamicGui.get().getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', ReplacerManager.get().replace(this.getData(), playerWrapper))); + DynamicGui.get().getPlatform().broadcastMessage(ChatColor.translateAlternateColorCodes('&', ReplacerManager.get().replace(this.getData(), playerWrapper))); return true; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java index 34c05bdac..e8f56f031 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java @@ -36,7 +36,7 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } - DynamicGui.get().getServer().broadcastJsonMessage(this.getData()); + DynamicGui.get().getPlatform().broadcastJsonMessage(this.getData()); return true; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java index d280bbe12..3aebe56f4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java @@ -39,7 +39,7 @@ public boolean function(PlayerWrapper playerWrapper) { } String json = MiniMessageManager.get().toJson(this.getData()); - DynamicGui.get().getServer().broadcastJsonMessage(json); + DynamicGui.get().getPlatform().broadcastJsonMessage(json); return true; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java index 405a348d8..7c660c298 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java @@ -42,7 +42,7 @@ public boolean function(PlayerWrapper playerWrapper) { String[] split = this.getData().split(","); if(split.length == 3) { String worldName = split[0]; - WorldWrapper world = DynamicGui.get().getServer().getWorld(worldName); + WorldWrapper world = DynamicGui.get().getPlatform().getWorld(worldName); if(world == null) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java index de2b2e91d..7d0a7dd63 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java @@ -23,7 +23,7 @@ import com.clubobsidian.dynamicgui.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.manager.world.LocationManager; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.FakeServer; +import com.clubobsidian.dynamicgui.server.Platform; import com.google.inject.Binder; import com.google.inject.Guice; import com.google.inject.Module; @@ -37,7 +37,7 @@ public class PluginModule implements Module { private Class materialClass; private Class locationClass; private DynamicGuiPlugin plugin; - private FakeServer fakeServer; + private Platform platform; private LoggerWrapper loggerWrapper; public PluginModule setEntity(Class clazz) { @@ -70,8 +70,8 @@ public PluginModule setPlugin(DynamicGuiPlugin plugin) { return this; } - public PluginModule setServer(FakeServer server) { - this.fakeServer = server; + public PluginModule setPlatform(Platform platform) { + this.platform = platform; return this; } @@ -88,7 +88,7 @@ public void configure(Binder binder) { binder.bind(MaterialManager.class).to(this.materialClass); binder.bind(LocationManager.class).to(this.locationClass); binder.bind(DynamicGuiPlugin.class).toInstance(this.plugin); - binder.bind(FakeServer.class).toInstance(this.fakeServer); + binder.bind(Platform.class).toInstance(this.platform); binder.bind(new TypeLiteral>() { }).toInstance(this.loggerWrapper); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java index 84be6718c..940f0d3b6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java @@ -33,7 +33,7 @@ import com.clubobsidian.dynamicgui.parser.macro.MacroToken; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.FakeServer; +import com.clubobsidian.dynamicgui.server.Platform; import com.clubobsidian.dynamicgui.server.ServerType; import com.clubobsidian.dynamicgui.util.ChatColor; @@ -217,7 +217,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu return; } - FakeServer server = DynamicGui.get().getServer(); + Platform server = DynamicGui.get().getPlatform(); if(server.getType() == ServerType.SPONGE) { server.getScheduler().runSyncDelayedTask(() -> { playerWrapper.openInventory(inventoryWrapper); @@ -227,7 +227,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu } this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); - DynamicGui.get().getServer().getScheduler().runSyncDelayedTask(() -> { + DynamicGui.get().getPlatform().getScheduler().runSyncDelayedTask(() -> { playerWrapper.updateInventory(); }, 2L); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java index 2af9d5298..756559803 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java @@ -44,12 +44,12 @@ private SlotManager() { } private void updateSlots() { - DynamicGui.get().getServer().getScheduler().scheduleSyncRepeatingTask(() -> { + DynamicGui.get().getPlatform().getScheduler().scheduleSyncRepeatingTask(() -> { Iterator> it = GuiManager.get().getPlayerGuis().entrySet().iterator(); while(it.hasNext()) { Entry next = it.next(); UUID key = next.getKey(); - PlayerWrapper playerWrapper = DynamicGui.get().getServer().getPlayer(key); + PlayerWrapper playerWrapper = DynamicGui.get().getPlatform().getPlayer(key); Gui gui = next.getValue(); for(Slot slot : gui.getSlots()) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java index 6790858f3..89f57ddf5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java @@ -17,8 +17,7 @@ import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.FakeServer; +import com.clubobsidian.dynamicgui.server.Platform; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; @@ -233,7 +232,7 @@ private void updateCache() { private void scheduleCooldownUpdate() { DynamicGui dynamicGui = DynamicGui.get(); - FakeServer server = dynamicGui.getServer(); + Platform server = dynamicGui.getPlatform(); server.getScheduler().scheduleSyncRepeatingTask(() -> { this.updateCache(); }, 1L, 1L); @@ -241,7 +240,7 @@ private void scheduleCooldownUpdate() { private void scheduleConfigUpdate() { DynamicGui dynamicGui = DynamicGui.get(); - FakeServer server = dynamicGui.getServer(); + Platform server = dynamicGui.getPlatform(); server.getScheduler().scheduleAsyncRepeatingTask(() -> { if(this.updateConfig.get()) { this.updateConfig.set(false); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java index c798c8aa3..fde690823 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java @@ -27,6 +27,6 @@ public GlobalPlayerCountReplacer(String toReplace) { @Override public String replacement(String text, PlayerWrapper playerWrapper) { - return String.valueOf(DynamicGui.get().getServer().getGlobalPlayerCount()); + return String.valueOf(DynamicGui.get().getPlatform().getGlobalPlayerCount()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java index 9b603839b..3efdbf51a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java @@ -27,6 +27,6 @@ public OnlinePlayersReplacer(String toReplace) { @Override public String replacement(String text, PlayerWrapper player) { - return String.valueOf(DynamicGui.get().getServer().getOnlinePlayers().size()); + return String.valueOf(DynamicGui.get().getPlatform().getOnlinePlayers().size()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java b/core/src/main/java/com/clubobsidian/dynamicgui/server/Platform.java similarity index 96% rename from core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/server/Platform.java index 354c40465..b901b8286 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/server/FakeServer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/server/Platform.java @@ -24,11 +24,11 @@ import java.util.Collection; import java.util.UUID; -public abstract class FakeServer { +public abstract class Platform { private final Scheduler scheduler; - public FakeServer(Scheduler scheduler) { + public Platform(Scheduler scheduler) { this.scheduler = scheduler; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java index ea1991fad..510a0ba5a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java @@ -2,12 +2,12 @@ import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.server.FakeServer; +import com.clubobsidian.dynamicgui.server.Platform; public final class ThreadUtil { public static void run(Runnable runnable, boolean isAsync) { - FakeServer server = DynamicGui.get().getServer(); + Platform server = DynamicGui.get().getPlatform(); Scheduler scheduler = server.getScheduler(); if(isAsync) { scheduler.runAsynchronousDelayedTask(runnable, 0); From dd849d60ae0b7263456eee38969aa0e559d0f386 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 23:53:27 -0800 Subject: [PATCH 023/261] Test DelayFunction --- .../test/function/DelayFunctionTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java new file mode 100644 index 000000000..5744ebd4e --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.DelayFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class DelayFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testNull() { + Function function = new DelayFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void testNonNumber() { + Function function = new DelayFunction(); + function.setData("a"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void testValidData() { + Function function = new DelayFunction(); + function.setData("1"); + assertTrue(function.function(this.factory.createPlayer())); + } +} \ No newline at end of file From 58fcd58458cb2451e99e55bab3d38ad117f955cb Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 5 Feb 2022 23:54:31 -0800 Subject: [PATCH 024/261] Remove exp pay function --- .../clubobsidian/dynamicgui/DynamicGui.java | 1 - .../function/impl/ExpPayFunction.java | 51 ------------------- 2 files changed, 52 deletions(-) delete mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ExpPayFunction.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index 56c67be8f..f953e665d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -288,7 +288,6 @@ private void loadFunctions() { FunctionManager.get().addFunction(new ConsoleCmdFunction()); FunctionManager.get().addFunction(new PlayerCmdFunction()); - //FunctionApi.get().addFunction(new ExpPayFunction("payexp")); FunctionManager.get().addFunction(new SetCooldownFunction()); FunctionManager.get().addFunction(new IsOnCooldownFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ExpPayFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ExpPayFunction.java deleted file mode 100644 index 4327b6c1b..000000000 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ExpPayFunction.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 Club Obsidian and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.clubobsidian.dynamicgui.function.impl; - -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; - -public class ExpPayFunction extends Function { - - /** - * - */ - private static final long serialVersionUID = -2383762506458369815L; - - public ExpPayFunction(String name) { - super(name); - } - - @Override - public boolean function(PlayerWrapper playerWrapper) { - int amt; - try { - amt = Integer.parseInt(this.getData()); - } catch(Exception ex) { - DynamicGui.get().getLogger().info("Experience is set to an invalid number for data " + this.getData() + ", failing gracefully!"); - return false; - } - System.out.println("Exp: " + playerWrapper.getExperience()); - if(playerWrapper.getExperience() < amt) { - return false; - } - - playerWrapper.setExperience(playerWrapper.getExperience() - amt); - return true; - - } -} \ No newline at end of file From 1fc077b9956bf71bee36a651116ee9a3db97ef5a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 00:39:07 -0800 Subject: [PATCH 025/261] Create GetGameRuleFunction test Remove statistics, mock a lot more of the DynamicGui platform including mocking injection --- .gitignore | 4 + .../entity/bukkit/BukkitPlayerWrapper.java | 31 ----- .../inject/bukkit/BukkitPluginModule.java | 64 ++++++++++ .../plugin/bukkit/BukkitPlugin.java | 23 +--- .../world/bukkit/BukkitWorldWrapper.java | 4 +- .../clubobsidian/dynamicgui/DynamicGui.java | 2 - .../dynamicgui/entity/PlayerWrapper.java | 5 - .../function/impl/GetGameRuleFunction.java | 7 +- .../function/impl/StatisticFunction.java | 60 ---------- .../inject/module/PluginModule.java | 62 +++------- .../impl/DynamicGuiReplacerRegistry.java | 26 ---- .../replacer/impl/StatisticReplacer.java | 48 -------- .../dynamicgui/util/Statistic.java | 113 ------------------ .../dynamicgui/world/WorldWrapper.java | 2 +- .../src/main/resources/config.yml | 0 .../function/GetGameRuleFunctionTest.java | 72 +++++++++++ .../dynamicgui/test/mock/MockFactory.java | 40 ++++++- .../test/mock/inject/MockPluginModule.java | 64 ++++++++++ .../test/mock/manager/MockEntityManager.java | 34 ++++++ .../mock/manager/MockInventoryManager.java | 37 ++++++ .../mock/manager/MockItemStackManager.java | 32 +++++ .../mock/manager/MockLocationManager.java | 32 +++++ .../mock/manager/MockMaterialManager.java | 33 +++++ .../mock/plugin/MockDynamicGuiPlugin.java | 96 +++++++++++++++ .../test/mock/plugin/MockPlatform.java | 103 ++++++++++++++++ .../test/mock/plugin/MockScheduler.java | 42 +++++++ .../test/mock/world/MockWorldWrapper.java | 4 +- 27 files changed, 680 insertions(+), 360 deletions(-) create mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java delete mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java delete mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/StatisticReplacer.java delete mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/util/Statistic.java rename {bukkit => core}/src/main/resources/config.yml (100%) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java diff --git a/.gitignore b/.gitignore index 4f3e49966..5687275df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +#DynamicGui +mock_data/ + # Compiled class file *.class @@ -22,6 +25,7 @@ hs_err_pid* .gradle build/ +out/ # Ignore Gradle GUI config gradle-app.setting diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java index 97ba19269..017652923 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java @@ -23,8 +23,6 @@ import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.manager.world.LocationManager; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.util.Statistic; -import com.clubobsidian.dynamicgui.util.Statistic.StatisticType; import com.clubobsidian.dynamicgui.world.LocationWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; @@ -153,35 +151,6 @@ public void playEffect(String effect, int data) { playerLocation.getWorld().playEffect(playerLocation, Effect.valueOf(effect), data); } - @Override - public int getStatistic(Statistic statistic) { - try { - return this.getPlayer().getStatistic(org.bukkit.Statistic.valueOf(statistic.getBukkitID())); - } catch(Exception ex) { - return -1; - } - } - - @Override - public int getStatistic(Statistic statistic, String data) { - if(data == null) { - return -1; - } - String upperData = data.toUpperCase(); - - try { - if(StatisticType.MATERIAL == statistic.getStatisticType()) { - return this.getPlayer().getStatistic(org.bukkit.Statistic.valueOf(statistic.getBukkitID()), Material.valueOf(upperData)); - } else if(StatisticType.ENTITY == statistic.getStatisticType()) { - return this.getPlayer().getStatistic(org.bukkit.Statistic.valueOf(statistic.getBukkitID()), EntityType.valueOf(upperData)); - } - } catch(Exception ex) { - //Ignore and return -1 - return -1; - } - return 0; - } - @Override public void updateInventory() { this.getPlayer().updateInventory(); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java new file mode 100644 index 000000000..a4ae7b02c --- /dev/null +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.inject.bukkit; + +import com.clubobsidian.dynamicgui.inject.module.PluginModule; +import com.clubobsidian.dynamicgui.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.manager.entity.bukkit.BukkitEntityManager; +import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.manager.inventory.bukkit.BukkitInventoryManager; +import com.clubobsidian.dynamicgui.manager.inventory.bukkit.BukkitItemStackManager; +import com.clubobsidian.dynamicgui.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.manager.material.bukkit.BukkitMaterialManager; +import com.clubobsidian.dynamicgui.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.manager.world.bukkit.BukkitLocationManager; +import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.server.Platform; + +public class BukkitPluginModule extends PluginModule { + + public BukkitPluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper logger) { + super(plugin, platform, logger); + } + + @Override + public Class getEntityManager() { + return BukkitEntityManager.class; + } + + @Override + public Class getInventoryManager() { + return BukkitInventoryManager.class; + } + + @Override + public Class getItemStackManager() { + return BukkitItemStackManager.class; + } + + @Override + public Class getMaterialManager() { + return BukkitMaterialManager.class; + } + + @Override + public Class getLocationManger() { + return BukkitLocationManager.class; + } +} diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java index ab48f570f..2ed620e14 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java @@ -22,20 +22,16 @@ import com.clubobsidian.dynamicgui.command.bukkit.CustomCommandExecutor; import com.clubobsidian.dynamicgui.economy.Economy; import com.clubobsidian.dynamicgui.economy.bukkit.VaultEconomy; -import com.clubobsidian.dynamicgui.inject.module.PluginModule; +import com.clubobsidian.dynamicgui.inject.bukkit.BukkitPluginModule; import com.clubobsidian.dynamicgui.listener.bukkit.EntityClickListener; import com.clubobsidian.dynamicgui.listener.bukkit.InventoryCloseListener; import com.clubobsidian.dynamicgui.listener.bukkit.InventoryInteractListener; import com.clubobsidian.dynamicgui.listener.bukkit.InventoryOpenListener; import com.clubobsidian.dynamicgui.listener.bukkit.PlayerInteractListener; import com.clubobsidian.dynamicgui.logger.JavaLoggerWrapper; +import com.clubobsidian.dynamicgui.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.manager.dynamicgui.ModelManager; import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.manager.entity.bukkit.BukkitEntityManager; -import com.clubobsidian.dynamicgui.manager.inventory.bukkit.BukkitInventoryManager; -import com.clubobsidian.dynamicgui.manager.inventory.bukkit.BukkitItemStackManager; -import com.clubobsidian.dynamicgui.manager.material.bukkit.BukkitMaterialManager; -import com.clubobsidian.dynamicgui.manager.world.bukkit.BukkitLocationManager; import com.clubobsidian.dynamicgui.permission.Permission; import com.clubobsidian.dynamicgui.permission.bukkit.FoundryPermission; import com.clubobsidian.dynamicgui.permission.bukkit.VaultPermission; @@ -46,6 +42,7 @@ import com.clubobsidian.dynamicgui.registry.npc.bukkit.CitizensRegistry; import com.clubobsidian.dynamicgui.registry.replacer.bukkit.PlaceholderApiReplacerRegistry; import com.clubobsidian.dynamicgui.platform.bukkit.BukkitPlatform; +import com.clubobsidian.dynamicgui.server.Platform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.SimpleCommandMap; @@ -82,18 +79,10 @@ public void start() { this.guiFolder = new File(this.getDataFolder(), "guis"); this.macroFolder = new File(this.getDataFolder(), "macros"); - new PluginModule() - .setEntity(BukkitEntityManager.class) - .setInventory(BukkitInventoryManager.class) - .setItemStack(BukkitItemStackManager.class) - .setLocation(BukkitLocationManager.class) - .setMaterial(BukkitMaterialManager.class) - .setLogger(new JavaLoggerWrapper<>(this.getLogger())) - .setPlugin(this) - .setPlatform(new BukkitPlatform()) - .bootstrap(); - + Platform platform = new BukkitPlatform(); + LoggerWrapper logger = new JavaLoggerWrapper<>(this.getLogger()); + new BukkitPluginModule(this, platform, logger).bootstrap(); PluginManager pm = this.getServer().getPluginManager(); boolean vault = false; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java index 37e3e85b3..b6185b001 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java @@ -36,8 +36,8 @@ public World getWorld() { } @Override - public void setGameRule(String rule, String value) { - this.getWorld().setGameRuleValue(rule, value); + public void setGameRule(String key, String value) { + this.getWorld().setGameRuleValue(key, value); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java index f953e665d..75bdfe96a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java @@ -55,7 +55,6 @@ import com.clubobsidian.dynamicgui.function.impl.SetNameFunction; import com.clubobsidian.dynamicgui.function.impl.SetTypeFunction; import com.clubobsidian.dynamicgui.function.impl.SoundFunction; -import com.clubobsidian.dynamicgui.function.impl.StatisticFunction; import com.clubobsidian.dynamicgui.function.impl.condition.CheckTickFunction; import com.clubobsidian.dynamicgui.function.impl.condition.ConditionFunction; import com.clubobsidian.dynamicgui.function.impl.cooldown.IsNotOnCooldownFunction; @@ -327,7 +326,6 @@ private void loadFunctions() { FunctionManager.get().addFunction(new SetEnchantsFunction()); FunctionManager.get().addFunction(new SetCloseFunction()); FunctionManager.get().addFunction(new RemoveSlotFunction()); - FunctionManager.get().addFunction(new StatisticFunction()); FunctionManager.get().addFunction(new CheckLevelFunction()); FunctionManager.get().addFunction(new LogFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java index c1fb46320..236f2698a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java @@ -18,7 +18,6 @@ import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.util.Statistic; import com.clubobsidian.dynamicgui.world.LocationWrapper; import java.util.UUID; @@ -71,10 +70,6 @@ public T getPlayer() { public abstract void playEffect(String effect, int data); - public abstract int getStatistic(Statistic statistic); - - public abstract int getStatistic(Statistic statistic, String data); - public abstract void updateInventory(); public abstract LocationWrapper getLocation(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java index e1d2d9c91..92d6f2908 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java @@ -34,12 +34,9 @@ public GetGameRuleFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { - return false; - } else if(!this.getData().contains(",")) { + if(this.getData() == null || !this.getData().contains(",")) { return false; } - String[] split = this.getData().split(","); if(split.length == 3) { String worldName = split[0]; @@ -47,13 +44,11 @@ public boolean function(PlayerWrapper playerWrapper) { if(world == null) { return false; } - String rule = split[1]; String value = split[2]; String worldRule = world.getGameRule(rule); return value.equals(worldRule); } - return false; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java deleted file mode 100644 index e76ec37b5..000000000 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/StatisticFunction.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2021 Club Obsidian and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.clubobsidian.dynamicgui.function.impl; - -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.util.Statistic; -import com.clubobsidian.dynamicgui.util.Statistic.StatisticType; - -public class StatisticFunction extends Function { - - /** - * - */ - private static final long serialVersionUID = -8624786841614185001L; - - public StatisticFunction() { - super("statistic"); - } - - @Override - public boolean function(PlayerWrapper playerWrapper) { - String[] split = this.getData().split(","); - String statisticString = null; - - if(split.length >= 2) - statisticString = split[0].toUpperCase(); - - if(statisticString == null) - return false; - - if(split.length == 3) { - Statistic stat = Statistic.valueOf(statisticString); - String type = split[1]; - Integer num = Integer.parseInt(split[2]); - - if(stat.getStatisticType() != StatisticType.NONE) { - return playerWrapper.getStatistic(stat, type) >= num; - } - } else if(split.length == 2) { - Statistic stat = Statistic.valueOf(split[0]); - Integer num = Integer.parseInt(split[1]); - return playerWrapper.getStatistic(stat) >= num; - } - return false; - } -} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java index 7d0a7dd63..8a6bd9b4f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java @@ -29,56 +29,28 @@ import com.google.inject.Module; import com.google.inject.TypeLiteral; -public class PluginModule implements Module { +public abstract class PluginModule implements Module { - private Class entityClass; - private Class inventoryClass; - private Class itemStackClass; - private Class materialClass; - private Class locationClass; - private DynamicGuiPlugin plugin; - private Platform platform; - private LoggerWrapper loggerWrapper; + private final Class entityClass = this.getEntityManager(); + private final Class inventoryClass = this.getInventoryManager(); + private final Class itemStackClass = this.getItemStackManager(); + private final Class materialClass = this.getMaterialManager(); + private final Class locationClass = this.getLocationManger(); + private final DynamicGuiPlugin plugin; + private final Platform platform; + private final LoggerWrapper logger; - public PluginModule setEntity(Class clazz) { - this.entityClass = clazz; - return this; - } - - public PluginModule setInventory(Class clazz) { - this.inventoryClass = clazz; - return this; - } - - public PluginModule setItemStack(Class clazz) { - this.itemStackClass = clazz; - return this; - } - - public PluginModule setMaterial(Class clazz) { - this.materialClass = clazz; - return this; - } - - public PluginModule setLocation(Class clazz) { - this.locationClass = clazz; - return this; - } - - public PluginModule setPlugin(DynamicGuiPlugin plugin) { + public PluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper logger) { this.plugin = plugin; - return this; - } - - public PluginModule setPlatform(Platform platform) { this.platform = platform; - return this; + this.logger = logger; } - public PluginModule setLogger(LoggerWrapper logger) { - this.loggerWrapper = logger; - return this; - } + public abstract Class getEntityManager(); + public abstract Class getInventoryManager(); + public abstract Class getItemStackManager(); + public abstract Class getMaterialManager(); + public abstract Class getLocationManger(); @Override public void configure(Binder binder) { @@ -90,7 +62,7 @@ public void configure(Binder binder) { binder.bind(DynamicGuiPlugin.class).toInstance(this.plugin); binder.bind(Platform.class).toInstance(this.platform); binder.bind(new TypeLiteral>() { - }).toInstance(this.loggerWrapper); + }).toInstance(this.logger); binder.requestStaticInjection(EntityManager.class); binder.requestStaticInjection(InventoryManager.class); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java index 9966d4c01..c56b2056f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -18,8 +18,6 @@ import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.event.DynamicGuiReloadEvent; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; import com.clubobsidian.dynamicgui.replacer.Replacer; import com.clubobsidian.dynamicgui.replacer.impl.GlobalPlayerCountReplacer; @@ -27,9 +25,7 @@ import com.clubobsidian.dynamicgui.replacer.impl.PlayerLevelReplacer; import com.clubobsidian.dynamicgui.replacer.impl.PlayerReplacer; import com.clubobsidian.dynamicgui.replacer.impl.PreviousGuiReplacer; -import com.clubobsidian.dynamicgui.replacer.impl.StatisticReplacer; import com.clubobsidian.dynamicgui.replacer.impl.UUIDReplacer; -import com.clubobsidian.dynamicgui.util.Statistic; import com.clubobsidian.trident.EventHandler; import org.apache.commons.lang3.StringUtils; @@ -54,7 +50,6 @@ private DynamicGuiReplacerRegistry() { this.addReplacer(new UUIDReplacer("%uuid%")); this.addReplacer(new PlayerLevelReplacer("%player-level%")); this.addReplacer(new PreviousGuiReplacer("%previous-gui-name%")); - this.generateStatisticReplacers(); DynamicGui.get().getEventBus().registerEvents(this); } @@ -99,25 +94,4 @@ public boolean addReplacer(Replacer replacer) { public void onReload(DynamicGuiReloadEvent event) { this.cachedReplacers.clear(); } - - private void generateStatisticReplacers() { - for(Statistic statistic : Statistic.values()) { - if(statistic.getStatisticType() == Statistic.StatisticType.MATERIAL) { - for(String material : MaterialManager.get().getMaterials()) { - String lowerMaterial = material.toLowerCase(); - String replacerName = "%statistic-" + statistic.name().toLowerCase() + "-" + lowerMaterial + "%"; - this.addReplacer(new StatisticReplacer(replacerName, statistic, lowerMaterial)); - } - } else if(statistic.getStatisticType() == Statistic.StatisticType.ENTITY) { - for(String entityType : EntityManager.get().getEntityTypes()) { - String lowerEntityType = entityType.toLowerCase(); - String replacerName = "%statistic-" + statistic.name().toLowerCase() + "-" + lowerEntityType + "%"; - this.addReplacer(new StatisticReplacer(replacerName, statistic, lowerEntityType)); - } - } else { - String replacerName = "%statistic-" + statistic.name().toLowerCase() + "%"; - this.addReplacer(new StatisticReplacer(replacerName, statistic)); - } - } - } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/StatisticReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/StatisticReplacer.java deleted file mode 100644 index f95020433..000000000 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/StatisticReplacer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2021 Club Obsidian and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.clubobsidian.dynamicgui.replacer.impl; - -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.Replacer; -import com.clubobsidian.dynamicgui.util.Statistic; - -/* - * Generated in DynamicGuiReplacerRegistry - */ -@Deprecated -public class StatisticReplacer extends Replacer { - - private final Statistic statistic; - private final String data; - - public StatisticReplacer(String toReplace, Statistic statistic) { - this(toReplace, statistic, null); - } - - public StatisticReplacer(String toReplace, Statistic statistic, String data) { - super(toReplace); - this.statistic = statistic; - this.data = data; - } - - @Override - public String replacement(String text, PlayerWrapper playerWrapper) { - if(this.data != null) { - return String.valueOf(playerWrapper.getStatistic(this.statistic, data)); - } - return String.valueOf(playerWrapper.getStatistic(this.statistic)); - } -} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/Statistic.java b/core/src/main/java/com/clubobsidian/dynamicgui/util/Statistic.java deleted file mode 100644 index cf2b69e2d..000000000 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/Statistic.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2021 Club Obsidian and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.clubobsidian.dynamicgui.util; - -public enum Statistic { - - ANIMALS_BRED("ANIMALS_BRED", "ANIMALS_BRED"), - ARMOR_CLEANED("ARMOR_CLEANED", "ARMOR_CLEANED"), - AVIATE_ONE_CM("AVIATE_ONE_CM", "AVIATE_ONE_CM"), - BANNER_CLEANED("BANNER_CLEANED", "BANNER_CLEANED"), - BEACON_INTERACTION("BEACON_INTERACTION", "BEACON_INTERACTION"), - BOAT_ONE_CM("BOAT_ONE_CM", "BOAT_ONE_CM"), - BREAK_ITEM("BREAK_ITEM", null, StatisticType.MATERIAL), - BREWINGSTAND_INTERACTION("BREWINGSTAND_INTERACTION", "BREWINGSTAND_INTERACTION"), - CAKE_SLICES_EATEN("CAKES_SLICES_EATEN", "CAKES_SLICES_EATEN"), - CAULDRON_FILLED("CAULDRON_FILLED", "CAULDRON_FILLED"), - CAULDRON_USED("CAULDRON_USED", "CAULDRON_USED"), - CHEST_OPENED("CHEST_OPENED", "CHEST_OPENED"), - CLIMB_ONE_CM("CLIMB_ONE_CM", "CLIMB_ONE_CM"), - CRAFT_ITEM("CRAFT_ITEM", null, StatisticType.MATERIAL), - CRAFTING_TABLE_INTERACTION("CRAFTING_TABLE_INTERACTION", "CRAFTING_TABLE_INTERACTION"), - CROUCH_ONE_CM("CROUCH_ONE_CM", "CROUCH_ONE_CM"), - DAMAGE_DEALT("DAMAGE_DEALT", "DAMAGE_DEALT"), - DAMAGE_TAKEN("DAMAGE_TAKEN", "DAMAGE_TAKEN"), - DEATHS("DEATHS", "DEATHS"), - DISPENSER_INSPECTED("DISPENSER_INSPECTED", "DISPENSER_INSPECTED"), - DROP("DROP", "DROP", StatisticType.MATERIAL), - DROP_COUNT("DROP_COUNT", null), - DROPPER_INSPECTED("DROPPER_INSPECTED", "DROPPED_INSPECTED"), - ENDERCHEST_OPENED("ENDERCHEST_OPENED", "ENDERCHEST_OPENED"), - ENTITY_KILLED_BY("ENTITY_KILLED_BY", null, StatisticType.ENTITY), - FALL_ONE_CM("FALL_ONE_CM", "FALL_ONE_CM"), - FISH_CAUGHT("FISH_CAUGHT", "FISH_CAUGHT"), - FLOWER_POTTED("FLOWER_POTTED", "FLOWER_POTTED"), - FLY_ONE_CM("FLY_ONE_CM", null), - FURNACE_INTERACTION("FURNACE_INTERACTION", "FURNACE_INTERACTION"), - HOPPER_INSPECTED("HOPPER_INSPECTED", "HOPPER_INSPECTED"), - HORSE_ONE_CM("HORSE_ONE_CM", "HORSE_ONE_CM"), - ITEM_ENCHANTED("ITEM_ENCHANTED", "ITEM_ENCHANTED"), - JUMP("JUMP", "JUMP"), - KILL_ENTITY("KILL_ENTITY", null, StatisticType.ENTITY), - LEAVE_GAME("LEAVE_GAME", "LEAVE_GAME"), - MINE_BLOCK("MINE_BLOCK", null, StatisticType.MATERIAL), - MINECART_ONE_CM("MINECART_ONE_CM", "MINECART_ONE_CM"), - MOB_KILLS("MOB_KILLS", "MOB_KILLS"), - NOTEBLOCK_PLAYED("NOTEBLOCK_PLAYED", "NOTEBLOCK_PLAYED"), - NOTEBLOCK_TUNED("NOTEBLOCK_TUNED", "NOTEBLOCK_TUNED"), - PICKUP("PICKUP", null, StatisticType.MATERIAL), - PIG_ONE_CM("PIG_ONE_CM", "PIG_ONE_CM"), - PLAYER_KILLS("PLAYER_KILLS", "PLAYER_KILLS"), - RECORD_PLAYED("RECORD_PLAYED", "RECORD_PLAYED"), - SHULKER_BOX_OPENED("SHULKER_BOX_OPENED", "OPEN_SHULKER_BOX"), - SLEEP_IN_BED("SLEEP_IN_BED", "SLEEP_IN_BED"), - SNEAK_TIME("SNEAK_TIME", "SNEAK_TIME"), - SPRINT_ONE_CM("SPRINT_ONE_CM", "SPRINT_ONE_CM"), - SWIM_ONE_CM("SWIM_ONE_CM", "SWIM_ONE_CM"), - TALKED_TO_VILLAGER("TALKED_TO_VILAGER", "TALKED_TO_VILLAGER"), - TIME_PLAYED_TICK("PLAY_ONE_TICK", "TIME_PLAYED"), - TIME_PLAYED("PLAY_ONE_MINUTE", "TIME_PLAYED"), - TIME_SINCE_DEATH("TIME_SINCE_DEATH", "TIME_SINCE_DEATH"), - TIME_SINCE_REST("TIME_SINCE_REST", "TIME_SINCE_REST"), - TRADED_WITH_VILLAGER("TRADED_WITH_VILLAGER", "TRADED_WITH_VILLAGER"), - TRAPPED_CHEST_TRIGGERED("TRAPPED_CHEST_TRIGGERED", "TRAPPED_CHEST_TRIGGERED"), - USE_ITEM("USE_ITEM", null, StatisticType.MATERIAL), - WALK_ON_WATER_ONE_CM("WALK_ON_WATER_ONE_CM", null), - WALK_ONE_CM("WALK_ONE_CM", "WALK_ONE_CM"), - WALK_UNDER_WATER_ONE_CM("WALK_UNDER_WATER_ONE_CM", null); - - private final String bukkitID; - private final String spongeID; - private final StatisticType statisticType; - - Statistic(String bukkitID, String spongeID) { - this(bukkitID, spongeID, StatisticType.NONE); - } - - Statistic(String bukkitID, String spongeID, StatisticType statisticType) { - this.bukkitID = bukkitID; - this.spongeID = spongeID; - this.statisticType = statisticType; - } - - public String getBukkitID() { - return this.bukkitID; - } - - public String getSpongeID() { - return this.spongeID; - } - - public StatisticType getStatisticType() { - return this.statisticType; - } - - public enum StatisticType { - NONE, - MATERIAL, - ENTITY - } -} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java index 70c975d93..772578b7b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java @@ -36,7 +36,7 @@ public String getName() { public abstract T getWorld(); - public abstract void setGameRule(String rule, String value); + public abstract void setGameRule(String key, String value); public abstract String getGameRule(String rule); diff --git a/bukkit/src/main/resources/config.yml b/core/src/main/resources/config.yml similarity index 100% rename from bukkit/src/main/resources/config.yml rename to core/src/main/resources/config.yml diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java new file mode 100644 index 000000000..d5c8561f1 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java @@ -0,0 +1,72 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.DynamicGui; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.GetGameRuleFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.world.WorldWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class GetGameRuleFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new GetGameRuleFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void noCommaTest() { + Function function = new GetGameRuleFunction(); + function.setData(""); + assertFalse(function.function(this.factory.createPlayer())); + } + @Test + public void lengthNotThreeTest() { + Function function = new GetGameRuleFunction(); + function.setData("a,b"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void worldNullTest() { + this.factory.inject().getPlatform(); + Function function = new GetGameRuleFunction(); + function.setData("test,key,value"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void hasGameRuleTest() { + String worldName = "test"; + MockPlatform platform = this.factory.inject().getPlatform(); + WorldWrapper world = this.factory.createWorld(worldName); + platform.addWorld(world); + world.setGameRule("key", "value"); + Function function = new GetGameRuleFunction(); + function.setData("test,key,value"); + assertTrue(function.function(this.factory.createPlayer())); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index b6619e6c9..9d5636160 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -16,22 +16,33 @@ package com.clubobsidian.dynamicgui.test.mock; +import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.gui.Gui; import com.clubobsidian.dynamicgui.gui.InventoryType; import com.clubobsidian.dynamicgui.gui.ModeEnum; import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.logger.JavaLoggerWrapper; +import com.clubobsidian.dynamicgui.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; +import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.server.Platform; import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.inject.MockPluginModule; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStack; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStackWrapper; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockDynamicGuiPlugin; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockScheduler; import com.clubobsidian.dynamicgui.test.mock.world.MockLocation; import com.clubobsidian.dynamicgui.test.mock.world.MockLocationWrapper; import com.clubobsidian.dynamicgui.test.mock.world.MockWorld; import com.clubobsidian.dynamicgui.test.mock.world.MockWorldWrapper; import org.mockito.Mockito; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.logging.Logger; public class MockFactory { @@ -93,10 +104,35 @@ public Slot createSlot(String type, boolean movable) { new HashMap<>()); } - public MockLocationWrapper createLocation(int x, int y, int z, String worldName) { + public MockWorldWrapper createWorld(String worldName) { MockWorld mockWorld = new MockWorld(worldName); - MockWorldWrapper worldWrapper = new MockWorldWrapper(mockWorld); + return new MockWorldWrapper(mockWorld); + } + + public MockLocationWrapper createLocation(int x, int y, int z, String worldName) { + MockWorldWrapper worldWrapper = this.createWorld(worldName); MockLocation mockLocation = new MockLocation(x, y, z, worldWrapper); return new MockLocationWrapper(mockLocation); } + + public MockFactory inject() { + DynamicGuiPlugin plugin = new MockDynamicGuiPlugin(); + Platform platform = new MockPlatform(new MockScheduler()); + System.out.println(new File(".").getAbsolutePath()); + LoggerWrapper logger = new JavaLoggerWrapper<>(Logger.getLogger("test")); + MockPluginModule module = new MockPluginModule(plugin, platform, logger); + module.bootstrap(); + DynamicGui.get(); //Initializes dynamic gui + return this; + } + + public MockPlatform getPlatform() { + Platform platform = DynamicGui.get().getPlatform(); + if(!(platform instanceof MockPlatform)) { + return null; + } + return (MockPlatform) platform; + } + + } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java new file mode 100644 index 000000000..7be60b3cf --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.inject; + +import com.clubobsidian.dynamicgui.inject.module.PluginModule; +import com.clubobsidian.dynamicgui.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.test.mock.manager.MockEntityManager; +import com.clubobsidian.dynamicgui.test.mock.manager.MockInventoryManager; +import com.clubobsidian.dynamicgui.test.mock.manager.MockItemStackManager; +import com.clubobsidian.dynamicgui.test.mock.manager.MockLocationManager; +import com.clubobsidian.dynamicgui.test.mock.manager.MockMaterialManager; + +public class MockPluginModule extends PluginModule { + + public MockPluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper logger) { + super(plugin, platform, logger); + } + + @Override + public Class getEntityManager() { + return MockEntityManager.class; + } + + @Override + public Class getInventoryManager() { + return MockInventoryManager.class; + } + + @Override + public Class getItemStackManager() { + return MockItemStackManager.class; + } + + @Override + public Class getMaterialManager() { + return MockMaterialManager.class; + } + + @Override + public Class getLocationManger() { + return MockLocationManager.class; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java new file mode 100644 index 000000000..9b4c4093f --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java @@ -0,0 +1,34 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.manager; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.manager.entity.EntityManager; + +import java.util.List; + +public class MockEntityManager extends EntityManager { + @Override + public PlayerWrapper createPlayerWrapper(Object player) { + return null; + } + + @Override + public List getEntityTypes() { + return null; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java new file mode 100644 index 000000000..663ae18cb --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.manager; + +import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; + +public class MockInventoryManager extends InventoryManager { + @Override + public Object createInventory(int size, String title) { + return null; + } + + @Override + public Object createInventory(String title, String type) { + return null; + } + + @Override + public InventoryWrapper createInventoryWrapper(Object inventory) { + return null; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java new file mode 100644 index 000000000..305707792 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java @@ -0,0 +1,32 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.manager; + +import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; + +public class MockItemStackManager extends ItemStackManager { + @Override + public Object createItemStack(String type, int quantity) { + return null; + } + + @Override + public ItemStackWrapper createItemStackWrapper(Object itemStack) { + return null; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java new file mode 100644 index 000000000..11cdd213f --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java @@ -0,0 +1,32 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.manager; + +import com.clubobsidian.dynamicgui.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.world.LocationWrapper; + +public class MockLocationManager extends LocationManager { + @Override + public LocationWrapper toLocationWrapper(String world, int x, int y, int z) { + return null; + } + + @Override + public LocationWrapper toLocationWrapper(Object obj) { + return null; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java new file mode 100644 index 000000000..18b85255b --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.manager; + +import com.clubobsidian.dynamicgui.manager.material.MaterialManager; + +import java.util.List; + +public class MockMaterialManager extends MaterialManager { + @Override + public List getMaterials() { + return null; + } + + @Override + public String normalizeMaterial(String material) { + return null; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java new file mode 100644 index 000000000..7c283d7bb --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java @@ -0,0 +1,96 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.plugin; + +import com.clubobsidian.dynamicgui.economy.Economy; +import com.clubobsidian.dynamicgui.permission.Permission; +import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class MockDynamicGuiPlugin implements DynamicGuiPlugin { + + private final File dataFolder = new File("mock_data"); + private final File guiFolder = new File(this.dataFolder, "guis"); + private final File macroFolder = new File(this.dataFolder, "macros"); + private final File mainFolder = new File("src", "main"); + private final File resourcesFolder = new File(this.mainFolder,"resources"); + private final File configFile = new File(this.resourcesFolder, "config.yml"); + + @Override + public void start() { + + } + + @Override + public void stop() { + + } + + @Override + public Economy getEconomy() { + return null; + } + + @Override + public Permission getPermission() { + return null; + } + + @Override + public List getNPCRegistries() { + return new ArrayList<>(); //TODO - implement + } + + @Override + public File getDataFolder() { + return this.dataFolder; + } + + @Override + public File getConfigFile() { + return this.configFile; + } + + @Override + public File getGuiFolder() { + return this.guiFolder; + } + + @Override + public File getMacroFolder() { + return this.macroFolder; + } + + @Override + public List getRegisteredCommands() { + return new ArrayList<>(); //TODO - implement + } + + @Override + public void createCommand(String guiName, String alias) { + + } + + @Override + public void unloadCommands() { + + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java new file mode 100644 index 000000000..c471f3088 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java @@ -0,0 +1,103 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.plugin; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.server.ServerType; +import com.clubobsidian.dynamicgui.world.WorldWrapper; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class MockPlatform extends Platform { + + private final Map> worlds = new HashMap<>(); + + public MockPlatform(Scheduler scheduler) { + super(scheduler); + } + + @Override + public boolean isMainThread() { + return false; + } + + @Override + public void broadcastMessage(String message) { + + } + + @Override + public void broadcastJsonMessage(String json) { + + } + + @Override + public void dispatchServerCommand(String command) { + + } + + @Override + public PlayerWrapper getPlayer(UUID uuid) { + return null; + } + + @Override + public PlayerWrapper getPlayer(String name) { + return null; + } + + @Override + public Collection> getOnlinePlayers() { + return null; + } + + @Override + public int getGlobalPlayerCount() { + return 0; + } + + @Override + public ServerType getType() { + return null; + } + + @Override + public void registerOutgoingPluginChannel(DynamicGuiPlugin plugin, String channel) { + + } + + @Override + public void registerIncomingPluginChannel(DynamicGuiPlugin plugin, String channel, MessagingRunnable runnable) { + + } + + @Override + public WorldWrapper getWorld(String worldName) { + return this.worlds.get(worldName); + } + + public void addWorld(WorldWrapper world) { + this.worlds.put(world.getName(), world); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java new file mode 100644 index 000000000..132bb076d --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java @@ -0,0 +1,42 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.plugin; + +import com.clubobsidian.dynamicgui.scheduler.Scheduler; + +public class MockScheduler extends Scheduler { + + @Override + public void runSyncDelayedTask(Runnable runnable, long delay) { + + } + + @Override + public void runAsynchronousDelayedTask(Runnable runnable, long delay) { + + } + + @Override + public void scheduleSyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating) { + + } + + @Override + public void scheduleAsyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating) { + + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java index 868657a2a..50d072dfc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java @@ -33,8 +33,8 @@ public MockWorld getWorld() { } @Override - public void setGameRule(String rule, String value) { - this.world.setGameRule(rule, value); + public void setGameRule(String key, String value) { + this.world.setGameRule(key, value); } @Override From 4396d0add64bc4706b98cdfd160f6729c7055017 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:12:58 -0800 Subject: [PATCH 026/261] Create IsBedrockPlayerFunction test --- .../function/IsBedrockPlayerFunctionTest.java | 41 +++++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 7 ++++ 2 files changed, 48 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java new file mode 100644 index 000000000..4c4493bb6 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java @@ -0,0 +1,41 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.IsBedrockPlayerFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import org.junit.Test; + +import java.util.UUID; + +import static org.junit.Assert.assertTrue; + +public class IsBedrockPlayerFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void test() { + String name = "test"; + UUID uuid = new UUID(0, 1); + MockPlayerWrapper player = this.factory.createPlayer(name, uuid); + Function function = new IsBedrockPlayerFunction(); + assertTrue(function.function(player)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index 9d5636160..aee194974 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -26,6 +26,7 @@ import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayer; import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; import com.clubobsidian.dynamicgui.test.mock.inject.MockPluginModule; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStack; @@ -42,6 +43,7 @@ import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.UUID; import java.util.logging.Logger; public class MockFactory { @@ -61,6 +63,11 @@ public MockPlayerWrapper createPlayer() { return this.mock(MockPlayerWrapper.class); } + public MockPlayerWrapper createPlayer(String name, UUID uuid) { + MockPlayer player = this.mock(MockPlayer.class, name, uuid); + return this.mock(MockPlayerWrapper.class, player); + } + public MockItemStackWrapper createItemStack(String type) { MockItemStack itemStack = this.mock(MockItemStack.class, type); return this.mock(MockItemStackWrapper.class, itemStack); From 3d118fe419c2ce85a780be236cdc1ce47cde043e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:15:13 -0800 Subject: [PATCH 027/261] Remove cla from readme and update description --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e90df3ee..7ffe992a3 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,12 @@

DynamicGui

[![build](https://github.com/ClubObsidian/DynamicGui/actions/workflows/build.yml/badge.svg)](https://github.com/ClubObsidian/DynamicGui/actions/workflows/build.yml) -[![CLA assistant](https://cla-assistant.io/readme/badge/ClubObsidian/DynamicGui)](https://cla-assistant.io/ClubObsidian/DynamicGui) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +A plugin designed to make writing menus for Minecraft easy. Menus can be written in the configuration language of your choice: yaml, hocon, json or xml. -A rewrite of the plugin originally created at Club Obsidian. -Designed to make writing menus easy. ## Features From 85bf2b3526dbe20b86aae1e33ef4792a6816ba23 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:18:39 -0800 Subject: [PATCH 028/261] Cleanup readme Remove multiserver support, add future features section --- README.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7ffe992a3..dfecb8c10 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,8 @@ A plugin designed to make writing menus for Minecraft easy. Menus can be written in the configuration language of your choice: yaml, hocon, json or xml. - - - ## Features -* Multi server support in one jar - * Bukkit - Fully supported - * Sponge - Support dropped for now * A number of functions to use to customize menus * Functions use latebinding * Addons can be written for more functions @@ -42,6 +36,9 @@ A plugin designed to make writing menus for Minecraft easy. Menus can be written * Hopper * Workbench +## Future features + +* Support for sponge ## Use cases @@ -57,7 +54,6 @@ Just a few uses for DynamicGui. * Quests * Shop * Staff tools - * Punishments ## Downloads @@ -65,10 +61,6 @@ You can get [development builds from our jenkins.](https://ci.ravenlab.dev/job/D ## Getting Started -### Gui Examples - -You can find [gui examples here](https://github.com/ClubObsidian/DynamicGuiExamples). - ### Gui Documentation You find find [gui documentation here](https://dynamicgui.github.io/documentation/). From 15a72560af56c973c0fe9db5da755378ffc50016 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:19:21 -0800 Subject: [PATCH 029/261] Remove CLA reference in contributing CLA is going to be removed so might as well remove reference to it --- CONTRIBUTING.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b4c7c790..e0c91e615 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,6 @@ First off thank you for considering contributing to DynamicGui! Below are a few different ways you can contribute. - ## Issues If you run into a bug please report it, **please note if this is a bug that could result in item duplication or some other security risk please report it to `virustotal#0001` on the DynamicGui Discord server.** If the bug is not a security risk or could do damage to servers that are using the plugin please file a bug report at https://github.com/ClubObsidian/DynamicGui/issues @@ -15,8 +14,6 @@ We gladly accept most contributions which do not break backwards compatability. If you are updating documentation please put `[ci skip]` in your commit so that your commit gets skipped by github actions, you can [read more about that here.](https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/) -**Please note before your code will be accepted please sign our [CLA.](https://cla-assistant.io/ClubObsidian/DynamicGui)** - ## Features From ea5703b802ec852a78395df275dc6f5c0e39a14a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:21:56 -0800 Subject: [PATCH 030/261] Remove reference to jenkins in readme Add reference to github actions instead of jenkins --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfecb8c10..df124ae50 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Just a few uses for DynamicGui. ## Downloads -You can get [development builds from our jenkins.](https://ci.ravenlab.dev/job/DynamicGui/) +You can get [development builds from Github actions](https://github.com/ClubObsidian/DynamicGui/actions/workflows/build.yml) but you will need a Github account. ## Getting Started From 8874161ccf817031d83389cb70fbd1683db5885e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:42:01 -0800 Subject: [PATCH 031/261] Create LogFunction test Created LogFunction test, create mock logger so that messages do not get logged to console and we can see the input and output of the logger --- .../function/IsBedrockPlayerFunctionTest.java | 2 +- .../test/function/LogFunctionTest.java | 47 +++++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 12 ++++- .../test/mock/logger/MockLogger.java | 47 +++++++++++++++++++ .../test/mock/logger/MockLoggerWrapper.java | 36 ++++++++++++++ 5 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java index 4c4493bb6..de9a1b8de 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java @@ -31,7 +31,7 @@ public class IsBedrockPlayerFunctionTest { private final MockFactory factory = new MockFactory(); @Test - public void test() { + public void functionTest() { String name = "test"; UUID uuid = new UUID(0, 1); MockPlayerWrapper player = this.factory.createPlayer(name, uuid); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java new file mode 100644 index 000000000..e6bf5fa32 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java @@ -0,0 +1,47 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.LogFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.logger.MockLogger; +import com.clubobsidian.dynamicgui.test.mock.logger.MockLoggerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class LogFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void functionTest() { + String data = "test"; + Function function = new LogFunction(); + function.setData(data); + MockLoggerWrapper wrapper = this.factory.inject().getLogger(); + MockLogger logger = wrapper.getLogger(); + logger.clear(); //Clear queue due to potential startup messages from DynamicGui + PlayerWrapper player = this.factory.createPlayer(); + assertTrue(function.function(player)); + assertTrue(logger.getInfoMessages().size() == 1); + assertEquals(data, logger.getInfoMessages().get(0)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index aee194974..b14236154 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -31,6 +31,8 @@ import com.clubobsidian.dynamicgui.test.mock.inject.MockPluginModule; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStack; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStackWrapper; +import com.clubobsidian.dynamicgui.test.mock.logger.MockLogger; +import com.clubobsidian.dynamicgui.test.mock.logger.MockLoggerWrapper; import com.clubobsidian.dynamicgui.test.mock.plugin.MockDynamicGuiPlugin; import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; import com.clubobsidian.dynamicgui.test.mock.plugin.MockScheduler; @@ -126,7 +128,7 @@ public MockFactory inject() { DynamicGuiPlugin plugin = new MockDynamicGuiPlugin(); Platform platform = new MockPlatform(new MockScheduler()); System.out.println(new File(".").getAbsolutePath()); - LoggerWrapper logger = new JavaLoggerWrapper<>(Logger.getLogger("test")); + LoggerWrapper logger = new MockLoggerWrapper(new MockLogger()); MockPluginModule module = new MockPluginModule(plugin, platform, logger); module.bootstrap(); DynamicGui.get(); //Initializes dynamic gui @@ -141,5 +143,13 @@ public MockPlatform getPlatform() { return (MockPlatform) platform; } + public MockLoggerWrapper getLogger() { + LoggerWrapper logger = DynamicGui.get().getLogger(); + if(!(logger instanceof MockLoggerWrapper)) { + return null; + } + return (MockLoggerWrapper) logger; + } + } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java new file mode 100644 index 000000000..d1f516d99 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java @@ -0,0 +1,47 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.logger; + +import java.util.ArrayList; +import java.util.List; + +public class MockLogger { + + private final List infoMessages = new ArrayList<>(); + private final List errorMessages = new ArrayList<>(); + + public void info(String message) { + this.infoMessages.add(message); + } + + public void error(String message) { + this.errorMessages.add(message); + } + + public List getInfoMessages() { + return this.infoMessages; + } + + public List getErrorMessages() { + return this.errorMessages; + } + + public void clear() { + this.infoMessages.clear(); + this.errorMessages.clear(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java new file mode 100644 index 000000000..4094f26ff --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java @@ -0,0 +1,36 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.logger; + +import com.clubobsidian.dynamicgui.logger.LoggerWrapper; + +public class MockLoggerWrapper extends LoggerWrapper { + + public MockLoggerWrapper(MockLogger logger) { + super(logger); + } + + @Override + public void info(String message) { + this.getLogger().info(message); + } + + @Override + public void error(String message) { + this.getLogger().error(message); + } +} From 9efc91b3a30d9c21b3ba751fdbd27d903b4a20fd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 03:43:54 -0800 Subject: [PATCH 032/261] Don't log if data is null --- .../dynamicgui/function/impl/LogFunction.java | 3 +++ .../dynamicgui/test/function/LogFunctionTest.java | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java index 53e16167b..3e708c664 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java @@ -32,6 +32,9 @@ public LogFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } DynamicGui.get().getLogger().info(this.getData()); return true; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java index e6bf5fa32..3dc76773e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java @@ -25,6 +25,7 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class LogFunctionTest { @@ -32,7 +33,14 @@ public class LogFunctionTest { private final MockFactory factory = new MockFactory(); @Test - public void functionTest() { + public void nullTest() { + Function function = new LogFunction(); + PlayerWrapper player = this.factory.createPlayer(); + assertFalse(function.function(player)); + } + + @Test + public void withDataTest() { String data = "test"; Function function = new LogFunction(); function.setData(data); From 0f75445580ae2c88d1bde6263bc8c4a5796c7f58 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 04:02:03 -0800 Subject: [PATCH 033/261] Test money balance function, create economy mock Mock economy for testing the money balance function --- .../function/impl/MoneyBalanceFunction.java | 4 +- .../test/function/LogFunctionTest.java | 1 - .../function/MoneyBalanceFunctionTest.java | 84 +++++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 19 ++++- .../mock/plugin/MockDynamicGuiPlugin.java | 3 +- .../test/mock/plugin/MockEconomy.java | 62 ++++++++++++++ 6 files changed, 168 insertions(+), 5 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java index fdc23c9d2..a9e0b6c35 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java @@ -43,11 +43,11 @@ public boolean function(final PlayerWrapper playerWrapper) { return false; } - if(DynamicGui.get().getPlugin().getEconomy() == null) + if(DynamicGui.get().getPlugin().getEconomy() == null) { return false; + } BigDecimal decimalAmt = new BigDecimal(amt); - return DynamicGui.get().getPlugin().getEconomy().getBalance(playerWrapper).compareTo(decimalAmt) >= 0; } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java index 3dc76773e..a91b45e94 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java @@ -46,7 +46,6 @@ public void withDataTest() { function.setData(data); MockLoggerWrapper wrapper = this.factory.inject().getLogger(); MockLogger logger = wrapper.getLogger(); - logger.clear(); //Clear queue due to potential startup messages from DynamicGui PlayerWrapper player = this.factory.createPlayer(); assertTrue(function.function(player)); assertTrue(logger.getInfoMessages().size() == 1); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java new file mode 100644 index 000000000..2aa35d50e --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java @@ -0,0 +1,84 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.MoneyBalanceFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; +import org.junit.Test; + +import java.math.BigDecimal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class MoneyBalanceFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testBelowBalance() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyBalanceFunction(); + function.setData("10"); + assertFalse(function.function(player)); + } + + @Test + public void testInvalidData() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyBalanceFunction(); + function.setData("a"); + assertFalse(function.function(player)); + } + + @Test + public void testNullEconomy() { + this.factory.inject().getPlugin().economy = null; + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyBalanceFunction(); + function.setData("10"); + assertFalse(function.function(player)); + } + + @Test + public void testEqualBalance() { + PlayerWrapper player = this.factory.createPlayer(); + MockEconomy economy = this.factory.inject().getEconomy(); + BigDecimal amount = new BigDecimal(1); + economy.deposit(player, amount); + Function function = new MoneyBalanceFunction(); + function.setData("" + amount.intValue()); + assertTrue(function.function(player)); + } + + @Test + public void testAboveBalance() { + PlayerWrapper player = this.factory.createPlayer(); + MockEconomy economy = this.factory.inject().getEconomy(); + int checkAmount = 9; + BigDecimal depositAmount = new BigDecimal(checkAmount + 1); + economy.deposit(player, depositAmount); + Function function = new MoneyBalanceFunction(); + function.setData("" + checkAmount); + assertTrue(function.function(player)); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index b14236154..6525b799a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -17,6 +17,7 @@ package com.clubobsidian.dynamicgui.test.mock; import com.clubobsidian.dynamicgui.DynamicGui; +import com.clubobsidian.dynamicgui.economy.Economy; import com.clubobsidian.dynamicgui.gui.Gui; import com.clubobsidian.dynamicgui.gui.InventoryType; import com.clubobsidian.dynamicgui.gui.ModeEnum; @@ -34,12 +35,14 @@ import com.clubobsidian.dynamicgui.test.mock.logger.MockLogger; import com.clubobsidian.dynamicgui.test.mock.logger.MockLoggerWrapper; import com.clubobsidian.dynamicgui.test.mock.plugin.MockDynamicGuiPlugin; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; import com.clubobsidian.dynamicgui.test.mock.plugin.MockScheduler; import com.clubobsidian.dynamicgui.test.mock.world.MockLocation; import com.clubobsidian.dynamicgui.test.mock.world.MockLocationWrapper; import com.clubobsidian.dynamicgui.test.mock.world.MockWorld; import com.clubobsidian.dynamicgui.test.mock.world.MockWorldWrapper; +import org.mockito.Mock; import org.mockito.Mockito; import java.io.File; @@ -127,11 +130,11 @@ public MockLocationWrapper createLocation(int x, int y, int z, String worldName) public MockFactory inject() { DynamicGuiPlugin plugin = new MockDynamicGuiPlugin(); Platform platform = new MockPlatform(new MockScheduler()); - System.out.println(new File(".").getAbsolutePath()); LoggerWrapper logger = new MockLoggerWrapper(new MockLogger()); MockPluginModule module = new MockPluginModule(plugin, platform, logger); module.bootstrap(); DynamicGui.get(); //Initializes dynamic gui + this.getLogger().getLogger().clear(); //Clear logs for initialization return this; } @@ -151,5 +154,19 @@ public MockLoggerWrapper getLogger() { return (MockLoggerWrapper) logger; } + public MockEconomy getEconomy() { + Economy economy = DynamicGui.get().getPlugin().getEconomy();; + if(!(economy instanceof MockEconomy)) { + return null; + } + return (MockEconomy) economy; + } + public MockDynamicGuiPlugin getPlugin() { + DynamicGuiPlugin plugin = DynamicGui.get().getPlugin(); + if(!(plugin instanceof MockDynamicGuiPlugin)) { + return null; + } + return (MockDynamicGuiPlugin) plugin; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java index 7c283d7bb..fdcb94f14 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java @@ -33,6 +33,7 @@ public class MockDynamicGuiPlugin implements DynamicGuiPlugin { private final File mainFolder = new File("src", "main"); private final File resourcesFolder = new File(this.mainFolder,"resources"); private final File configFile = new File(this.resourcesFolder, "config.yml"); + public Economy economy = new MockEconomy(); //Visible for testing @Override public void start() { @@ -46,7 +47,7 @@ public void stop() { @Override public Economy getEconomy() { - return null; + return this.economy; } @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java new file mode 100644 index 000000000..fe85811a2 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java @@ -0,0 +1,62 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.plugin; + +import com.clubobsidian.dynamicgui.economy.Economy; +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +public class MockEconomy implements Economy { + + private final Map, BigDecimal> balances = new HashMap<>(); + + @Override + public boolean setup() { + return true; + } + + @Override + public BigDecimal getBalance(PlayerWrapper playerWrapper) { + return this.balances.getOrDefault(playerWrapper, new BigDecimal(0)); + } + + @Override + public boolean withdraw(PlayerWrapper playerWrapper, BigDecimal amt) { + BigDecimal balance = this.getBalance(playerWrapper); + if(balance.intValue() >= amt.intValue()) { + balance = balance.subtract(amt); + this.balances.put(playerWrapper, balance); + return true; + } + return false; + } + + @Override + public boolean deposit(PlayerWrapper playerWrapper, BigDecimal amt) { + BigDecimal balance = this.getBalance(playerWrapper); + balance = balance.add(amt); + this.balances.put(playerWrapper, balance); + return true; + } + + public Map, BigDecimal> getBalances() { + return this.balances; + } +} From 55025e2423718b963a54446c6ed83d2311176eb3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 04:03:33 -0800 Subject: [PATCH 034/261] Console command shouldn't execute if data is null --- .../dynamicgui/function/impl/ConsoleCmdFunction.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java index eac6dcfe7..e963fff7c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java @@ -33,6 +33,9 @@ public ConsoleCmdFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } DynamicGui.get().getPlatform().dispatchServerCommand(ReplacerManager.get().replace(this.getData(), playerWrapper)); return true; } From 8e06128c5b0f5bb05104f447281a0e91ad869c3c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 04:08:07 -0800 Subject: [PATCH 035/261] Create console command function test --- .../test/function/ConsoleCmdFunctionTest.java | 49 +++++++++++++++++++ .../test/mock/plugin/MockPlatform.java | 7 +++ 2 files changed, 56 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java new file mode 100644 index 000000000..c00d147db --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.ConsoleCmdFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class ConsoleCmdFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new ConsoleCmdFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void withDataTest() { + String data = "test"; + MockPlatform platform = this.factory.inject().getPlatform(); + Function function = new ConsoleCmdFunction(); + function.setData(data); + assertTrue(function.function(this.factory.createPlayer())); + assertEquals(data, platform.getDispatchedServerCommands().get(0)); + } + +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java index c471f3088..44869ddef 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java @@ -24,14 +24,17 @@ import com.clubobsidian.dynamicgui.server.ServerType; import com.clubobsidian.dynamicgui.world.WorldWrapper; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; public class MockPlatform extends Platform { private final Map> worlds = new HashMap<>(); + private final List dispatchedServerCommands = new ArrayList<>(); public MockPlatform(Scheduler scheduler) { super(scheduler); @@ -54,7 +57,11 @@ public void broadcastJsonMessage(String json) { @Override public void dispatchServerCommand(String command) { + this.dispatchedServerCommands.add(command); + } + public List getDispatchedServerCommands() { + return this.dispatchedServerCommands; } @Override From e43824c2f1dcd779bd41333eebe5fcb989d5fb4d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 04:11:50 -0800 Subject: [PATCH 036/261] Create money deposit test --- .../function/impl/MoneyDepositFunction.java | 6 +- .../function/MoneyDepositFunctionTest.java | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java index 0104d7743..f68725430 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java @@ -42,12 +42,10 @@ public boolean function(final PlayerWrapper playerWrapper) { ex.printStackTrace(); return false; } - - if(DynamicGui.get().getPlugin().getEconomy() == null) + if(DynamicGui.get().getPlugin().getEconomy() == null) { return false; - + } BigDecimal decimalAmt = new BigDecimal(amt); - return DynamicGui.get().getPlugin().getEconomy().deposit(playerWrapper, decimalAmt); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java new file mode 100644 index 000000000..32d95555b --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java @@ -0,0 +1,61 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.MoneyDepositFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; +import org.junit.Test; + +import java.math.BigDecimal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class MoneyDepositFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testInvalidData() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyDepositFunction(); + function.setData("a"); + assertFalse(function.function(player)); + } + + @Test + public void testNullEconomy() { + this.factory.inject().getPlugin().economy = null; + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyDepositFunction(); + function.setData("10"); + assertFalse(function.function(player)); + } + + @Test + public void testValidDeposit() { + PlayerWrapper player = this.factory.createPlayer(); + this.factory.inject(); + Function function = new MoneyDepositFunction(); + function.setData("10"); + assertTrue(function.function(player)); + } +} From 8b4d4e444dbf833abc907f7584a7be157a107a5b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 19:07:22 -0800 Subject: [PATCH 037/261] Create money withdraw function --- .../function/impl/MoneyWithdrawFunction.java | 6 +- .../function/MoneyWithdrawFunctionTest.java | 84 +++++++++++++++++++ 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java index 658b3f29d..4b076ceab 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java @@ -41,15 +41,13 @@ public boolean function(final PlayerWrapper playerWrapper) { ex.printStackTrace(); return false; } - - if(DynamicGui.get().getPlugin().getEconomy() == null) + if(DynamicGui.get().getPlugin().getEconomy() == null) { return false; - + } BigDecimal decimalAmt = new BigDecimal(amt); if(DynamicGui.get().getPlugin().getEconomy().getBalance(playerWrapper).compareTo(decimalAmt) == -1) { return false; } - return DynamicGui.get().getPlugin().getEconomy().withdraw(playerWrapper, decimalAmt); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java new file mode 100644 index 000000000..706a5a56f --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java @@ -0,0 +1,84 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.MoneyWithdrawFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; +import org.junit.Test; + +import java.math.BigDecimal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class MoneyWithdrawFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testBelowBalance() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyWithdrawFunction(); + function.setData("10"); + assertFalse(function.function(player)); + } + + @Test + public void testInvalidData() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyWithdrawFunction(); + function.setData("a"); + assertFalse(function.function(player)); + } + + @Test + public void testNullEconomy() { + this.factory.inject().getPlugin().economy = null; + PlayerWrapper player = this.factory.createPlayer(); + Function function = new MoneyWithdrawFunction(); + function.setData("10"); + assertFalse(function.function(player)); + } + + @Test + public void testEqualBalance() { + PlayerWrapper player = this.factory.createPlayer(); + MockEconomy economy = this.factory.inject().getEconomy(); + BigDecimal amount = new BigDecimal(1); + economy.deposit(player, amount); + Function function = new MoneyWithdrawFunction(); + function.setData("" + amount.intValue()); + assertTrue(function.function(player)); + } + + @Test + public void testAboveBalance() { + PlayerWrapper player = this.factory.createPlayer(); + MockEconomy economy = this.factory.inject().getEconomy(); + int withdrawAmount = 9; + BigDecimal depositAmount = new BigDecimal(withdrawAmount + 1); + economy.deposit(player, depositAmount); + Function function = new MoneyWithdrawFunction(); + function.setData("" + withdrawAmount); + assertTrue(function.function(player)); + } +} From cd90ea35a25bea5a14f055495688e4e09ce27014 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 19:16:15 -0800 Subject: [PATCH 038/261] Test no permission function --- .../function/impl/NoPermissionFunction.java | 3 + .../CheckItemInTypeHandFunctionTest.java | 2 +- .../test/function/CheckLevelFunctionTest.java | 2 +- .../function/CheckMoveableFunctionTest.java | 2 +- .../CheckPlayerWorldFunctionTest.java | 2 +- .../function/IsBedrockPlayerFunctionTest.java | 2 +- .../function/NoPermissionFunctionTest.java | 56 +++++++++++++++++++ .../dynamicgui/test/mock/MockFactory.java | 8 +-- .../test/mock/entity/package-info.java | 17 ++++++ .../mock/entity/{ => player}/MockPlayer.java | 6 +- .../{ => player}/MockPlayerWrapper.java | 7 ++- .../mock/plugin/MockDynamicGuiPlugin.java | 3 +- .../test/mock/plugin/MockPermission.java | 43 ++++++++++++++ 13 files changed, 139 insertions(+), 14 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java rename core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/{ => player}/MockPlayer.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/{ => player}/MockPlayerWrapper.java (92%) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java index 1f9357ed4..382614fb0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java @@ -31,6 +31,9 @@ public NoPermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } return !playerWrapper.hasPermission(this.getData()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java index 6d19c3487..77fe48823 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java @@ -20,7 +20,7 @@ import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java index 7f83af772..859e63c30 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java index 1eb450fd6..64b54652b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java index e150dadcd..6d2f6b499 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java index de9a1b8de..38c3697f4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.function.Function; import com.clubobsidian.dynamicgui.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import java.util.UUID; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java new file mode 100644 index 000000000..8b87a45ea --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.NoPermissionFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class NoPermissionFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testNullData() { + Function function = new NoPermissionFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void testHasNoPermission() { + this.factory.inject(); + Function function = new NoPermissionFunction(); + function.setData("test"); + assertTrue(function.function(this.factory.createPlayer())); + } + + @Test + public void testHasPermission() { + String permission = "test"; + this.factory.inject(); + Function function = new NoPermissionFunction(); + function.setData(permission); + PlayerWrapper player = this.factory.createPlayer(); + player.addPermission(permission); + assertFalse(function.function(player)); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index 6525b799a..3e8d35f93 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -22,13 +22,12 @@ import com.clubobsidian.dynamicgui.gui.InventoryType; import com.clubobsidian.dynamicgui.gui.ModeEnum; import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.logger.JavaLoggerWrapper; import com.clubobsidian.dynamicgui.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.server.Platform; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayer; -import com.clubobsidian.dynamicgui.test.mock.entity.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.test.mock.inject.MockPluginModule; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStack; import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStackWrapper; @@ -42,14 +41,11 @@ import com.clubobsidian.dynamicgui.test.mock.world.MockLocationWrapper; import com.clubobsidian.dynamicgui.test.mock.world.MockWorld; import com.clubobsidian.dynamicgui.test.mock.world.MockWorldWrapper; -import org.mockito.Mock; import org.mockito.Mockito; -import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; -import java.util.logging.Logger; public class MockFactory { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java new file mode 100644 index 000000000..3345b467b --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.entity; \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayer.java rename to core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java index b2061de50..dc84df24d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.entity; +package com.clubobsidian.dynamicgui.test.mock.entity.player; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.world.LocationWrapper; @@ -77,6 +77,10 @@ public boolean addPermission(String permission) { return this.permissions.add(permission); } + public boolean removePermission(String permission) { + return this.permissions.remove(permission); + } + public ItemStackWrapper getItemInHand() { return this.hand; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java similarity index 92% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayerWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java index 6b85963e0..1e50dd660 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.entity; +package com.clubobsidian.dynamicgui.test.mock.entity.player; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; @@ -64,6 +64,11 @@ public boolean addPermission(String permission) { return this.getPlayer().addPermission(permission); } + @Override + public boolean removePermission(String permission) { + return this.getPlayer().removePermission(permission); + } + @Override public ItemStackWrapper getItemInHand() { return this.getPlayer().getItemInHand(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java index fdcb94f14..2ad59b1b1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java @@ -34,6 +34,7 @@ public class MockDynamicGuiPlugin implements DynamicGuiPlugin { private final File resourcesFolder = new File(this.mainFolder,"resources"); private final File configFile = new File(this.resourcesFolder, "config.yml"); public Economy economy = new MockEconomy(); //Visible for testing + public Permission permission = new MockPermission(); //Visible for testing @Override public void start() { @@ -52,7 +53,7 @@ public Economy getEconomy() { @Override public Permission getPermission() { - return null; + return this.permission; } @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java new file mode 100644 index 000000000..2f37439c4 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java @@ -0,0 +1,43 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.mock.plugin; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.permission.Permission; + +public class MockPermission implements Permission { + + @Override + public boolean setup() { + return true; + } + + @Override + public boolean hasPermission(PlayerWrapper playerWrapper, String permission) { + return playerWrapper.hasPermission(permission); + } + + @Override + public boolean addPermission(PlayerWrapper playerWrapper, String permission) { + return playerWrapper.addPermission(permission); + } + + @Override + public boolean removePermission(PlayerWrapper playerWrapper, String permission) { + return playerWrapper.removePermission(permission); + } +} From eb5cd4e0cc0d7218c2f40f21a682f227ce189eb5 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 19:31:50 -0800 Subject: [PATCH 039/261] Test particle function --- .../entity/bukkit/BukkitPlayerWrapper.java | 7 ++- .../dynamicgui/effect/ParticleWrapper.java | 49 +++++++++++++++---- .../dynamicgui/entity/PlayerWrapper.java | 3 +- .../function/impl/ParticleFunction.java | 3 ++ .../test/function/ParticleFunctionTest.java | 48 ++++++++++++++++++ .../test/mock/entity/player/MockPlayer.java | 10 ++++ .../mock/entity/player/MockPlayerWrapper.java | 12 +++++ 7 files changed, 120 insertions(+), 12 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java index 017652923..fc4b68934 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.entity.bukkit; import com.clubobsidian.dynamicgui.DynamicGui; +import com.clubobsidian.dynamicgui.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; @@ -145,10 +146,12 @@ public void playSound(String sound, Float volume, Float pitch) { } @Override - public void playEffect(String effect, int data) { + public void playEffect(ParticleWrapper.ParticleData particleData) { + String effect = particleData.getEffect(); + int extraData = particleData.getExtraData(); Player player = this.getPlayer(); Location playerLocation = player.getLocation(); - playerLocation.getWorld().playEffect(playerLocation, Effect.valueOf(effect), data); + playerLocation.getWorld().playEffect(playerLocation, Effect.valueOf(effect), extraData); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java index 4060d0e50..ddcabb153 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java @@ -16,8 +16,10 @@ package com.clubobsidian.dynamicgui.effect; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import org.apache.commons.lang3.math.NumberUtils; import java.io.Serializable; +import java.util.Objects; public class ParticleWrapper implements Serializable { @@ -25,25 +27,54 @@ public class ParticleWrapper implements Serializable { * */ private static final long serialVersionUID = -5003322741003989392L; - private String effect; - private int data; + private final ParticleData data; public ParticleWrapper(String str) { - this.loadFromString(str); + this.data = this.loadFromString(str); } - private void loadFromString(String str) { + private ParticleData loadFromString(String str) { if(str.contains(",")) { String[] args = str.split(","); - this.effect = args[0].toUpperCase(); - this.data = Integer.parseInt(args[1]); + return new ParticleData(args[0].toUpperCase(), NumberUtils.toInt(args[1])); } else { - this.effect = str; - this.data = 0; + return new ParticleData(str, 0); } } public void spawnEffect(PlayerWrapper player) { - player.playEffect(this.effect.toUpperCase(), this.data); + player.playEffect(this.data); + } + + public class ParticleData { + + private final String effect; + private final int extraData; + + private ParticleData(String effect, int data) { + this.effect = effect; + this.extraData = data; + } + + public String getEffect() { + return this.effect; + } + + public int getExtraData() { + return this.extraData; + } + + @Override + public boolean equals(Object o) { + if(this == o) return true; + if(!(o instanceof ParticleData)) return false; + ParticleData that = (ParticleData) o; + return extraData == that.extraData && Objects.equals(effect, that.effect); + } + + @Override + public int hashCode() { + return Objects.hash(effect, extraData); + } } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java index 236f2698a..7fe117bb8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java @@ -15,6 +15,7 @@ */ package com.clubobsidian.dynamicgui.entity; +import com.clubobsidian.dynamicgui.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; @@ -68,7 +69,7 @@ public T getPlayer() { public abstract void playSound(String sound, Float volume, Float pitch); - public abstract void playEffect(String effect, int data); + public abstract void playEffect(ParticleWrapper.ParticleData particleData); public abstract void updateInventory(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java index f227ec5c0..f5968abeb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java @@ -32,6 +32,9 @@ public ParticleFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } ParticleWrapper wrapper = new ParticleWrapper(this.getData()); wrapper.spawnEffect(playerWrapper); return true; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java new file mode 100644 index 000000000..1fc44fb22 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.ParticleFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class ParticleFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testNullData() { + Function function = new ParticleFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void testValid() { + Function function = new ParticleFunction(); + function.setData("test,0"); + MockPlayerWrapper player = this.factory.createPlayer(); + assertTrue(function.function(player)); + assertTrue(player.getParticles().size() == 1); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java index dc84df24d..91c998f36 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.entity.player; +import com.clubobsidian.dynamicgui.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.world.LocationWrapper; @@ -35,6 +36,7 @@ public class MockPlayer { private ItemStackWrapper hand; private int level = 0; private LocationWrapper location; + private List particles = new ArrayList<>(); public MockPlayer(String name, UUID uuid) { this.name = name; @@ -104,4 +106,12 @@ public LocationWrapper getLocation() { public void setLocation(LocationWrapper location) { this.location = location; } + + public void playEffect(ParticleWrapper.ParticleData particleData) { + this.particles.add(particleData); + } + + public List getParticles() { + return this.particles; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java index 1e50dd660..708c85df0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java @@ -16,10 +16,13 @@ package com.clubobsidian.dynamicgui.test.mock.entity.player; +import com.clubobsidian.dynamicgui.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.world.LocationWrapper; +import java.util.Collection; +import java.util.List; import java.util.UUID; public abstract class MockPlayerWrapper extends PlayerWrapper { @@ -95,4 +98,13 @@ public LocationWrapper getLocation() { public void setLocation(LocationWrapper location) { this.getPlayer().setLocation(location); } + + @Override + public void playEffect(ParticleWrapper.ParticleData particleData) { + this.getPlayer().playEffect(particleData); + } + + public List getParticles() { + return this.getPlayer().getParticles(); + } } \ No newline at end of file From 21495b0eede37578e53efcf992445392e0a29b4e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 19:36:03 -0800 Subject: [PATCH 040/261] Test permission function --- .../function/impl/PermissionFunction.java | 3 + .../test/function/PermissionFunctionTest.java | 56 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java index a7b1aaeaf..4e616d3c9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java @@ -31,6 +31,9 @@ public PermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } return playerWrapper.hasPermission(this.getData()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java new file mode 100644 index 000000000..897dfb4b1 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.test.function; + +import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.function.impl.PermissionFunction; +import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class PermissionFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new PermissionFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + + @Test + public void doesNotHavePermissionTest() { + Function function = new PermissionFunction(); + function.setData("test"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void hasPermissionTest() { + String permission = "test"; + Function function = new PermissionFunction(); + function.setData(permission); + PlayerWrapper player = this.factory.createPlayer(); + player.addPermission(permission); + assertTrue(function.function(player)); + } + +} From 06fe494155df4859930ec5e12af93a89d487e354 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 19:45:48 -0800 Subject: [PATCH 041/261] Check for null data in a bunch of places Catch a bunch of potential npes --- .../dynamicgui/function/impl/PlayerCmdFunction.java | 3 +++ .../dynamicgui/function/impl/PlayerMiniMsgFunction.java | 1 - .../dynamicgui/function/impl/PlayerMsgFunction.java | 3 +++ .../dynamicgui/function/impl/PlayerMsgJsonFunction.java | 1 - .../dynamicgui/function/impl/RandomFunction.java | 3 +++ .../function/impl/RemovePermissionFunction.java | 3 +++ .../dynamicgui/function/impl/RemoveSlotFunction.java | 1 - .../dynamicgui/function/impl/SendFunction.java | 3 +++ .../function/impl/ServerBroadcastFunction.java | 9 ++++++++- .../function/impl/ServerBroadcastJsonFunction.java | 1 - .../function/impl/ServerMiniBroadcastFunction.java | 1 - .../dynamicgui/function/impl/SetAmountFunction.java | 3 +++ .../dynamicgui/function/impl/SetCloseFunction.java | 3 +++ .../dynamicgui/function/impl/SetDataFunction.java | 3 +++ .../dynamicgui/function/impl/SetEnchantsFunction.java | 3 +++ .../dynamicgui/function/impl/SetGameRuleFunction.java | 4 +--- .../dynamicgui/function/impl/SetGlowFunction.java | 3 +++ .../dynamicgui/function/impl/SetLoreFunction.java | 3 +++ .../dynamicgui/function/impl/SetMoveableFunction.java | 3 +++ .../dynamicgui/function/impl/SetNBTFunction.java | 3 +++ .../dynamicgui/function/impl/SetNameFunction.java | 3 +++ .../dynamicgui/function/impl/SetTypeFunction.java | 4 +++- .../dynamicgui/function/impl/SoundFunction.java | 3 +++ .../function/impl/cooldown/IsNotOnCooldownFunction.java | 1 - .../function/impl/cooldown/IsOnCooldownFunction.java | 1 - .../function/impl/cooldown/SetCooldownFunction.java | 4 +--- .../dynamicgui/function/impl/gui/GuiFunction.java | 4 +++- 27 files changed, 61 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java index 6dfda824b..3fbe97f33 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java @@ -32,6 +32,9 @@ public PlayerCmdFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } playerWrapper.chat("/" + ReplacerManager.get().replace(this.getData(), playerWrapper)); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java index e5fc3e519..87e4bb71d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java @@ -36,7 +36,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - String json = MiniMessageManager.get().toJson(this.getData()); playerWrapper.sendJsonMessage(json); return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java index 90b8d90d3..58ec1c8bd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java @@ -33,6 +33,9 @@ public PlayerMsgFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } playerWrapper.sendMessage(ChatColor.translateAlternateColorCodes(ReplacerManager.get().replace(this.getData(), playerWrapper))); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java index 232a4eec7..2127b1a88 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java @@ -34,7 +34,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - playerWrapper.sendJsonMessage(this.getData()); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java index 83df6242a..e86c23b4a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java @@ -33,6 +33,9 @@ public RandomFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } try { if(this.getData().contains("-")) { String[] split = this.getData().split("-"); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java index da529cf4e..73e18d6da 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java @@ -31,6 +31,9 @@ public RemovePermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } return playerWrapper.removePermission(this.getData()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java index a890513ca..c4452ca57 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java @@ -37,7 +37,6 @@ public RemoveSlotFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { FunctionOwner owner = this.getOwner(); - if(this.getData() == null || this.getData().equals("this")) { if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java index c8a2885e0..18301a9c3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java @@ -32,6 +32,9 @@ public SendFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } return DynamicGui.get().sendToServer(playerWrapper, this.getData()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java index f2502ed24..aa603e0f9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java @@ -35,7 +35,14 @@ public ServerBroadcastFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - DynamicGui.get().getPlatform().broadcastMessage(ChatColor.translateAlternateColorCodes('&', ReplacerManager.get().replace(this.getData(), playerWrapper))); + if(this.getData() == null) { + return false; + } + String colorized = ChatColor.translateAlternateColorCodes('&', + ReplacerManager + .get() + .replace(this.getData(), playerWrapper)); + DynamicGui.get().getPlatform().broadcastMessage(colorized); return true; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java index e8f56f031..ca4ea1c7c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java @@ -35,7 +35,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - DynamicGui.get().getPlatform().broadcastJsonMessage(this.getData()); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java index 3aebe56f4..d4def12c5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java @@ -37,7 +37,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - String json = MiniMessageManager.get().toJson(this.getData()); DynamicGui.get().getPlatform().broadcastJsonMessage(json); return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java index 064481ee0..c7905ede6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java @@ -37,6 +37,9 @@ public SetAmountFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java index 6ae4b540c..45135cf6f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java @@ -34,6 +34,9 @@ public SetCloseFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } try { Boolean value = Boolean.valueOf(this.getData()); if(value != null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java index 435b16d67..9acce8fde 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java @@ -37,6 +37,9 @@ public SetDataFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java index 2262b45ee..de529a18b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java @@ -41,6 +41,9 @@ public SetEnchantsFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java index 7c660c298..d2b0a444e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java @@ -33,9 +33,7 @@ public SetGameRuleFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { - return false; - } else if(!this.getData().contains(",")) { + if(this.getData() == null || !this.getData().contains(",")) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java index b845c4882..83fffbf32 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java @@ -37,6 +37,9 @@ public SetGlowFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } try { Boolean value = Boolean.valueOf(this.getData()); if(value != null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java index 020105903..e0b990299 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java @@ -43,6 +43,9 @@ public SetLoreFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java index 12ee535ce..138a4c10f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java @@ -35,6 +35,9 @@ public SetMoveableFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } if(this.getOwner() instanceof Slot) { Boolean value = Boolean.valueOf(this.getData()); if(value != null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java index 4b2759151..1eb452af4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java @@ -36,6 +36,9 @@ public SetNBTFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java index eb2410b7b..2995afce1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java @@ -39,6 +39,9 @@ public SetNameFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); if(owner != null) { if(owner instanceof Slot) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java index ad2bdcd5f..f7d17c077 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java @@ -36,8 +36,10 @@ public SetTypeFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } FunctionOwner owner = this.getOwner(); - if(owner != null) { if(owner instanceof Slot) { Slot slot = (Slot) owner; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java index 0d6bbfd6b..bc7b777ee 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java @@ -32,6 +32,9 @@ public SoundFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { + if(this.getData() == null) { + return false; + } SoundWrapper wrapper = new SoundWrapper(this.getData()); wrapper.playSoundToPlayer(playerWrapper); return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java index 1e7d89adf..4781fd4da 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java @@ -36,7 +36,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - return !CooldownManager.get().isOnCooldown(playerWrapper, this.getData()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java index 20f73a99e..723abe7f2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java @@ -36,7 +36,6 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - return CooldownManager.get().isOnCooldown(playerWrapper, this.getData()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java index ab6d002fe..3a1703fdd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java @@ -32,9 +32,7 @@ public SetCooldownFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { - return false; - } else if(!this.getData().contains(",")) { + if(this.getData() == null || !this.getData().contains(",")) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java index 1fefbb28e..fd49477e2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java @@ -38,7 +38,9 @@ public GuiFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { final String gui = this.getData(); - + if(gui == null) { + return false; + } if(!GuiManager.get().hasGuiName(gui)) { return false; } From 42a0fc10d68fad17134824d103bffa4debd1a6af Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 20:45:03 -0800 Subject: [PATCH 042/261] Refactor bukkit packages Refactor bukkit classes into bukkit package, this is done since we are going to be repackaging the core into the core package as well --- .../command}/BukkitDynamicGuiCommand.java | 2 +- .../command}/BukkitGuiCommand.java | 4 +- .../command}/CustomCommand.java | 2 +- .../command}/CustomCommandExecutor.java | 4 +- .../economy}/VaultEconomy.java | 2 +- .../entity}/BukkitEntityWrapper.java | 2 +- .../entity}/BukkitPlayerWrapper.java | 8 ++-- .../inject}/BukkitPluginModule.java | 12 +++--- .../inventory}/BukkitInventoryWrapper.java | 4 +- .../inventory}/BukkitItemStackWrapper.java | 4 +- .../listener}/EntityClickListener.java | 6 +-- .../listener}/InventoryCloseListener.java | 6 +-- .../listener}/InventoryInteractListener.java | 8 ++-- .../listener}/InventoryOpenListener.java | 6 +-- .../listener}/PlayerInteractListener.java | 4 +- .../manager/entity}/BukkitEntityManager.java | 4 +- .../inventory}/BukkitInventoryManager.java | 4 +- .../inventory}/BukkitItemStackManager.java | 4 +- .../material}/BukkitMaterialManager.java | 2 +- .../bukkit/manager/package-info.java | 17 +++++++++ .../manager/world}/BukkitLocationManager.java | 4 +- .../dynamicgui/bukkit/package-info.java | 17 +++++++++ .../permission}/FoundryPermission.java | 2 +- .../permission}/VaultPermission.java | 2 +- .../platform}/BukkitPlatform.java | 8 ++-- .../plugin}/BukkitPlugin.java | 38 +++++++++---------- .../model}/ItemsAdderModelProvider.java | 2 +- .../registry/model}/OraxenModelProvider.java | 2 +- .../registry/npc}/CitizensRegistry.java | 2 +- .../bukkit/registry/package-info.java | 17 +++++++++ .../PlaceholderApiReplacerRegistry.java | 2 +- .../scheduler}/BukkitScheduler.java | 2 +- .../bukkit => bukkit/util}/BukkitNBTUtil.java | 2 +- .../util}/BukkitPacketUtil.java | 2 +- .../bukkit => bukkit/util}/VersionUtil.java | 2 +- .../world}/BukkitWorldWrapper.java | 2 +- .../dynamicgui/manager/package-info.java | 1 - .../clubobsidian/dynamicgui/package-info.java | 1 - .../registry/npc/bukkit/package-info.java | 1 - .../dynamicgui/registry/package-info.java | 1 - bukkit/src/main/resources/plugin.yml | 2 +- 41 files changed, 131 insertions(+), 86 deletions(-) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{command/bukkit => bukkit/command}/BukkitDynamicGuiCommand.java (98%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{command/bukkit => bukkit/command}/BukkitGuiCommand.java (92%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{command/bukkit => bukkit/command}/CustomCommand.java (96%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{command/bukkit => bukkit/command}/CustomCommandExecutor.java (92%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{economy/bukkit => bukkit/economy}/VaultEconomy.java (98%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{entity/bukkit => bukkit/entity}/BukkitEntityWrapper.java (94%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{entity/bukkit => bukkit/entity}/BukkitPlayerWrapper.java (95%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{inject/bukkit => bukkit/inject}/BukkitPluginModule.java (85%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{inventory/bukkit => bukkit/inventory}/BukkitInventoryWrapper.java (96%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{inventory/bukkit => bukkit/inventory}/BukkitItemStackWrapper.java (98%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{listener/bukkit => bukkit/listener}/EntityClickListener.java (89%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{listener/bukkit => bukkit/listener}/InventoryCloseListener.java (92%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{listener/bukkit => bukkit/listener}/InventoryInteractListener.java (95%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{listener/bukkit => bukkit/listener}/InventoryOpenListener.java (90%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{listener/bukkit => bukkit/listener}/PlayerInteractListener.java (94%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{manager/entity/bukkit => bukkit/manager/entity}/BukkitEntityManager.java (92%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{manager/inventory/bukkit => bukkit/manager/inventory}/BukkitInventoryManager.java (92%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{manager/inventory/bukkit => bukkit/manager/inventory}/BukkitItemStackManager.java (91%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{manager/material/bukkit => bukkit/manager/material}/BukkitMaterialManager.java (95%) create mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{manager/world/bukkit => bukkit/manager/world}/BukkitLocationManager.java (92%) create mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{permission/bukkit => bukkit/permission}/FoundryPermission.java (95%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{permission/bukkit => bukkit/permission}/VaultPermission.java (98%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{platform/bukkit => bukkit/platform}/BukkitPlatform.java (94%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{plugin/bukkit => bukkit/plugin}/BukkitPlugin.java (86%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{registry/model/bukkit => bukkit/registry/model}/ItemsAdderModelProvider.java (98%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{registry/model/bukkit => bukkit/registry/model}/OraxenModelProvider.java (98%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{registry/npc/bukkit => bukkit/registry/npc}/CitizensRegistry.java (98%) create mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{registry/replacer/bukkit => bukkit/registry/replacer}/PlaceholderApiReplacerRegistry.java (96%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{scheduler/bukkit => bukkit/scheduler}/BukkitScheduler.java (97%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{util/bukkit => bukkit/util}/BukkitNBTUtil.java (99%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{util/bukkit => bukkit/util}/BukkitPacketUtil.java (99%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{util/bukkit => bukkit/util}/VersionUtil.java (95%) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/{world/bukkit => bukkit/world}/BukkitWorldWrapper.java (96%) delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/package-info.java delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/package-info.java delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/package-info.java delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/BukkitDynamicGuiCommand.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index 5ccdd7e87..a9f3d8d44 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.command.bukkit; +package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.event.DynamicGuiReloadEvent; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/BukkitGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java similarity index 92% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/BukkitGuiCommand.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java index c1b323238..27ac1e87b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/BukkitGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.command.bukkit; +package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java similarity index 96% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommand.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java index c8450913f..73d0a85e8 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.command.bukkit; +package com.clubobsidian.dynamicgui.bukkit.command; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java similarity index 92% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java index e716387ae..d091cf5ba 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/command/bukkit/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.command.bukkit; +package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/economy/bukkit/VaultEconomy.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/economy/bukkit/VaultEconomy.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java index 932f3837b..f93625fa7 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/economy/bukkit/VaultEconomy.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.economy.bukkit; +package com.clubobsidian.dynamicgui.bukkit.economy; import com.clubobsidian.dynamicgui.economy.Economy; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitEntityWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java similarity index 94% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitEntityWrapper.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java index 88210f30f..cc94f6f6e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitEntityWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.entity.bukkit; +package com.clubobsidian.dynamicgui.bukkit.entity; import com.clubobsidian.dynamicgui.entity.EntityWrapper; import org.bukkit.entity.Entity; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java similarity index 95% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index fc4b68934..e190d7c6c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/entity/bukkit/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.entity.bukkit; +package com.clubobsidian.dynamicgui.bukkit.entity; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitInventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitItemStackWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.manager.world.LocationManager; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.world.LocationWrapper; @@ -29,9 +29,7 @@ import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryView; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java similarity index 85% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index a4ae7b02c..e19cf9e5e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inject/bukkit/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -14,20 +14,20 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.inject.bukkit; +package com.clubobsidian.dynamicgui.bukkit.inject; import com.clubobsidian.dynamicgui.inject.module.PluginModule; import com.clubobsidian.dynamicgui.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.manager.entity.EntityManager; -import com.clubobsidian.dynamicgui.manager.entity.bukkit.BukkitEntityManager; +import com.clubobsidian.dynamicgui.bukkit.manager.entity.BukkitEntityManager; import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.manager.inventory.bukkit.BukkitInventoryManager; -import com.clubobsidian.dynamicgui.manager.inventory.bukkit.BukkitItemStackManager; +import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitInventoryManager; +import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitItemStackManager; import com.clubobsidian.dynamicgui.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.manager.material.bukkit.BukkitMaterialManager; +import com.clubobsidian.dynamicgui.bukkit.manager.material.BukkitMaterialManager; import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.manager.world.bukkit.BukkitLocationManager; +import com.clubobsidian.dynamicgui.bukkit.manager.world.BukkitLocationManager; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.server.Platform; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inventory/bukkit/BukkitInventoryWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java similarity index 96% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/inventory/bukkit/BukkitInventoryWrapper.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java index 3bbf2f8ec..e87b26ecd 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inventory/bukkit/BukkitInventoryWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.inventory.bukkit; +package com.clubobsidian.dynamicgui.bukkit.inventory; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.util.bukkit.BukkitPacketUtil; +import com.clubobsidian.dynamicgui.bukkit.util.BukkitPacketUtil; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inventory/bukkit/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/inventory/bukkit/BukkitItemStackWrapper.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index a35d0994d..f3038b220 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/inventory/bukkit/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.inventory.bukkit; +package com.clubobsidian.dynamicgui.bukkit.inventory; import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.util.bukkit.BukkitNBTUtil; +import com.clubobsidian.dynamicgui.bukkit.util.BukkitNBTUtil; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/EntityClickListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java similarity index 89% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/EntityClickListener.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java index 3ebf231a9..7ad084466 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/EntityClickListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener.bukkit; +package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.EntityWrapper; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitEntityWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitEntityWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryCloseListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java similarity index 92% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryCloseListener.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java index a75b9c693..b09ac7cea 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryCloseListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener.bukkit; +package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java similarity index 95% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryInteractListener.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index 9f24ca208..e7f1381cd 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener.bukkit; +package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.event.inventory.Click; import com.clubobsidian.dynamicgui.gui.InventoryView; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitInventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitItemStackWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryOpenListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java similarity index 90% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryOpenListener.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java index ca3ec0e7c..b60e2ac27 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/InventoryOpenListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener.bukkit; +package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java similarity index 94% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/PlayerInteractListener.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index 372807bf5..c9e639329 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/listener/bukkit/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener.bukkit; +package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.manager.world.LocationManager; import com.clubobsidian.dynamicgui.world.LocationWrapper; import com.clubobsidian.dynamicgui.event.player.Action; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/entity/bukkit/BukkitEntityManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java similarity index 92% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/entity/bukkit/BukkitEntityManager.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java index a0e2d36cb..f5b462365 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/entity/bukkit/BukkitEntityManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.entity.bukkit; +package com.clubobsidian.dynamicgui.bukkit.manager.entity; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.manager.entity.EntityManager; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/bukkit/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java similarity index 92% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/bukkit/BukkitInventoryManager.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index 039d1f5fa..defabde80 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/bukkit/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.inventory.bukkit; +package com.clubobsidian.dynamicgui.bukkit.manager.inventory; import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.event.inventory.InventoryType; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/bukkit/BukkitItemStackManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java similarity index 91% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/bukkit/BukkitItemStackManager.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java index 2aa79b999..79bed83e0 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/bukkit/BukkitItemStackManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.inventory.bukkit; +package com.clubobsidian.dynamicgui.bukkit.manager.inventory; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.inventory.bukkit.BukkitItemStackWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/material/bukkit/BukkitMaterialManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java similarity index 95% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/material/bukkit/BukkitMaterialManager.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java index 206679bae..83471f909 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/material/bukkit/BukkitMaterialManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.material.bukkit; +package com.clubobsidian.dynamicgui.bukkit.manager.material; import com.clubobsidian.dynamicgui.manager.material.MaterialManager; import org.bukkit.Material; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java new file mode 100644 index 000000000..6787f6f40 --- /dev/null +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.bukkit.manager; \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/world/bukkit/BukkitLocationManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java similarity index 92% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/world/bukkit/BukkitLocationManager.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java index 49abd997e..27edcc826 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/world/bukkit/BukkitLocationManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.world.bukkit; +package com.clubobsidian.dynamicgui.bukkit.manager.world; import com.clubobsidian.dynamicgui.manager.world.LocationManager; import com.clubobsidian.dynamicgui.world.LocationWrapper; -import com.clubobsidian.dynamicgui.world.bukkit.BukkitWorldWrapper; +import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import org.bukkit.Location; import org.bukkit.World; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java new file mode 100644 index 000000000..2191f0431 --- /dev/null +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.bukkit; \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/permission/bukkit/FoundryPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java similarity index 95% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/permission/bukkit/FoundryPermission.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java index 8c2f64323..8f6a68992 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/permission/bukkit/FoundryPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.permission.bukkit; +package com.clubobsidian.dynamicgui.bukkit.permission; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.foundry.FoundryPlugin; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/permission/bukkit/VaultPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/permission/bukkit/VaultPermission.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java index 71776dc31..ce6c0c1c5 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/permission/bukkit/VaultPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.permission.bukkit; +package com.clubobsidian.dynamicgui.bukkit.permission; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.permission.Permission; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/platform/bukkit/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java similarity index 94% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/platform/bukkit/BukkitPlatform.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index e18f18327..8343e0251 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/platform/bukkit/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.platform.bukkit; +package com.clubobsidian.dynamicgui.bukkit.platform; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.entity.bukkit.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.messaging.MessagingRunnable; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.proxy.Proxy; -import com.clubobsidian.dynamicgui.scheduler.bukkit.BukkitScheduler; +import com.clubobsidian.dynamicgui.bukkit.scheduler.BukkitScheduler; import com.clubobsidian.dynamicgui.server.Platform; import com.clubobsidian.dynamicgui.server.ServerType; import com.clubobsidian.dynamicgui.world.WorldWrapper; -import com.clubobsidian.dynamicgui.world.bukkit.BukkitWorldWrapper; +import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Bukkit; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java similarity index 86% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 2ed620e14..aafd23aad 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/plugin/bukkit/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -13,35 +13,35 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.plugin.bukkit; +package com.clubobsidian.dynamicgui.bukkit.plugin; import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.command.bukkit.BukkitDynamicGuiCommand; -import com.clubobsidian.dynamicgui.command.bukkit.BukkitGuiCommand; -import com.clubobsidian.dynamicgui.command.bukkit.CustomCommand; -import com.clubobsidian.dynamicgui.command.bukkit.CustomCommandExecutor; +import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; +import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommand; +import com.clubobsidian.dynamicgui.bukkit.command.CustomCommand; +import com.clubobsidian.dynamicgui.bukkit.command.CustomCommandExecutor; import com.clubobsidian.dynamicgui.economy.Economy; -import com.clubobsidian.dynamicgui.economy.bukkit.VaultEconomy; -import com.clubobsidian.dynamicgui.inject.bukkit.BukkitPluginModule; -import com.clubobsidian.dynamicgui.listener.bukkit.EntityClickListener; -import com.clubobsidian.dynamicgui.listener.bukkit.InventoryCloseListener; -import com.clubobsidian.dynamicgui.listener.bukkit.InventoryInteractListener; -import com.clubobsidian.dynamicgui.listener.bukkit.InventoryOpenListener; -import com.clubobsidian.dynamicgui.listener.bukkit.PlayerInteractListener; +import com.clubobsidian.dynamicgui.bukkit.economy.VaultEconomy; +import com.clubobsidian.dynamicgui.bukkit.inject.BukkitPluginModule; +import com.clubobsidian.dynamicgui.bukkit.listener.EntityClickListener; +import com.clubobsidian.dynamicgui.bukkit.listener.InventoryCloseListener; +import com.clubobsidian.dynamicgui.bukkit.listener.InventoryInteractListener; +import com.clubobsidian.dynamicgui.bukkit.listener.InventoryOpenListener; +import com.clubobsidian.dynamicgui.bukkit.listener.PlayerInteractListener; import com.clubobsidian.dynamicgui.logger.JavaLoggerWrapper; import com.clubobsidian.dynamicgui.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.manager.dynamicgui.ModelManager; import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; import com.clubobsidian.dynamicgui.permission.Permission; -import com.clubobsidian.dynamicgui.permission.bukkit.FoundryPermission; -import com.clubobsidian.dynamicgui.permission.bukkit.VaultPermission; +import com.clubobsidian.dynamicgui.bukkit.permission.FoundryPermission; +import com.clubobsidian.dynamicgui.bukkit.permission.VaultPermission; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.registry.model.bukkit.ItemsAdderModelProvider; -import com.clubobsidian.dynamicgui.registry.model.bukkit.OraxenModelProvider; +import com.clubobsidian.dynamicgui.bukkit.registry.model.ItemsAdderModelProvider; +import com.clubobsidian.dynamicgui.bukkit.registry.model.OraxenModelProvider; import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; -import com.clubobsidian.dynamicgui.registry.npc.bukkit.CitizensRegistry; -import com.clubobsidian.dynamicgui.registry.replacer.bukkit.PlaceholderApiReplacerRegistry; -import com.clubobsidian.dynamicgui.platform.bukkit.BukkitPlatform; +import com.clubobsidian.dynamicgui.bukkit.registry.npc.CitizensRegistry; +import com.clubobsidian.dynamicgui.bukkit.registry.replacer.PlaceholderApiReplacerRegistry; +import com.clubobsidian.dynamicgui.bukkit.platform.BukkitPlatform; import com.clubobsidian.dynamicgui.server.Platform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/model/bukkit/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/model/bukkit/ItemsAdderModelProvider.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 26070e1ef..4c461dd36 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/model/bukkit/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.model.bukkit; +package com.clubobsidian.dynamicgui.bukkit.registry.model; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/model/bukkit/OraxenModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/model/bukkit/OraxenModelProvider.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java index ce459487f..cf840b62e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/model/bukkit/OraxenModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.model.bukkit; +package com.clubobsidian.dynamicgui.bukkit.registry.model; import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/CitizensRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java similarity index 98% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/CitizensRegistry.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java index 933b3197c..699dbc6be 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/CitizensRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.npc.bukkit; +package com.clubobsidian.dynamicgui.bukkit.registry.npc; import com.clubobsidian.dynamicgui.entity.EntityWrapper; import com.clubobsidian.dynamicgui.registry.npc.NPC; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java new file mode 100644 index 000000000..ac22ce66b --- /dev/null +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java @@ -0,0 +1,17 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.bukkit.registry; \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/bukkit/PlaceholderApiReplacerRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java similarity index 96% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/bukkit/PlaceholderApiReplacerRegistry.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java index 12aa09377..ea56d188d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/bukkit/PlaceholderApiReplacerRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer.bukkit; +package com.clubobsidian.dynamicgui.bukkit.registry.replacer; import com.clubobsidian.dynamicgui.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java similarity index 97% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java index 0c6b1fb24..df767f7f8 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/scheduler/bukkit/BukkitScheduler.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.scheduler.bukkit; +package com.clubobsidian.dynamicgui.bukkit.scheduler; import com.clubobsidian.dynamicgui.DynamicGui; import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java similarity index 99% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/BukkitNBTUtil.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index 5ba7daf2f..f3e64492a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util.bukkit; +package com.clubobsidian.dynamicgui.bukkit.util; import org.bukkit.inventory.ItemStack; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/BukkitPacketUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java similarity index 99% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/BukkitPacketUtil.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java index a410f1dee..610e6dc19 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/BukkitPacketUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util.bukkit; +package com.clubobsidian.dynamicgui.bukkit.util; import com.clubobsidian.dynamicgui.util.ReflectionUtil; import org.bukkit.entity.Player; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/VersionUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java similarity index 95% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/VersionUtil.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java index 1fceee725..59adcfa6b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/util/bukkit/VersionUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util.bukkit; +package com.clubobsidian.dynamicgui.bukkit.util; import org.bukkit.Bukkit; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java similarity index 96% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java index b6185b001..8b488b465 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/world/bukkit/BukkitWorldWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.world.bukkit; +package com.clubobsidian.dynamicgui.bukkit.world; import com.clubobsidian.dynamicgui.world.WorldWrapper; import org.bukkit.Bukkit; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/package-info.java deleted file mode 100644 index 5cf1cb544..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/manager/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.clubobsidian.dynamicgui.manager; \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/package-info.java deleted file mode 100644 index 953e80505..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.clubobsidian.dynamicgui; \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/package-info.java deleted file mode 100644 index 0d406fc22..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/npc/bukkit/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.clubobsidian.dynamicgui.registry.npc.bukkit; \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java deleted file mode 100644 index 794871f9c..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.clubobsidian.dynamicgui.registry; \ No newline at end of file diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 657be9ef3..999664827 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: DynamicGui -main: com.clubobsidian.dynamicgui.plugin.bukkit.BukkitPlugin +main: com.clubobsidian.dynamicgui.bukkit.plugin.BukkitPlugin version: ${pluginVersion} author: VirusTotal api-version: 1.13 From d1d2b427232c09801610c3708df5ffca56c8a5fd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 22:02:04 -0800 Subject: [PATCH 043/261] Refactor core module into core package --- .../command/BukkitDynamicGuiCommand.java | 8 +- .../bukkit/command/BukkitGuiCommand.java | 4 +- .../bukkit/command/CustomCommandExecutor.java | 4 +- .../bukkit/economy/VaultEconomy.java | 4 +- .../bukkit/entity/BukkitEntityWrapper.java | 2 +- .../bukkit/entity/BukkitPlayerWrapper.java | 16 +- .../bukkit/inject/BukkitPluginModule.java | 18 +- .../inventory/BukkitInventoryWrapper.java | 6 +- .../inventory/BukkitItemStackWrapper.java | 6 +- .../bukkit/listener/EntityClickListener.java | 8 +- .../listener/InventoryCloseListener.java | 12 +- .../listener/InventoryInteractListener.java | 16 +- .../listener/InventoryOpenListener.java | 8 +- .../listener/PlayerInteractListener.java | 12 +- .../manager/entity/BukkitEntityManager.java | 4 +- .../inventory/BukkitInventoryManager.java | 4 +- .../inventory/BukkitItemStackManager.java | 4 +- .../material/BukkitMaterialManager.java | 2 +- .../manager/world/BukkitLocationManager.java | 4 +- .../bukkit/permission/FoundryPermission.java | 2 +- .../bukkit/permission/VaultPermission.java | 4 +- .../bukkit/platform/BukkitPlatform.java | 16 +- .../bukkit/plugin/BukkitPlugin.java | 20 +-- .../model/ItemsAdderModelProvider.java | 6 +- .../registry/model/OraxenModelProvider.java | 6 +- .../bukkit/registry/npc/CitizensRegistry.java | 10 +- .../PlaceholderApiReplacerRegistry.java | 6 +- .../bukkit/scheduler/BukkitScheduler.java | 5 +- .../bukkit/util/BukkitPacketUtil.java | 2 +- .../bukkit/world/BukkitWorldWrapper.java | 2 +- .../dynamicgui/{ => core}/DynamicGui.java | 160 +++++++++--------- .../{ => core}/animation/AnimationHolder.java | 2 +- .../{ => core}/animation/Refreshable.java | 2 +- .../builder/EnchantmentBuilder.java | 4 +- .../{ => core}/builder/FunctionBuilder.java | 2 +- .../builder/FunctionTokenBuilder.java | 2 +- .../{ => core}/builder/GuiBuilder.java | 12 +- .../{ => core}/builder/SlotBuilder.java | 8 +- .../command}/package-info.java | 2 +- .../{ => core}/economy/Economy.java | 4 +- .../{ => core}/effect/ParticleWrapper.java | 4 +- .../enchantment/EnchantmentWrapper.java | 2 +- .../{ => core}/entity/EntityWrapper.java | 2 +- .../{ => core}/entity/PlayerWrapper.java | 12 +- .../event/DynamicGuiReloadEvent.java | 2 +- .../{ => core}/event/InventoryEvent.java | 6 +- .../{ => core}/event/LocationEvent.java | 6 +- .../{ => core}/event/PlayerEvent.java | 4 +- .../event/block/PlayerInteractEvent.java | 10 +- .../{ => core}/event/inventory/Click.java | 2 +- .../event/inventory/GuiLoadEvent.java | 6 +- .../event/inventory/GuiPreloadEvent.java | 6 +- .../event/inventory/InventoryClickEvent.java | 12 +- .../event/inventory/InventoryCloseEvent.java | 8 +- .../event/inventory/InventoryDragEvent.java | 10 +- .../event/inventory/InventoryOpenEvent.java | 8 +- .../inventory/PlayerInteractEntityEvent.java | 8 +- .../{ => core}/event/player/Action.java | 2 +- .../event/player/PlayerKickEvent.java | 6 +- .../event/player/PlayerQuitEvent.java | 6 +- .../{ => core}/function/Function.java | 7 +- .../function/impl/AddPermissionFunction.java | 6 +- .../impl/CheckItemTypeInHandFunction.java | 8 +- .../function/impl/CheckLevelFunction.java | 6 +- .../function/impl/CheckMoveableFunction.java | 10 +- .../impl/CheckPlayerWorldFunction.java | 8 +- .../function/impl/ConsoleCmdFunction.java | 10 +- .../function/impl/DelayFunction.java | 6 +- .../function/impl/GetGameRuleFunction.java | 10 +- .../impl/IsBedrockPlayerFunction.java | 6 +- .../{ => core}/function/impl/LogFunction.java | 8 +- .../function/impl/MoneyBalanceFunction.java | 8 +- .../function/impl/MoneyDepositFunction.java | 8 +- .../function/impl/MoneyWithdrawFunction.java | 8 +- .../function/impl/NoPermissionFunction.java | 6 +- .../function/impl/ParticleFunction.java | 8 +- .../function/impl/PermissionFunction.java | 6 +- .../function/impl/PlayerCmdFunction.java | 8 +- .../function/impl/PlayerMiniMsgFunction.java | 8 +- .../function/impl/PlayerMsgFunction.java | 10 +- .../function/impl/PlayerMsgJsonFunction.java | 6 +- .../function/impl/RandomFunction.java | 6 +- .../impl/RemovePermissionFunction.java | 6 +- .../function/impl/RemoveSlotFunction.java | 16 +- .../function/impl/ResetFrameFunction.java | 8 +- .../function/impl/ResetTickFunction.java | 8 +- .../function/impl/SendFunction.java | 8 +- .../impl/ServerBroadcastFunction.java | 12 +- .../impl/ServerBroadcastJsonFunction.java | 8 +- .../impl/ServerMiniBroadcastFunction.java | 10 +- .../function/impl/SetAmountFunction.java | 18 +- .../function/impl/SetCloseFunction.java | 12 +- .../function/impl/SetDataFunction.java | 18 +- .../function/impl/SetEnchantsFunction.java | 18 +- .../function/impl/SetGameRuleFunction.java | 10 +- .../function/impl/SetGlowFunction.java | 18 +- .../function/impl/SetLoreFunction.java | 22 +-- .../function/impl/SetMoveableFunction.java | 12 +- .../function/impl/SetNBTFunction.java | 16 +- .../function/impl/SetNameFunction.java | 22 +-- .../function/impl/SetTypeFunction.java | 16 +- .../function/impl/SoundFunction.java | 8 +- .../impl/condition/AfterDateLazyFunction.java | 98 +++++------ .../condition/BeforeDateLazyFunction.java | 68 ++++---- .../impl/condition/CheckTickFunction.java | 10 +- .../impl/condition/ConditionFunction.java | 6 +- .../impl/condition/ContainsLazyFunction.java | 2 +- .../impl/condition/EndsWithLazyFunction.java | 2 +- .../impl/condition/EqualLazyFunction.java | 2 +- .../IgnoreCaseEqualLazyFunction.java | 2 +- .../condition/StartsWithLazyFunction.java | 2 +- .../cooldown/IsNotOnCooldownFunction.java | 8 +- .../impl/cooldown/IsOnCooldownFunction.java | 8 +- .../impl/cooldown/SetCooldownFunction.java | 8 +- .../function/impl/gui/BackFunction.java | 14 +- .../function/impl/gui/GuiFunction.java | 14 +- .../function/impl/gui/HasBackFunction.java | 12 +- .../function/impl/gui/RefreshGuiFunction.java | 12 +- .../impl/gui/RefreshSlotFunction.java | 12 +- .../function/impl/gui/SetBackFunction.java | 14 +- .../impl/meta/CopyBackMetadataFunction.java | 12 +- .../impl/meta/HasMetadataFunction.java | 16 +- .../function/impl/meta/IsGuiMetadataSet.java | 12 +- .../impl/meta/SetMetadataFunction.java | 16 +- .../{ => core}/gui/FunctionOwner.java | 2 +- .../dynamicgui/{ => core}/gui/Gui.java | 20 +-- .../{ => core}/gui/InventoryType.java | 2 +- .../{ => core}/gui/InventoryView.java | 2 +- .../dynamicgui/{ => core}/gui/ModeEnum.java | 2 +- .../dynamicgui/{ => core}/gui/Slot.java | 24 +-- .../gui/property/MetadataHolder.java | 2 +- .../inject/module/PluginModule.java | 20 +-- .../inject}/package-info.java | 2 +- .../inventory/InventoryWrapper.java | 4 +- .../inventory/ItemStackWrapper.java | 4 +- .../listener/EntityClickListener.java | 16 +- .../{ => core}/listener/GuiListener.java | 14 +- .../listener/InventoryCloseListener.java | 12 +- .../listener/InventoryInteractListener.java | 26 +-- .../listener/InventoryOpenListener.java | 4 +- .../listener/PlayerInteractListener.java | 12 +- .../{ => core}/logger/JavaLoggerWrapper.java | 2 +- .../{ => core}/logger/LoggerWrapper.java | 2 +- .../dynamicgui/AnimationReplacerManager.java | 8 +- .../manager/dynamicgui/FunctionManager.java | 12 +- .../manager/dynamicgui/GuiManager.java | 46 ++--- .../dynamicgui/MiniMessageManager.java | 6 +- .../manager/dynamicgui/ModelManager.java | 6 +- .../manager/dynamicgui/ReplacerManager.java | 6 +- .../manager/dynamicgui/SlotManager.java | 14 +- .../manager/dynamicgui/cooldown/Cooldown.java | 2 +- .../dynamicgui/cooldown/CooldownManager.java | 8 +- .../manager/entity/EntityManager.java | 4 +- .../manager/inventory/InventoryManager.java | 4 +- .../manager/inventory/ItemStackManager.java | 4 +- .../manager/material/MaterialManager.java | 2 +- .../manager/world/LocationManager.java | 4 +- .../messaging/MessagingRunnable.java | 4 +- .../{ => core}/permission/Permission.java | 4 +- .../{ => core}/plugin/DynamicGuiPlugin.java | 8 +- .../dynamicgui/{ => core}/proxy/Proxy.java | 2 +- .../registry/model/ModelProvider.java | 4 +- .../model/vanilla/VanillaModelProvider.java | 6 +- .../{ => core}/registry/npc/NPC.java | 4 +- .../{ => core}/registry/npc/NPCMeta.java | 2 +- .../{ => core}/registry/npc/NPCRegistry.java | 4 +- .../{ => core}/registry/package-info.java | 2 +- .../replacer/AnimationReplacerRegistry.java | 6 +- .../registry/replacer/ReplacerRegistry.java | 4 +- .../impl/CooldownReplacerRegistry.java | 10 +- .../DynamicGuiAnimationReplacerRegistry.java | 16 +- .../impl/DynamicGuiReplacerRegistry.java | 24 +-- .../impl/MetadataReplacerRegistry.java | 18 +- .../replacer/AnimationReplacer.java | 6 +- .../{ => core}/replacer/Replacer.java | 4 +- .../impl/MultiLineTestAnimationReplacer.java | 8 +- .../animation/impl/TestAnimationReplacer.java | 8 +- .../impl/GlobalPlayerCountReplacer.java | 8 +- .../replacer/impl/OnlinePlayersReplacer.java | 8 +- .../replacer/impl/PlayerLevelReplacer.java | 6 +- .../replacer/impl/PlayerReplacer.java | 6 +- .../replacer/impl/PreviousGuiReplacer.java | 18 +- .../replacer/impl/UUIDReplacer.java | 6 +- .../{ => core}/scheduler/Scheduler.java | 4 +- .../{ => core}/server/Platform.java | 12 +- .../{ => core}/server/ServerType.java | 2 +- .../{ => core}/sound/SoundWrapper.java | 4 +- .../dynamicgui/{ => core}/util/ChatColor.java | 2 +- .../dynamicgui/{ => core}/util/HashUtil.java | 2 +- .../{ => core}/util/ReflectionUtil.java | 2 +- .../{ => core}/util/ThreadUtil.java | 8 +- .../{ => core}/world/LocationWrapper.java | 2 +- .../{ => core}/world/WorldWrapper.java | 2 +- .../function/AddPermissionFunctionTest.java | 6 +- .../CheckItemInTypeHandFunctionTest.java | 6 +- .../test/function/CheckLevelFunctionTest.java | 4 +- .../function/CheckMoveableFunctionTest.java | 4 +- .../CheckPlayerWorldFunctionTest.java | 4 +- .../test/function/ConsoleCmdFunctionTest.java | 4 +- .../test/function/DelayFunctionTest.java | 4 +- .../function/GetGameRuleFunctionTest.java | 7 +- .../function/IsBedrockPlayerFunctionTest.java | 4 +- .../test/function/LogFunctionTest.java | 6 +- .../function/MoneyBalanceFunctionTest.java | 6 +- .../function/MoneyDepositFunctionTest.java | 9 +- .../function/MoneyWithdrawFunctionTest.java | 6 +- .../function/NoPermissionFunctionTest.java | 6 +- .../test/function/ParticleFunctionTest.java | 6 +- .../test/function/PermissionFunctionTest.java | 6 +- .../dynamicgui/test/mock/MockFactory.java | 18 +- .../test/mock/entity/player/MockPlayer.java | 6 +- .../mock/entity/player/MockPlayerWrapper.java | 9 +- .../test/mock/inject/MockPluginModule.java | 18 +- .../mock/inventory/MockItemStackWrapper.java | 2 +- .../test/mock/logger/MockLoggerWrapper.java | 2 +- .../test/mock/manager/MockEntityManager.java | 4 +- .../mock/manager/MockInventoryManager.java | 4 +- .../mock/manager/MockItemStackManager.java | 4 +- .../mock/manager/MockLocationManager.java | 4 +- .../mock/manager/MockMaterialManager.java | 2 +- .../mock/plugin/MockDynamicGuiPlugin.java | 8 +- .../test/mock/plugin/MockEconomy.java | 4 +- .../test/mock/plugin/MockPermission.java | 4 +- .../test/mock/plugin/MockPlatform.java | 14 +- .../test/mock/plugin/MockScheduler.java | 2 +- .../test/mock/world/MockLocation.java | 2 +- .../test/mock/world/MockLocationWrapper.java | 2 +- .../test/mock/world/MockWorldWrapper.java | 2 +- 228 files changed, 1023 insertions(+), 1034 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/DynamicGui.java (71%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/animation/AnimationHolder.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/animation/Refreshable.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/builder/EnchantmentBuilder.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/builder/FunctionBuilder.java (97%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/builder/FunctionTokenBuilder.java (98%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/builder/GuiBuilder.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/builder/SlotBuilder.java (96%) rename core/src/main/java/com/clubobsidian/dynamicgui/{inject => core/command}/package-info.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/economy/Economy.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/effect/ParticleWrapper.java (95%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/enchantment/EnchantmentWrapper.java (95%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/entity/EntityWrapper.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/entity/PlayerWrapper.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/DynamicGuiReloadEvent.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/InventoryEvent.java (85%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/LocationEvent.java (85%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/PlayerEvent.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/block/PlayerInteractEvent.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/Click.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/GuiLoadEvent.java (90%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/GuiPreloadEvent.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/InventoryClickEvent.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/InventoryCloseEvent.java (77%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/InventoryDragEvent.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/InventoryOpenEvent.java (77%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/inventory/PlayerInteractEntityEvent.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/player/Action.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/player/PlayerKickEvent.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/event/player/PlayerQuitEvent.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/Function.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/AddPermissionFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/CheckItemTypeInHandFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/CheckLevelFunction.java (87%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/CheckMoveableFunction.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/CheckPlayerWorldFunction.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ConsoleCmdFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/DelayFunction.java (76%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/GetGameRuleFunction.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/IsBedrockPlayerFunction.java (85%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/LogFunction.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/MoneyBalanceFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/MoneyDepositFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/MoneyWithdrawFunction.java (87%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/NoPermissionFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ParticleFunction.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/PermissionFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/PlayerCmdFunction.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/PlayerMiniMsgFunction.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/PlayerMsgFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/PlayerMsgJsonFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/RandomFunction.java (90%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/RemovePermissionFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/RemoveSlotFunction.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ResetFrameFunction.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ResetTickFunction.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SendFunction.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ServerBroadcastFunction.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ServerBroadcastJsonFunction.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/ServerMiniBroadcastFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetAmountFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetCloseFunction.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetDataFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetEnchantsFunction.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetGameRuleFunction.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetGlowFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetLoreFunction.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetMoveableFunction.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetNBTFunction.java (77%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetNameFunction.java (73%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SetTypeFunction.java (77%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/SoundFunction.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/AfterDateLazyFunction.java (91%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/BeforeDateLazyFunction.java (87%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/CheckTickFunction.java (85%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/ConditionFunction.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/ContainsLazyFunction.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/EndsWithLazyFunction.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/EqualLazyFunction.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/IgnoreCaseEqualLazyFunction.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/condition/StartsWithLazyFunction.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/cooldown/IsNotOnCooldownFunction.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/cooldown/IsOnCooldownFunction.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/cooldown/SetCooldownFunction.java (85%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/gui/BackFunction.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/gui/GuiFunction.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/gui/HasBackFunction.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/gui/RefreshGuiFunction.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/gui/RefreshSlotFunction.java (87%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/gui/SetBackFunction.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/meta/CopyBackMetadataFunction.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/meta/HasMetadataFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/meta/IsGuiMetadataSet.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/function/impl/meta/SetMetadataFunction.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/FunctionOwner.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/Gui.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/InventoryType.java (95%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/InventoryView.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/ModeEnum.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/Slot.java (91%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/gui/property/MetadataHolder.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/inject/module/PluginModule.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{command => core/inject}/package-info.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/inventory/InventoryWrapper.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/inventory/ItemStackWrapper.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/listener/EntityClickListener.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/listener/GuiListener.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/listener/InventoryCloseListener.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/listener/InventoryInteractListener.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/listener/InventoryOpenListener.java (88%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/listener/PlayerInteractListener.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/logger/JavaLoggerWrapper.java (95%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/logger/LoggerWrapper.java (95%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/AnimationReplacerManager.java (85%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/FunctionManager.java (96%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/GuiManager.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/MiniMessageManager.java (91%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/ModelManager.java (87%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/ReplacerManager.java (88%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/SlotManager.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/cooldown/Cooldown.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/dynamicgui/cooldown/CooldownManager.java (97%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/entity/EntityManager.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/inventory/InventoryManager.java (90%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/inventory/ItemStackManager.java (90%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/material/MaterialManager.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/manager/world/LocationManager.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/messaging/MessagingRunnable.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/permission/Permission.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/plugin/DynamicGuiPlugin.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/proxy/Proxy.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/model/ModelProvider.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/model/vanilla/VanillaModelProvider.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/npc/NPC.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/npc/NPCMeta.java (94%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/npc/NPCRegistry.java (87%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/package-info.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/replacer/AnimationReplacerRegistry.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/replacer/ReplacerRegistry.java (86%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/replacer/impl/CooldownReplacerRegistry.java (88%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/replacer/impl/DynamicGuiReplacerRegistry.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/registry/replacer/impl/MetadataReplacerRegistry.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/AnimationReplacer.java (84%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/Replacer.java (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/animation/impl/MultiLineTestAnimationReplacer.java (79%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/animation/impl/TestAnimationReplacer.java (78%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/impl/GlobalPlayerCountReplacer.java (81%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/impl/OnlinePlayersReplacer.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/impl/PlayerLevelReplacer.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/impl/PlayerReplacer.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/impl/PreviousGuiReplacer.java (80%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/replacer/impl/UUIDReplacer.java (83%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/scheduler/Scheduler.java (90%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/server/Platform.java (82%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/server/ServerType.java (93%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/sound/SoundWrapper.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/util/ChatColor.java (98%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/util/HashUtil.java (97%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/util/ReflectionUtil.java (98%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/util/ThreadUtil.java (71%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/world/LocationWrapper.java (97%) rename core/src/main/java/com/clubobsidian/dynamicgui/{ => core}/world/WorldWrapper.java (97%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index a9f3d8d44..e4df2146d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -15,10 +15,10 @@ */ package com.clubobsidian.dynamicgui.bukkit.command; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.event.DynamicGuiReloadEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java index 27ac1e87b..7dffa7689 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.command; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java index d091cf5ba..7bfd2024f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.command; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java index f93625fa7..0b7abc56b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.economy; -import com.clubobsidian.dynamicgui.economy.Economy; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.economy.Economy; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.plugin.Plugin; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java index cc94f6f6e..9d1676124 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.bukkit.entity; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; import org.bukkit.entity.Entity; public class BukkitEntityWrapper extends EntityWrapper { diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index e190d7c6c..2f07fe7ef 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -15,16 +15,16 @@ */ package com.clubobsidian.dynamicgui.bukkit.entity; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.effect.ParticleWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Effect; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index e19cf9e5e..689247850 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -16,20 +16,20 @@ package com.clubobsidian.dynamicgui.bukkit.inject; -import com.clubobsidian.dynamicgui.inject.module.PluginModule; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import com.clubobsidian.dynamicgui.bukkit.manager.entity.BukkitEntityManager; -import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitInventoryManager; import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitItemStackManager; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.bukkit.manager.material.BukkitMaterialManager; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.bukkit.manager.world.BukkitLocationManager; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.server.Platform; public class BukkitPluginModule extends PluginModule { diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java index e87b26ecd..ed16242dd 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.bukkit.util.BukkitPacketUtil; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index f3038b220..44ab496e9 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.inventory; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.bukkit.util.BukkitNBTUtil; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java index 7ad084466..0b51bd754 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitEntityWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import org.bukkit.entity.Entity; @@ -34,7 +34,7 @@ public void onEntityClick(PlayerInteractEntityEvent e) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); EntityWrapper entityWrapper = new BukkitEntityWrapper(e.getRightClicked()); - DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.event.inventory.PlayerInteractEntityEvent(playerWrapper, entityWrapper)); + DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.core.event.inventory.PlayerInteractEntityEvent(playerWrapper, entityWrapper)); } } } \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java index b09ac7cea..ce704ea4e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java @@ -15,10 +15,10 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -35,19 +35,19 @@ public void inventoryClose(InventoryCloseEvent e) { if(e.getPlayer() instanceof Player) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper((Player) e.getPlayer()); InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(e.getInventory()); - DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.event.inventory.InventoryCloseEvent(playerWrapper, inventoryWrapper)); + DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent(playerWrapper, inventoryWrapper)); } } @EventHandler public void onQuit(PlayerQuitEvent e) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); - DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.event.player.PlayerQuitEvent(playerWrapper)); + DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.core.event.player.PlayerQuitEvent(playerWrapper)); } @EventHandler public void onKick(PlayerKickEvent e) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); - DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.event.player.PlayerKickEvent(playerWrapper)); + DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.core.event.player.PlayerKickEvent(playerWrapper)); } } \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index e7f1381cd..d598f7f9d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -15,13 +15,13 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.Click; -import com.clubobsidian.dynamicgui.gui.InventoryView; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.Click; +import com.clubobsidian.dynamicgui.core.gui.InventoryView; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import org.bukkit.entity.Player; @@ -77,7 +77,7 @@ public void onInventoryClick(InventoryClickEvent e) { itemStackWrapper = new BukkitItemStackWrapper(itemStack); } - com.clubobsidian.dynamicgui.event.inventory.InventoryClickEvent clickEvent = new com.clubobsidian.dynamicgui.event.inventory.InventoryClickEvent(playerWrapper, inventoryWrapper, itemStackWrapper, slot, clickType, view); + com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent clickEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent(playerWrapper, inventoryWrapper, itemStackWrapper, slot, clickType, view); DynamicGui.get().getEventBus().callEvent(clickEvent); if(clickEvent.isCanceled()) { e.setCancelled(true); @@ -97,7 +97,7 @@ public void onInventoryDrag(InventoryDragEvent e) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(inventory); Map> slotItems = this.wrapItemStacks(e.getNewItems()); - com.clubobsidian.dynamicgui.event.inventory.InventoryDragEvent dragEvent = new com.clubobsidian.dynamicgui.event.inventory.InventoryDragEvent(playerWrapper, inventoryWrapper, slotItems); + com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent dragEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent(playerWrapper, inventoryWrapper, slotItems); DynamicGui.get().getEventBus().callEvent(dragEvent); if(dragEvent.isCanceled()) { e.setCancelled(true); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java index b60e2ac27..44da579db 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java @@ -15,10 +15,10 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -35,7 +35,7 @@ public void inventoryOpen(InventoryOpenEvent e) { Player player = (Player) e.getPlayer(); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(e.getInventory()); - com.clubobsidian.dynamicgui.event.inventory.InventoryOpenEvent inventoryOpenEvent = new com.clubobsidian.dynamicgui.event.inventory.InventoryOpenEvent(playerWrapper, inventoryWrapper); + com.clubobsidian.dynamicgui.core.event.inventory.InventoryOpenEvent inventoryOpenEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryOpenEvent(playerWrapper, inventoryWrapper); DynamicGui.get().getEventBus().callEvent(inventoryOpenEvent); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index c9e639329..728ecec59 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -15,12 +15,12 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.world.LocationWrapper; -import com.clubobsidian.dynamicgui.event.player.Action; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.event.player.Action; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -34,7 +34,7 @@ public void interact(final PlayerInteractEvent e) { Action action = Action.valueOf(e.getAction().toString()); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); LocationWrapper locationWrapper = LocationManager.get().toLocationWrapper(e.getClickedBlock().getLocation()); - com.clubobsidian.dynamicgui.event.block.PlayerInteractEvent interactEvent = new com.clubobsidian.dynamicgui.event.block.PlayerInteractEvent(playerWrapper, locationWrapper, action); + com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent interactEvent = new com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent(playerWrapper, locationWrapper, action); DynamicGui.get().getEventBus().callEvent(interactEvent); if(interactEvent.isCanceled()) { e.setCancelled(true); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java index f5b462365..45884311f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.entity; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index defabde80..13daafef5 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.inventory; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; -import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.Inventory; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java index 79bed83e0..da097c5c6 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.inventory; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java index 83471f909..2f3551643 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.material; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import org.bukkit.Material; import java.util.ArrayList; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java index 27edcc826..429dd3fd8 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.world; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import org.bukkit.Location; import org.bukkit.World; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java index 8f6a68992..f63ef647d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.bukkit.permission; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.foundry.FoundryPlugin; import org.bukkit.entity.Player; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java index ce6c0c1c5..9d785a594 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.permission; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.permission.Permission; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.permission.Permission; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.plugin.Plugin; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index 8343e0251..8fd6ae506 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -15,16 +15,16 @@ */ package com.clubobsidian.dynamicgui.bukkit.platform; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.messaging.MessagingRunnable; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.proxy.Proxy; +import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.proxy.Proxy; import com.clubobsidian.dynamicgui.bukkit.scheduler.BukkitScheduler; -import com.clubobsidian.dynamicgui.server.Platform; -import com.clubobsidian.dynamicgui.server.ServerType; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.server.ServerType; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index aafd23aad..9391a8e9d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -15,12 +15,12 @@ */ package com.clubobsidian.dynamicgui.bukkit.plugin; -import com.clubobsidian.dynamicgui.DynamicGui; +import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommand; import com.clubobsidian.dynamicgui.bukkit.command.CustomCommand; import com.clubobsidian.dynamicgui.bukkit.command.CustomCommandExecutor; -import com.clubobsidian.dynamicgui.economy.Economy; +import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.bukkit.economy.VaultEconomy; import com.clubobsidian.dynamicgui.bukkit.inject.BukkitPluginModule; import com.clubobsidian.dynamicgui.bukkit.listener.EntityClickListener; @@ -28,21 +28,21 @@ import com.clubobsidian.dynamicgui.bukkit.listener.InventoryInteractListener; import com.clubobsidian.dynamicgui.bukkit.listener.InventoryOpenListener; import com.clubobsidian.dynamicgui.bukkit.listener.PlayerInteractListener; -import com.clubobsidian.dynamicgui.logger.JavaLoggerWrapper; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ModelManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.permission.Permission; +import com.clubobsidian.dynamicgui.core.logger.JavaLoggerWrapper; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ModelManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.permission.Permission; import com.clubobsidian.dynamicgui.bukkit.permission.FoundryPermission; import com.clubobsidian.dynamicgui.bukkit.permission.VaultPermission; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.bukkit.registry.model.ItemsAdderModelProvider; import com.clubobsidian.dynamicgui.bukkit.registry.model.OraxenModelProvider; -import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; +import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; import com.clubobsidian.dynamicgui.bukkit.registry.npc.CitizensRegistry; import com.clubobsidian.dynamicgui.bukkit.registry.replacer.PlaceholderApiReplacerRegistry; import com.clubobsidian.dynamicgui.bukkit.platform.BukkitPlatform; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.server.Platform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.SimpleCommandMap; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 4c461dd36..4174253c2 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.bukkit.registry.model; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java index cf840b62e..99f69bbfe 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.bukkit.registry.model; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java index 699dbc6be..9d8910b67 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java @@ -15,11 +15,11 @@ */ package com.clubobsidian.dynamicgui.bukkit.registry.npc; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; -import com.clubobsidian.dynamicgui.registry.npc.NPC; -import com.clubobsidian.dynamicgui.registry.npc.NPCMeta; -import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; -import com.clubobsidian.dynamicgui.util.ReflectionUtil; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.registry.npc.NPC; +import com.clubobsidian.dynamicgui.core.registry.npc.NPCMeta; +import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import org.bukkit.entity.Entity; import java.lang.reflect.InvocationTargetException; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java index ea56d188d..9c3d354d6 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.registry.replacer; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; -import com.clubobsidian.dynamicgui.util.ReflectionUtil; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.registry.replacer.ReplacerRegistry; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import org.bukkit.OfflinePlayer; import java.lang.reflect.InvocationTargetException; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java index df767f7f8..ee35ceee6 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java @@ -15,9 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.scheduler; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java index 610e6dc19..d0388f6ea 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.bukkit.util; -import com.clubobsidian.dynamicgui.util.ReflectionUtil; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java index 8b488b465..fb3a59df3 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.bukkit.world; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import org.bukkit.Bukkit; import org.bukkit.World; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java similarity index 71% rename from core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 75bdfe96a..7b2087b63 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -13,86 +13,86 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui; - -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.impl.AddPermissionFunction; -import com.clubobsidian.dynamicgui.function.impl.DelayFunction; -import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; -import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; -import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; -import com.clubobsidian.dynamicgui.function.impl.CheckPlayerWorldFunction; -import com.clubobsidian.dynamicgui.function.impl.ConsoleCmdFunction; -import com.clubobsidian.dynamicgui.function.impl.GetGameRuleFunction; -import com.clubobsidian.dynamicgui.function.impl.IsBedrockPlayerFunction; -import com.clubobsidian.dynamicgui.function.impl.LogFunction; -import com.clubobsidian.dynamicgui.function.impl.MoneyBalanceFunction; -import com.clubobsidian.dynamicgui.function.impl.MoneyDepositFunction; -import com.clubobsidian.dynamicgui.function.impl.MoneyWithdrawFunction; -import com.clubobsidian.dynamicgui.function.impl.NoPermissionFunction; -import com.clubobsidian.dynamicgui.function.impl.ParticleFunction; -import com.clubobsidian.dynamicgui.function.impl.PermissionFunction; -import com.clubobsidian.dynamicgui.function.impl.PlayerCmdFunction; -import com.clubobsidian.dynamicgui.function.impl.PlayerMiniMsgFunction; -import com.clubobsidian.dynamicgui.function.impl.PlayerMsgFunction; -import com.clubobsidian.dynamicgui.function.impl.RandomFunction; -import com.clubobsidian.dynamicgui.function.impl.RemovePermissionFunction; -import com.clubobsidian.dynamicgui.function.impl.RemoveSlotFunction; -import com.clubobsidian.dynamicgui.function.impl.ResetFrameFunction; -import com.clubobsidian.dynamicgui.function.impl.ResetTickFunction; -import com.clubobsidian.dynamicgui.function.impl.SendFunction; -import com.clubobsidian.dynamicgui.function.impl.ServerBroadcastFunction; -import com.clubobsidian.dynamicgui.function.impl.ServerMiniBroadcastFunction; -import com.clubobsidian.dynamicgui.function.impl.SetAmountFunction; -import com.clubobsidian.dynamicgui.function.impl.SetCloseFunction; -import com.clubobsidian.dynamicgui.function.impl.SetDataFunction; -import com.clubobsidian.dynamicgui.function.impl.SetEnchantsFunction; -import com.clubobsidian.dynamicgui.function.impl.SetGameRuleFunction; -import com.clubobsidian.dynamicgui.function.impl.SetGlowFunction; -import com.clubobsidian.dynamicgui.function.impl.SetLoreFunction; -import com.clubobsidian.dynamicgui.function.impl.SetMoveableFunction; -import com.clubobsidian.dynamicgui.function.impl.SetNBTFunction; -import com.clubobsidian.dynamicgui.function.impl.SetNameFunction; -import com.clubobsidian.dynamicgui.function.impl.SetTypeFunction; -import com.clubobsidian.dynamicgui.function.impl.SoundFunction; -import com.clubobsidian.dynamicgui.function.impl.condition.CheckTickFunction; -import com.clubobsidian.dynamicgui.function.impl.condition.ConditionFunction; -import com.clubobsidian.dynamicgui.function.impl.cooldown.IsNotOnCooldownFunction; -import com.clubobsidian.dynamicgui.function.impl.cooldown.IsOnCooldownFunction; -import com.clubobsidian.dynamicgui.function.impl.cooldown.SetCooldownFunction; -import com.clubobsidian.dynamicgui.function.impl.gui.BackFunction; -import com.clubobsidian.dynamicgui.function.impl.gui.GuiFunction; -import com.clubobsidian.dynamicgui.function.impl.gui.HasBackFunction; -import com.clubobsidian.dynamicgui.function.impl.gui.RefreshGuiFunction; -import com.clubobsidian.dynamicgui.function.impl.gui.RefreshSlotFunction; -import com.clubobsidian.dynamicgui.function.impl.gui.SetBackFunction; -import com.clubobsidian.dynamicgui.function.impl.meta.CopyBackMetadataFunction; -import com.clubobsidian.dynamicgui.function.impl.meta.HasMetadataFunction; -import com.clubobsidian.dynamicgui.function.impl.meta.IsGuiMetadataSet; -import com.clubobsidian.dynamicgui.function.impl.meta.SetMetadataFunction; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.listener.EntityClickListener; -import com.clubobsidian.dynamicgui.listener.GuiListener; -import com.clubobsidian.dynamicgui.listener.InventoryCloseListener; -import com.clubobsidian.dynamicgui.listener.InventoryInteractListener; -import com.clubobsidian.dynamicgui.listener.InventoryOpenListener; -import com.clubobsidian.dynamicgui.listener.PlayerInteractListener; -import com.clubobsidian.dynamicgui.manager.dynamicgui.AnimationReplacerManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.SlotManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown.CooldownManager; -import com.clubobsidian.dynamicgui.messaging.MessagingRunnable; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.proxy.Proxy; -import com.clubobsidian.dynamicgui.registry.replacer.impl.CooldownReplacerRegistry; -import com.clubobsidian.dynamicgui.registry.replacer.impl.DynamicGuiAnimationReplacerRegistry; -import com.clubobsidian.dynamicgui.registry.replacer.impl.DynamicGuiReplacerRegistry; -import com.clubobsidian.dynamicgui.registry.replacer.impl.MetadataReplacerRegistry; -import com.clubobsidian.dynamicgui.replacer.Replacer; -import com.clubobsidian.dynamicgui.server.Platform; -import com.clubobsidian.dynamicgui.util.ChatColor; +package com.clubobsidian.dynamicgui.core; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; +import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; +import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; +import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; +import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; +import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCmdFunction; +import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; +import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; +import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; +import com.clubobsidian.dynamicgui.core.function.impl.MoneyBalanceFunction; +import com.clubobsidian.dynamicgui.core.function.impl.MoneyDepositFunction; +import com.clubobsidian.dynamicgui.core.function.impl.MoneyWithdrawFunction; +import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerCmdFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMsgFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgFunction; +import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; +import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; +import com.clubobsidian.dynamicgui.core.function.impl.RemoveSlotFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ResetFrameFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ResetTickFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SendFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ServerMiniBroadcastFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetAmountFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetCloseFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetDataFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetEnchantsFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetGlowFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetLoreFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetMoveableFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetNBTFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetNameFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetTypeFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SoundFunction; +import com.clubobsidian.dynamicgui.core.function.impl.condition.CheckTickFunction; +import com.clubobsidian.dynamicgui.core.function.impl.condition.ConditionFunction; +import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsNotOnCooldownFunction; +import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsOnCooldownFunction; +import com.clubobsidian.dynamicgui.core.function.impl.cooldown.SetCooldownFunction; +import com.clubobsidian.dynamicgui.core.function.impl.gui.BackFunction; +import com.clubobsidian.dynamicgui.core.function.impl.gui.GuiFunction; +import com.clubobsidian.dynamicgui.core.function.impl.gui.HasBackFunction; +import com.clubobsidian.dynamicgui.core.function.impl.gui.RefreshGuiFunction; +import com.clubobsidian.dynamicgui.core.function.impl.gui.RefreshSlotFunction; +import com.clubobsidian.dynamicgui.core.function.impl.gui.SetBackFunction; +import com.clubobsidian.dynamicgui.core.function.impl.meta.CopyBackMetadataFunction; +import com.clubobsidian.dynamicgui.core.function.impl.meta.HasMetadataFunction; +import com.clubobsidian.dynamicgui.core.function.impl.meta.IsGuiMetadataSet; +import com.clubobsidian.dynamicgui.core.function.impl.meta.SetMetadataFunction; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.listener.EntityClickListener; +import com.clubobsidian.dynamicgui.core.listener.GuiListener; +import com.clubobsidian.dynamicgui.core.listener.InventoryCloseListener; +import com.clubobsidian.dynamicgui.core.listener.InventoryInteractListener; +import com.clubobsidian.dynamicgui.core.listener.InventoryOpenListener; +import com.clubobsidian.dynamicgui.core.listener.PlayerInteractListener; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.SlotManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; +import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.proxy.Proxy; +import com.clubobsidian.dynamicgui.core.registry.replacer.impl.CooldownReplacerRegistry; +import com.clubobsidian.dynamicgui.core.registry.replacer.impl.DynamicGuiAnimationReplacerRegistry; +import com.clubobsidian.dynamicgui.core.registry.replacer.impl.DynamicGuiReplacerRegistry; +import com.clubobsidian.dynamicgui.core.registry.replacer.impl.MetadataReplacerRegistry; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.trident.EventBus; import com.clubobsidian.trident.eventbus.methodhandle.MethodHandleEventBus; import com.clubobsidian.wrappy.Configuration; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/animation/AnimationHolder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/AnimationHolder.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/animation/AnimationHolder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/animation/AnimationHolder.java index 24e42df0f..69e3d92b2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/animation/AnimationHolder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/AnimationHolder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.animation; +package com.clubobsidian.dynamicgui.core.animation; public interface AnimationHolder extends Refreshable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/animation/Refreshable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/Refreshable.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/animation/Refreshable.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/animation/Refreshable.java index 836e0f49c..e8f855c43 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/animation/Refreshable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/Refreshable.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.animation; +package com.clubobsidian.dynamicgui.core.animation; public interface Refreshable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/builder/EnchantmentBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/builder/EnchantmentBuilder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java index 376428944..97ff248e1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/builder/EnchantmentBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.builder; +package com.clubobsidian.dynamicgui.core.builder; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; public class EnchantmentBuilder { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/builder/FunctionBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/builder/FunctionBuilder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java index d2fd1c755..d89689fba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/builder/FunctionBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.builder; +package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/builder/FunctionTokenBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java similarity index 98% rename from core/src/main/java/com/clubobsidian/dynamicgui/builder/FunctionTokenBuilder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java index 3a8405a82..c9d468e70 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/builder/FunctionTokenBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.builder; +package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/builder/GuiBuilder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index 57e33a4d7..6fe74ac5b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.builder; +package com.clubobsidian.dynamicgui.core.builder; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.ModeEnum; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.ModeEnum; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import java.util.ArrayList; import java.util.HashMap; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/builder/SlotBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java similarity index 96% rename from core/src/main/java/com/clubobsidian/dynamicgui/builder/SlotBuilder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java index fddc14c1d..694a1eea9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/builder/SlotBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.builder; +package com.clubobsidian.dynamicgui.core.builder; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import java.util.ArrayList; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/inject/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/inject/package-info.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java index e539abf5f..ae3b14c68 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/inject/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.inject; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.command; \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/economy/Economy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/economy/Economy.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java index 3ff3c792d..0cf8cc3c2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/economy/Economy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.economy; +package com.clubobsidian.dynamicgui.core.economy; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import java.math.BigDecimal; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java similarity index 95% rename from core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java index ddcabb153..42a91e61a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/effect/ParticleWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.effect; +package com.clubobsidian.dynamicgui.core.effect; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import org.apache.commons.lang3.math.NumberUtils; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/enchantment/EnchantmentWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java similarity index 95% rename from core/src/main/java/com/clubobsidian/dynamicgui/enchantment/EnchantmentWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java index 9c73d0dd1..728eeab8c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/enchantment/EnchantmentWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.enchantment; +package com.clubobsidian.dynamicgui.core.enchantment; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/entity/EntityWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/entity/EntityWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java index 1ea354be6..3d3945074 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/entity/EntityWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.entity; +package com.clubobsidian.dynamicgui.core.entity; public abstract class EntityWrapper { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index 7fe117bb8..503c84470 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.entity; +package com.clubobsidian.dynamicgui.core.entity; -import com.clubobsidian.dynamicgui.effect.ParticleWrapper; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import java.util.UUID; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/DynamicGuiReloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/DynamicGuiReloadEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java index c9cf2e402..679d63a95 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/DynamicGuiReloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event; +package com.clubobsidian.dynamicgui.core.event; import com.clubobsidian.trident.Event; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/InventoryEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java similarity index 85% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/InventoryEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java index 94d2969b5..ce99dda1b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/InventoryEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event; +package com.clubobsidian.dynamicgui.core.event; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; public class InventoryEvent extends PlayerEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/LocationEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java similarity index 85% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/LocationEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java index 7d330e88f..89306d096 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/LocationEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event; +package com.clubobsidian.dynamicgui.core.event; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; public class LocationEvent extends PlayerEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/PlayerEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/PlayerEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java index 293d44e24..4266b0e67 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/PlayerEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event; +package com.clubobsidian.dynamicgui.core.event; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.trident.Event; public class PlayerEvent extends Event { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/block/PlayerInteractEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/block/PlayerInteractEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java index e5c00c2e5..db16e35ce 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/block/PlayerInteractEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.block; +package com.clubobsidian.dynamicgui.core.event.block; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.LocationEvent; -import com.clubobsidian.dynamicgui.event.player.Action; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.LocationEvent; +import com.clubobsidian.dynamicgui.core.event.player.Action; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import com.clubobsidian.trident.Cancellable; public class PlayerInteractEvent extends LocationEvent implements Cancellable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/Click.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/Click.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java index 8aa7d4eb1..4314b45fc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/Click.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; public enum Click { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/GuiLoadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/GuiLoadEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java index bf1f25901..ee68f66d0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/GuiLoadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.Gui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.trident.Cancellable; import com.clubobsidian.trident.Event; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/GuiPreloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/GuiPreloadEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java index 193485617..87076a105 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/GuiPreloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.Gui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.trident.Event; public class GuiPreloadEvent extends Event { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryClickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryClickEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java index bf6872fd5..b1c6cbd97 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryClickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.InventoryEvent; -import com.clubobsidian.dynamicgui.gui.InventoryView; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.InventoryEvent; +import com.clubobsidian.dynamicgui.core.gui.InventoryView; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.trident.Cancellable; public class InventoryClickEvent extends InventoryEvent implements Cancellable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryCloseEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java similarity index 77% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryCloseEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java index 0c9e72613..f93913a84 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryCloseEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.InventoryEvent; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.InventoryEvent; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; public class InventoryCloseEvent extends InventoryEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryDragEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryDragEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java index 622e148df..b9bea3e64 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryDragEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.InventoryEvent; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.InventoryEvent; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.trident.Cancellable; import java.util.Map; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryOpenEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java similarity index 77% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryOpenEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java index ddb69ca8f..4e3cf08f5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/InventoryOpenEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.InventoryEvent; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.InventoryEvent; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; public class InventoryOpenEvent extends InventoryEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/PlayerInteractEntityEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/PlayerInteractEntityEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java index 15a5a7110..64d0a13b0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/inventory/PlayerInteractEntityEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.inventory; +package com.clubobsidian.dynamicgui.core.event.inventory; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.PlayerEvent; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.PlayerEvent; public class PlayerInteractEntityEvent extends PlayerEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/player/Action.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/Action.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/player/Action.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/Action.java index d6f54a420..5c99db8f8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/player/Action.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/Action.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.player; +package com.clubobsidian.dynamicgui.core.event.player; public enum Action { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/player/PlayerKickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/player/PlayerKickEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java index 0a7af3426..72bf3f028 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/player/PlayerKickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.player; +package com.clubobsidian.dynamicgui.core.event.player; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.PlayerEvent; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.PlayerEvent; public class PlayerKickEvent extends PlayerEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/event/player/PlayerQuitEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/event/player/PlayerQuitEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java index 2b3aad7ce..4c2a9c364 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/event/player/PlayerQuitEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.event.player; +package com.clubobsidian.dynamicgui.core.event.player; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.PlayerEvent; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.PlayerEvent; public class PlayerQuitEvent extends PlayerEvent { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 0873cb03b..6ef46e824 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function; +package com.clubobsidian.dynamicgui.core.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; import com.clubobsidian.fuzzutil.StringFuzz; import org.apache.commons.lang3.SerializationUtils; import java.io.Serializable; -import java.util.concurrent.CompletableFuture; public abstract class Function implements Cloneable, Serializable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java index e46244d36..d2ce9eaac 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/AddPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class AddPermissionFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java index 9a5a87ed4..ba6aee212 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckItemTypeInHandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import java.util.ArrayList; import java.util.Arrays; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java similarity index 87% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java index c58ef7862..d265e6362 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckLevelFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class CheckLevelFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMoveableFunction.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMoveableFunction.java index deae89526..83044d0d1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMoveableFunction.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class CheckMoveableFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java index d43b92400..17c7bfae6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/CheckPlayerWorldFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; public class CheckPlayerWorldFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCmdFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCmdFunction.java index e963fff7c..5c2ee55aa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ConsoleCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCmdFunction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; public class ConsoleCmdFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java similarity index 76% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java index 0a336b571..8ddbecfc8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/DelayFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java @@ -1,7 +1,7 @@ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import org.apache.commons.lang3.math.NumberUtils; public class DelayFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java index 92d6f2908..efa133c18 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; public class GetGameRuleFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java similarity index 85% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java index 493be73ec..32d6e897e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/IsBedrockPlayerFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class IsBedrockPlayerFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java index 3e708c664..f23024dd5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/LogFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class LogFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java index a9e0b6c35..426f96364 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyBalanceFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import java.math.BigDecimal; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java index f68725430..248bd1f0a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyDepositFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import java.math.BigDecimal; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java similarity index 87% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java index 4b076ceab..610e088d4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/MoneyWithdrawFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import java.math.BigDecimal; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java index 382614fb0..906aafc05 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/NoPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class NoPermissionFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java index f5968abeb..29f145ce6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ParticleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.effect.ParticleWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class ParticleFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java index 4e616d3c9..77903156e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class PermissionFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCmdFunction.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCmdFunction.java index 3fbe97f33..0e6d579bf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCmdFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; public class PlayerCmdFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMsgFunction.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMsgFunction.java index 87e4bb71d..c31631c25 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMiniMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMsgFunction.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.MiniMessageManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; public class PlayerMiniMsgFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgFunction.java index 58ec1c8bd..1f5c37db8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgFunction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.util.ChatColor; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.util.ChatColor; public class PlayerMsgFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java index 2127b1a88..7b89f196c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/PlayerMsgJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class PlayerMsgJsonFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java index e86c23b4a..2ad5ee506 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RandomFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import java.util.Random; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java index 73e18d6da..5e1f32222 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemovePermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class RemovePermissionFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java index c4452ca57..da10c5b26 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/RemoveSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public class RemoveSlotFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java index 15573a168..903fe88cd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetFrameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class ResetFrameFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java index d68c2c5c5..70b1ca1be 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ResetTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class ResetTickFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java index 18301a9c3..e14617b71 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SendFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class SendFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java index aa603e0f9..8e9736964 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.util.ChatColor; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.util.ChatColor; public class ServerBroadcastFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java index ca4ea1c7c..8181335c2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; public class ServerBroadcastJsonFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java index d4def12c5..5438bc449 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/ServerMiniBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.MiniMessageManager; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; public class ServerMiniBroadcastFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java index c7905ede6..1363c84ad 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public class SetAmountFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java index 45135cf6f..dbdaa5d9f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class SetCloseFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDataFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDataFunction.java index 9acce8fde..b90217df6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetDataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDataFunction.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public class SetDataFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java index de529a18b..5bdd06a9b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import java.util.HashMap; import java.util.Map; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java index d2b0a444e..cd580932a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; public class SetGameRuleFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java index 83fffbf32..939bc1923 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public class SetGlowFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java index e0b990299..19e771f80 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.AnimationReplacerManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.util.ChatColor; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.util.ChatColor; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMoveableFunction.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMoveableFunction.java index 138a4c10f..649edff8e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMoveableFunction.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class SetMoveableFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java similarity index 77% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java index 1eb452af4..e93f7bfba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public class SetNBTFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java similarity index 73% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java index 2995afce1..9547b232c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.AnimationReplacerManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.util.ChatColor; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.util.ChatColor; public class SetNameFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java similarity index 77% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java index f7d17c077..3ec415068 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public class SetTypeFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java index bc7b777ee..533420260 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.sound.SoundWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.sound.SoundWrapper; public class SoundFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java similarity index 91% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java index af810f781..710d7d8c3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/AfterDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java @@ -1,50 +1,50 @@ -/* - * Copyright 2021 Club Obsidian and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.clubobsidian.dynamicgui.function.impl.condition; - -import com.clubobsidian.dynamicgui.DynamicGui; -import com.udojava.evalex.AbstractLazyFunction; -import com.udojava.evalex.Expression.LazyNumber; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.util.Date; -import java.util.List; - -public class AfterDateLazyFunction extends AbstractLazyFunction { - - protected AfterDateLazyFunction() { - super("AFTERDATE", 1, true); - } - - @Override - public LazyNumber lazyEval(List lazyParams) { - try { - String format = DynamicGui.get().getDateTimeFormat(); - Date now = Date.from(Instant.now()); - Date expected = new SimpleDateFormat(format).parse(lazyParams.get(0).getString()); - if(now.after(expected)) { - return ConditionFunction.ONE; - } - } catch (ParseException ignore) { - DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", - lazyParams.get(0).getString())); - } - return ConditionFunction.ZERO; - } +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.function.impl.condition; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.udojava.evalex.AbstractLazyFunction; +import com.udojava.evalex.Expression.LazyNumber; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.util.Date; +import java.util.List; + +public class AfterDateLazyFunction extends AbstractLazyFunction { + + protected AfterDateLazyFunction() { + super("AFTERDATE", 1, true); + } + + @Override + public LazyNumber lazyEval(List lazyParams) { + try { + String format = DynamicGui.get().getDateTimeFormat(); + Date now = Date.from(Instant.now()); + Date expected = new SimpleDateFormat(format).parse(lazyParams.get(0).getString()); + if(now.after(expected)) { + return ConditionFunction.ONE; + } + } catch (ParseException ignore) { + DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", + lazyParams.get(0).getString())); + } + return ConditionFunction.ZERO; + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/BeforeDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java similarity index 87% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/BeforeDateLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java index 6ffbfe1a7..0ac995ad1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/BeforeDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java @@ -1,34 +1,34 @@ -package com.clubobsidian.dynamicgui.function.impl.condition; - -import com.clubobsidian.dynamicgui.DynamicGui; -import com.udojava.evalex.AbstractLazyFunction; -import com.udojava.evalex.Expression.LazyNumber; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.util.Date; -import java.util.List; - -public class BeforeDateLazyFunction extends AbstractLazyFunction { - - protected BeforeDateLazyFunction() { - super("BEFOREDATE", 1, true); - } - - @Override - public LazyNumber lazyEval(List lazyParams) { - try { - String format = DynamicGui.get().getDateTimeFormat(); - Date now = Date.from(Instant.now()); - Date expected = new SimpleDateFormat(format).parse(lazyParams.get(0).getString()); - if(now.before(expected)) { - return ConditionFunction.ONE; - } - } catch (ParseException ignore) { - DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", - lazyParams.get(0).getString())); - } - return ConditionFunction.ZERO; - } -} +package com.clubobsidian.dynamicgui.core.function.impl.condition; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.udojava.evalex.AbstractLazyFunction; +import com.udojava.evalex.Expression.LazyNumber; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.util.Date; +import java.util.List; + +public class BeforeDateLazyFunction extends AbstractLazyFunction { + + protected BeforeDateLazyFunction() { + super("BEFOREDATE", 1, true); + } + + @Override + public LazyNumber lazyEval(List lazyParams) { + try { + String format = DynamicGui.get().getDateTimeFormat(); + Date now = Date.from(Instant.now()); + Date expected = new SimpleDateFormat(format).parse(lazyParams.get(0).getString()); + if(now.before(expected)) { + return ConditionFunction.ONE; + } + } catch (ParseException ignore) { + DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", + lazyParams.get(0).getString())); + } + return ConditionFunction.ZERO; + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java similarity index 85% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java index 646e0ad12..50f497eaa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/CheckTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Slot; import com.udojava.evalex.Expression; public class CheckTickFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java index c1067f512..b4f2ebeeb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ConditionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import com.udojava.evalex.Expression; import com.udojava.evalex.Expression.LazyNumber; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ContainsLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ContainsLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java index d50932df0..7254ad68e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/ContainsLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; import com.udojava.evalex.Expression.LazyNumber; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/EndsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/EndsWithLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java index ece6d2bdb..fdf19dc89 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/EndsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; import com.udojava.evalex.Expression.LazyNumber; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/EqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/EqualLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java index f34d248b6..0dd2b1600 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/EqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; import com.udojava.evalex.Expression.LazyNumber; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/IgnoreCaseEqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/IgnoreCaseEqualLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java index e649d6151..8e13bde21 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/IgnoreCaseEqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; import com.udojava.evalex.Expression.LazyNumber; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/StartsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/StartsWithLazyFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java index 1ead07bfb..c86f0d3c6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/condition/StartsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.condition; +package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; import com.udojava.evalex.Expression.LazyNumber; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java index 4781fd4da..abb5c2435 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsNotOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.cooldown; +package com.clubobsidian.dynamicgui.core.function.impl.cooldown; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown.CooldownManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; public class IsNotOnCooldownFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java index 723abe7f2..3fb1f5de9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/IsOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.cooldown; +package com.clubobsidian.dynamicgui.core.function.impl.cooldown; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown.CooldownManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; public class IsOnCooldownFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java similarity index 85% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java index 3a1703fdd..711126be8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.cooldown; +package com.clubobsidian.dynamicgui.core.function.impl.cooldown; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown.CooldownManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; public class SetCooldownFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java index 9c9df59a9..3880046de 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.gui; +package com.clubobsidian.dynamicgui.core.function.impl.gui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import java.util.concurrent.ExecutionException; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java index fd49477e2..8ebcaec72 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.gui; +package com.clubobsidian.dynamicgui.core.function.impl.gui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import java.util.concurrent.ExecutionException; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java index 40b80c1b9..4bb9d6b5e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/HasBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.gui; +package com.clubobsidian.dynamicgui.core.function.impl.gui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class HasBackFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java index ea7e2edc4..b1e42309c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshGuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.gui; +package com.clubobsidian.dynamicgui.core.function.impl.gui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class RefreshGuiFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java similarity index 87% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java index 8dd96ffcc..9b19d9e91 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/RefreshSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.gui; +package com.clubobsidian.dynamicgui.core.function.impl.gui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java index 845185555..18b01c902 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.gui; +package com.clubobsidian.dynamicgui.core.function.impl.gui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; public class SetBackFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java index 2e1fb7c30..f6feeb80c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/CopyBackMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.meta; +package com.clubobsidian.dynamicgui.core.function.impl.meta; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class CopyBackMetadataFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java index ccd357971..c09ceff4a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/HasMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.meta; +package com.clubobsidian.dynamicgui.core.function.impl.meta; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.gui.property.MetadataHolder; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; public class HasMetadataFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/IsGuiMetadataSet.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/IsGuiMetadataSet.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java index 78a0fcd3f..57df336bf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/IsGuiMetadataSet.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.meta; +package com.clubobsidian.dynamicgui.core.function.impl.meta; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; public class IsGuiMetadataSet extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java index cf10f1a3f..3fff56e6f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/function/impl/meta/SetMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.function.impl.meta; +package com.clubobsidian.dynamicgui.core.function.impl.meta; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.gui.property.MetadataHolder; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; public class SetMetadataFunction extends Function { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/FunctionOwner.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/FunctionOwner.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java index d7b845159..ec47bd63b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/FunctionOwner.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui; +package com.clubobsidian.dynamicgui.core.gui; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/Gui.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index bc2d70bb1..b6572961c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui; - -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.property.MetadataHolder; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; +package com.clubobsidian.dynamicgui.core.gui; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -import com.clubobsidian.dynamicgui.util.ChatColor; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.util.ChatColor; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import org.apache.commons.lang3.SerializationUtils; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/InventoryType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java similarity index 95% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/InventoryType.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java index df2f16492..3822f93de 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/InventoryType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui; +package com.clubobsidian.dynamicgui.core.gui; public enum InventoryType { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/InventoryView.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/InventoryView.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java index 0f5cae81a..37eacb8a6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/InventoryView.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui; +package com.clubobsidian.dynamicgui.core.gui; public enum InventoryView { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/ModeEnum.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/ModeEnum.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java index 532d4950c..e4cedbe15 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/ModeEnum.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui; +package com.clubobsidian.dynamicgui.core.gui; public enum ModeEnum { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java similarity index 91% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/Slot.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index ca569ca21..3cb941dfd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui; - -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.property.MetadataHolder; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.AnimationReplacerManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ModelManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.ReplacerManager; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; +package com.clubobsidian.dynamicgui.core.gui; + +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ModelManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -import com.clubobsidian.dynamicgui.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; import java.io.Serializable; import java.util.ArrayList; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/gui/property/MetadataHolder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/gui/property/MetadataHolder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java index 161c3b52c..0f0238329 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/gui/property/MetadataHolder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.gui.property; +package com.clubobsidian.dynamicgui.core.gui.property; import java.util.Map; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 8a6bd9b4f..fc7472fd6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.inject.module; +package com.clubobsidian.dynamicgui.core.inject.module; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; -import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.server.Platform; import com.google.inject.Binder; import com.google.inject.Guice; import com.google.inject.Module; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/command/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/command/package-info.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java index 132140e5e..21cd49743 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/command/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.command; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.inject; \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/inventory/InventoryWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/inventory/InventoryWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java index 0b231e785..5fe2071ad 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/inventory/InventoryWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.inventory; +package com.clubobsidian.dynamicgui.core.inventory; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/inventory/ItemStackWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/inventory/ItemStackWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java index db6edb97d..b9a0b6163 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/inventory/ItemStackWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.inventory; +package com.clubobsidian.dynamicgui.core.inventory; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import java.io.Serializable; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/EntityClickListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/listener/EntityClickListener.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java index c86e5e821..fff1107a7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/EntityClickListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener; +package com.clubobsidian.dynamicgui.core.listener; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; -import com.clubobsidian.dynamicgui.event.inventory.PlayerInteractEntityEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.registry.npc.NPC; -import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.PlayerInteractEntityEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.registry.npc.NPC; +import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; import com.clubobsidian.trident.EventHandler; import java.util.Iterator; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index e093f5ada..93b6011c2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener; +package com.clubobsidian.dynamicgui.core.listener; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.GuiLoadEvent; -import com.clubobsidian.dynamicgui.event.inventory.InventoryCloseEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.trident.EventHandler; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryCloseListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryCloseListener.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java index 4250ced2d..edb9ba02e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryCloseListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener; +package com.clubobsidian.dynamicgui.core.listener; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.InventoryCloseEvent; -import com.clubobsidian.dynamicgui.event.player.PlayerKickEvent; -import com.clubobsidian.dynamicgui.event.player.PlayerQuitEvent; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent; +import com.clubobsidian.dynamicgui.core.event.player.PlayerKickEvent; +import com.clubobsidian.dynamicgui.core.event.player.PlayerQuitEvent; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.trident.EventHandler; import com.clubobsidian.trident.EventPriority; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index f57d12dd1..23777ae92 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener; - -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.Click; -import com.clubobsidian.dynamicgui.event.inventory.InventoryClickEvent; -import com.clubobsidian.dynamicgui.event.inventory.InventoryDragEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.InventoryView; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.FunctionManager; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; +package com.clubobsidian.dynamicgui.core.listener; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.Click; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.InventoryView; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; import com.clubobsidian.trident.EventHandler; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryOpenListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java similarity index 88% rename from core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryOpenListener.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java index b93062484..e9a17cd19 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/InventoryOpenListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener; +package com.clubobsidian.dynamicgui.core.listener; -import com.clubobsidian.dynamicgui.event.inventory.InventoryOpenEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryOpenEvent; import com.clubobsidian.trident.EventHandler; public class InventoryOpenListener { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/listener/PlayerInteractListener.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 8beae8122..82cab310d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.listener; +package com.clubobsidian.dynamicgui.core.listener; -import com.clubobsidian.dynamicgui.event.block.PlayerInteractEvent; -import com.clubobsidian.dynamicgui.event.player.Action; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent; +import com.clubobsidian.dynamicgui.core.event.player.Action; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import com.clubobsidian.trident.EventHandler; public class PlayerInteractListener { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/logger/JavaLoggerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java similarity index 95% rename from core/src/main/java/com/clubobsidian/dynamicgui/logger/JavaLoggerWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java index f041742ae..46d736861 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/logger/JavaLoggerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.logger; +package com.clubobsidian.dynamicgui.core.logger; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/logger/LoggerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java similarity index 95% rename from core/src/main/java/com/clubobsidian/dynamicgui/logger/LoggerWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java index 3d8260dec..75a24e723 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/logger/LoggerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.logger; +package com.clubobsidian.dynamicgui.core.logger; public abstract class LoggerWrapper { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/AnimationReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java similarity index 85% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/AnimationReplacerManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java index c057d5680..2fa1eca85 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/AnimationReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.registry.replacer.AnimationReplacerRegistry; +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.registry.replacer.AnimationReplacerRegistry; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java similarity index 96% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index ca43dde1b..afc4db7bf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; -import com.clubobsidian.dynamicgui.util.ThreadUtil; +import com.clubobsidian.dynamicgui.core.util.ThreadUtil; import com.clubobsidian.fuzzutil.StringFuzz; import java.util.ArrayDeque; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 940f0d3b6..23621bd2a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -13,33 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; - -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.enchantment.EnchantmentWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.GuiLoadEvent; -import com.clubobsidian.dynamicgui.event.inventory.GuiPreloadEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.ModeEnum; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiPreloadEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.ModeEnum; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.Platform; -import com.clubobsidian.dynamicgui.server.ServerType; -import com.clubobsidian.dynamicgui.util.ChatColor; - -import com.clubobsidian.dynamicgui.util.HashUtil; -import com.clubobsidian.dynamicgui.util.ThreadUtil; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.server.ServerType; +import com.clubobsidian.dynamicgui.core.util.ChatColor; + +import com.clubobsidian.dynamicgui.core.util.HashUtil; +import com.clubobsidian.dynamicgui.core.util.ThreadUtil; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; import org.apache.commons.io.FileUtils; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/MiniMessageManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java similarity index 91% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/MiniMessageManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java index 219ab4d9f..a2d9a1274 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/MiniMessageManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; import com.clubobsidian.trident.EventHandler; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/ModelManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java similarity index 87% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/ModelManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java index 1b4d0b0ca..9f916809a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/ModelManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.registry.model.ModelProvider; -import com.clubobsidian.dynamicgui.registry.model.vanilla.VanillaModelProvider; +import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.registry.model.vanilla.VanillaModelProvider; import java.util.HashMap; import java.util.Map; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/ReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java similarity index 88% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/ReplacerManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java index 3ac134f3d..e64ba924f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/ReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.registry.replacer.ReplacerRegistry; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java index 756559803..fbff26056 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import java.util.Iterator; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/Cooldown.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/Cooldown.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java index bbff291c7..2ce0ad2bb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/Cooldown.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown; public class Cooldown { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java index 89f57ddf5..2a4a91220 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown; +package com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/entity/EntityManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/entity/EntityManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java index d678f95ff..9648416f9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/entity/EntityManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.entity; +package com.clubobsidian.dynamicgui.core.manager.entity; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.google.inject.Inject; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/InventoryManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/InventoryManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java index 6ebab9809..005daf258 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/InventoryManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.inventory; +package com.clubobsidian.dynamicgui.core.manager.inventory; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.google.inject.Inject; public abstract class InventoryManager { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/ItemStackManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/ItemStackManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java index da026865f..1d5046e62 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/inventory/ItemStackManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.inventory; +package com.clubobsidian.dynamicgui.core.manager.inventory; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.google.inject.Inject; public abstract class ItemStackManager { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/material/MaterialManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/material/MaterialManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java index 9eb868c83..8ea57d423 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/material/MaterialManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.material; +package com.clubobsidian.dynamicgui.core.manager.material; import com.google.inject.Inject; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/manager/world/LocationManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/manager/world/LocationManager.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java index 46d7bc7ef..354b52528 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/manager/world/LocationManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.manager.world; +package com.clubobsidian.dynamicgui.core.manager.world; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import com.google.inject.Inject; public abstract class LocationManager { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/messaging/MessagingRunnable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/messaging/MessagingRunnable.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java index 167bdf6b2..4606f7918 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/messaging/MessagingRunnable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.messaging; +package com.clubobsidian.dynamicgui.core.messaging; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public interface MessagingRunnable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/permission/Permission.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/permission/Permission.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java index 9002bfa8e..94abdd1f3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/permission/Permission.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.permission; +package com.clubobsidian.dynamicgui.core.permission; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public interface Permission { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/plugin/DynamicGuiPlugin.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index 8426f3e3c..9e416f942 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.plugin; +package com.clubobsidian.dynamicgui.core.plugin; -import com.clubobsidian.dynamicgui.economy.Economy; -import com.clubobsidian.dynamicgui.permission.Permission; -import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; +import com.clubobsidian.dynamicgui.core.economy.Economy; +import com.clubobsidian.dynamicgui.core.permission.Permission; +import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; import java.io.File; import java.util.List; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/proxy/Proxy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/proxy/Proxy.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java index 735bfc7c0..536f3c7ca 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/proxy/Proxy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.proxy; +package com.clubobsidian.dynamicgui.core.proxy; public enum Proxy { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/model/ModelProvider.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/model/ModelProvider.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java index fc8428365..6447cad03 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/model/ModelProvider.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.model; +package com.clubobsidian.dynamicgui.core.registry.model; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public interface ModelProvider { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/model/vanilla/VanillaModelProvider.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/model/vanilla/VanillaModelProvider.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java index 86d4cc82f..331aef963 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/model/vanilla/VanillaModelProvider.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.model.vanilla; +package com.clubobsidian.dynamicgui.core.registry.model.vanilla; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; import org.apache.commons.lang3.math.NumberUtils; public class VanillaModelProvider implements ModelProvider { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPC.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPC.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java index 7ad520f13..31973b484 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPC.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.npc; +package com.clubobsidian.dynamicgui.core.registry.npc; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; public class NPC { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPCMeta.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java similarity index 94% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPCMeta.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java index e1a3d1f92..c3d176bcf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPCMeta.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.npc; +package com.clubobsidian.dynamicgui.core.registry.npc; public class NPCMeta { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPCRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java similarity index 87% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPCRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java index e4fb577e8..c91e1a179 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/npc/NPCRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.npc; +package com.clubobsidian.dynamicgui.core.registry.npc; -import com.clubobsidian.dynamicgui.entity.EntityWrapper; +import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; public interface NPCRegistry { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java index 49dcf80db..cf0f93faa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry; +package com.clubobsidian.dynamicgui.core.registry; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/AnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/AnimationReplacerRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java index f7415c1e5..bd8ce1539 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/AnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer; +package com.clubobsidian.dynamicgui.core.registry.replacer; -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public interface AnimationReplacerRegistry { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/ReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java similarity index 86% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/ReplacerRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java index d10ad3786..d20c3cdbd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/ReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer; +package com.clubobsidian.dynamicgui.core.registry.replacer; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public interface ReplacerRegistry { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/CooldownReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java similarity index 88% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/CooldownReplacerRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java index 7ae241ff9..06518818c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/CooldownReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer.impl; +package com.clubobsidian.dynamicgui.core.registry.replacer.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown.Cooldown; -import com.clubobsidian.dynamicgui.manager.dynamicgui.cooldown.CooldownManager; -import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.Cooldown; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; +import com.clubobsidian.dynamicgui.core.registry.replacer.ReplacerRegistry; import org.apache.commons.lang3.StringUtils; import java.util.Collection; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java index f20336aac..5a94fdbe1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer.impl; - -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.registry.replacer.AnimationReplacerRegistry; -import com.clubobsidian.dynamicgui.replacer.AnimationReplacer; -import com.clubobsidian.dynamicgui.replacer.animation.impl.MultiLineTestAnimationReplacer; -import com.clubobsidian.dynamicgui.replacer.animation.impl.TestAnimationReplacer; +package com.clubobsidian.dynamicgui.core.registry.replacer.impl; + +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.registry.replacer.AnimationReplacerRegistry; +import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; +import com.clubobsidian.dynamicgui.core.replacer.animation.impl.MultiLineTestAnimationReplacer; +import com.clubobsidian.dynamicgui.core.replacer.animation.impl.TestAnimationReplacer; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java index c56b2056f..bf7473ecc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer.impl; +package com.clubobsidian.dynamicgui.core.registry.replacer.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.DynamicGuiReloadEvent; -import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; -import com.clubobsidian.dynamicgui.replacer.Replacer; -import com.clubobsidian.dynamicgui.replacer.impl.GlobalPlayerCountReplacer; -import com.clubobsidian.dynamicgui.replacer.impl.OnlinePlayersReplacer; -import com.clubobsidian.dynamicgui.replacer.impl.PlayerLevelReplacer; -import com.clubobsidian.dynamicgui.replacer.impl.PlayerReplacer; -import com.clubobsidian.dynamicgui.replacer.impl.PreviousGuiReplacer; -import com.clubobsidian.dynamicgui.replacer.impl.UUIDReplacer; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.registry.replacer.ReplacerRegistry; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.GlobalPlayerCountReplacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.OnlinePlayersReplacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.PlayerLevelReplacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.PlayerReplacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.PreviousGuiReplacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.UUIDReplacer; import com.clubobsidian.trident.EventHandler; import org.apache.commons.lang3.StringUtils; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/MetadataReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/MetadataReplacerRegistry.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java index c2493b763..0c02d7075 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/registry/replacer/impl/MetadataReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.registry.replacer.impl; +package com.clubobsidian.dynamicgui.core.registry.replacer.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.GuiLoadEvent; -import com.clubobsidian.dynamicgui.event.inventory.GuiPreloadEvent; -import com.clubobsidian.dynamicgui.event.inventory.InventoryCloseEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.registry.replacer.ReplacerRegistry; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiPreloadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.registry.replacer.ReplacerRegistry; import com.clubobsidian.trident.EventHandler; import com.clubobsidian.trident.EventPriority; import org.apache.commons.lang3.StringUtils; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/AnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java similarity index 84% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/AnimationReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java index e568bb404..45dda75df 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/AnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer; +package com.clubobsidian.dynamicgui.core.replacer; -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public abstract class AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/Replacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/Replacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java index 83fac181e..c5b5c9daf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/Replacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer; +package com.clubobsidian.dynamicgui.core.replacer; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public abstract class Replacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/animation/impl/MultiLineTestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java similarity index 79% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/animation/impl/MultiLineTestAnimationReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java index 6377f49c5..0908aad5a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/animation/impl/MultiLineTestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.animation.impl; +package com.clubobsidian.dynamicgui.core.replacer.animation.impl; -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.AnimationReplacer; +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; public class MultiLineTestAnimationReplacer extends AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/animation/impl/TestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java similarity index 78% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/animation/impl/TestAnimationReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java index 004195ba9..a90403b30 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/animation/impl/TestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.animation.impl; +package com.clubobsidian.dynamicgui.core.replacer.animation.impl; -import com.clubobsidian.dynamicgui.animation.AnimationHolder; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.AnimationReplacer; +import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; public class TestAnimationReplacer extends AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java similarity index 81% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java index fde690823..2f8446c76 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/GlobalPlayerCountReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.impl; +package com.clubobsidian.dynamicgui.core.replacer.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; public class GlobalPlayerCountReplacer extends Replacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java index 3efdbf51a..1d5cd4540 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/OnlinePlayersReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.impl; +package com.clubobsidian.dynamicgui.core.replacer.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; public class OnlinePlayersReplacer extends Replacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PlayerLevelReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PlayerLevelReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java index fc3a610d1..9499d1556 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PlayerLevelReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.impl; +package com.clubobsidian.dynamicgui.core.replacer.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; public class PlayerLevelReplacer extends Replacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PlayerReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PlayerReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java index 94d6fbe3a..0aeadb6a3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PlayerReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.impl; +package com.clubobsidian.dynamicgui.core.replacer.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; public class PlayerReplacer extends Replacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PreviousGuiReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java similarity index 80% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PreviousGuiReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java index 348006a4e..9a31fdfca 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/PreviousGuiReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.impl; +package com.clubobsidian.dynamicgui.core.replacer.impl; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.event.inventory.GuiLoadEvent; -import com.clubobsidian.dynamicgui.event.inventory.GuiPreloadEvent; -import com.clubobsidian.dynamicgui.event.inventory.InventoryCloseEvent; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiPreloadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; import com.clubobsidian.trident.EventHandler; import com.clubobsidian.trident.EventPriority; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/UUIDReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java similarity index 83% rename from core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/UUIDReplacer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java index 85167b91b..f4d2b15f5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/replacer/impl/UUIDReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.replacer.impl; +package com.clubobsidian.dynamicgui.core.replacer.impl; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.replacer.Replacer; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; public class UUIDReplacer extends Replacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java index 3e98982f1..b936a877e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/scheduler/Scheduler.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java @@ -13,9 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.scheduler; - -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; +package com.clubobsidian.dynamicgui.core.scheduler; public abstract class Scheduler { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/server/Platform.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java similarity index 82% rename from core/src/main/java/com/clubobsidian/dynamicgui/server/Platform.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java index b901b8286..515aa9ccd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/server/Platform.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.server; +package com.clubobsidian.dynamicgui.core.server; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.messaging.MessagingRunnable; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import java.util.Collection; import java.util.UUID; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/server/ServerType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/ServerType.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/server/ServerType.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/server/ServerType.java index 783379e55..4ffdadfc3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/server/ServerType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/ServerType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.server; +package com.clubobsidian.dynamicgui.core.server; public enum ServerType { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/sound/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/sound/SoundWrapper.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/sound/SoundWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/sound/SoundWrapper.java index b596e338e..ee71310d1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/sound/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/sound/SoundWrapper.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.sound; +package com.clubobsidian.dynamicgui.core.sound; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/ChatColor.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java similarity index 98% rename from core/src/main/java/com/clubobsidian/dynamicgui/util/ChatColor.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java index 7dcf68a13..55af588db 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/ChatColor.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util; +package com.clubobsidian.dynamicgui.core.util; import java.awt.*; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/HashUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/util/HashUtil.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java index 6b622d17b..6483ae34b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/HashUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util; +package com.clubobsidian.dynamicgui.core.util; import java.io.File; import java.io.IOException; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java similarity index 98% rename from core/src/main/java/com/clubobsidian/dynamicgui/util/ReflectionUtil.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index cde89b949..a6ec315b6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.util; +package com.clubobsidian.dynamicgui.core.util; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java similarity index 71% rename from core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java index 510a0ba5a..395786b15 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/util/ThreadUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java @@ -1,8 +1,8 @@ -package com.clubobsidian.dynamicgui.util; +package com.clubobsidian.dynamicgui.core.util; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.server.Platform; public final class ThreadUtil { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/world/LocationWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/world/LocationWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java index c012052a0..650a5e532 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/world/LocationWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.world; +package com.clubobsidian.dynamicgui.core.world; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java index 772578b7b..75b09acc7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/world/WorldWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.world; +package com.clubobsidian.dynamicgui.core.world; import java.io.Serializable; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java index 56cc2fcc9..00873cc46 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.AddPermissionFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java index 77fe48823..255e8df7b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.CheckItemTypeInHandFunction; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java index 859e63c30..1f5f36784 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.CheckLevelFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java index 64b54652b..3b1876fb5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.CheckMoveableFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java index 6d2f6b499..3bdcee110 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.CheckPlayerWorldFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java index c00d147db..7b2756c84 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.ConsoleCmdFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCmdFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java index 5744ebd4e..a0c85e8f7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.DelayFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java index d5c8561f1..f5eb7314c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java @@ -16,12 +16,11 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.GetGameRuleFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java index 38c3697f4..492902fa2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.IsBedrockPlayerFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java index a91b45e94..807910779 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.LogFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.logger.MockLogger; import com.clubobsidian.dynamicgui.test.mock.logger.MockLoggerWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java index 2aa35d50e..a218a691c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.MoneyBalanceFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.MoneyBalanceFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java index 32d95555b..f3960d6f5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java @@ -16,15 +16,12 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.MoneyDepositFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.MoneyDepositFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; import org.junit.Test; -import java.math.BigDecimal; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java index 706a5a56f..a2c4544db 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.MoneyWithdrawFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.MoneyWithdrawFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java index 8b87a45ea..e6411fdad 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.NoPermissionFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java index 1fc44fb22..62e5e9c73 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java @@ -16,11 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.ParticleFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java index 897dfb4b1..ff2409d30 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.function; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.function.Function; -import com.clubobsidian.dynamicgui.function.impl.PermissionFunction; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; import com.clubobsidian.dynamicgui.test.mock.MockFactory; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java index 3e8d35f93..01d3380c1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java @@ -16,16 +16,16 @@ package com.clubobsidian.dynamicgui.test.mock; -import com.clubobsidian.dynamicgui.DynamicGui; -import com.clubobsidian.dynamicgui.economy.Economy; -import com.clubobsidian.dynamicgui.gui.Gui; -import com.clubobsidian.dynamicgui.gui.InventoryType; -import com.clubobsidian.dynamicgui.gui.ModeEnum; -import com.clubobsidian.dynamicgui.gui.Slot; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.economy.Economy; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.InventoryType; +import com.clubobsidian.dynamicgui.core.gui.ModeEnum; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.test.mock.inject.MockPluginModule; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java index 91c998f36..8721f9069 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.test.mock.entity.player; -import com.clubobsidian.dynamicgui.effect.ParticleWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import java.util.ArrayList; import java.util.Collection; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java index 708c85df0..0fefba76a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java @@ -16,12 +16,11 @@ package com.clubobsidian.dynamicgui.test.mock.entity.player; -import com.clubobsidian.dynamicgui.effect.ParticleWrapper; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; -import java.util.Collection; import java.util.List; import java.util.UUID; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java index 7be60b3cf..98f7adf75 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java @@ -16,15 +16,15 @@ package com.clubobsidian.dynamicgui.test.mock.inject; -import com.clubobsidian.dynamicgui.inject.module.PluginModule; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; -import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.server.Platform; +import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.test.mock.manager.MockEntityManager; import com.clubobsidian.dynamicgui.test.mock.manager.MockInventoryManager; import com.clubobsidian.dynamicgui.test.mock.manager.MockItemStackManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java index 9c7ffe14e..3292e0bab 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.inventory; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; public abstract class MockItemStackWrapper extends ItemStackWrapper { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java index 4094f26ff..ffcdcda81 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.logger; -import com.clubobsidian.dynamicgui.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; public class MockLoggerWrapper extends LoggerWrapper { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java index 9b4c4093f..2efe93f19 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.mock.manager; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.manager.entity.EntityManager; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import java.util.List; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java index 663ae18cb..cd555811f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.mock.manager; -import com.clubobsidian.dynamicgui.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; public class MockInventoryManager extends InventoryManager { @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java index 305707792..e01f616d6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.mock.manager; -import com.clubobsidian.dynamicgui.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; public class MockItemStackManager extends ItemStackManager { @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java index 11cdd213f..a9061c350 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.mock.manager; -import com.clubobsidian.dynamicgui.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; public class MockLocationManager extends LocationManager { @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java index 18b85255b..b083860bb 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.manager; -import com.clubobsidian.dynamicgui.manager.material.MaterialManager; +import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import java.util.List; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java index 2ad59b1b1..1ce785a9d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java @@ -16,10 +16,10 @@ package com.clubobsidian.dynamicgui.test.mock.plugin; -import com.clubobsidian.dynamicgui.economy.Economy; -import com.clubobsidian.dynamicgui.permission.Permission; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.registry.npc.NPCRegistry; +import com.clubobsidian.dynamicgui.core.economy.Economy; +import com.clubobsidian.dynamicgui.core.permission.Permission; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; import java.io.File; import java.util.ArrayList; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java index fe85811a2..f84025b1e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.mock.plugin; -import com.clubobsidian.dynamicgui.economy.Economy; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.economy.Economy; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import java.math.BigDecimal; import java.util.HashMap; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java index 2f37439c4..abd68d1fa 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java @@ -16,8 +16,8 @@ package com.clubobsidian.dynamicgui.test.mock.plugin; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.permission.Permission; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.permission.Permission; public class MockPermission implements Permission { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java index 44869ddef..730a052fb 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java @@ -16,13 +16,13 @@ package com.clubobsidian.dynamicgui.test.mock.plugin; -import com.clubobsidian.dynamicgui.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.messaging.MessagingRunnable; -import com.clubobsidian.dynamicgui.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.server.Platform; -import com.clubobsidian.dynamicgui.server.ServerType; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.server.ServerType; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import java.util.ArrayList; import java.util.Collection; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java index 132bb076d..669fae9bd 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.plugin; -import com.clubobsidian.dynamicgui.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; public class MockScheduler extends Scheduler { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java index ed04d5c43..e83357391 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.world; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; public class MockLocation { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java index 562f7db62..93a34afe8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.world; -import com.clubobsidian.dynamicgui.world.LocationWrapper; +import com.clubobsidian.dynamicgui.core.world.LocationWrapper; public class MockLocationWrapper extends LocationWrapper { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java index 50d072dfc..3fc171251 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.test.mock.world; -import com.clubobsidian.dynamicgui.world.WorldWrapper; +import com.clubobsidian.dynamicgui.core.world.WorldWrapper; public class MockWorldWrapper extends WorldWrapper { From 8d0562e9df247295b6a36f5a5cc2d234c7d1e27d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 23:23:35 -0800 Subject: [PATCH 044/261] Make particles list final --- .../dynamicgui/test/mock/entity/player/MockPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java index 8721f9069..9c1b108bb 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java @@ -36,7 +36,7 @@ public class MockPlayer { private ItemStackWrapper hand; private int level = 0; private LocationWrapper location; - private List particles = new ArrayList<>(); + private final List particles = new ArrayList<>(); public MockPlayer(String name, UUID uuid) { this.name = name; From 0ff93978f03f3fac16854cc575ae57e8f58703e5 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 23:24:56 -0800 Subject: [PATCH 045/261] Repackage core test code --- .../function/AddPermissionFunctionTest.java | 4 +-- .../CheckItemInTypeHandFunctionTest.java | 6 ++-- .../test/function/CheckLevelFunctionTest.java | 6 ++-- .../function/CheckMoveableFunctionTest.java | 6 ++-- .../CheckPlayerWorldFunctionTest.java | 6 ++-- .../test/function/ConsoleCmdFunctionTest.java | 6 ++-- .../test/function/DelayFunctionTest.java | 4 +-- .../function/GetGameRuleFunctionTest.java | 6 ++-- .../function/IsBedrockPlayerFunctionTest.java | 6 ++-- .../test/function/LogFunctionTest.java | 8 ++--- .../function/MoneyBalanceFunctionTest.java | 6 ++-- .../function/MoneyDepositFunctionTest.java | 4 +-- .../function/MoneyWithdrawFunctionTest.java | 6 ++-- .../function/NoPermissionFunctionTest.java | 4 +-- .../test/function/ParticleFunctionTest.java | 6 ++-- .../test/function/PermissionFunctionTest.java | 4 +-- .../{ => core}/test/mock/MockFactory.java | 32 +++++++++---------- .../test/mock/entity/package-info.java | 2 +- .../test/mock/entity/player/MockPlayer.java | 2 +- .../mock/entity/player/MockPlayerWrapper.java | 2 +- .../test/mock/inject/MockPluginModule.java | 12 +++---- .../test/mock/inventory/MockItemStack.java | 2 +- .../mock/inventory/MockItemStackWrapper.java | 2 +- .../test/mock/logger/MockLogger.java | 2 +- .../test/mock/logger/MockLoggerWrapper.java | 2 +- .../test/mock/manager/MockEntityManager.java | 2 +- .../mock/manager/MockInventoryManager.java | 2 +- .../mock/manager/MockItemStackManager.java | 2 +- .../mock/manager/MockLocationManager.java | 2 +- .../mock/manager/MockMaterialManager.java | 2 +- .../mock/plugin/MockDynamicGuiPlugin.java | 2 +- .../test/mock/plugin/MockEconomy.java | 2 +- .../test/mock/plugin/MockPermission.java | 2 +- .../test/mock/plugin/MockPlatform.java | 2 +- .../test/mock/plugin/MockScheduler.java | 2 +- .../test/mock/world/MockLocation.java | 2 +- .../test/mock/world/MockLocationWrapper.java | 2 +- .../{ => core}/test/mock/world/MockWorld.java | 2 +- .../test/mock/world/MockWorldWrapper.java | 2 +- .../{ => core}/test/package-info.java | 2 +- 40 files changed, 88 insertions(+), 88 deletions(-) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/AddPermissionFunctionTest.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/CheckItemInTypeHandFunctionTest.java (91%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/CheckLevelFunctionTest.java (92%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/CheckMoveableFunctionTest.java (90%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/CheckPlayerWorldFunctionTest.java (88%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/ConsoleCmdFunctionTest.java (89%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/DelayFunctionTest.java (92%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/GetGameRuleFunctionTest.java (92%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/IsBedrockPlayerFunctionTest.java (86%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/LogFunctionTest.java (87%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/MoneyBalanceFunctionTest.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/MoneyDepositFunctionTest.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/MoneyWithdrawFunctionTest.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/NoPermissionFunctionTest.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/ParticleFunctionTest.java (87%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/function/PermissionFunctionTest.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/MockFactory.java (81%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/entity/package-info.java (91%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/entity/player/MockPlayer.java (97%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/entity/player/MockPlayerWrapper.java (97%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/inject/MockPluginModule.java (82%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/inventory/MockItemStack.java (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/inventory/MockItemStackWrapper.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/logger/MockLogger.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/logger/MockLoggerWrapper.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/manager/MockEntityManager.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/manager/MockInventoryManager.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/manager/MockItemStackManager.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/manager/MockLocationManager.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/manager/MockMaterialManager.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/plugin/MockDynamicGuiPlugin.java (97%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/plugin/MockEconomy.java (97%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/plugin/MockPermission.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/plugin/MockPlatform.java (98%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/plugin/MockScheduler.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/world/MockLocation.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/world/MockLocationWrapper.java (94%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/world/MockWorld.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/mock/world/MockWorldWrapper.java (95%) rename core/src/test/java/com/clubobsidian/dynamicgui/{ => core}/test/package-info.java (93%) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java index 00873cc46..07555c7c4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java similarity index 91% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java index 255e8df7b..f6523bede 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java similarity index 92% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java index 1f5f36784..1eb3db622 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java similarity index 90% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java index 3b1876fb5..2df8adcb2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java similarity index 88% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java index 3bdcee110..f6d6fb045 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCmdFunctionTest.java similarity index 89% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCmdFunctionTest.java index 7b2756c84..2cdf7a649 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ConsoleCmdFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCmdFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCmdFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java similarity index 92% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index a0c85e8f7..51198d0f7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java similarity index 92% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java index f5eb7314c..c16ecd5b2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import org.junit.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java similarity index 86% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java index 492902fa2..b74c25a82 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import java.util.UUID; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java similarity index 87% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java index 807910779..a7ff9a9db 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.logger.MockLogger; -import com.clubobsidian.dynamicgui.test.mock.logger.MockLoggerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLogger; +import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLoggerWrapper; import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java index a218a691c..b757f7bd9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyBalanceFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyBalanceFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; import org.junit.Test; import java.math.BigDecimal; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java index f3960d6f5..75eeedc92 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyDepositFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyDepositFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java index a2c4544db..bc965bfc6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/MoneyWithdrawFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyWithdrawFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; import org.junit.Test; import java.math.BigDecimal; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java index e6411fdad..9498d4c2c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/NoPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java similarity index 87% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java index 62e5e9c73..d533eac9f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/ParticleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java index ff2409d30..1b3000545 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/function/PermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.function; +package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; -import com.clubobsidian.dynamicgui.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.Test; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java similarity index 81% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 01d3380c1..74ca3cbc1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock; +package com.clubobsidian.dynamicgui.core.test.mock; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.economy.Economy; @@ -26,21 +26,21 @@ import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayer; -import com.clubobsidian.dynamicgui.test.mock.entity.player.MockPlayerWrapper; -import com.clubobsidian.dynamicgui.test.mock.inject.MockPluginModule; -import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStack; -import com.clubobsidian.dynamicgui.test.mock.inventory.MockItemStackWrapper; -import com.clubobsidian.dynamicgui.test.mock.logger.MockLogger; -import com.clubobsidian.dynamicgui.test.mock.logger.MockLoggerWrapper; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockDynamicGuiPlugin; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockEconomy; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockPlatform; -import com.clubobsidian.dynamicgui.test.mock.plugin.MockScheduler; -import com.clubobsidian.dynamicgui.test.mock.world.MockLocation; -import com.clubobsidian.dynamicgui.test.mock.world.MockLocationWrapper; -import com.clubobsidian.dynamicgui.test.mock.world.MockWorld; -import com.clubobsidian.dynamicgui.test.mock.world.MockWorldWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.inject.MockPluginModule; +import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockItemStack; +import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockItemStackWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLogger; +import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLoggerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockDynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockScheduler; +import com.clubobsidian.dynamicgui.core.test.mock.world.MockLocation; +import com.clubobsidian.dynamicgui.core.test.mock.world.MockLocationWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorld; +import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorldWrapper; import org.mockito.Mockito; import java.util.ArrayList; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java similarity index 91% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java index 3345b467b..fa2b065f6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.entity; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.test.mock.entity; \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java similarity index 97% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java index 9c1b108bb..9a2453470 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.entity.player; +package com.clubobsidian.dynamicgui.core.test.mock.entity.player; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java similarity index 97% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index 0fefba76a..cdea72eb2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.entity.player; +package com.clubobsidian.dynamicgui.core.test.mock.entity.player; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java similarity index 82% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java index 98f7adf75..e369eb5c9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.inject; +package com.clubobsidian.dynamicgui.core.test.mock.inject; import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; @@ -25,11 +25,11 @@ import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.test.mock.manager.MockEntityManager; -import com.clubobsidian.dynamicgui.test.mock.manager.MockInventoryManager; -import com.clubobsidian.dynamicgui.test.mock.manager.MockItemStackManager; -import com.clubobsidian.dynamicgui.test.mock.manager.MockLocationManager; -import com.clubobsidian.dynamicgui.test.mock.manager.MockMaterialManager; +import com.clubobsidian.dynamicgui.core.test.mock.manager.MockEntityManager; +import com.clubobsidian.dynamicgui.core.test.mock.manager.MockInventoryManager; +import com.clubobsidian.dynamicgui.core.test.mock.manager.MockItemStackManager; +import com.clubobsidian.dynamicgui.core.test.mock.manager.MockLocationManager; +import com.clubobsidian.dynamicgui.core.test.mock.manager.MockMaterialManager; public class MockPluginModule extends PluginModule { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStack.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index 6afaf80d8..8c3ec2f5a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.inventory; +package com.clubobsidian.dynamicgui.core.test.mock.inventory; public class MockItemStack { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 3292e0bab..c6cba3394 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.inventory; +package com.clubobsidian.dynamicgui.core.test.mock.inventory; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java index d1f516d99..948c77ca1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLogger.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.logger; +package com.clubobsidian.dynamicgui.core.test.mock.logger; import java.util.ArrayList; import java.util.List; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java index ffcdcda81..844354f0b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/logger/MockLoggerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.logger; +package com.clubobsidian.dynamicgui.core.test.mock.logger; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java index 2efe93f19..ae8ab311f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockEntityManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.manager; +package com.clubobsidian.dynamicgui.core.test.mock.manager; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java index cd555811f..4e2bfbc30 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockInventoryManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.manager; +package com.clubobsidian.dynamicgui.core.test.mock.manager; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java index e01f616d6..fe3463e86 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockItemStackManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.manager; +package com.clubobsidian.dynamicgui.core.test.mock.manager; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java index a9061c350..79171964d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockLocationManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.manager; +package com.clubobsidian.dynamicgui.core.test.mock.manager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java index b083860bb..9064fa3ee 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/manager/MockMaterialManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.manager; +package com.clubobsidian.dynamicgui.core.test.mock.manager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java similarity index 97% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index 1ce785a9d..9c9dfbc72 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.plugin; +package com.clubobsidian.dynamicgui.core.test.mock.plugin; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.permission.Permission; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java similarity index 97% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java index f84025b1e..98c7a4b3f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockEconomy.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.plugin; +package com.clubobsidian.dynamicgui.core.test.mock.plugin; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java index abd68d1fa..2fb5abfe7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPermission.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.plugin; +package com.clubobsidian.dynamicgui.core.test.mock.plugin; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.permission.Permission; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java similarity index 98% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 730a052fb..bc3adc77c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.plugin; +package com.clubobsidian.dynamicgui.core.test.mock.plugin; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockScheduler.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockScheduler.java index 669fae9bd..e85d36025 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/plugin/MockScheduler.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockScheduler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.plugin; +package com.clubobsidian.dynamicgui.core.test.mock.plugin; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java index e83357391..7dc244058 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocation.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.world; +package com.clubobsidian.dynamicgui.core.test.mock.world; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java similarity index 94% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java index 93a34afe8..cf3abf97c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockLocationWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.world; +package com.clubobsidian.dynamicgui.core.test.mock.world; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java index 1be3afedc..464a68782 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorld.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.world; +package com.clubobsidian.dynamicgui.core.test.mock.world; import java.util.HashMap; import java.util.Map; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java similarity index 95% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java index 3fc171251..34ec647e6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/mock/world/MockWorldWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test.mock.world; +package com.clubobsidian.dynamicgui.core.test.mock.world; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java index a67693dc4..d7ed98c2a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/test/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.test; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.test; \ No newline at end of file From a4126fbaa425dfd3c3f858bda3a6687eef11b809 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 23:28:08 -0800 Subject: [PATCH 046/261] Rename PlayerCmdFunction -> PlayerCommandFunction --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 4 ++-- .../{PlayerCmdFunction.java => PlayerCommandFunction.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{PlayerCmdFunction.java => PlayerCommandFunction.java} (93%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 7b2087b63..888a18b2b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -32,7 +32,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerCmdFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMsgFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgFunction; import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; @@ -286,7 +286,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new ResetTickFunction()); FunctionManager.get().addFunction(new ConsoleCmdFunction()); - FunctionManager.get().addFunction(new PlayerCmdFunction()); + FunctionManager.get().addFunction(new PlayerCommandFunction()); FunctionManager.get().addFunction(new SetCooldownFunction()); FunctionManager.get().addFunction(new IsOnCooldownFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCmdFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java index 0e6d579bf..a33423fd4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java @@ -19,14 +19,14 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; -public class PlayerCmdFunction extends Function { +public class PlayerCommandFunction extends Function { /** * */ private static final long serialVersionUID = 220426382325192292L; - public PlayerCmdFunction() { + public PlayerCommandFunction() { super("executep"); } From 0f59981c6cb6456cc4949d1286472967e768cb45 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 23:31:28 -0800 Subject: [PATCH 047/261] Create PlayerCommandFunction test --- .../function/PlayerCommandFunctionTest.java | 50 +++++++++++++++++++ .../mock/entity/player/MockPlayerWrapper.java | 4 ++ 2 files changed, 54 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java new file mode 100644 index 000000000..2c3951d03 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class PlayerCommandFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullDataTest() { + Function function = new PlayerCommandFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void validTest() { + String cmd = "test"; + String slashCmd = "/" + cmd; + Function function = new PlayerCommandFunction(); + function.setData(cmd); + MockPlayerWrapper player = this.factory.createPlayer(); + assertTrue(function.function(player)); + assertTrue(player.getOutgoingChat().size() == 1); + assertEquals(slashCmd, player.getOutgoingChat().get(0)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index cdea72eb2..2da2acb0a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -51,6 +51,10 @@ public void chat(String message) { this.getPlayer().chat(message); } + public List getOutgoingChat() { + return this.getPlayer().getOutgoingChat(); + } + @Override public void sendMessage(String message) { this.getPlayer().sendMessage(message); From a2dea2b22ede4fd67e7fdb7fad29cb693fe5fc89 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 23:32:11 -0800 Subject: [PATCH 048/261] Rename ConsoleCmdFunction to ConsoleCommandFunction --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 4 ++-- ...onsoleCmdFunction.java => ConsoleCommandFunction.java} | 4 ++-- ...dFunctionTest.java => ConsoleCommandFunctionTest.java} | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{ConsoleCmdFunction.java => ConsoleCommandFunction.java} (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/{ConsoleCmdFunctionTest.java => ConsoleCommandFunctionTest.java} (86%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 888a18b2b..38412ba24 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -22,7 +22,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCmdFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; @@ -285,7 +285,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new ResetFrameFunction()); FunctionManager.get().addFunction(new ResetTickFunction()); - FunctionManager.get().addFunction(new ConsoleCmdFunction()); + FunctionManager.get().addFunction(new ConsoleCommandFunction()); FunctionManager.get().addFunction(new PlayerCommandFunction()); FunctionManager.get().addFunction(new SetCooldownFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCmdFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCmdFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java index 5c2ee55aa..16755c86a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCmdFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java @@ -20,14 +20,14 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; -public class ConsoleCmdFunction extends Function { +public class ConsoleCommandFunction extends Function { /** * */ private static final long serialVersionUID = -4802600274176592465L; - public ConsoleCmdFunction() { + public ConsoleCommandFunction() { super("executec"); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCmdFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java similarity index 86% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCmdFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java index 2cdf7a649..c40356525 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCmdFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java @@ -17,7 +17,7 @@ package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; -import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCmdFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; import org.junit.Test; @@ -26,13 +26,13 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -public class ConsoleCmdFunctionTest { +public class ConsoleCommandFunctionTest { private final MockFactory factory = new MockFactory(); @Test public void nullTest() { - Function function = new ConsoleCmdFunction(); + Function function = new ConsoleCommandFunction(); assertFalse(function.function(this.factory.createPlayer())); } @@ -40,7 +40,7 @@ public void nullTest() { public void withDataTest() { String data = "test"; MockPlatform platform = this.factory.inject().getPlatform(); - Function function = new ConsoleCmdFunction(); + Function function = new ConsoleCommandFunction(); function.setData(data); assertTrue(function.function(this.factory.createPlayer())); assertEquals(data, platform.getDispatchedServerCommands().get(0)); From 874e89bf556ef98a374dead1fb890c8fc47e3e1b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 6 Feb 2022 23:57:08 -0800 Subject: [PATCH 049/261] Convert to junit 5 --- build.gradle | 9 +++- .../function/AddPermissionFunctionTest.java | 6 +-- .../CheckItemInTypeHandFunctionTest.java | 6 +-- .../test/function/CheckLevelFunctionTest.java | 6 +-- .../function/CheckMoveableFunctionTest.java | 6 +-- .../CheckPlayerWorldFunctionTest.java | 6 +-- .../function/ConsoleCommandFunctionTest.java | 8 ++-- .../core/test/function/DelayFunctionTest.java | 6 +-- .../function/GetGameRuleFunctionTest.java | 6 +-- .../function/IsBedrockPlayerFunctionTest.java | 4 +- .../core/test/function/LogFunctionTest.java | 8 ++-- .../function/MoneyBalanceFunctionTest.java | 6 +-- .../function/MoneyDepositFunctionTest.java | 6 +-- .../function/MoneyWithdrawFunctionTest.java | 6 +-- .../function/NoPermissionFunctionTest.java | 6 +-- .../test/function/ParticleFunctionTest.java | 6 +-- .../test/function/PermissionFunctionTest.java | 6 +-- .../function/PlayerCommandFunctionTest.java | 8 ++-- parser/build.gradle | 1 - .../parser/test/FunctionDataTest.java | 8 ++-- .../parser/test/FunctionModifierTest.java | 4 +- .../parser/test/FunctionTreeTest.java | 40 ++++++++--------- .../parser/test/FunctionTypeParserTest.java | 4 +- .../parser/test/FunctionTypeTest.java | 6 +-- .../dynamicgui/parser/test/GuiTokenTest.java | 32 +++++++------- .../dynamicgui/parser/test/SlotTokenTest.java | 24 +++++----- .../functiontree/EmptyFunctionTreeTest.java | 6 +-- .../dynamicgui/parser/test/gui/AliasTest.java | 6 +-- .../parser/test/gui/GuitMetadataTest.java | 4 +- .../parser/test/gui/InvalidTypeTest.java | 6 +-- .../parser/test/gui/LoadMacrosTest.java | 4 +- .../parser/test/gui/LocationTest.java | 6 +-- .../parser/test/gui/NoModeTest.java | 6 +-- .../parser/test/gui/ValidTypeTest.java | 6 +-- .../parser/test/macro/MacroNonStringTest.java | 4 +- .../parser/test/macro/MacroParserTest.java | 44 +++++++++---------- .../parser/test/macro/MacrosTokenTest.java | 20 ++++----- .../test/macro/MultiMacroSameFileTest.java | 4 +- .../parser/test/slot/EnchantTest.java | 6 +-- .../parser/test/slot/InvalidAmountTest.java | 6 +-- .../slot/InvalidFunctionTypeMacroTest.java | 6 +-- .../test/slot/InvalidSlotDataMacroTest.java | 6 +-- .../test/slot/InvalidUpdateIntervalTest.java | 8 ++-- .../parser/test/slot/ItemFlagTest.java | 6 +-- .../dynamicgui/parser/test/slot/LoreTest.java | 6 +-- .../parser/test/slot/ModelTest.java | 6 +-- .../parser/test/slot/MoveableTest.java | 6 +-- .../parser/test/slot/SlotIndexTest.java | 6 +-- .../parser/test/slot/SlotMetadataTest.java | 4 +- .../parser/test/slot/ValidAmountTest.java | 6 +-- .../test/slot/ValidFunctionTypeMacroTest.java | 6 +-- .../test/slot/ValidSlotDataMacroTest.java | 6 +-- .../test/slot/ValidUpdateIntervalTest.java | 6 +-- 53 files changed, 223 insertions(+), 217 deletions(-) diff --git a/build.gradle b/build.gradle index e20ae4da0..1482b319e 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,10 @@ subprojects { targetCompatibility = JavaVersion.VERSION_11 } + test { + useJUnitPlatform() + } + repositories { maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"} maven { url = "https://oss.sonatype.org/content/repositories/snapshots" } @@ -24,8 +28,11 @@ subprojects { maven { url 'https://jitpack.io' } } + def junitVersion = '5.8.2' + dependencies { - testImplementation 'junit:junit:4.13.2' + testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" testImplementation 'org.mockito:mockito-core:4.3.1' api 'org.apache.commons:commons-lang3:3.12.0' api 'com.github.clubobsidian:wrappy:2.3.2' diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java index 07555c7c4..0379176d7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class AddPermissionFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java index f6523bede..dcb5b1935 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java @@ -21,10 +21,10 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class CheckItemInTypeHandFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java index 1eb3db622..479272409 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class CheckLevelFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java index 2df8adcb2..1522668fd 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class CheckMoveableFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java index f6d6fb045..03cc5c84d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class CheckPlayerWorldFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java index c40356525..a9de5df19 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java @@ -20,11 +20,11 @@ import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ConsoleCommandFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index 51198d0f7..b44d0f858 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -19,10 +19,10 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class DelayFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java index c16ecd5b2..666b449a2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java @@ -21,10 +21,10 @@ import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class GetGameRuleFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java index b74c25a82..7b0221fa6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java @@ -20,11 +20,11 @@ import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.UUID; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class IsBedrockPlayerFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java index a7ff9a9db..4082e7b77 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java @@ -22,11 +22,11 @@ import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLogger; import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLoggerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class LogFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java index b757f7bd9..567253140 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java @@ -21,12 +21,12 @@ import com.clubobsidian.dynamicgui.core.function.impl.MoneyBalanceFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MoneyBalanceFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java index 75eeedc92..b1a8b0cba 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyDepositFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MoneyDepositFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java index bc965bfc6..6c2ba6278 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java @@ -21,12 +21,12 @@ import com.clubobsidian.dynamicgui.core.function.impl.MoneyWithdrawFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.math.BigDecimal; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MoneyWithdrawFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java index 9498d4c2c..1cb48c22f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class NoPermissionFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java index d533eac9f..f800c2f4d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ParticleFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java index 1b3000545..e06a0189d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java @@ -20,10 +20,10 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class PermissionFunctionTest { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java index 2c3951d03..df9ccdc1f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java @@ -20,11 +20,11 @@ import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class PlayerCommandFunctionTest { diff --git a/parser/build.gradle b/parser/build.gradle index 1fc6e3e33..0d6938d5d 100644 --- a/parser/build.gradle +++ b/parser/build.gradle @@ -3,6 +3,5 @@ plugins { } dependencies { - testImplementation 'junit:junit:4.12' api 'com.github.ClubObsidian:FuzzUtil:1.1.0' } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java index 5d55799bf..0227306d7 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java @@ -18,10 +18,10 @@ import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class FunctionDataTest { @@ -32,7 +32,7 @@ public class FunctionDataTest { private FunctionData data; - @Before + @BeforeEach public void setup() { this.data = new FunctionData(NAME, DATA, MODIFIER); } diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java index 9b1c70ac8..26dda61f0 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java @@ -17,9 +17,9 @@ package com.clubobsidian.dynamicgui.parser.test; import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class FunctionModifierTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java index 11290a9d4..695920f32 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java @@ -15,13 +15,13 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.List; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; @@ -36,7 +36,7 @@ public class FunctionTreeTest { private static FunctionTree tree; - @BeforeClass + @BeforeAll public static void loadTree() { File testFile = new File("test.yml"); System.out.println(testFile.getAbsolutePath()); @@ -49,7 +49,7 @@ public static void loadTree() { @Test public void testRootNodeSize() { int rootNodeSize = tree.getRootNodes().size(); - assertTrue("Root node size is not three", rootNodeSize == 3); + assertTrue(rootNodeSize == 3); } @Test @@ -57,7 +57,7 @@ public void testFunctionTypes() { FunctionNode node = tree.getRootNodes().get(0); FunctionToken token = node.getToken(); FunctionType type = token.getTypes().get(0); - assertTrue("Function type is not load", type == FunctionType.LOAD); + assertTrue(type == FunctionType.LOAD); } @Test @@ -66,16 +66,16 @@ public void testDescend() { int childrenNodeSize = childrenNodes.size(); FunctionToken token = childrenNodes.get(0).getToken(); FunctionData data = token.getFunctions().get(0); - assertTrue("Children node size for descend is not one", childrenNodeSize == 1); - assertTrue("Function is not function", data.getName().equals("function")); - assertTrue("Function data for child not is not 'with other data'", data.getData().equals("with other data")); + assertTrue(childrenNodeSize == 1); + assertTrue(data.getName().equals("function")); + assertTrue(data.getData().equals("with other data")); } @Test public void testDescendTwoFunctions() { List childrenNodes = tree.getRootNodes().get(1).getChildren(); int childrenNodeSize = childrenNodes.size(); - assertTrue("Children node size for descend is not two", childrenNodeSize == 2); + assertTrue(childrenNodeSize == 2); } @Test @@ -87,10 +87,10 @@ public void testDepthTwo() { String name = node.getToken().getName(); int depth = node.getDepth(); FunctionData data = token.getFunctions().get(0); - assertTrue("Depth is not two", depth == 2); - assertTrue("Children node size for depth two is not one", childrenNodeSize == 1); - assertTrue("Invalid data for depth-2-left node", data.getData().equals("some other data")); - assertTrue("Section name is not 'depth-2-left'", name.equals("depth-2-left")); + assertTrue(depth == 2); + assertTrue(childrenNodeSize == 1); + assertTrue(data.getData().equals("some other data")); + assertTrue(name.equals("depth-2-left")); } @Test @@ -99,7 +99,7 @@ public void testColonParsing() { FunctionToken token = node.getToken(); FunctionData data = token.getFunctions().get(1); String functionData = data.getData(); - assertTrue("Function data is not 'with:a colon'", functionData.equals("with:a colon")); + assertTrue(functionData.equals("with:a colon")); } @Test @@ -108,7 +108,7 @@ public void testTrimming() { FunctionToken token = node.getToken(); FunctionData data = token.getFunctions().get(2); String functionDataStr = data.getData(); - assertTrue("Function data is not 'test trimming'", functionDataStr.equals("test trimming")); + assertTrue(functionDataStr.equals("test trimming")); } @Test @@ -117,7 +117,7 @@ public void testNormalize() { FunctionToken token = node.getToken(); FunctionData data = token.getFunctions().get(1); String functionName = data.getName(); - assertTrue("Function normalization failed, function is not 'functiontonormalize'", functionName.equals("functiontonormalize")); + assertTrue(functionName.equals("functiontonormalize")); } @Test @@ -133,7 +133,7 @@ public void testFailFunctionsList() { FunctionData data = token.getFailOnFunctions().get(0); String functionName = data.getName(); - assertTrue("Function normalization failed, function is not 'onfailfunction'", functionName.equals("onfailfunction")); + assertTrue(functionName.equals("onfailfunction")); } @Test @@ -149,12 +149,12 @@ public void testFailFunctionsString() { FunctionData data = token.getFailOnFunctions().get(0); String functionName = data.getName(); - assertTrue("Function normalization failed, function is not 'onfailfunctionstring'", functionName.equals("onfailfunctionstring")); + assertTrue(functionName.equals("onfailfunctionstring")); } @Test public void testMacroTokens() { List tokens = tree.getMacroParser().getTokens(); - assertTrue("MacroToken's for functions should not be null", tokens != null); + assertTrue(tokens != null); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java index febed8974..318b16311 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java @@ -15,13 +15,13 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.FunctionTypeParser; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java index b560a0dcc..bfc1fef5a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java @@ -16,10 +16,10 @@ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.FunctionType; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java index 430942807..12f43e592 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java @@ -15,15 +15,15 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; @@ -39,7 +39,7 @@ public class GuiTokenTest { private static GuiToken token; - @BeforeClass + @BeforeAll public static void loadToken() { File file = new File("test.yml"); Configuration config = Configuration.load(file); @@ -49,41 +49,41 @@ public static void loadToken() { @Test public void testTitle() { String title = token.getTitle(); - assertTrue("Gui title is not 'test gui title'", title.equals("test gui title")); + assertTrue(title.equals("test gui title")); } @Test public void testRows() { int rows = token.getRows(); - assertTrue("Gui rows is not 1", rows == 1); + assertTrue(rows == 1); } @Test public void testMode() { GuiMode mode = token.getMode(); - assertTrue("Gui mode is not 'set'", mode == GuiMode.SET); + assertTrue(mode == GuiMode.SET); } @Test public void testClose() { boolean closed = token.isClosed(); - assertTrue("Gui close it not true", closed); + assertTrue(closed); } @Test public void testNpcs() { Map> npcs = token.getNpcs(); List npcIds = npcs.get("citizens"); - assertTrue("No npc ids were found for citizens", npcIds != null); - assertTrue("Npcs size is not 2", npcIds.size() == 2); - assertTrue("Npc at index 0 is not 5", npcIds.get(0) == 5); - assertTrue("Npc at index 1 is not 88", npcIds.get(1) == 77); + assertTrue(npcIds != null); + assertTrue(npcIds.size() == 2); + assertTrue(npcIds.get(0) == 5); + assertTrue(npcIds.get(1) == 77); } @Test public void testSlots() { Map slots = token.getSlots(); - assertTrue("Slots size is not 6", slots.size() == 6); + assertTrue(slots.size() == 6); } @Test @@ -92,13 +92,13 @@ public void testGuiFunctions() { FunctionNode node = tree.getRootNodes().get(0); FunctionData data = node.getToken().getFunctions().get(0); String functionName = data.getName(); - assertTrue("Function name is not function2", functionName.equals("function2")); + assertTrue(functionName.equals("function2")); } @Test public void testMacroToken() { MacroToken macroToken = token.getMacroParser().getTokens().get(0); - assertTrue("Macro token was not initialized", macroToken != null); + assertTrue(macroToken != null); } @Test @@ -117,6 +117,6 @@ public void testExternalMacroToken() { String title = token.getTitle(); - assertTrue("External gui test's title is not 'test gui title'", title.equals("test gui title")); + assertTrue(title.equals("test gui title")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java index a3acc1911..67884c0bd 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java @@ -15,13 +15,13 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; @@ -33,7 +33,7 @@ public class SlotTokenTest { private static SlotToken token; - @BeforeClass + @BeforeAll public static void loadSlotToken() { File file = new File("test.yml"); Configuration config = Configuration.load(file); @@ -44,19 +44,19 @@ public static void loadSlotToken() { @Test public void testSlotName() { String name = token.getName(); - assertTrue("Name was not test for slot token", name.equals("test")); + assertTrue(name.equals("test")); } @Test public void testSlotIcon() { String icon = token.getIcon(); - assertTrue("Icon was not dirt", icon.equals("DIRT")); + assertTrue(icon.equals("DIRT")); } @Test public void testSlotNbt() { String nbt = token.getNbt(); - assertTrue("Nbt was not '{SomeKey:\"some value\"}'", nbt.equals("{SomeKey:\"some value\"}")); + assertTrue(nbt.equals("{SomeKey:\"some value\"}")); } @Test @@ -68,13 +68,13 @@ public void testSlotGlow() { @Test public void testSlotClose() { boolean close = token.isClosed(); - assertTrue("Close not was true", close); + assertTrue(close); } @Test public void testSlotData() { byte data = token.getData(); - assertTrue("Data was not 1", data == 1); + assertTrue(data == 1); } @@ -82,12 +82,12 @@ public void testSlotData() { public void testSlotFunctionTree() { FunctionTree tree = token.getFunctionTree(); int nodeSize = tree.getRootNodes().size(); - assertTrue("Node were not parsed for the function tree", nodeSize == 1); + assertTrue(nodeSize == 1); } @Test public void testMacroToken() { MacroToken macroToken = token.getMacroParser().getTokens().get(0); - assertTrue("Macro token was not initialized", macroToken != null); + assertTrue(macroToken != null); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java index 1aa8d5fb0..4c6b1a8bc 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java @@ -16,9 +16,9 @@ package com.clubobsidian.dynamicgui.parser.test.functiontree; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; @@ -27,6 +27,6 @@ public class EmptyFunctionTreeTest { @Test public void testEmptyFunctionTree() { FunctionTree tree = new FunctionTree(); - assertTrue("Tree nodes are not empty", tree.getRootNodes().size() == 0); + assertTrue(tree.getRootNodes().size() == 0); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java index 5d947a769..52ee66437 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.wrappy.Configuration; @@ -34,6 +34,6 @@ public void testAlias() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String alias = token.getAlias().get(0); - assertTrue("Gui alias is not 'test'", alias.equals("test")); + assertTrue(alias.equals("test")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java index 3e2cae59e..260d92afd 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java @@ -16,12 +16,12 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java index 64c3e2e89..3aef66a14 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.wrappy.Configuration; @@ -34,6 +34,6 @@ public void testType() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String type = token.getType(); - assertTrue("Gui type is not 'CHEST'", type.equals("CHEST")); + assertTrue(type.equals("CHEST")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java index cd97dfd05..84dade54d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java @@ -16,12 +16,12 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.wrappy.Configuration; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java index 52ce6b5b4..f8d1430b6 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.wrappy.Configuration; @@ -34,7 +34,7 @@ public void testAlias() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String location = token.getLocations().get(0); - assertTrue("Location is not '0,0,0,world'", location.equals("0,0,0,world")); + assertTrue(location.equals("0,0,0,world")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java index 8dd636db2..476bb7411 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiMode; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; @@ -35,7 +35,7 @@ public void testAlias() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); GuiMode alias = token.getMode(); - assertTrue("Gui mode was null but is set by default", alias == GuiMode.SET); + assertTrue(alias == GuiMode.SET); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java index 53816d486..789616475 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.wrappy.Configuration; @@ -34,6 +34,6 @@ public void testType() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String type = token.getType(); - assertTrue("Gui type is not 'DISPENSER'", type.equals("DISPENSER")); + assertTrue(type.equals("DISPENSER")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java index d8c81c12b..4a57cee8d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java @@ -16,13 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.macro.MacroParser; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java index cd3080076..a148f9098 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java @@ -16,13 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.macro.MacroParser; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; @@ -52,15 +52,15 @@ public void testMultilineParsing() { System.out.println("newLore:" + newLore.toString()); - assertTrue("New lore size is not 8", newLore.size() == 8); - assertTrue("First line is not 'This is some gui text'", newLore.get(0).equals("This is some text")); - assertTrue("Second line is not 'Replace some text'", newLore.get(1).equals("Replace some text")); - assertTrue("Third line is not 'and some other text test'", newLore.get(2).equals("and some other text test")); - assertTrue("Forth line is not 'with some other text'", newLore.get(3).equals("with some other text")); - assertTrue("Fifth line is not 'Replace some text'", newLore.get(4).equals("Replace some text")); - assertTrue("Sixth line is not 'and some other text'", newLore.get(5).equals("and some other text")); - assertTrue("Seventh line is not 'with some other text'", newLore.get(6).equals("with some other text")); - assertTrue("Eigth line is not 'not-a-macro'", newLore.get(7).equals("not-a-macro")); + assertTrue(newLore.size() == 8); + assertTrue(newLore.get(0).equals("This is some text")); + assertTrue(newLore.get(1).equals("Replace some text")); + assertTrue(newLore.get(2).equals("and some other text test")); + assertTrue(newLore.get(3).equals("with some other text")); + assertTrue(newLore.get(4).equals("Replace some text")); + assertTrue(newLore.get(5).equals("and some other text")); + assertTrue(newLore.get(6).equals("with some other text")); + assertTrue(newLore.get(7).equals("not-a-macro")); } @Test @@ -84,9 +84,9 @@ public void testSmallMultiLine() { System.out.println(newLore.toString()); - assertTrue("Size of new lore is not 2", newLore.size() == 2); - assertTrue("First line is not 'Replace some text", newLore.get(0).equals("Replace some text")); - assertTrue("Second line is not 'test'", newLore.get(1).equals("test")); + assertTrue(newLore.size() == 2); + assertTrue(newLore.get(0).equals("Replace some text")); + assertTrue(newLore.get(1).equals("test")); } @Test @@ -110,7 +110,7 @@ public void testOutOfIndexSmallMultiLine() { System.out.println("New lore: " + newLore + " Size: " + newLore.size()); - assertTrue("First line is not 'Replace some text", newLore.get(0).equals("Replace some text")); + assertTrue(newLore.get(0).equals("Replace some text")); } @@ -133,7 +133,7 @@ public void testSingleLineParsing() { String newName = parser.parseStringMacros(name); - assertTrue("New name is not 'A name'", newName.equals("A name")); + assertTrue(newName.equals("A name")); } @Test @@ -160,11 +160,11 @@ public void testMacroChaining() { System.out.println("parsedLore: " + parsedLore.size()); - assertTrue("Lore length is not 5'", parsedLore.size() == 5); - assertTrue("First line of lore is not 'not-a-macro'", parsedLore.get(0).equals("not-a-macro")); - assertTrue("Second line of lore is not 'Replace some text'", parsedLore.get(1).equals("Replace some text")); - assertTrue("Third line of lore is not 'and some other text test'", parsedLore.get(2).equals("and some other text test")); - assertTrue("Forth line of lore is not 'with some other text'", parsedLore.get(3).equals("with some other text")); - assertTrue("Fifth line of lore is not 'still-not-a-macro'", parsedLore.get(4).equals("still-not-a-macro")); + assertTrue(parsedLore.size() == 5); + assertTrue(parsedLore.get(0).equals("not-a-macro")); + assertTrue(parsedLore.get(1).equals("Replace some text")); + assertTrue(parsedLore.get(2).equals("and some other text test")); + assertTrue(parsedLore.get(3).equals("with some other text")); + assertTrue(parsedLore.get(4).equals("still-not-a-macro")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java index 964d8aa9f..484d67b75 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java @@ -16,13 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; import com.clubobsidian.wrappy.Configuration; @@ -39,7 +39,7 @@ public void testGuiMacroToken() { MacroToken token = new MacroToken(section); Map macros = token.getMacros(); - assertTrue("Macros did not load in for gui macros, size is not 2", macros.size() == 2); + assertTrue(macros.size() == 2); } @Test @@ -57,16 +57,16 @@ public void testSlotMacroToken() { Map macros = token.getMacros(); Object firstMacro = macros.get("%test%"); - assertTrue("First line of slot macro is not a string", firstMacro instanceof String); - assertTrue("First macro is not 'This is some text'", firstMacro.equals("This is some text")); + assertTrue(firstMacro instanceof String); + assertTrue(firstMacro.equals("This is some text")); Object secondMacro = macros.get("%multiline-test%"); - assertTrue("Second line of slot macro is not a list", secondMacro instanceof List); + assertTrue(secondMacro instanceof List); List listMacro = ((List) secondMacro); - assertTrue("Second line of slot macro's first line is not a string", listMacro.get(0) instanceof String); - assertTrue("Second line of slot macro's size is not 3", listMacro.size() == 3); + assertTrue(listMacro.get(0) instanceof String); + assertTrue(listMacro.size() == 3); } @@ -81,7 +81,7 @@ public void testEmptyMacroToken() { MacroToken token = new MacroToken(section); Map macros = token.getMacros(); - assertTrue("Macros is null on an empty slot, it should just be empty", macros != null); - assertTrue("Macros is not empty when it should be empty", macros.size() == 0); + assertTrue(macros != null); + assertTrue(macros.size() == 0); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java index 96e1c648a..b489ecda7 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java @@ -16,13 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.macro.MacroParser; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java index b68b34eaf..a65a30827 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java @@ -16,12 +16,12 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -37,6 +37,6 @@ public void enchantTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); List enchants = token.getEnchants(); - assertTrue("Slot enchants size is not 3", enchants.size() == 3); + assertTrue(enchants.size() == 3); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java index 8e9fb7f02..fd32669ae 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -36,6 +36,6 @@ public void amountTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int amount = token.getAmount(); - assertTrue("Amount is not 1", amount == 1); + assertTrue(amount == 1); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java index ac8f08ba2..c498ba040 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; @@ -40,6 +40,6 @@ public void invalidFunctionTypeTest() { SlotToken token = new SlotToken(0, section); FunctionTree tree = token.getFunctionTree(); FunctionToken functionToken = tree.getRootNodes().get(0).getToken(); - assertTrue("Function node parsed incorrect function type", functionToken.getTypes().size() == 1); + assertTrue(functionToken.getTypes().size() == 1); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java index e31e66afe..bed4165a6 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -37,6 +37,6 @@ public void testInvalidSlotData() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); byte data = token.getData(); - assertTrue("Slot data was not parsed correctly, data is not 0", data == 0); + assertTrue( data == 0); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java index 2266ef463..dea9c4c23 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -36,7 +36,7 @@ public void lessThanZeroupdateIntervalTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int interval = token.getUpdateInterval(); - assertTrue("Update interval is not 0", interval == 0); + assertTrue(interval == 0); } @Test @@ -47,6 +47,6 @@ public void invalidIntervalTest() { ConfigurationSection section = config.getConfigurationSection("1"); SlotToken token = new SlotToken(1, section); int interval = token.getUpdateInterval(); - assertTrue("Update interval was not invalid", interval == 0); + assertTrue(interval == 0); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java index cdd8a6f7d..591babd54 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java @@ -19,12 +19,12 @@ import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.List; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ItemFlagTest { @@ -36,6 +36,6 @@ public void enchantTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); List enchants = token.getItemFlags(); - assertTrue("Slot item-flags size is not 2", enchants.size() == 2); + assertTrue(enchants.size() == 2); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java index a75d7cbeb..bb56da7b8 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java @@ -16,12 +16,12 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -37,6 +37,6 @@ public void loreTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); List lore = token.getLore(); - assertTrue("Slot lore size is not 2", lore.size() == 2); + assertTrue(lore.size() == 2); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java index 85860d29c..afc50cf60 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java @@ -19,12 +19,12 @@ import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.File; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class ModelTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java index 2b6d923bf..562e927ac 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java @@ -16,12 +16,12 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java index 112ee8f8f..b2ba9aa0b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -35,6 +35,6 @@ public void testSlotIndex() { Configuration config = Configuration.load(file); ConfigurationSection section = config.getConfigurationSection("13"); SlotToken token = new SlotToken(13, section); - assertTrue("Slot index is not 13", token.getIndex() == 13); + assertTrue(token.getIndex() == 13); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java index c84784434..07ff40e8a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java @@ -16,12 +16,12 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java index d3d166e82..b7fb60e6c 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -36,6 +36,6 @@ public void amountTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int amount = token.getAmount(); - assertTrue("Amount is not 32", amount == 32); + assertTrue(amount == 32); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java index c9f3e08ca..dfb0878ed 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.FunctionType; @@ -41,6 +41,6 @@ public void validFunctionTypeMacroTest() { SlotToken token = new SlotToken(0, section); FunctionTree tree = token.getFunctionTree(); FunctionToken functionToken = tree.getRootNodes().get(0).getToken(); - assertTrue("Function node parsed incorrect function type", functionToken.getTypes().get(0) == FunctionType.RIGHT); + assertTrue(functionToken.getTypes().get(0) == FunctionType.RIGHT); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java index a50c80fff..f8d5e1379 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -37,6 +37,6 @@ public void validSlotDataMacroTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); byte data = token.getData(); - assertTrue("Slot data was not parsed correctly, data is not 1", data == 1); + assertTrue(data == 1); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java index c58f4b57d..39911388c 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java @@ -16,11 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import org.junit.Test; +import org.junit.jupiter.api.Test; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; @@ -36,6 +36,6 @@ public void updateIntervalTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int interval = token.getUpdateInterval(); - assertTrue("Update interval is not 5", interval == 5); + assertTrue(interval == 5); } } \ No newline at end of file From 0a0599ff1fddd5f0eb8ec4cc03ee6a07fde306b0 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 7 Feb 2022 19:49:26 -0800 Subject: [PATCH 050/261] Rename PlayerMiniMsgFunction -> PlayerMiniMessageFunction --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 4 ++-- ...rMiniMsgFunction.java => PlayerMiniMessageFunction.java} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{PlayerMiniMsgFunction.java => PlayerMiniMessageFunction.java} (90%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 38412ba24..b482413c9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -33,7 +33,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMsgFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgFunction; import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; @@ -336,7 +336,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new CheckPlayerWorldFunction()); - FunctionManager.get().addFunction(new PlayerMiniMsgFunction()); + FunctionManager.get().addFunction(new PlayerMiniMessageFunction()); FunctionManager.get().addFunction(new ServerMiniBroadcastFunction()); FunctionManager.get().addFunction(new HasMetadataFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMsgFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java index c31631c25..45eb848e9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java @@ -20,15 +20,15 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; -public class PlayerMiniMsgFunction extends Function { +public class PlayerMiniMessageFunction extends Function { /** * */ private static final long serialVersionUID = 9216295481570082778L; - public PlayerMiniMsgFunction() { - super("minimsg"); + public PlayerMiniMessageFunction() { + super("minimsg", "minimessage"); } @Override From 52985149e38d64c5a10857873cfff160d65ed234 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 7 Feb 2022 19:50:56 -0800 Subject: [PATCH 051/261] Rename PlayerMsgFunction -> PlayerMessageFunction --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 4 ++-- .../{PlayerMsgFunction.java => PlayerMessageFunction.java} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{PlayerMsgFunction.java => PlayerMessageFunction.java} (90%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index b482413c9..6022f34b5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -34,7 +34,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.RemoveSlotFunction; @@ -308,7 +308,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new PermissionFunction()); FunctionManager.get().addFunction(new AddPermissionFunction()); FunctionManager.get().addFunction(new RemovePermissionFunction()); - FunctionManager.get().addFunction(new PlayerMsgFunction()); + FunctionManager.get().addFunction(new PlayerMessageFunction()); FunctionManager.get().addFunction(new RandomFunction()); FunctionManager.get().addFunction(new SendFunction()); FunctionManager.get().addFunction(new ServerBroadcastFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java index 1f5c37db8..42acd5c83 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java @@ -20,15 +20,15 @@ import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; import com.clubobsidian.dynamicgui.core.util.ChatColor; -public class PlayerMsgFunction extends Function { +public class PlayerMessageFunction extends Function { /** * */ private static final long serialVersionUID = 6244543904061733902L; - public PlayerMsgFunction() { - super("msg", "pmsg"); + public PlayerMessageFunction() { + super("msg", "pmsg", "message", "playermessage"); } @Override From 8e558776ad272689e4d4b575344bdbaadc7a1afc Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 8 Feb 2022 21:05:07 -0800 Subject: [PATCH 052/261] Create player message function test --- .../function/PlayerMessageFunctionTest.java | 51 +++++++++++++++++++ .../mock/entity/player/MockPlayerWrapper.java | 4 ++ 2 files changed, 55 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java new file mode 100644 index 000000000..7f80a8291 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class PlayerMessageFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new PlayerMessageFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void withDataTest() { + String data = "test"; + MockPlayerWrapper playerWrapper = this.factory.createPlayer(); + Function function = new PlayerMessageFunction(); + function.setData(data); + assertTrue(function.function(playerWrapper)); + assertEquals(1, playerWrapper.getIncomingChat().size()); + assertEquals(data, playerWrapper.getIncomingChat().get(0)); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index 2da2acb0a..d6d880fa5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -55,6 +55,10 @@ public List getOutgoingChat() { return this.getPlayer().getOutgoingChat(); } + public List getIncomingChat() { + return this.getPlayer().getIncomingChat(); + } + @Override public void sendMessage(String message) { this.getPlayer().sendMessage(message); From a367a8b65674c63f2f92e7888356354d1f45cc4a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 9 Feb 2022 20:54:47 -0800 Subject: [PATCH 053/261] Create mini message function test --- .../function/PlayerMessageFunctionTest.java | 3 -- .../PlayerMiniMessageFunctionTest.java | 50 +++++++++++++++++++ .../mock/entity/player/MockPlayerWrapper.java | 5 ++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java index 7f80a8291..ef5ab9a45 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java @@ -15,12 +15,9 @@ */ package com.clubobsidian.dynamicgui.core.test.function; - -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.jupiter.api.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java new file mode 100644 index 000000000..e4a43f1e7 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class PlayerMiniMessageFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new PlayerMiniMessageFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataTest() { + this.factory.inject(); + String data = "test"; + Function function = new PlayerMiniMessageFunction(); + function.setData(data); + MockPlayerWrapper player = this.factory.createPlayer(); + assertTrue(function.function(player)); + assertEquals(1, player.getIncomingChat().size()); + assertEquals("{\"text\":\"test\"}", player.getIncomingChat().get(0)); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index d6d880fa5..61fb4cf80 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -64,6 +64,11 @@ public void sendMessage(String message) { this.getPlayer().sendMessage(message); } + @Override + public void sendJsonMessage(String message) { + this.sendMessage(message); + } + @Override public boolean hasPermission(String permission) { return this.getPlayer().hasPermission(permission); From d93a00e4173bc243f2f8246629a488b85d5e68b3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 9 Feb 2022 23:07:21 -0800 Subject: [PATCH 054/261] Register player json message function --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 3 +++ .../dynamicgui/core/function/impl/PlayerMsgJsonFunction.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 6022f34b5..e7474419b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -35,6 +35,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgJsonFunction; import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.RemoveSlotFunction; @@ -339,6 +340,8 @@ private void loadFunctions() { FunctionManager.get().addFunction(new PlayerMiniMessageFunction()); FunctionManager.get().addFunction(new ServerMiniBroadcastFunction()); + FunctionManager.get().addFunction(new PlayerMsgJsonFunction()); + FunctionManager.get().addFunction(new HasMetadataFunction()); FunctionManager.get().addFunction(new SetMetadataFunction()); FunctionManager.get().addFunction(new IsGuiMetadataSet()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java index 7b89f196c..667180544 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java @@ -25,8 +25,8 @@ public class PlayerMsgJsonFunction extends Function { */ private static final long serialVersionUID = -1691264533250689175L; - public PlayerMsgJsonFunction(String name) { - super(name); + public PlayerMsgJsonFunction() { + super("msgjson", "pmsgjson", "messagejson", "playermessagejson"); } @Override From 350ae9076690203f1c77fc387cb331f50a4f8039 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 9 Feb 2022 23:12:13 -0800 Subject: [PATCH 055/261] Test player json message function --- .../function/PlayerMsgJsonFunctionTest.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java new file mode 100644 index 000000000..4a283c728 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgJsonFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class PlayerMsgJsonFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new PlayerMsgJsonFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataTest() { + String data = "{\"text\":\"test\"}"; + Function function = new PlayerMsgJsonFunction(); + function.setData(data); + MockPlayerWrapper player = this.factory.createPlayer(); + assertTrue(function.function(player)); + assertEquals(1, player.getIncomingChat().size()); + assertEquals(data, player.getIncomingChat().get(0)); + } +} From f4bc93fb042cfc144bcb9b0e3d0b068f4474034f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 9 Feb 2022 23:16:45 -0800 Subject: [PATCH 056/261] Create test for random function --- .../test/function/RandomFunctionTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java new file mode 100644 index 000000000..332b12e00 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class RandomFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new RandomFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void incorrectLengthTest() { + Function function = new RandomFunction(); + function.setData("1-1-1"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void correctLengthTest() { + Function function = new RandomFunction(); + function.setData("1-1"); + assertTrue(function.function(this.factory.createPlayer())); + } +} \ No newline at end of file From ab1fe43924a57ed1f57eeb42181824c58d3f8409 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 9 Feb 2022 23:20:48 -0800 Subject: [PATCH 057/261] Add remove permission test --- .../RemovePermissionFunctionTest.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java new file mode 100644 index 000000000..fd62b4847 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class RemovePermissionFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new RemovePermissionFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void permissionNotRemovedTest() { + String permission = "data"; + Function function = new RemovePermissionFunction(); + function.setData(permission); + MockPlayerWrapper player = this.factory.createPlayer(); + assertFalse(function.function(player)); + } + + @Test + public void permissionRemoveTest() { + String permission = "data"; + Function function = new RemovePermissionFunction(); + function.setData(permission); + MockPlayerWrapper player = this.factory.createPlayer(); + player.addPermission(permission); + assertTrue(function.function(player)); + } +} \ No newline at end of file From 87bc0e724f3d7644439ff51dc038c75d653afce5 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 9 Feb 2022 23:51:23 -0800 Subject: [PATCH 058/261] Don't allow setting function owner multiple times --- .../clubobsidian/dynamicgui/core/function/Function.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 6ef46e824..311d1761c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -87,8 +87,12 @@ public void setData(String data) { this.data = data; } - public void setOwner(FunctionOwner slot) { - this.owner = slot; + public boolean setOwner(FunctionOwner owner) { + if(this.owner != null) { + return false; + } + this.owner = owner; + return true; } public FunctionOwner getOwner() { From b877d77c2c3b291b1460f3174340d1d17cf83d52 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 10 Feb 2022 00:07:13 -0800 Subject: [PATCH 059/261] Update spelling of movable from "moveable" to movable --- .../clubobsidian/dynamicgui/core/DynamicGui.java | 8 ++++---- .../dynamicgui/core/builder/SlotBuilder.java | 8 ++++---- ...ableFunction.java => CheckMovableFunction.java} | 8 ++++---- ...veableFunction.java => SetMovableFunction.java} | 8 ++++---- .../com/clubobsidian/dynamicgui/core/gui/Slot.java | 14 +++++++------- .../core/listener/InventoryInteractListener.java | 8 ++++---- .../core/manager/dynamicgui/GuiManager.java | 4 ++-- ...tionTest.java => CheckMovableFunctionTest.java} | 10 +++++----- .../dynamicgui/parser/slot/SlotToken.java | 8 ++++---- .../slot/{MoveableTest.java => MovableTest.java} | 14 +++++++------- parser/test/slot/movable.yml | 4 ++++ parser/test/slot/moveable.yml | 4 ---- 12 files changed, 49 insertions(+), 49 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{CheckMoveableFunction.java => CheckMovableFunction.java} (89%) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{SetMoveableFunction.java => SetMovableFunction.java} (91%) rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/{CheckMoveableFunctionTest.java => CheckMovableFunctionTest.java} (86%) rename parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/{MoveableTest.java => MovableTest.java} (82%) create mode 100644 parser/test/slot/movable.yml delete mode 100644 parser/test/slot/moveable.yml diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index e7474419b..81d7c2c22 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -20,7 +20,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; -import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; +import com.clubobsidian.dynamicgui.core.function.impl.CheckMovableFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; @@ -51,7 +51,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetGlowFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetLoreFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetMoveableFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetMovableFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetNBTFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetNameFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetTypeFunction; @@ -322,8 +322,8 @@ private void loadFunctions() { FunctionManager.get().addFunction(new SetAmountFunction()); FunctionManager.get().addFunction(new SetNBTFunction()); FunctionManager.get().addFunction(new SetGlowFunction()); - FunctionManager.get().addFunction(new CheckMoveableFunction()); - FunctionManager.get().addFunction(new SetMoveableFunction()); + FunctionManager.get().addFunction(new CheckMovableFunction()); + FunctionManager.get().addFunction(new SetMovableFunction()); FunctionManager.get().addFunction(new SetEnchantsFunction()); FunctionManager.get().addFunction(new SetCloseFunction()); FunctionManager.get().addFunction(new RemoveSlotFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java index 694a1eea9..869e550dd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java @@ -36,7 +36,7 @@ public class SlotBuilder { private String nbt; private short data; private boolean glow; - private boolean moveable; + private boolean movable; private Boolean close; private List lore; private final List enchants; @@ -98,8 +98,8 @@ public SlotBuilder setModelData(String modelData) { return this; } - public SlotBuilder setMoveable(boolean moveable) { - this.moveable = moveable; + public SlotBuilder setMovable(boolean movable) { + this.movable = movable; return this; } @@ -219,7 +219,7 @@ public SlotBuilder fromItemStackWrapper(ItemStackWrapper itemStackWrapper) { public Slot build() { return new Slot(this.index, this.amount, this.icon, this.name, - this.nbt, this.data, this.glow, this.moveable, + this.nbt, this.data, this.glow, this.movable, this.close, this.lore, this.enchants, this.itemFlags, this.modelProvider, this.modelData, this.functionTree, this.updateInterval, this.metadata); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMoveableFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java index 83044d0d1..221bc728d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java @@ -21,15 +21,15 @@ import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; import com.clubobsidian.dynamicgui.core.gui.Slot; -public class CheckMoveableFunction extends Function { +public class CheckMovableFunction extends Function { /** * */ private static final long serialVersionUID = 1037806025228025407L; - public CheckMoveableFunction() { - super("checkmoveable"); + public CheckMovableFunction() { + super("checkmovable"); } @Override @@ -45,6 +45,6 @@ public boolean function(PlayerWrapper playerWrapper) { Slot slot = (Slot) owner; Boolean value = Boolean.valueOf(this.getData()); - return value.equals(slot.isMoveable()); + return value.equals(slot.isMovable()); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMoveableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java similarity index 91% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMoveableFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java index 649edff8e..e0c9320a4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMoveableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java @@ -22,15 +22,15 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -public class SetMoveableFunction extends Function { +public class SetMovableFunction extends Function { /** * */ private static final long serialVersionUID = 453447798953153174L; - public SetMoveableFunction() { - super("setmoveable"); + public SetMovableFunction() { + super("setmovable"); } @Override @@ -47,7 +47,7 @@ public boolean function(PlayerWrapper playerWrapper) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); if(gui != null) { - slot.setMoveable(value); + slot.setMovable(value); return true; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 3cb941dfd..9614007e0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -47,7 +47,7 @@ public class Slot implements Serializable, FunctionOwner, AnimationHolder, Metad private final String nbt; private final short data; private final boolean glow; - private boolean moveable; + private boolean movable; private final List lore; private final List enchants; @@ -66,7 +66,7 @@ public class Slot implements Serializable, FunctionOwner, AnimationHolder, Metad private boolean update; public Slot(int index, int amount, String icon, String name, String nbt, short data, boolean glow, - boolean moveable, Boolean close, List lore, + boolean movable, Boolean close, List lore, List enchants, List itemFlags, String modelProvider, String modelData, FunctionTree functions, int updateInterval, Map metadata) { @@ -75,7 +75,7 @@ public Slot(int index, int amount, String icon, String name, String nbt, short d this.name = name; this.nbt = nbt; this.glow = glow; - this.moveable = moveable; + this.movable = movable; this.lore = lore; this.enchants = enchants; this.itemFlags = itemFlags; @@ -120,12 +120,12 @@ public boolean getGlow() { return this.glow; } - public boolean isMoveable() { - return this.moveable; + public boolean isMovable() { + return this.movable; } - public void setMoveable(boolean moveable) { - this.moveable = moveable; + public void setMovable(boolean movable) { + this.movable = movable; } public short getData() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 23777ae92..2160427a7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -74,7 +74,7 @@ public void invClick(final InventoryClickEvent e) { FunctionManager.get().tryFunctions(slot, FunctionType.valueOf(clickString), player); } - if(!slot.isMoveable()) { + if(!slot.isMovable()) { e.setCancelled(true); } @@ -110,7 +110,7 @@ public void onDrag(InventoryDragEvent e) { } Slot slot = this.getSlotFromIndex(gui, rawSlot); - if(slot == null || (slot != null && !slot.isMoveable())) { + if(slot == null || (slot != null && !slot.isMovable())) { e.setCancelled(true); return; } @@ -135,9 +135,9 @@ private boolean canStack(Gui gui, InventoryWrapper inventory, ItemStackWrappe if(stackTo.getItemStack() == null || (stackTo.isSimilar(clickedItem) && validSize(clickedItem, stackTo))) { Slot slot = this.getSlotFromIndex(gui, i); if(slot != null) { - if(slot.isMoveable()) { + if(slot.isMovable()) { canStack = true; - } else if(canStack && !slot.isMoveable()) { + } else if(canStack && !slot.isMovable()) { canStack = false; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 23621bd2a..01882533a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -449,7 +449,7 @@ private List createSlots(GuiToken guiToken) { short data = slotToken.getData(); boolean glow = slotToken.getGlow(); - boolean moveable = slotToken.isMoveable(); + boolean movable = slotToken.isMovable(); String modelProvider = slotToken.getModelProvider(); String modelData = slotToken.getModelData(); @@ -458,7 +458,7 @@ private List createSlots(GuiToken guiToken) { Map metadata = slotToken.getMetadata(); - slots.add(new Slot(index, amount, icon, name, nbt, data, glow, moveable, + slots.add(new Slot(index, amount, icon, name, nbt, data, glow, movable, close, lore, enchants, itemFlags, modelProvider, modelData, slotToken.getFunctionTree(), updateInterval, metadata)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java similarity index 86% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java index 1522668fd..be18998e0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMoveableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java @@ -17,7 +17,7 @@ package com.clubobsidian.dynamicgui.core.test.function; import com.clubobsidian.dynamicgui.core.function.Function; -import com.clubobsidian.dynamicgui.core.function.impl.CheckMoveableFunction; +import com.clubobsidian.dynamicgui.core.function.impl.CheckMovableFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.jupiter.api.Test; @@ -25,20 +25,20 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CheckMoveableFunctionTest { +public class CheckMovableFunctionTest { private final MockFactory factory = new MockFactory(); @Test public void nullTest() { - Function function = new CheckMoveableFunction(); + Function function = new CheckMovableFunction(); MockPlayerWrapper wrapper = this.factory.createPlayer(); assertFalse(function.function(wrapper)); } @Test public void ownerNotSlotTest() { - Function function = new CheckMoveableFunction(); + Function function = new CheckMovableFunction(); function.setData("true"); function.setOwner(this.factory.createGui("test")); MockPlayerWrapper wrapper = this.factory.createPlayer(); @@ -47,7 +47,7 @@ public void ownerNotSlotTest() { @Test public void isMovableTest() { - Function function = new CheckMoveableFunction(); + Function function = new CheckMovableFunction(); function.setData("true"); function.setOwner(this.factory.createSlot("STONE", true)); MockPlayerWrapper wrapper = this.factory.createPlayer(); diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index 94e733933..2c06974a8 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -39,7 +39,7 @@ public class SlotToken implements Serializable { private final String name; private final String nbt; private final boolean glow; - private final boolean moveable; + private final boolean movable; private final boolean closed; private final byte data; private final List lore; @@ -69,7 +69,7 @@ public SlotToken(int index, ConfigurationSection section, List macro this.name = this.macroParser.parseStringMacros(section.getString("name")); this.nbt = this.macroParser.parseStringMacros(section.getString("nbt")); this.glow = this.parseBoolean(section.getString("glow")); - this.moveable = this.parseBoolean(section.getString("moveable")); + this.movable = this.parseBoolean(section.getString("movable")); this.closed = this.parseBoolean(section.getString("close")); this.data = this.parseByte(section.getString("data")); this.lore = this.macroParser.parseListMacros(section.getStringList("lore")); @@ -171,8 +171,8 @@ public boolean getGlow() { return this.glow; } - public boolean isMoveable() { - return this.moveable; + public boolean isMovable() { + return this.movable; } public boolean isClosed() { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java similarity index 82% rename from parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java rename to parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java index 562e927ac..1e84d8864 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MoveableTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java @@ -27,25 +27,25 @@ import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; -public class MoveableTest { +public class MovableTest { @Test - public void testSlotMoveable() { + public void testSlotMovable() { File slotFolder = new File("test", "slot"); - File metadataFile = new File(slotFolder, "moveable.yml"); + File metadataFile = new File(slotFolder, "movable.yml"); Configuration config = Configuration.load(metadataFile); ConfigurationSection slot = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, slot); - assertTrue(token.isMoveable()); + assertTrue(token.isMovable()); } @Test - public void testSlotNotMoveable() { + public void testSlotNotMovable() { File slotFolder = new File("test", "slot"); - File metadataFile = new File(slotFolder, "moveable.yml"); + File metadataFile = new File(slotFolder, "movable.yml"); Configuration config = Configuration.load(metadataFile); ConfigurationSection slot = config.getConfigurationSection("1"); SlotToken token = new SlotToken(1, slot); - assertFalse(token.isMoveable()); + assertFalse(token.isMovable()); } } \ No newline at end of file diff --git a/parser/test/slot/movable.yml b/parser/test/slot/movable.yml new file mode 100644 index 000000000..ade9d7349 --- /dev/null +++ b/parser/test/slot/movable.yml @@ -0,0 +1,4 @@ +'0': + movable: true +'1': + movable: false \ No newline at end of file diff --git a/parser/test/slot/moveable.yml b/parser/test/slot/moveable.yml deleted file mode 100644 index f84f85c70..000000000 --- a/parser/test/slot/moveable.yml +++ /dev/null @@ -1,4 +0,0 @@ -'0': - moveable: true -'1': - moveable: false \ No newline at end of file From a15c788f96d4b5b06c24679f1ce392611ae266e9 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 11 Feb 2022 20:42:56 -0800 Subject: [PATCH 060/261] Start testing remove from slot function --- .../test/function/RemoveSlotFunctionTest.java | 57 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 14 ++++- 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java new file mode 100644 index 000000000..89b4530ac --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java @@ -0,0 +1,57 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.RemoveSlotFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +public class RemoveSlotFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void randomDataTest() { + Function function = new RemoveSlotFunction(); + function.setData(UUID.randomUUID().toString()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void noDataTest() { + Slot slot = this.factory.createSlot(0, "STONE", false); + List slots = new ArrayList<>(); + Gui gui = this.factory.createGui("test", slots); + slot.setOwner(gui); + Function function = new RemoveSlotFunction(); + function.setOwner(slot); + } + + @Test + public void thisDataTest() { + Slot slot = this.factory.createSlot(0, "STONE", false); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 74ca3cbc1..1c444d7a1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -45,6 +45,7 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.UUID; public class MockFactory { @@ -75,6 +76,10 @@ public MockItemStackWrapper createItemStack(String type) { } public Gui createGui(String title) { + return this.createGui(title, new ArrayList<>()); + } + + public Gui createGui(String title, List slots) { return new Gui(title, InventoryType.CHEST.toString(), title, @@ -82,18 +87,23 @@ public Gui createGui(String title) { true, ModeEnum.SET, new HashMap<>(), - new ArrayList<>(), + slots, new ArrayList<>(), new FunctionTree(), new HashMap<>()); } + public Slot createSlot(String type) { return this.createSlot(type, false); } public Slot createSlot(String type, boolean movable) { - return new Slot(0, + return this.createSlot(0, type, movable); + } + + public Slot createSlot(int index, String type, boolean movable) { + return new Slot(index, 1, type, "test", From 5e658d729a339ecf5c7716ef5a3426d39cf724cd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 17:40:03 -0800 Subject: [PATCH 061/261] Finish remove slot test --- .../dynamicgui/core/gui/Slot.java | 1 + .../test/function/RemoveSlotFunctionTest.java | 22 ++++++- .../core/test/mock/MockFactory.java | 5 ++ .../test/mock/inventory/MockInventory.java | 66 +++++++++++++++++++ .../mock/inventory/MockInventoryWrapper.java | 58 ++++++++++++++++ .../test/mock/inventory/MockItemStack.java | 10 +++ .../mock/manager/MockInventoryManager.java | 8 ++- .../mock/manager/MockItemStackManager.java | 10 ++- 8 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 9614007e0..05118b9f1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -40,6 +40,7 @@ public class Slot implements Serializable, FunctionOwner, AnimationHolder, Metad private static final long serialVersionUID = 2366997214615469494L; public final static String IGNORE_MATERIAL = "AIR"; + public static final String TEST_MATERIAL = "STONE"; private int index; private final String icon; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java index 89b4530ac..a7233f8db 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java @@ -21,6 +21,7 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -28,6 +29,7 @@ import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class RemoveSlotFunctionTest { @@ -42,16 +44,32 @@ public void randomDataTest() { @Test public void noDataTest() { - Slot slot = this.factory.createSlot(0, "STONE", false); + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(0, Slot.TEST_MATERIAL, false); + slot.buildItemStack(player); List slots = new ArrayList<>(); Gui gui = this.factory.createGui("test", slots); + gui.buildInventory(player); slot.setOwner(gui); Function function = new RemoveSlotFunction(); function.setOwner(slot); + assertTrue(function.function(player)); } @Test public void thisDataTest() { - Slot slot = this.factory.createSlot(0, "STONE", false); + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(0, Slot.TEST_MATERIAL, false); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + Gui gui = this.factory.createGui("test", slots); + gui.buildInventory(player); + slot.setOwner(gui); + Function function = new RemoveSlotFunction(); + function.setData("this"); + function.setOwner(slot); + assertTrue(function.function(player)); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 1c444d7a1..4168b6762 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -22,6 +22,7 @@ import com.clubobsidian.dynamicgui.core.gui.InventoryType; import com.clubobsidian.dynamicgui.core.gui.ModeEnum; import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; @@ -72,6 +73,10 @@ public MockPlayerWrapper createPlayer(String name, UUID uuid) { public MockItemStackWrapper createItemStack(String type) { MockItemStack itemStack = this.mock(MockItemStack.class, type); + return this.createItemStack(itemStack); + } + + public MockItemStackWrapper createItemStack(MockItemStack itemStack) { return this.mock(MockItemStackWrapper.class, itemStack); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java new file mode 100644 index 000000000..c63edbb91 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java @@ -0,0 +1,66 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.mock.inventory; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; + +import java.util.HashMap; +import java.util.Map; + +public class MockInventory { + + private final MockFactory factory = new MockFactory(); + private final int size; + private final Map contents = new HashMap<>(); + + public MockInventory(int size) { + this.size = size; + } + + public ItemStackWrapper[] getContents() { + ItemStackWrapper[] ar = new ItemStackWrapper[this.size]; + for(int i = 0; i < this.size; i++) { + ar[i] = this.getItem(i); + } + return ar; + } + + public ItemStackWrapper getItem(int index) { + return this.contents.get(index) == null ? + this.factory.createItemStack(Slot.IGNORE_MATERIAL) + : this.factory.createItemStack(this.contents.get(index)); + } + + public void setItem(int index, ItemStackWrapper itemStack) { + this.contents.put(index, (MockItemStack) itemStack.getItemStack()); + } + + public void updateItem(int index, PlayerWrapper player) { + //do nothing + } + + public int getSize() { + return this.size; + } + + public int getCurrentContentSize() { + return this.contents.size(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java new file mode 100644 index 000000000..2d28f959b --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java @@ -0,0 +1,58 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.mock.inventory; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; + +public class MockInventoryWrapper extends InventoryWrapper { + + public MockInventoryWrapper(MockInventory inventory) { + super(inventory); + } + + @Override + public ItemStackWrapper[] getContents() { + return this.getInventory().getContents(); + } + + @Override + public ItemStackWrapper getItem(int index) { + return this.getInventory().getItem(index); + } + + @Override + public void setItem(int index, ItemStackWrapper itemStack) { + this.getInventory().setItem(index, itemStack); + } + + @Override + public void updateItem(int index, PlayerWrapper player) { + this.getInventory().updateItem(index, player); + } + + @Override + public int getSize() { + return this.getInventory().getSize(); + } + + @Override + public int getCurrentContentSize() { + return this.getInventory().getCurrentContentSize(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index 8c3ec2f5a..d9796f541 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -19,12 +19,22 @@ public class MockItemStack { private final String type; + private final int quantity; public MockItemStack(String type) { + this(type, 1); + } + + public MockItemStack(String type, int quantity) { this.type = type; + this.quantity = quantity; } public String getType() { return this.type; } + + public int getQuantity() { + return this.quantity; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java index 4e2bfbc30..7ee0b0e31 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java @@ -18,20 +18,22 @@ import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; +import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockInventory; +import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockInventoryWrapper; public class MockInventoryManager extends InventoryManager { @Override public Object createInventory(int size, String title) { - return null; + return new MockInventory(size); } @Override public Object createInventory(String title, String type) { - return null; + return new MockInventory(9); //TODO - Do inventory size based on type } @Override public InventoryWrapper createInventoryWrapper(Object inventory) { - return null; + return new MockInventoryWrapper((MockInventory) inventory); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java index fe3463e86..a6bfe556f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java @@ -18,15 +18,21 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockItemStack; +import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockItemStackWrapper; public class MockItemStackManager extends ItemStackManager { + + private final MockFactory factory = new MockFactory(); + @Override public Object createItemStack(String type, int quantity) { - return null; + return new MockItemStack(type, quantity); } @Override public ItemStackWrapper createItemStackWrapper(Object itemStack) { - return null; + return this.factory.createItemStack((MockItemStack) itemStack); } } From f730699a0300049ce60e96abd79f0e05f8d9e71c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 17:45:36 -0800 Subject: [PATCH 062/261] Create reset frame function test --- .../test/function/ResetFrameFunctionTest.java | 49 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 3 ++ 2 files changed, 52 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java new file mode 100644 index 000000000..38c2aa3dc --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ResetFrameFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ResetFrameFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void ownerNotSlotTest() { + Gui gui = this.factory.createGui("test"); + Function function = new ResetFrameFunction(); + function.setOwner(gui); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void slotOwnerTest() { + Slot slot = this.factory.createSlot(); + Function function = new ResetFrameFunction(); + function.setOwner(slot); + assertTrue(function.function(this.factory.createPlayer())); + } + +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 4168b6762..5afe86fd8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -98,6 +98,9 @@ public Gui createGui(String title, List slots) { new HashMap<>()); } + public Slot createSlot() { + return this.createSlot(Slot.TEST_MATERIAL); + } public Slot createSlot(String type) { return this.createSlot(type, false); From dded6ff2377def4bc2fe58f579154c30b3aa5bbe Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 17:46:24 -0800 Subject: [PATCH 063/261] Create reset tick function test --- .../test/function/ResetFrameFunctionTest.java | 3 +- .../test/function/ResetTickFunctionTest.java | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java index 38c2aa3dc..096c05870 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java @@ -45,5 +45,4 @@ public void slotOwnerTest() { function.setOwner(slot); assertTrue(function.function(this.factory.createPlayer())); } - -} +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java new file mode 100644 index 000000000..7196c97fb --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java @@ -0,0 +1,48 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ResetTickFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ResetTickFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void ownerNotSlotTest() { + Gui gui = this.factory.createGui("test"); + Function function = new ResetTickFunction(); + function.setOwner(gui); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void slotOwnerTest() { + Slot slot = this.factory.createSlot(); + Function function = new ResetTickFunction(); + function.setOwner(slot); + assertTrue(function.function(this.factory.createPlayer())); + } +} \ No newline at end of file From df92f43ca13123eb1142f3e3d5c3db6e3a68a0e6 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 17:52:26 -0800 Subject: [PATCH 064/261] eventManager -> eventBus --- .../dynamicgui/core/DynamicGui.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 81d7c2c22..a1410aa6d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -127,7 +127,7 @@ public static DynamicGui get() { private Proxy proxy; private String dateTimeFormat; private final Map serverPlayerCount; - private final EventBus eventManager; + private final EventBus eventBus; private final DynamicGuiPlugin plugin; private final Platform platform; private final LoggerWrapper loggerWrapper; @@ -144,7 +144,7 @@ private DynamicGui(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper this.initialized = false; this.setupFileStructure(); this.saveDefaultConfig(); - this.eventManager = new MethodHandleEventBus(); + this.eventBus = new MethodHandleEventBus(); } private void init() { @@ -238,8 +238,7 @@ private void loadGuis() { } public void checkForProxy() { - MessagingRunnable runnable = (playerWrapper, message) -> - { + MessagingRunnable runnable = (playerWrapper, message) -> { if(message.length > 13) { ByteArrayDataInput in = ByteStreams.newDataInput(message); String packet = in.readUTF(); @@ -272,12 +271,12 @@ public void checkForProxy() { } private void registerListeners() { - this.eventManager.registerEvents(new EntityClickListener()); - this.eventManager.registerEvents(new InventoryInteractListener()); - this.eventManager.registerEvents(new InventoryCloseListener()); - this.eventManager.registerEvents(new InventoryOpenListener()); - this.eventManager.registerEvents(new PlayerInteractListener()); - this.eventManager.registerEvents(new GuiListener()); + this.eventBus.registerEvents(new EntityClickListener()); + this.eventBus.registerEvents(new InventoryInteractListener()); + this.eventBus.registerEvents(new InventoryCloseListener()); + this.eventBus.registerEvents(new InventoryOpenListener()); + this.eventBus.registerEvents(new PlayerInteractListener()); + this.eventBus.registerEvents(new GuiListener()); } private void loadFunctions() { @@ -397,7 +396,7 @@ public DynamicGuiPlugin getPlugin() { } public EventBus getEventBus() { - return this.eventManager; + return this.eventBus; } public Platform getPlatform() { From 4e4c73a1862d131c05c6e1efc72f143b95dcc03a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 18:01:51 -0800 Subject: [PATCH 065/261] Refactor how messages are handled Migrate no gui config option to message section. Use wrappy injection to handle messages via nodes instead, use Message object in DynamicGui to hold messages for retrieval. Closes #220 --- .../dynamicgui/core/DynamicGui.java | 19 ++++++++--- .../core/config/ChatColorColorizer.java | 32 +++++++++++++++++++ .../dynamicgui/core/config/Message.java | 29 +++++++++++++++++ .../core/manager/dynamicgui/GuiManager.java | 2 +- core/src/main/resources/config.yml | 4 ++- 5 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index a1410aa6d..79eb711e9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -15,6 +15,8 @@ */ package com.clubobsidian.dynamicgui.core; +import com.clubobsidian.dynamicgui.core.config.Message; +import com.clubobsidian.dynamicgui.core.config.ChatColorColorizer; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; @@ -93,10 +95,11 @@ import com.clubobsidian.dynamicgui.core.registry.replacer.impl.MetadataReplacerRegistry; import com.clubobsidian.dynamicgui.core.replacer.Replacer; import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.trident.EventBus; import com.clubobsidian.trident.eventbus.methodhandle.MethodHandleEventBus; import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import com.clubobsidian.wrappy.transformer.NodeTransformer; import com.google.common.collect.Iterables; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; @@ -106,6 +109,8 @@ import org.apache.commons.io.FileUtils; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -123,7 +128,7 @@ public static DynamicGui get() { return instance; } - private String noGui; + private Message message; private Proxy proxy; private String dateTimeFormat; private final Map serverPlayerCount; @@ -192,8 +197,12 @@ private void saveDefaultConfig() { } private void loadConfig() { + this.message = new Message(); Configuration config = Configuration.load(this.plugin.getConfigFile()); - this.noGui = ChatColor.translateAlternateColorCodes('&', config.getString("no-gui")); + ConfigurationSection messageSection = config.getConfigurationSection("message"); + Collection transformers = new ArrayList<>(); + transformers.add(new ChatColorColorizer()); + messageSection.inject(this.message, transformers); String version = config.getString("version"); if(version != null) { version = version.trim(); @@ -369,8 +378,8 @@ private void startPlayerCountTimer() { }, 1L, 20L); } - public String getNoGui() { - return this.noGui; + public Message getMessage() { + return this.message; } @Deprecated diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java new file mode 100644 index 000000000..e7e551b07 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java @@ -0,0 +1,32 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.config; + +import com.clubobsidian.dynamicgui.core.util.ChatColor; +import com.clubobsidian.wrappy.transformer.NodeTransformer; + +public class ChatColorColorizer extends NodeTransformer { + + public ChatColorColorizer() { + super(String.class); + } + + @Override + public String transform(String transform) { + return ChatColor.translateAlternateColorCodes('&', transform); + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java new file mode 100644 index 000000000..3e138404b --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java @@ -0,0 +1,29 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.config; + +import com.clubobsidian.wrappy.inject.Node; + +public class Message { + + @Node("no-gui") + private String noGui; + + public String getNoGui() { + return this.noGui; + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 01882533a..10d6a434b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -182,7 +182,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu }); ThreadUtil.run(() -> { if(gui == null) { - playerWrapper.sendMessage(DynamicGui.get().getNoGui()); + playerWrapper.sendMessage(DynamicGui.get().getMessage().getNoGui()); future.complete(false); return; } diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 2f8b0932f..9b73b4b07 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -1,4 +1,6 @@ -no-gui: "&4That gui does not exist!" +message: + no-gui: "&4That gui does not exist!" + #Configure proxy types # Proxy types: # bungee - If you use Bungeecord as your proxy From b2e4279a9fc961b19cad61dd1bcbe23ec4cdb8f9 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 18:18:53 -0800 Subject: [PATCH 066/261] Refactor gui building --- .../clubobsidian/dynamicgui/core/gui/Gui.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index b6572961c..89d379973 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -68,26 +68,36 @@ public Gui(String name, String type, String title, int rows, Boolean close, Mode } public InventoryWrapper buildInventory(PlayerWrapper playerWrapper) { + String inventoryTitle = this.formatTitle(playerWrapper); + Object serverInventory = this.createInventory(inventoryTitle); + InventoryWrapper inventoryWrapper = InventoryManager.get().createInventoryWrapper(serverInventory); + this.populateInventory(playerWrapper, inventoryWrapper); + this.inventoryWrapper = inventoryWrapper; + return inventoryWrapper; + } + + private String formatTitle(PlayerWrapper playerWrapper) { String inventoryTitle = ReplacerManager.get().replace(this.title, playerWrapper); if(inventoryTitle.length() > 32) { inventoryTitle = inventoryTitle.substring(0, 31); } + return inventoryTitle; + } - Object serverInventory = null; + private Object createInventory(String inventoryTitle) { if(this.type == null || this.type.equals(InventoryType.CHEST.toString())) { - serverInventory = InventoryManager.get().createInventory(this.rows * 9, inventoryTitle); + return InventoryManager.get().createInventory(this.rows * 9, inventoryTitle); } else { - serverInventory = InventoryManager.get().createInventory(inventoryTitle, this.type); + return InventoryManager.get().createInventory(inventoryTitle, this.type); } + } - InventoryWrapper inventoryWrapper = InventoryManager.get().createInventoryWrapper(serverInventory); - + private void populateInventory(PlayerWrapper playerWrapper, InventoryWrapper inventoryWrapper) { for(int i = 0; i < this.slots.size(); i++) { Slot slot = this.slots.get(i); if(slot != null) { slot.setOwner(this); ItemStackWrapper item = slot.buildItemStack(playerWrapper); - if(this.modeEnum == ModeEnum.ADD) { int itemIndex = inventoryWrapper.addItem(item); if(itemIndex != -1) { @@ -98,9 +108,6 @@ public InventoryWrapper buildInventory(PlayerWrapper playerWrapper) { } } } - - this.inventoryWrapper = inventoryWrapper; - return inventoryWrapper; } public String getName() { From eea2f644b1effc10ecc055abdfeac699eff89213 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 18:25:42 -0800 Subject: [PATCH 067/261] serverInventory -> nativeInventory --- .../main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index 89d379973..93003771f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -69,8 +69,8 @@ public Gui(String name, String type, String title, int rows, Boolean close, Mode public InventoryWrapper buildInventory(PlayerWrapper playerWrapper) { String inventoryTitle = this.formatTitle(playerWrapper); - Object serverInventory = this.createInventory(inventoryTitle); - InventoryWrapper inventoryWrapper = InventoryManager.get().createInventoryWrapper(serverInventory); + Object nativeInventory = this.createInventory(inventoryTitle); + InventoryWrapper inventoryWrapper = InventoryManager.get().createInventoryWrapper(nativeInventory); this.populateInventory(playerWrapper, inventoryWrapper); this.inventoryWrapper = inventoryWrapper; return inventoryWrapper; From e3366a5832813dad6b9ba96edd1de25e2db9df39 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 18:44:08 -0800 Subject: [PATCH 068/261] Create pull request github action --- .github/workflows/test_pr.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/test_pr.yml diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml new file mode 100644 index 000000000..456c54491 --- /dev/null +++ b/.github/workflows/test_pr.yml @@ -0,0 +1,17 @@ +name: test_pr + +on: pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.11 + uses: actions/setup-java@v1 + with: + java-version: 1.11 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Test + run: ./gradlew test From 20282e53d4f65bcf94438e640b386198b31c1012 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:14:32 -0800 Subject: [PATCH 069/261] Perform null check before proxy check Simplify if statements in sendToServer method --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 79eb711e9..003e12bb8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -444,16 +444,13 @@ private Proxy findProxyByString(String proxyStr) { } public boolean sendToServer(PlayerWrapper playerWrapper, String server) { - if(this.platform == null) { - return false; - } else if(this.proxy == Proxy.BUNGEECORD || this.proxy == Proxy.REDIS_BUNGEE) { + if(this.platform != null && (this.proxy == Proxy.BUNGEECORD || this.proxy == Proxy.REDIS_BUNGEE)) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(server); playerWrapper.sendPluginMessage(DynamicGui.get().getPlugin(), "BungeeCord", out.toByteArray()); return true; } - return false; } } \ No newline at end of file From 452736760e2f13d4109e3b8c09b9680e920732ba Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:16:49 -0800 Subject: [PATCH 070/261] Refactor Platform to be an interface There isn't a need for this to be an abstract class --- .../bukkit/platform/BukkitPlatform.java | 10 ++++-- .../dynamicgui/core/server/Platform.java | 36 ++++++++----------- .../core/test/mock/MockFactory.java | 2 +- .../core/test/mock/plugin/MockPlatform.java | 9 +++-- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index 8fd6ae506..f1de8d153 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -22,6 +22,7 @@ import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.proxy.Proxy; import com.clubobsidian.dynamicgui.bukkit.scheduler.BukkitScheduler; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.core.server.ServerType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; @@ -39,10 +40,13 @@ import java.util.List; import java.util.UUID; -public class BukkitPlatform extends Platform { +public class BukkitPlatform implements Platform { - public BukkitPlatform() { - super(new BukkitScheduler()); + private final Scheduler scheduler = new BukkitScheduler(); + + @Override + public Scheduler getScheduler() { + return this.scheduler; } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java index 515aa9ccd..a266d841b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java @@ -24,40 +24,32 @@ import java.util.Collection; import java.util.UUID; -public abstract class Platform { +public interface Platform { - private final Scheduler scheduler; + Scheduler getScheduler(); - public Platform(Scheduler scheduler) { - this.scheduler = scheduler; - } + boolean isMainThread(); - public Scheduler getScheduler() { - return this.scheduler; - } + void broadcastMessage(String message); - public abstract boolean isMainThread(); + void broadcastJsonMessage(String json); - public abstract void broadcastMessage(String message); + void dispatchServerCommand(String command); - public abstract void broadcastJsonMessage(String json); + PlayerWrapper getPlayer(UUID uuid); - public abstract void dispatchServerCommand(String command); + PlayerWrapper getPlayer(String name); - public abstract PlayerWrapper getPlayer(UUID uuid); + Collection> getOnlinePlayers(); - public abstract PlayerWrapper getPlayer(String name); + int getGlobalPlayerCount(); - public abstract Collection> getOnlinePlayers(); + ServerType getType(); - public abstract int getGlobalPlayerCount(); + void registerOutgoingPluginChannel(DynamicGuiPlugin plugin, String channel); - public abstract ServerType getType(); + void registerIncomingPluginChannel(DynamicGuiPlugin plugin, String channel, MessagingRunnable runnable); - public abstract void registerOutgoingPluginChannel(DynamicGuiPlugin plugin, String channel); - - public abstract void registerIncomingPluginChannel(DynamicGuiPlugin plugin, String channel, MessagingRunnable runnable); - - public abstract WorldWrapper getWorld(String worldName); + WorldWrapper getWorld(String worldName); } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 5afe86fd8..9eb7dddee 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -143,7 +143,7 @@ public MockLocationWrapper createLocation(int x, int y, int z, String worldName) public MockFactory inject() { DynamicGuiPlugin plugin = new MockDynamicGuiPlugin(); - Platform platform = new MockPlatform(new MockScheduler()); + Platform platform = new MockPlatform(); LoggerWrapper logger = new MockLoggerWrapper(new MockLogger()); MockPluginModule module = new MockPluginModule(plugin, platform, logger); module.bootstrap(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index bc3adc77c..1bc4e1960 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -23,6 +23,7 @@ import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.core.server.ServerType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; +import org.mockito.Mock; import java.util.ArrayList; import java.util.Collection; @@ -31,13 +32,15 @@ import java.util.Map; import java.util.UUID; -public class MockPlatform extends Platform { +public class MockPlatform implements Platform { private final Map> worlds = new HashMap<>(); private final List dispatchedServerCommands = new ArrayList<>(); + private final Scheduler scheduler = new MockScheduler(); - public MockPlatform(Scheduler scheduler) { - super(scheduler); + @Override + public Scheduler getScheduler() { + return this.scheduler; } @Override From 88deee5ad07576166414089289df6cb2f0889f9d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:27:06 -0800 Subject: [PATCH 071/261] Test send function --- .../dynamicgui/core/DynamicGui.java | 1 - .../core/test/function/SendFunctionTest.java | 79 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 003e12bb8..b42386d21 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -439,7 +439,6 @@ private Proxy findProxyByString(String proxyStr) { } else if(proxyStr.equalsIgnoreCase("redis") || proxyStr.equalsIgnoreCase("redisbungee")) { return Proxy.REDIS_BUNGEE; } - return Proxy.NONE; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java new file mode 100644 index 000000000..ec9f41b2d --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java @@ -0,0 +1,79 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SendFunction; +import com.clubobsidian.dynamicgui.core.proxy.Proxy; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Field; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SendFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SendFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void noProxyTest() { + this.factory.inject(); + Function function = new SendFunction(); + function.setData("test"); + assertTrue(this.setProxy(Proxy.NONE)); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void bungeeCordTest() { + this.factory.inject(); + Function function = new SendFunction(); + function.setData("test"); + assertTrue(this.setProxy(Proxy.BUNGEECORD)); + assertTrue(function.function(this.factory.createPlayer())); + } + + @Test + public void redisBungeeTest() { + this.factory.inject(); + Function function = new SendFunction(); + function.setData("test"); + assertTrue(this.setProxy(Proxy.REDIS_BUNGEE)); + assertTrue(function.function(this.factory.createPlayer())); + } + + private boolean setProxy(Proxy proxy) { + try { + Field proxyField = DynamicGui.class.getDeclaredField("proxy"); + proxyField.setAccessible(true); + proxyField.set(DynamicGui.get(), proxy); + return true; + } catch(NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + return false; + } + } +} From 4fd8e82bde0e31da61f9d25b42031e42bdf8b227 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:33:19 -0800 Subject: [PATCH 072/261] Refactor retrieving proxy from string --- .../dynamicgui/core/DynamicGui.java | 13 +----- .../dynamicgui/core/proxy/Proxy.java | 12 +++++- .../dynamicgui/core/test/proxy/ProxyTest.java | 42 +++++++++++++++++++ 3 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index b42386d21..ded6cc6a9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -217,7 +217,7 @@ private void loadConfig() { proxyStr = proxyStr.trim(); } - this.proxy = this.findProxyByString(proxyStr); + this.proxy = Proxy.fromString(proxyStr); String dateTimeFormat = config.getString("date-time-format"); if(dateTimeFormat == null) { @@ -362,7 +362,7 @@ private void loadFunctions() { private void startPlayerCountTimer() { this.getPlatform().getScheduler().scheduleSyncRepeatingTask(() -> { - for(String server : serverPlayerCount.keySet()) { + for(String server : this.serverPlayerCount.keySet()) { PlayerWrapper player = Iterables.getFirst(this.getPlatform().getOnlinePlayers(), null); if(player != null) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); @@ -433,15 +433,6 @@ public Injector getInjector() { return this.injector; } - private Proxy findProxyByString(String proxyStr) { - if(proxyStr.equalsIgnoreCase("bungee") || proxyStr.equalsIgnoreCase("bungeecord")) { - return Proxy.BUNGEECORD; - } else if(proxyStr.equalsIgnoreCase("redis") || proxyStr.equalsIgnoreCase("redisbungee")) { - return Proxy.REDIS_BUNGEE; - } - return Proxy.NONE; - } - public boolean sendToServer(PlayerWrapper playerWrapper, String server) { if(this.platform != null && (this.proxy == Proxy.BUNGEECORD || this.proxy == Proxy.REDIS_BUNGEE)) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java index 536f3c7ca..7aaad0cfc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java @@ -15,10 +15,20 @@ */ package com.clubobsidian.dynamicgui.core.proxy; +import java.util.Locale; + public enum Proxy { BUNGEECORD, REDIS_BUNGEE, - NONE + NONE; + public static Proxy fromString(String proxyStr) { + if(proxyStr.toLowerCase(Locale.ROOT).startsWith("bungee")) { + return Proxy.BUNGEECORD; + } else if(proxyStr.toLowerCase(Locale.ROOT).startsWith("redis")) { + return Proxy.REDIS_BUNGEE; + } + return Proxy.NONE; + } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java new file mode 100644 index 000000000..fb6c1f9a8 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.proxy; + +import com.clubobsidian.dynamicgui.core.proxy.Proxy; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ProxyTest { + + @Test + public void noProxyTest() { + assertEquals(Proxy.NONE, Proxy.fromString(UUID.randomUUID().toString())); + } + + @Test + public void bungeeTest() {; + assertEquals(Proxy.BUNGEECORD, Proxy.fromString("BUNGEE")); + } + + @Test + public void redisBungeeTest() { + assertEquals(Proxy.REDIS_BUNGEE, Proxy.fromString("REDIS")); + } +} \ No newline at end of file From 1f8d0e8b4dfadef63baa18047db11871ddd8fa29 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:36:34 -0800 Subject: [PATCH 073/261] Reformat code --- .../bukkit/command/BukkitGuiCommand.java | 2 +- .../bukkit/command/CustomCommandExecutor.java | 2 +- .../bukkit/entity/BukkitPlayerWrapper.java | 4 +-- .../bukkit/inject/BukkitPluginModule.java | 10 ++++---- .../inventory/BukkitInventoryWrapper.java | 2 +- .../inventory/BukkitItemStackWrapper.java | 2 +- .../bukkit/listener/EntityClickListener.java | 4 +-- .../listener/InventoryCloseListener.java | 4 +-- .../listener/InventoryInteractListener.java | 6 ++--- .../listener/InventoryOpenListener.java | 4 +-- .../listener/PlayerInteractListener.java | 4 +-- .../manager/entity/BukkitEntityManager.java | 2 +- .../inventory/BukkitInventoryManager.java | 2 +- .../inventory/BukkitItemStackManager.java | 2 +- .../manager/world/BukkitLocationManager.java | 2 +- .../bukkit/platform/BukkitPlatform.java | 6 ++--- .../bukkit/plugin/BukkitPlugin.java | 18 ++++++------- .../model/ItemsAdderModelProvider.java | 2 +- .../dynamicgui/core/DynamicGui.java | 14 +++++------ .../dynamicgui/core/builder/GuiBuilder.java | 2 +- .../impl/ServerBroadcastFunction.java | 4 +-- .../impl/condition/AfterDateLazyFunction.java | 2 +- .../condition/BeforeDateLazyFunction.java | 2 +- .../clubobsidian/dynamicgui/core/gui/Gui.java | 2 +- .../dynamicgui/core/gui/Slot.java | 2 +- .../core/inject/module/PluginModule.java | 4 +++ .../manager/dynamicgui/FunctionManager.java | 12 ++++----- .../core/manager/dynamicgui/GuiManager.java | 9 +++---- .../core/manager/dynamicgui/ModelManager.java | 2 +- .../core/registry/model/ModelProvider.java | 1 + .../function/GetGameRuleFunctionTest.java | 1 + .../function/PlayerMessageFunctionTest.java | 1 + .../core/test/mock/MockFactory.java | 7 +++--- .../mock/manager/MockItemStackManager.java | 1 - .../mock/plugin/MockDynamicGuiPlugin.java | 2 +- .../core/test/mock/plugin/MockPlatform.java | 1 - .../dynamicgui/core/test/proxy/ProxyTest.java | 3 ++- .../dynamicgui/parser/gui/GuiToken.java | 24 +++++++++--------- .../dynamicgui/parser/macro/MacroToken.java | 2 +- .../dynamicgui/parser/slot/SlotToken.java | 25 ++++++++++--------- 40 files changed, 102 insertions(+), 99 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java index 7dffa7689..1740dc511 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.command; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java index 7bfd2024f..4715516b3 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.command; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 2f07fe7ef..ef9b6462e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -15,13 +15,13 @@ */ package com.clubobsidian.dynamicgui.bukkit.entity; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; -import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index 689247850..53a7f58ac 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -16,18 +16,18 @@ package com.clubobsidian.dynamicgui.bukkit.inject; +import com.clubobsidian.dynamicgui.bukkit.manager.entity.BukkitEntityManager; +import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitInventoryManager; +import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitItemStackManager; +import com.clubobsidian.dynamicgui.bukkit.manager.material.BukkitMaterialManager; +import com.clubobsidian.dynamicgui.bukkit.manager.world.BukkitLocationManager; import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; -import com.clubobsidian.dynamicgui.bukkit.manager.entity.BukkitEntityManager; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitInventoryManager; -import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitItemStackManager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.bukkit.manager.material.BukkitMaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.bukkit.manager.world.BukkitLocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.server.Platform; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java index ed16242dd..499e6296b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java @@ -15,10 +15,10 @@ */ package com.clubobsidian.dynamicgui.bukkit.inventory; +import com.clubobsidian.dynamicgui.bukkit.util.BukkitPacketUtil; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.bukkit.util.BukkitPacketUtil; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index 44ab496e9..4a525be8c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -15,10 +15,10 @@ */ package com.clubobsidian.dynamicgui.bukkit.inventory; +import com.clubobsidian.dynamicgui.bukkit.util.BukkitNBTUtil; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; -import com.clubobsidian.dynamicgui.bukkit.util.BukkitNBTUtil; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java index 0b51bd754..682932e17 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java @@ -15,11 +15,11 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitEntityWrapper; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitEntityWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java index ce704ea4e..21e697dbe 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java @@ -15,11 +15,11 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index d598f7f9d..c5b372d75 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -15,15 +15,15 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.event.inventory.Click; import com.clubobsidian.dynamicgui.core.gui.InventoryView; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; -import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java index 44da579db..fe59fd815 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java @@ -15,11 +15,11 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index 728ecec59..7e35f2529 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -15,12 +15,12 @@ */ package com.clubobsidian.dynamicgui.bukkit.listener; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.player.Action; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; -import com.clubobsidian.dynamicgui.core.event.player.Action; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java index 45884311f..21527701b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.entity; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index 13daafef5..c29eba65d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.inventory; -import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.event.inventory.InventoryType; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java index da097c5c6..8cf785a96 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.inventory; -import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; +import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java index 429dd3fd8..4300361ae 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.bukkit.manager.world; +import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; -import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import org.bukkit.Location; import org.bukkit.World; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index f1de8d153..3470df55f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -15,18 +15,18 @@ */ package com.clubobsidian.dynamicgui.bukkit.platform; +import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import com.clubobsidian.dynamicgui.bukkit.scheduler.BukkitScheduler; +import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.proxy.Proxy; -import com.clubobsidian.dynamicgui.bukkit.scheduler.BukkitScheduler; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.core.server.ServerType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; -import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Bukkit; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 9391a8e9d..33cf84e1b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -15,12 +15,10 @@ */ package com.clubobsidian.dynamicgui.bukkit.plugin; -import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommand; import com.clubobsidian.dynamicgui.bukkit.command.CustomCommand; import com.clubobsidian.dynamicgui.bukkit.command.CustomCommandExecutor; -import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.bukkit.economy.VaultEconomy; import com.clubobsidian.dynamicgui.bukkit.inject.BukkitPluginModule; import com.clubobsidian.dynamicgui.bukkit.listener.EntityClickListener; @@ -28,20 +26,22 @@ import com.clubobsidian.dynamicgui.bukkit.listener.InventoryInteractListener; import com.clubobsidian.dynamicgui.bukkit.listener.InventoryOpenListener; import com.clubobsidian.dynamicgui.bukkit.listener.PlayerInteractListener; +import com.clubobsidian.dynamicgui.bukkit.permission.FoundryPermission; +import com.clubobsidian.dynamicgui.bukkit.permission.VaultPermission; +import com.clubobsidian.dynamicgui.bukkit.platform.BukkitPlatform; +import com.clubobsidian.dynamicgui.bukkit.registry.model.ItemsAdderModelProvider; +import com.clubobsidian.dynamicgui.bukkit.registry.model.OraxenModelProvider; +import com.clubobsidian.dynamicgui.bukkit.registry.npc.CitizensRegistry; +import com.clubobsidian.dynamicgui.bukkit.registry.replacer.PlaceholderApiReplacerRegistry; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.logger.JavaLoggerWrapper; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ModelManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; import com.clubobsidian.dynamicgui.core.permission.Permission; -import com.clubobsidian.dynamicgui.bukkit.permission.FoundryPermission; -import com.clubobsidian.dynamicgui.bukkit.permission.VaultPermission; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.bukkit.registry.model.ItemsAdderModelProvider; -import com.clubobsidian.dynamicgui.bukkit.registry.model.OraxenModelProvider; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; -import com.clubobsidian.dynamicgui.bukkit.registry.npc.CitizensRegistry; -import com.clubobsidian.dynamicgui.bukkit.registry.replacer.PlaceholderApiReplacerRegistry; -import com.clubobsidian.dynamicgui.bukkit.platform.BukkitPlatform; import com.clubobsidian.dynamicgui.core.server.Platform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 4174253c2..624802a34 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -55,7 +55,7 @@ private static Method instance() { private static Method itemStack() { if(ITEMS_ADDER_EXISTS) { try { - Class customStack= Class.forName("dev.lone.itemsadder.api.CustomStack"); + Class customStack = Class.forName("dev.lone.itemsadder.api.CustomStack"); Method getItemStack = customStack.getDeclaredMethod("getItemStack"); getItemStack.setAccessible(true); return getItemStack; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index ded6cc6a9..efa77d8fa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -15,16 +15,16 @@ */ package com.clubobsidian.dynamicgui.core; -import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.config.ChatColorColorizer; +import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckMovableFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; +import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; @@ -35,8 +35,8 @@ import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; +import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgJsonFunction; import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; @@ -73,13 +73,13 @@ import com.clubobsidian.dynamicgui.core.function.impl.meta.HasMetadataFunction; import com.clubobsidian.dynamicgui.core.function.impl.meta.IsGuiMetadataSet; import com.clubobsidian.dynamicgui.core.function.impl.meta.SetMetadataFunction; -import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.listener.EntityClickListener; import com.clubobsidian.dynamicgui.core.listener.GuiListener; import com.clubobsidian.dynamicgui.core.listener.InventoryCloseListener; import com.clubobsidian.dynamicgui.core.listener.InventoryInteractListener; import com.clubobsidian.dynamicgui.core.listener.InventoryOpenListener; import com.clubobsidian.dynamicgui.core.listener.PlayerInteractListener; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; @@ -131,8 +131,8 @@ public static DynamicGui get() { private Message message; private Proxy proxy; private String dateTimeFormat; - private final Map serverPlayerCount; - private final EventBus eventBus; + private final Map serverPlayerCount = new ConcurrentHashMap<>(); + private final EventBus eventBus = new MethodHandleEventBus(); private final DynamicGuiPlugin plugin; private final Platform platform; private final LoggerWrapper loggerWrapper; @@ -145,11 +145,9 @@ private DynamicGui(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper this.platform = platform; this.loggerWrapper = loggerWrapper; this.injector = injector; - this.serverPlayerCount = new ConcurrentHashMap<>(); this.initialized = false; this.setupFileStructure(); this.saveDefaultConfig(); - this.eventBus = new MethodHandleEventBus(); } private void init() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index 6fe74ac5b..426741e15 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -19,8 +19,8 @@ import com.clubobsidian.dynamicgui.core.gui.ModeEnum; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import java.util.ArrayList; import java.util.HashMap; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java index 8e9736964..ca4b23649 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java @@ -40,8 +40,8 @@ public boolean function(PlayerWrapper playerWrapper) { } String colorized = ChatColor.translateAlternateColorCodes('&', ReplacerManager - .get() - .replace(this.getData(), playerWrapper)); + .get() + .replace(this.getData(), playerWrapper)); DynamicGui.get().getPlatform().broadcastMessage(colorized); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java index 710d7d8c3..4c30042a0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java @@ -41,7 +41,7 @@ public LazyNumber lazyEval(List lazyParams) { if(now.after(expected)) { return ConditionFunction.ONE; } - } catch (ParseException ignore) { + } catch(ParseException ignore) { DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", lazyParams.get(0).getString())); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java index 0ac995ad1..fd7515828 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java @@ -25,7 +25,7 @@ public LazyNumber lazyEval(List lazyParams) { if(now.before(expected)) { return ConditionFunction.ONE; } - } catch (ParseException ignore) { + } catch(ParseException ignore) { DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", lazyParams.get(0).getString())); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index 93003771f..bf7c77c67 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -21,9 +21,9 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import org.apache.commons.lang3.SerializationUtils; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 05118b9f1..3dc6bea9a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -24,8 +24,8 @@ import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ModelManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import java.io.Serializable; import java.util.ArrayList; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index fc7472fd6..5bd3a1466 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -47,9 +47,13 @@ public PluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper } public abstract Class getEntityManager(); + public abstract Class getInventoryManager(); + public abstract Class getItemStackManager(); + public abstract Class getMaterialManager(); + public abstract Class getLocationManger(); @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index afc4db7bf..7c11da11e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -19,12 +19,12 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.util.ThreadUtil; import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; -import com.clubobsidian.dynamicgui.core.util.ThreadUtil; import com.clubobsidian.fuzzutil.StringFuzz; import java.util.ArrayDeque; @@ -90,10 +90,10 @@ public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType } private CompletableFuture recurFunctionNodes(FunctionResponse fail, - FunctionOwner owner, - Collection functionNodes, - FunctionType type, - PlayerWrapper playerWrapper) { + FunctionOwner owner, + Collection functionNodes, + FunctionType type, + PlayerWrapper playerWrapper) { Queue nodeQueue = new ArrayDeque<>(functionNodes); CompletableFuture future = new CompletableFuture<>(); FunctionNode node = nodeQueue.poll(); @@ -163,7 +163,7 @@ private CompletableFuture runFunctionData(FunctionOwner owner, } if(!ran) { response.complete(new FunctionResponse(false, functionName, functionData)); - } else if (async) { + } else if(async) { try { response.complete(runFunctionData(owner, futureData, playerWrapper).get()); } catch(InterruptedException | ExecutionException ex) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 10d6a434b..086768cfe 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -28,18 +28,17 @@ import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.core.server.ServerType; import com.clubobsidian.dynamicgui.core.util.ChatColor; - import com.clubobsidian.dynamicgui.core.util.HashUtil; import com.clubobsidian.dynamicgui.core.util.ThreadUtil; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; +import com.clubobsidian.dynamicgui.parser.function.FunctionType; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; import org.apache.commons.io.FileUtils; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java index 9f916809a..35c11af94 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java @@ -36,7 +36,7 @@ public static ModelManager get() { private Map registries = new HashMap<>(); private ModelManager() { - this.register(new VanillaModelProvider()); + this.register(new VanillaModelProvider()); } public ModelProvider getProvider(final String registryName) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java index 6447cad03..d64b41731 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java @@ -21,6 +21,7 @@ public interface ModelProvider { String name(); + boolean applyModel(ItemStackWrapper itemStack, String data); } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java index 666b449a2..dd40202b9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java @@ -42,6 +42,7 @@ public void noCommaTest() { function.setData(""); assertFalse(function.function(this.factory.createPlayer())); } + @Test public void lengthNotThreeTest() { Function function = new GetGameRuleFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java index ef5ab9a45..5f1fceb40 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java @@ -15,6 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.test.function; + import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 9eb7dddee..bdc0a6c00 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -22,9 +22,7 @@ import com.clubobsidian.dynamicgui.core.gui.InventoryType; import com.clubobsidian.dynamicgui.core.gui.ModeEnum; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; @@ -37,11 +35,11 @@ import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockDynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; -import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockScheduler; import com.clubobsidian.dynamicgui.core.test.mock.world.MockLocation; import com.clubobsidian.dynamicgui.core.test.mock.world.MockLocationWrapper; import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorld; import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorldWrapper; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import org.mockito.Mockito; import java.util.ArrayList; @@ -169,7 +167,8 @@ public MockLoggerWrapper getLogger() { } public MockEconomy getEconomy() { - Economy economy = DynamicGui.get().getPlugin().getEconomy();; + Economy economy = DynamicGui.get().getPlugin().getEconomy(); + ; if(!(economy instanceof MockEconomy)) { return null; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java index a6bfe556f..b84836d1d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java @@ -20,7 +20,6 @@ import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockItemStack; -import com.clubobsidian.dynamicgui.core.test.mock.inventory.MockItemStackWrapper; public class MockItemStackManager extends ItemStackManager { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index 9c9dfbc72..babb2ef04 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -31,7 +31,7 @@ public class MockDynamicGuiPlugin implements DynamicGuiPlugin { private final File guiFolder = new File(this.dataFolder, "guis"); private final File macroFolder = new File(this.dataFolder, "macros"); private final File mainFolder = new File("src", "main"); - private final File resourcesFolder = new File(this.mainFolder,"resources"); + private final File resourcesFolder = new File(this.mainFolder, "resources"); private final File configFile = new File(this.resourcesFolder, "config.yml"); public Economy economy = new MockEconomy(); //Visible for testing public Permission permission = new MockPermission(); //Visible for testing diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 1bc4e1960..9e5db77e4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -23,7 +23,6 @@ import com.clubobsidian.dynamicgui.core.server.Platform; import com.clubobsidian.dynamicgui.core.server.ServerType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; -import org.mockito.Mock; import java.util.ArrayList; import java.util.Collection; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java index fb6c1f9a8..31e35b077 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java @@ -31,7 +31,8 @@ public void noProxyTest() { } @Test - public void bungeeTest() {; + public void bungeeTest() { + ; assertEquals(Proxy.BUNGEECORD, Proxy.fromString("BUNGEE")); } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java index 5bcb6d236..538f701fc 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java @@ -15,6 +15,12 @@ */ package com.clubobsidian.dynamicgui.parser.gui; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.dynamicgui.parser.slot.SlotToken; +import com.clubobsidian.wrappy.ConfigurationSection; + import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; @@ -22,12 +28,6 @@ import java.util.List; import java.util.Map; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.dynamicgui.parser.slot.SlotToken; -import com.clubobsidian.wrappy.ConfigurationSection; - public class GuiToken implements Serializable { /** @@ -82,14 +82,14 @@ public GuiToken(ConfigurationSection section, List macroTokens) { } public String parseType(String type) { - if (type == null) { + if(type == null) { return "CHEST"; } return type.toUpperCase(); } private GuiMode parseMode(String mode) { - if (mode == null) { + if(mode == null) { return GuiMode.SET; } @@ -99,7 +99,7 @@ private GuiMode parseMode(String mode) { private Map> loadNpcs(ConfigurationSection section) { Map> npcs = new HashMap<>(); ConfigurationSection npcSection = section.getConfigurationSection("npcs"); - for (String key : npcSection.getKeys()) { + for(String key : npcSection.getKeys()) { List npcIds = npcSection.getIntegerList(key); npcs.put(key, npcIds); } @@ -108,7 +108,7 @@ private Map> loadNpcs(ConfigurationSection section) { private Map parseMetadata(ConfigurationSection section) { Map metadata = new HashMap<>(); - for (String key : section.getKeys()) { + for(String key : section.getKeys()) { String parsedKey = this.macroParser.parseStringMacros(key); String value = section.getString(parsedKey); value = this.macroParser.parseStringMacros(value); @@ -121,9 +121,9 @@ private Map parseMetadata(ConfigurationSection section) { private Map loadSlots(ConfigurationSection section) { Map slots = new LinkedHashMap<>(); int slotAmt = this.rows * 9; - for (int i = 0; i < slotAmt; i++) { + for(int i = 0; i < slotAmt; i++) { ConfigurationSection slotSection = section.getConfigurationSection(String.valueOf(i)); - if (!slotSection.isEmpty()) { + if(!slotSection.isEmpty()) { SlotToken token = new SlotToken(i, slotSection, this.macroParser.getTokens()); slots.put(i, token); } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java index bfaa1a768..9abb16bdd 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java @@ -36,7 +36,7 @@ public MacroToken(ConfigurationSection section) { private void parse(ConfigurationSection section) { this.macros = new LinkedHashMap<>(); - for (String key : section.getKeys()) { + for(String key : section.getKeys()) { this.macros.put(key, section.get(key)); } } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index 2c06974a8..d81f29a61 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -15,17 +15,17 @@ */ package com.clubobsidian.dynamicgui.parser.slot; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.wrappy.ConfigurationSection; + import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.wrappy.ConfigurationSection; - public class SlotToken implements Serializable { /** @@ -89,7 +89,7 @@ public SlotToken(int index, ConfigurationSection section, List macro } private int parseAmount(int amount) { - if (amount == 0) { + if(amount == 0) { return 1; } return amount; @@ -99,18 +99,18 @@ private byte parseByte(String data) { String stringData = this.macroParser.parseStringMacros(data); try { return Byte.parseByte(stringData); - } catch (Exception ex) { + } catch(Exception ex) { return 0; } } private boolean parseBoolean(String data) { - if (data == null) { + if(data == null) { return false; } String parsed = this.macroParser.parseStringMacros(data); - if (data.equals("true")) { + if(data.equals("true")) { return Boolean.parseBoolean(parsed); } @@ -118,14 +118,14 @@ private boolean parseBoolean(String data) { } private int parseInteger(String data) { - if (data == null) { + if(data == null) { return 0; } try { String parsed = this.macroParser.parseStringMacros(data); return Integer.parseInt(parsed); - } catch (Exception ex) { + } catch(Exception ex) { return 0; } } @@ -137,7 +137,7 @@ private int parseUpdateInterval(String data) { private Map parseMetadata(ConfigurationSection section) { Map metadata = new HashMap<>(); - for (String key : section.getKeys()) { + for(String key : section.getKeys()) { String parsedKey = this.macroParser.parseStringMacros(key); String value = section.getString(parsedKey); value = this.macroParser.parseStringMacros(value); @@ -194,6 +194,7 @@ public int getUpdateInterval() { public List getEnchants() { return this.enchants; } + public List getItemFlags() { return this.itemFlags; } From 3d531df002e0cb03d6d9196770fbdde80f670405 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:37:36 -0800 Subject: [PATCH 074/261] More code cleanup --- .../parser/function/FunctionData.java | 4 +- .../parser/function/FunctionModifier.java | 6 +-- .../parser/function/FunctionType.java | 6 +-- .../parser/function/FunctionTypeParser.java | 8 ++-- .../parser/function/tree/FunctionNode.java | 4 +- .../parser/function/tree/FunctionTree.java | 28 +++++++------ .../dynamicgui/parser/macro/MacroParser.java | 42 +++++++++---------- .../dynamicgui/parser/macro/MacroToken.java | 4 +- .../parser/test/FunctionTreeTest.java | 15 ++++--- .../parser/test/FunctionTypeParserTest.java | 13 +++--- .../parser/test/FunctionTypeTest.java | 7 ++-- .../dynamicgui/parser/test/GuiTokenTest.java | 19 ++++----- .../dynamicgui/parser/test/SlotTokenTest.java | 15 ++++--- .../functiontree/EmptyFunctionTreeTest.java | 5 +-- .../dynamicgui/parser/test/gui/AliasTest.java | 9 ++-- .../parser/test/gui/GuitMetadataTest.java | 11 ++--- .../parser/test/gui/InvalidTypeTest.java | 9 ++-- .../parser/test/gui/LoadMacrosTest.java | 9 ++-- .../parser/test/gui/LocationTest.java | 9 ++-- .../parser/test/gui/NoModeTest.java | 11 +++-- .../parser/test/gui/ValidTypeTest.java | 9 ++-- .../parser/test/macro/MacroNonStringTest.java | 13 +++--- .../parser/test/macro/MacroParserTest.java | 13 +++--- .../parser/test/macro/MacrosTokenTest.java | 11 +++-- .../test/macro/MultiMacroSameFileTest.java | 15 ++++--- .../parser/test/slot/EnchantTest.java | 11 +++-- .../parser/test/slot/InvalidAmountTest.java | 11 +++-- .../slot/InvalidFunctionTypeMacroTest.java | 11 +++-- .../test/slot/InvalidSlotDataMacroTest.java | 13 +++--- .../test/slot/InvalidUpdateIntervalTest.java | 11 +++-- .../dynamicgui/parser/test/slot/LoreTest.java | 11 +++-- .../parser/test/slot/MovableTest.java | 13 +++--- .../parser/test/slot/SlotIndexTest.java | 11 +++-- .../parser/test/slot/SlotMetadataTest.java | 11 +++-- .../parser/test/slot/ValidAmountTest.java | 11 +++-- .../test/slot/ValidFunctionTypeMacroTest.java | 11 +++-- .../test/slot/ValidSlotDataMacroTest.java | 11 +++-- .../test/slot/ValidUpdateIntervalTest.java | 11 +++-- 38 files changed, 207 insertions(+), 235 deletions(-) diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java index dfa82e69e..0c26bc6d7 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java @@ -15,10 +15,10 @@ */ package com.clubobsidian.dynamicgui.parser.function; -import java.io.Serializable; - import com.clubobsidian.fuzzutil.StringFuzz; +import java.io.Serializable; + public class FunctionData implements Serializable { /** diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java index 27d77a8c1..7864f412c 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java @@ -31,9 +31,9 @@ public String getModifier() { } public static FunctionModifier findModifier(String functionData) { - for (FunctionModifier modifier : FunctionModifier.values()) { - if (modifier != FunctionModifier.NONE) { - if (functionData.startsWith(modifier.getModifier())) { + for(FunctionModifier modifier : FunctionModifier.values()) { + if(modifier != FunctionModifier.NONE) { + if(functionData.startsWith(modifier.getModifier())) { return modifier; } } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java index d7abb006b..936e6c65e 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java @@ -15,11 +15,11 @@ */ package com.clubobsidian.dynamicgui.parser.function; +import com.clubobsidian.fuzzutil.StringFuzz; + import java.util.HashMap; import java.util.Map; -import com.clubobsidian.fuzzutil.StringFuzz; - public enum FunctionType { CLICK(true), @@ -47,7 +47,7 @@ public boolean isClick() { private final static Map normalizedFunctions = new HashMap<>(); static { - for (FunctionType type : FunctionType.values()) { + for(FunctionType type : FunctionType.values()) { String normalized = StringFuzz.normalize(type.toString()); normalizedFunctions.put(normalized, type); } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java index 6fa8687ed..b85af5985 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java @@ -15,12 +15,12 @@ */ package com.clubobsidian.dynamicgui.parser.function; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; + import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; - public class FunctionTypeParser implements Serializable { /** @@ -37,9 +37,9 @@ public FunctionTypeParser(MacroParser macroParser) { public List parseTypes(List types) { types = this.macroParser.parseListMacros(types); List typesList = new ArrayList<>(); - for (String type : types) { + for(String type : types) { FunctionType parsedType = this.parseType(type); - if (parsedType == null) + if(parsedType == null) continue; //TODO - warn typesList.add(parsedType); diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java index 08c31bab9..7ab62d26a 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java @@ -15,12 +15,12 @@ */ package com.clubobsidian.dynamicgui.parser.function.tree; +import com.clubobsidian.dynamicgui.parser.function.FunctionToken; + import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import com.clubobsidian.dynamicgui.parser.function.FunctionToken; - public class FunctionNode implements Serializable { /** diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java index 1fdea1c8f..4015c6dda 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java @@ -15,15 +15,19 @@ */ package com.clubobsidian.dynamicgui.parser.function.tree; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import com.clubobsidian.dynamicgui.parser.function.*; +import com.clubobsidian.dynamicgui.parser.function.FunctionData; +import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; +import com.clubobsidian.dynamicgui.parser.function.FunctionToken; +import com.clubobsidian.dynamicgui.parser.function.FunctionType; +import com.clubobsidian.dynamicgui.parser.function.FunctionTypeParser; import com.clubobsidian.dynamicgui.parser.macro.MacroParser; import com.clubobsidian.fuzzutil.StringFuzz; import com.clubobsidian.wrappy.ConfigurationSection; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + public class FunctionTree implements Serializable { /** @@ -69,7 +73,7 @@ private void parseNodes(ConfigurationSection section) { private String[] parseFunctionData(String functionData) { String[] args = new String[3]; - if (!functionData.contains(":")) { + if(!functionData.contains(":")) { args[0] = StringFuzz.normalize(functionData); FunctionModifier modifier = FunctionModifier.findModifier(args[0]); args[0] = functionData.replaceFirst(modifier.getModifier(), ""); @@ -82,8 +86,8 @@ private String[] parseFunctionData(String functionData) { StringBuilder dat = new StringBuilder(); dat.append(split[1].trim()); - if (split.length > 2) { - for (int i = 2; i < split.length; i++) { + if(split.length > 2) { + for(int i = 2; i < split.length; i++) { dat.append(":"); dat.append(split[i]); } @@ -101,7 +105,7 @@ private List parseFunctionData(final List tokens) { List parsedTokens = this.macroParser.parseListMacros(tokens); List functionTokens = new ArrayList<>(); - for (String token : parsedTokens) { + for(String token : parsedTokens) { String[] parsedFunctionData = this.parseFunctionData(token); String functionName = parsedFunctionData[0]; @@ -115,9 +119,9 @@ private List parseFunctionData(final List tokens) { } private void walkTree(int depth, ConfigurationSection section, FunctionNode parentNode) { - for (String name : section.getKeys()) { + for(String name : section.getKeys()) { ConfigurationSection rootSection = section.getConfigurationSection(name); - if (rootSection.get("functions") == null) { + if(rootSection.get("functions") == null) { continue; } @@ -128,7 +132,7 @@ private void walkTree(int depth, ConfigurationSection section, FunctionNode pare FunctionToken data = new FunctionToken(name, types, functionTokens, failFunctions); FunctionNode childNode = new FunctionNode(depth, data); - if (depth == 0) { + if(depth == 0) { this.rootNodes.add(childNode); } else { parentNode.addChild(childNode); diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java index 957d2dd3c..c75fe6d50 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java @@ -15,14 +15,14 @@ */ package com.clubobsidian.dynamicgui.parser.macro; +import org.apache.commons.lang3.StringUtils; + import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map.Entry; -import org.apache.commons.lang3.StringUtils; - public class MacroParser implements Serializable { /** @@ -41,26 +41,26 @@ public List getTokens() { } public String parseStringMacros(final String replaceIn) { - if (replaceIn == null) { + if(replaceIn == null) { return null; } String replace = replaceIn; - for (MacroToken token : this.tokens) { - for (Entry next : token.getMacros().entrySet()) { + for(MacroToken token : this.tokens) { + for(Entry next : token.getMacros().entrySet()) { String key = next.getKey(); Object value = next.getValue(); - if (replace.contains(key)) { + if(replace.contains(key)) { replace = StringUtils.replace(replace, key, value.toString()); } } } - for (MacroToken token : this.tokens) { - for (Entry entry : token.getMacros().entrySet()) { + for(MacroToken token : this.tokens) { + for(Entry entry : token.getMacros().entrySet()) { String key = entry.getKey(); - if (replace.contains(key)) { + if(replace.contains(key)) { return this.parseStringMacros(replace); } } @@ -74,15 +74,15 @@ public List parseListMacros(final List replaceIn) { List newList = new ArrayList<>(replaceIn); - for (MacroToken token : this.tokens) { - for (Entry next : token.getMacros().entrySet()) { + for(MacroToken token : this.tokens) { + for(Entry next : token.getMacros().entrySet()) { String key = next.getKey(); - for (int i = 0; i < newList.size(); i++) { + for(int i = 0; i < newList.size(); i++) { String line = newList.get(i); - if (line.contains(key)) { + if(line.contains(key)) { Object value = next.getValue(); - if (!(value instanceof List)) { + if(!(value instanceof List)) { String stringMacro = value.toString(); newList.remove(i); newList.add(i, StringUtils.replace(line, key, stringMacro)); @@ -104,16 +104,16 @@ public List parseListMacros(final List replaceIn) { String ending = line.substring(endIndex); String appended = ending; - if (listMacro.size() >= 2) { + if(listMacro.size() >= 2) { appended = listMacro.get(1) + ending; } - if (appended.length() > 0) { + if(appended.length() > 0) { i++; newList.add(i, appended); } - for (int j = 2; j < listMacro.size(); j++) { + for(int j = 2; j < listMacro.size(); j++) { i++; newList.add(i, listMacro.get(j)); } @@ -123,11 +123,11 @@ public List parseListMacros(final List replaceIn) { } } - for (MacroToken token : this.tokens) { - for (Entry entry : token.getMacros().entrySet()) { + for(MacroToken token : this.tokens) { + for(Entry entry : token.getMacros().entrySet()) { String key = entry.getKey(); - for (String line : newList) { - if (line.contains(key)) { + for(String line : newList) { + if(line.contains(key)) { return this.parseListMacros(newList); } } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java index 9abb16bdd..23b306d9d 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java @@ -15,12 +15,12 @@ */ package com.clubobsidian.dynamicgui.parser.macro; +import com.clubobsidian.wrappy.ConfigurationSection; + import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; -import com.clubobsidian.wrappy.ConfigurationSection; - public class MacroToken implements Serializable { /** diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java index 695920f32..ad0da1ef7 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java @@ -15,14 +15,6 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; -import java.util.List; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.FunctionType; @@ -31,6 +23,13 @@ import com.clubobsidian.dynamicgui.parser.macro.MacroToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class FunctionTreeTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java index 318b16311..1be746161 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java @@ -15,18 +15,17 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.function.FunctionType; +import com.clubobsidian.dynamicgui.parser.function.FunctionTypeParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import com.clubobsidian.dynamicgui.parser.function.FunctionTypeParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import static org.junit.jupiter.api.Assertions.assertTrue; public class FunctionTypeParserTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java index bfc1fef5a..c00d4f5b7 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java @@ -16,12 +16,11 @@ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - +import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; -import com.clubobsidian.dynamicgui.parser.function.FunctionType; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class FunctionTypeTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java index 12f43e592..7c279bd99 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java @@ -15,16 +15,6 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.function.FunctionData; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; @@ -34,6 +24,15 @@ import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class GuiTokenTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java index 67884c0bd..2d2ecec6d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java @@ -15,19 +15,18 @@ */ package com.clubobsidian.dynamicgui.parser.test; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.parser.macro.MacroToken; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class SlotTokenTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java index 4c6b1a8bc..96b554b15 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java @@ -16,11 +16,10 @@ package com.clubobsidian.dynamicgui.parser.test.functiontree; -import static org.junit.jupiter.api.Assertions.assertTrue; - +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import org.junit.jupiter.api.Test; -import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; +import static org.junit.jupiter.api.Assertions.assertTrue; public class EmptyFunctionTreeTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java index 52ee66437..92a26bf11 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java @@ -16,14 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.wrappy.Configuration; +import static org.junit.jupiter.api.Assertions.assertTrue; public class AliasTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java index 260d92afd..514798890 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java @@ -16,17 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.Map; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.dynamicgui.parser.slot.SlotToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class GuitMetadataTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java index 3aef66a14..149aedb5f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java @@ -16,14 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.wrappy.Configuration; +import static org.junit.jupiter.api.Assertions.assertTrue; public class InvalidTypeTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java index 84dade54d..f4990796b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.wrappy.Configuration; +import static org.junit.jupiter.api.Assertions.assertTrue; public class LoadMacrosTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java index f8d1430b6..dba127995 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java @@ -16,14 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.wrappy.Configuration; +import static org.junit.jupiter.api.Assertions.assertTrue; public class LocationTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java index 476bb7411..5e145d73b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.gui.GuiMode; import com.clubobsidian.dynamicgui.parser.gui.GuiToken; import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class NoModeTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java index 789616475..d8cdc298f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java @@ -16,14 +16,13 @@ package com.clubobsidian.dynamicgui.parser.test.gui; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.gui.GuiToken; -import com.clubobsidian.wrappy.Configuration; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ValidTypeTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java index 4a57cee8d..ec6808801 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java @@ -16,18 +16,17 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.ArrayList; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MacroNonStringTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java index a148f9098..ba2389594 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java @@ -16,18 +16,17 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.ArrayList; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MacroParserTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java index 484d67b75..92d41ddcd 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java @@ -16,17 +16,16 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.List; import java.util.Map; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MacrosTokenTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java index b489ecda7..aa02db7a6 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java @@ -16,17 +16,16 @@ package com.clubobsidian.dynamicgui.parser.test.macro; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.macro.MacroParser; +import com.clubobsidian.dynamicgui.parser.macro.MacroToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.ArrayList; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; -import com.clubobsidian.wrappy.Configuration; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MultiMacroSameFileTest { @@ -39,7 +38,7 @@ public void stringTest() { Configuration config = Configuration.load(sameFileMacroFile); List tokens = new ArrayList<>(); - for (String key : config.getKeys()) { + for(String key : config.getKeys()) { MacroToken token = new MacroToken(config.getConfigurationSection(key)); tokens.add(token); } @@ -60,7 +59,7 @@ public void listTest() { Configuration config = Configuration.load(sameFileMacroFile); List tokens = new ArrayList<>(); - for (String key : config.getKeys()) { + for(String key : config.getKeys()) { MacroToken token = new MacroToken(config.getConfigurationSection(key)); tokens.add(token); } diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java index a65a30827..cfc6b4536 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java @@ -16,16 +16,15 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.slot.SlotToken; +import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.slot.SlotToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class EnchantTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java index fd32669ae..76ededb55 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class InvalidAmountTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java index c498ba040..64d3c91e0 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java @@ -16,17 +16,16 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class InvalidFunctionTypeMacroTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java index bed4165a6..8e8fe8926 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class InvalidSlotDataMacroTest { @@ -37,6 +36,6 @@ public void testInvalidSlotData() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); byte data = token.getData(); - assertTrue( data == 0); + assertTrue(data == 0); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java index dea9c4c23..3f6cdb8b4 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class InvalidUpdateIntervalTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java index bb56da7b8..02db14eda 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java @@ -16,16 +16,15 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.slot.SlotToken; +import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.List; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.slot.SlotToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class LoreTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java index 1e84d8864..e17759a3f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java @@ -16,16 +16,15 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MovableTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java index b2ba9aa0b..7c2be1477 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class SlotIndexTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java index 07ff40e8a..d109ede8e 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java @@ -16,16 +16,15 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; +import com.clubobsidian.dynamicgui.parser.slot.SlotToken; +import com.clubobsidian.wrappy.Configuration; +import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.Map; -import org.junit.jupiter.api.Test; - -import com.clubobsidian.dynamicgui.parser.slot.SlotToken; -import com.clubobsidian.wrappy.Configuration; -import com.clubobsidian.wrappy.ConfigurationSection; +import static org.junit.jupiter.api.Assertions.assertTrue; public class SlotMetadataTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java index b7fb60e6c..f5839cfca 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class ValidAmountTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java index dfb0878ed..8f8c17b37 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java @@ -16,18 +16,17 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.function.FunctionToken; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class ValidFunctionTypeMacroTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java index f8d5e1379..2650136f7 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class ValidSlotDataMacroTest { diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java index 39911388c..72498776f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java @@ -16,15 +16,14 @@ package com.clubobsidian.dynamicgui.parser.test.slot; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.File; - -import org.junit.jupiter.api.Test; - import com.clubobsidian.dynamicgui.parser.slot.SlotToken; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class ValidUpdateIntervalTest { From fe9059dd5c97b7538c13787c9e49399f90dd700e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:45:35 -0800 Subject: [PATCH 075/261] Create broadcast function test --- .../function/ServerBroadcastFunctionTest.java | 53 +++++++++++++++++++ .../core/test/mock/plugin/MockPlatform.java | 5 ++ 2 files changed, 58 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java new file mode 100644 index 000000000..83ae3d8d7 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java @@ -0,0 +1,53 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.util.ChatColor; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ServerBroadcastFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void noDataTest() { + Function function = new ServerBroadcastFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataTest() { + this.factory.inject(); + String data = "&4test"; + String colorized = ChatColor.translateAlternateColorCodes(data); + Function function= new ServerBroadcastFunction(); + function.setData(data); + assertTrue(function.function(this.factory.createPlayer())); + List messages = this.factory.getPlatform().getBroadcastMessages(); + assertTrue(messages.size() == 1); + assertEquals(colorized, messages.get(0)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 9e5db77e4..9e60f4fd3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -36,6 +36,7 @@ public class MockPlatform implements Platform { private final Map> worlds = new HashMap<>(); private final List dispatchedServerCommands = new ArrayList<>(); private final Scheduler scheduler = new MockScheduler(); + private final List broadcastMessages = new ArrayList<>(); @Override public Scheduler getScheduler() { @@ -49,7 +50,11 @@ public boolean isMainThread() { @Override public void broadcastMessage(String message) { + this.broadcastMessages.add(message); + } + public List getBroadcastMessages() { + return this.broadcastMessages; } @Override From 04c6d766dfde4844b3effaef99f5bee99c26f94c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:56:08 -0800 Subject: [PATCH 076/261] Initialize fields outside of constructor --- .../core/manager/dynamicgui/MiniMessageManager.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java index a2d9a1274..d41b67fe1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java @@ -37,16 +37,11 @@ public static MiniMessageManager get() { return instance; } - private final Map json; - private final MiniMessage miniMessage; - private final GsonComponentSerializer serializer; + private final Map json = new HashMap<>(); + private final MiniMessage miniMessage = MiniMessage.builder().build(); + private final GsonComponentSerializer serializer = GsonComponentSerializer.builder().build(); private MiniMessageManager() { - this.json = new HashMap<>(); - this.miniMessage = MiniMessage - .builder() - .build(); - this.serializer = GsonComponentSerializer.builder().build(); DynamicGui.get().getEventBus().registerEvents(this); } From b229bdca3a058fd69a18d6f37199b38cc07613f5 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 21:59:22 -0800 Subject: [PATCH 077/261] Actually implement server json broadcast --- .../dynamicgui/core/DynamicGui.java | 3 ++ .../impl/ServerBroadcastJsonFunction.java | 4 +- .../ServerBroadcastJsonFunctionTest.java | 53 +++++++++++++++++++ .../core/test/mock/plugin/MockPlatform.java | 2 +- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index efa77d8fa..ebc59e3a6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.core.config.ChatColorColorizer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; @@ -45,6 +46,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.ResetTickFunction; import com.clubobsidian.dynamicgui.core.function.impl.SendFunction; import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastFunction; +import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastJsonFunction; import com.clubobsidian.dynamicgui.core.function.impl.ServerMiniBroadcastFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetAmountFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetCloseFunction; @@ -319,6 +321,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new RandomFunction()); FunctionManager.get().addFunction(new SendFunction()); FunctionManager.get().addFunction(new ServerBroadcastFunction()); + FunctionManager.get().addFunction(new ServerBroadcastJsonFunction()); FunctionManager.get().addFunction(new ParticleFunction()); FunctionManager.get().addFunction(new SoundFunction()); FunctionManager.get().addFunction(new SetNameFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java index 8181335c2..71e5e65fb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java @@ -26,8 +26,8 @@ public class ServerBroadcastJsonFunction extends Function { */ private static final long serialVersionUID = 7108356107897317545L; - public ServerBroadcastJsonFunction(String name) { - super(name); + public ServerBroadcastJsonFunction() { + super("broadcastjson", "bjson"); } @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java new file mode 100644 index 000000000..daed2fe7b --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java @@ -0,0 +1,53 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastJsonFunction; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ServerBroadcastJsonFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new ServerBroadcastJsonFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataTest() { + MockPlatform platform = this.factory.inject().getPlatform(); + String json = MiniMessageManager.get().toJson("test"); + Function function = new ServerBroadcastJsonFunction(); + function.setData(json); + assertTrue(function.function(this.factory.createPlayer())); + List messages = platform.getBroadcastMessages(); + assertTrue(messages.size() == 1); + assertEquals(json, messages.get(0)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 9e60f4fd3..2d850364f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -59,7 +59,7 @@ public List getBroadcastMessages() { @Override public void broadcastJsonMessage(String json) { - + this.broadcastMessages.add(json); } @Override From 4c55ebff72c6540b909886666edd71aee9092b52 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 22:19:16 -0800 Subject: [PATCH 078/261] Create mini broadcast function test --- .../ServerMiniBroadcastFunctionTest.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java new file mode 100644 index 000000000..fa705d6a2 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java @@ -0,0 +1,54 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.ServerMiniBroadcastFunction; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ServerMiniBroadcastFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new ServerMiniBroadcastFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataTest() { + MockPlatform platform = this.factory.inject().getPlatform(); + String data = "test"; + String json = MiniMessageManager.get().toJson(data); + Function function = new ServerMiniBroadcastFunction(); + function.setData(data); + assertTrue(function.function(this.factory.createPlayer())); + List messages = platform.getBroadcastMessages(); + assertTrue(messages.size() == 1); + assertEquals(json, messages.get(0)); + } +} \ No newline at end of file From 5f83a5de53d6517ad84bead27c616eb45a588b2c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:02:25 -0800 Subject: [PATCH 079/261] Create set amount function test --- .../core/function/impl/SetAmountFunction.java | 33 +++++---- .../test/function/SetAmountFunctionTest.java | 72 +++++++++++++++++++ .../test/mock/inventory/MockItemStack.java | 12 ++-- .../mock/inventory/MockItemStackWrapper.java | 8 +++ 4 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java index 1363c84ad..e9b504e0b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java @@ -41,26 +41,25 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - try { - Integer amount = Integer.parseInt(this.getData()); - item.setAmount(amount); - inv.setItem(slot.getIndex(), item); - return true; - } catch(Exception ex) { - DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as an amount"); - return false; - } + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + try { + Integer amount = Integer.parseInt(this.getData()); + item.setAmount(amount); + inv.setItem(slot.getIndex(), item); + return true; + } catch(Exception ex) { + DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as an amount"); + return false; } } } + } return false; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java new file mode 100644 index 000000000..572f9487c --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java @@ -0,0 +1,72 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetAmountFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetAmountFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetAmountFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void nonSlotOwnerTest() { + Function function = new SetAmountFunction(); + function.setOwner(this.factory.createGui("test")); + function.setData("1"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataTest() { + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + int newAmount = 2; + Slot slot = this.factory.createSlot(); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.factory.createGui("test", slots); + InventoryWrapper inventory = gui.buildInventory(player); + slot.setOwner(gui); + Function function = new SetAmountFunction(); + function.setOwner(slot); + function.setData("" + newAmount); + assertTrue(function.function(player)); + assertEquals(newAmount, inventory.getItem(slot.getIndex()).getAmount()); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index d9796f541..e268410b6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -19,7 +19,7 @@ public class MockItemStack { private final String type; - private final int quantity; + private int amount; public MockItemStack(String type) { this(type, 1); @@ -27,14 +27,18 @@ public MockItemStack(String type) { public MockItemStack(String type, int quantity) { this.type = type; - this.quantity = quantity; + this.amount = quantity; } public String getType() { return this.type; } - public int getQuantity() { - return this.quantity; + public int getAmount() { + return this.amount; + } + + public void setAmount(int amount) { + this.amount = amount; } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index c6cba3394..58915f564 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -28,4 +28,12 @@ public MockItemStackWrapper(MockItemStack itemStack) { public String getType() { return this.getItemStack().getType(); } + + public int getAmount() { + return this.getItemStack().getAmount(); + } + + public void setAmount(int amount) { + this.getItemStack().setAmount(amount); + } } From 677569e35e401f43ad2e5fb9892795df5b6aa897 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:09:58 -0800 Subject: [PATCH 080/261] Use closeable componenet Use CloseableComponent for classes that define getClose() and setClose(close) methods. This allows us to not have to check multiple different instance types. --- .../core/function/impl/SetCloseFunction.java | 22 +++++----------- .../clubobsidian/dynamicgui/core/gui/Gui.java | 5 +++- .../dynamicgui/core/gui/Slot.java | 5 +++- .../core/gui/property/CloseableComponent.java | 25 +++++++++++++++++++ 4 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java index dbdaa5d9f..63f92fa6f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java @@ -20,6 +20,7 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; public class SetCloseFunction extends Function { @@ -37,22 +38,11 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - try { - Boolean value = Boolean.valueOf(this.getData()); - if(value != null) { - if(this.getOwner() instanceof Slot) { - Slot slot = (Slot) this.getOwner(); - slot.setClose(value); - return true; - } else if(this.getOwner() instanceof Gui) { - Gui gui = (Gui) this.getOwner(); - gui.setClose(value); - return true; - } - } - } catch(Exception ex) { - DynamicGui.get().getLogger().info("Error parsing value " + this.getData() + " for setclose function"); - ex.printStackTrace(); + boolean value = Boolean.valueOf(this.getData()); + if(this.getOwner() instanceof CloseableComponent) { + CloseableComponent component = (CloseableComponent) this.getOwner(); + component.setClose(value); + return true; } return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index bf7c77c67..95160efc3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.core.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; @@ -31,7 +32,7 @@ import java.util.Map; -public class Gui implements Serializable, FunctionOwner, MetadataHolder { +public class Gui implements Serializable, FunctionOwner, MetadataHolder, CloseableComponent { /** * @@ -130,10 +131,12 @@ public List getSlots() { return this.slots; } + @Override public Boolean getClose() { return this.close; } + @Override public void setClose(Boolean close) { this.close = close; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 3dc6bea9a..7948f8a7b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; @@ -32,7 +33,7 @@ import java.util.List; import java.util.Map; -public class Slot implements Serializable, FunctionOwner, AnimationHolder, MetadataHolder { +public class Slot implements Serializable, FunctionOwner, AnimationHolder, MetadataHolder, CloseableComponent { /** * @@ -145,10 +146,12 @@ public List getItemFlags() { return this.itemFlags; } + @Override public Boolean getClose() { return this.close; } + @Override public void setClose(Boolean close) { this.close = close; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java new file mode 100644 index 000000000..dd9811d83 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java @@ -0,0 +1,25 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.gui.property; + +public interface CloseableComponent { + + Boolean getClose(); + + void setClose(Boolean close); + +} From d4d859a2ab27ca28c54ec8f2f79f9ba591f2a88e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:12:58 -0800 Subject: [PATCH 081/261] Refactor set data function -> set durability Renamed SetDataFunction to SetDurabilityFunction, added additional aliases --- .../com/clubobsidian/dynamicgui/core/DynamicGui.java | 5 ++--- ...SetDataFunction.java => SetDurabilityFunction.java} | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{SetDataFunction.java => SetDurabilityFunction.java} (88%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index ebc59e3a6..2fcb4cf60 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -18,7 +18,6 @@ import com.clubobsidian.dynamicgui.core.config.ChatColorColorizer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; @@ -50,7 +49,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.ServerMiniBroadcastFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetAmountFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetCloseFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetDataFunction; +import com.clubobsidian.dynamicgui.core.function.impl.SetDurabilityFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetEnchantsFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.SetGlowFunction; @@ -327,7 +326,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new SetNameFunction()); FunctionManager.get().addFunction(new SetLoreFunction()); FunctionManager.get().addFunction(new SetTypeFunction()); - FunctionManager.get().addFunction(new SetDataFunction()); + FunctionManager.get().addFunction(new SetDurabilityFunction()); FunctionManager.get().addFunction(new SetAmountFunction()); FunctionManager.get().addFunction(new SetNBTFunction()); FunctionManager.get().addFunction(new SetGlowFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java similarity index 88% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDataFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java index b90217df6..dda0738b2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java @@ -24,15 +24,15 @@ import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; -public class SetDataFunction extends Function { +public class SetDurabilityFunction extends Function { /** * */ private static final long serialVersionUID = 6943230273788425141L; - public SetDataFunction() { - super("setdata"); + public SetDurabilityFunction() { + super("setdata", "setdura", "setdurability"); } @Override @@ -51,8 +51,8 @@ public boolean function(PlayerWrapper playerWrapper) { ItemStackWrapper item = slot.getItemStack(); try { - short dura = Short.parseShort(this.getData()); - item.setDurability(dura); + short durability = Short.parseShort(this.getData()); + item.setDurability(durability); inv.setItem(slot.getIndex(), item); return true; } catch(Exception ex) { From a625dd2152b9f0561049ee3c428c3c2752b0cc85 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:15:55 -0800 Subject: [PATCH 082/261] Add set amount function test for invalid data --- .../test/function/SetAmountFunctionTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java index 572f9487c..4299740a8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java @@ -51,6 +51,23 @@ public void nonSlotOwnerTest() { assertFalse(function.function(this.factory.createPlayer())); } + @Test + public void invalidDataTest() { + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.factory.createGui("test", slots); + gui.buildInventory(player); + slot.setOwner(gui); + Function function = new SetAmountFunction(); + function.setOwner(slot); + function.setData("a"); + assertFalse(function.function(player)); + } + @Test public void dataTest() { this.factory.inject(); From 717fa351fa4526557551bccdab4708d554e059d3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:24:12 -0800 Subject: [PATCH 083/261] Test set close function --- .../core/function/impl/SetCloseFunction.java | 3 - .../test/function/SetCloseFunctionTest.java | 69 +++++++++++++++++++ .../test/mock/gui/CloseableFunctionOwner.java | 41 +++++++++++ .../mock/gui/NonCloseableFunctionOwner.java | 28 ++++++++ 4 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java index 63f92fa6f..ec218efdc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java @@ -15,11 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; -import com.clubobsidian.dynamicgui.core.gui.Gui; -import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; public class SetCloseFunction extends Function { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java new file mode 100644 index 000000000..e7e71e49e --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java @@ -0,0 +1,69 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetCloseFunction; +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.gui.CloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.gui.NonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetCloseFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetCloseFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void nonCloseableComponentTest() { + Function function = new SetCloseFunction(); + function.setOwner(new NonCloseableFunctionOwner()); + function.setData("true"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void invalidDataTest() { + Function function = new SetCloseFunction(); + CloseableComponent component = new CloseableFunctionOwner(); + function.setOwner((FunctionOwner) component); + function.setData("a"); + assertTrue(function.function(this.factory.createPlayer())); + assertEquals(false, component.getClose()); + } + + @Test + public void validDataTest() { + Function function = new SetCloseFunction(); + CloseableComponent component = new CloseableFunctionOwner(); + function.setOwner((FunctionOwner) component); + function.setData("true"); + assertTrue(function.function(this.factory.createPlayer())); + assertEquals(true, component.getClose()); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java new file mode 100644 index 000000000..833827095 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java @@ -0,0 +1,41 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.mock.gui; + +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; + +public class CloseableFunctionOwner implements FunctionOwner, CloseableComponent { + + private Boolean close; + + @Override + public FunctionTree getFunctions() { + return null; + } + + @Override + public Boolean getClose() { + return this.close; + } + + @Override + public void setClose(Boolean close) { + this.close = close; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java new file mode 100644 index 000000000..1a260ec64 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java @@ -0,0 +1,28 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.mock.gui; + +import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; +import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; + +public class NonCloseableFunctionOwner implements FunctionOwner { + + @Override + public FunctionTree getFunctions() { + return null; + } +} From fed6ab1eab6c5f37449106368373784027452dac Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:29:04 -0800 Subject: [PATCH 084/261] Create set durability function test --- .../function/impl/SetDurabilityFunction.java | 33 ++++--- .../function/SetDurabilityFunctionTest.java | 88 +++++++++++++++++++ .../test/mock/inventory/MockItemStack.java | 9 ++ .../mock/inventory/MockItemStackWrapper.java | 12 +++ 4 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java index dda0738b2..bd2811a2c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java @@ -41,24 +41,21 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - - try { - short durability = Short.parseShort(this.getData()); - item.setDurability(durability); - inv.setItem(slot.getIndex(), item); - return true; - } catch(Exception ex) { - DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as durability"); - return false; - } + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + try { + short durability = Short.parseShort(this.getData()); + item.setDurability(durability); + inv.setItem(slot.getIndex(), item); + return true; + } catch(Exception ex) { + DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as durability"); + return false; } } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java new file mode 100644 index 000000000..32b2981aa --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetDurabilityFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetDurabilityFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetDurabilityFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void nonSlotOwnerTest() { + Function function = new SetDurabilityFunction(); + function.setOwner(this.factory.createGui("test")); + function.setData("1"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void invalidDataTest() { + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.factory.createGui("test", slots); + gui.buildInventory(player); + slot.setOwner(gui); + Function function = new SetDurabilityFunction(); + function.setOwner(slot); + function.setData("a"); + assertFalse(function.function(player)); + } + + @Test + public void dataTest() { + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + int newDurability = 2; + Slot slot = this.factory.createSlot(); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.factory.createGui("test", slots); + InventoryWrapper inventory = gui.buildInventory(player); + slot.setOwner(gui); + Function function = new SetDurabilityFunction(); + function.setOwner(slot); + function.setData("" + newDurability); + assertTrue(function.function(player)); + assertEquals(newDurability, inventory.getItem(slot.getIndex()).getDurability()); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index e268410b6..a0f23021a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -20,6 +20,7 @@ public class MockItemStack { private final String type; private int amount; + private short durability = 0; public MockItemStack(String type) { this(type, 1); @@ -41,4 +42,12 @@ public int getAmount() { public void setAmount(int amount) { this.amount = amount; } + + public short getDurability() { + return this.durability; + } + + public void setDurability(short durability) { + this.durability = durability; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 58915f564..e5b52bb6c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -29,11 +29,23 @@ public String getType() { return this.getItemStack().getType(); } + @Override public int getAmount() { return this.getItemStack().getAmount(); } + @Override public void setAmount(int amount) { this.getItemStack().setAmount(amount); } + + @Override + public short getDurability() { + return this.getItemStack().getDurability(); + } + + @Override + public void setDurability(short durability) { + this.getItemStack().setDurability(durability); + } } From 3c879096c922251ba1d042760dbffd8e507c2ffe Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:34:02 -0800 Subject: [PATCH 085/261] Test for thread interrupt in delay function --- .../core/test/function/DelayFunctionTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index b44d0f858..a54a3c14c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -21,6 +21,8 @@ import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.jupiter.api.Test; +import java.util.concurrent.atomic.AtomicBoolean; + import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -41,6 +43,26 @@ public void testNonNumber() { assertFalse(function.function(this.factory.createPlayer())); } + @Test + public void testInterrupt() { + AtomicBoolean value = new AtomicBoolean(true); + Thread thread = new Thread(() -> { + Function function = new DelayFunction(); + function.setData("5000"); + value.set(function.function(this.factory.createPlayer())); + }); + thread.start(); + thread.interrupt(); + while(thread.isAlive()) { + try { + Thread.sleep(1); + } catch(InterruptedException e) { + e.printStackTrace(); + } + } + assertFalse(value.get()); + } + @Test public void testValidData() { Function function = new DelayFunction(); From ccc1017587f19e3bb1bb4ab311ec3c9e0431250e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:36:20 -0800 Subject: [PATCH 086/261] Add catch for infinite loop --- .../dynamicgui/core/test/function/DelayFunctionTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index a54a3c14c..49d3770d0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -53,9 +53,14 @@ public void testInterrupt() { }); thread.start(); thread.interrupt(); + int count = 0; while(thread.isAlive()) { try { Thread.sleep(1); + count += 1; + if(count > 1000) { + break; //Just so the test doesn't get stuck in an infinite loop + } } catch(InterruptedException e) { e.printStackTrace(); } From b9abbb0dd203347cfc9a9519fa6126108a5eae66 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:48:23 -0800 Subject: [PATCH 087/261] Move SoundWrapper to effect package --- .../dynamicgui/core/{sound => effect}/SoundWrapper.java | 2 +- .../dynamicgui/core/function/impl/SoundFunction.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/{sound => effect}/SoundWrapper.java (96%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/sound/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java similarity index 96% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/sound/SoundWrapper.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index ee71310d1..cbfdaf8fb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/sound/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.sound; +package com.clubobsidian.dynamicgui.core.effect; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java index 533420260..7906de4ed 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java @@ -17,7 +17,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; -import com.clubobsidian.dynamicgui.core.sound.SoundWrapper; +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; public class SoundFunction extends Function { From cfed0ebc0243b07700d95ed34678ed779105d90d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 12 Feb 2022 23:57:53 -0800 Subject: [PATCH 088/261] Refactor sound wrapper to use sound data class Use inner sound data class for storing data for the sound wrapper, which is then used when sending sound data. --- .../bukkit/entity/BukkitPlayerWrapper.java | 6 +- .../dynamicgui/core/effect/SoundWrapper.java | 55 +++++++++++++++---- .../dynamicgui/core/entity/PlayerWrapper.java | 3 +- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index ef9b6462e..c393ca659 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -19,6 +19,7 @@ import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; @@ -137,7 +138,10 @@ public void sendPluginMessage(DynamicGuiPlugin plugin, String channel, byte[] me } @Override - public void playSound(String sound, Float volume, Float pitch) { + public void playSound(SoundWrapper.SoundData soundData) { + String sound = soundData.getSound(); + float volume = soundData.getVolume(); + float pitch = soundData.getPitch(); Player player = this.getPlayer(); Location playerLocation = player.getLocation(); player.playSound(playerLocation, Sound.valueOf(sound), volume, pitch); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index cbfdaf8fb..613cef98b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -25,24 +25,55 @@ public class SoundWrapper implements Serializable { * */ private static final long serialVersionUID = -8096584636206059158L; - private final String sound; - private final Float volume; - private final Float pitch; + + private final SoundData data; public SoundWrapper(String str) { - String[] args = str.split(","); - this.sound = args[0]; - this.volume = Float.parseFloat(args[1]); - this.pitch = Float.parseFloat(args[2]); + this(SoundData.fromString(str)); + } + + public SoundWrapper(SoundData data) { + this.data = data; } - public SoundWrapper(String sound, Float volume, Float pitch) { - this.sound = sound; - this.volume = volume; - this.pitch = pitch; + public SoundData getData() { + return this.data; } public void playSoundToPlayer(PlayerWrapper player) { - player.playSound(this.sound, this.volume, this.pitch); + player.playSound(this.data); + } + + public static class SoundData { + + public static SoundData fromString(String str) { + String[] args = str.split(","); + String sound = args[0]; + float volume = Float.parseFloat(args[1]); + float pitch = Float.parseFloat(args[2]); + return new SoundData(sound, volume, pitch); + } + + private final String sound; + private final float volume; + private final float pitch; + + private SoundData(String sound, float volume, float pitch) { + this.sound = sound; + this.volume = volume; + this.pitch = pitch; + } + + public String getSound() { + return this.sound; + } + + public float getVolume() { + return this.volume; + } + + public float getPitch() { + return this.pitch; + } } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index 503c84470..ba8deae45 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.core.entity; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; @@ -67,7 +68,7 @@ public T getPlayer() { public abstract void sendPluginMessage(DynamicGuiPlugin plugin, String channel, byte[] message); - public abstract void playSound(String sound, Float volume, Float pitch); + public abstract void playSound(SoundWrapper.SoundData soundData); public abstract void playEffect(ParticleWrapper.ParticleData particleData); From 18138a3dec914493c2ab03d6354a297f2f54ddf4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:00:41 -0800 Subject: [PATCH 089/261] Validate arguments when creating sound data from string --- .../dynamicgui/core/effect/SoundWrapper.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index 613cef98b..a4222c75e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -47,11 +47,16 @@ public void playSoundToPlayer(PlayerWrapper player) { public static class SoundData { public static SoundData fromString(String str) { - String[] args = str.split(","); - String sound = args[0]; - float volume = Float.parseFloat(args[1]); - float pitch = Float.parseFloat(args[2]); - return new SoundData(sound, volume, pitch); + if(str.contains(",")) { + String[] args = str.split(","); + if(args.length == 3) { + String sound = args[0]; + float volume = Float.parseFloat(args[1]); + float pitch = Float.parseFloat(args[2]); + return new SoundData(sound, volume, pitch); + } + } + return new SoundData(null, 0f, 0f); } private final String sound; From d4b23ff76986be3f4f0f56a9b5954a79ec89003d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:01:59 -0800 Subject: [PATCH 090/261] Refactor ParticleWrapper, accept ParticleData class in constructor Create a second constructor that takes ParticleData. Make ParticleData a static class. Remove un-needed redundant else statement in fromString(String) --- .../core/effect/ParticleWrapper.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java index 42a91e61a..c68bf2929 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java @@ -27,26 +27,34 @@ public class ParticleWrapper implements Serializable { * */ private static final long serialVersionUID = -5003322741003989392L; + private final ParticleData data; public ParticleWrapper(String str) { - this.data = this.loadFromString(str); + this(ParticleData.fromString(str)); } - private ParticleData loadFromString(String str) { - if(str.contains(",")) { - String[] args = str.split(","); - return new ParticleData(args[0].toUpperCase(), NumberUtils.toInt(args[1])); - } else { - return new ParticleData(str, 0); - } + public ParticleWrapper(ParticleData data) { + this.data = data; + } + + public ParticleData getData() { + return this.data; } public void spawnEffect(PlayerWrapper player) { player.playEffect(this.data); } - public class ParticleData { + public static class ParticleData { + + public static ParticleData fromString(String str) { + if(str.contains(",")) { + String[] args = str.split(","); + return new ParticleData(args[0].toUpperCase(), NumberUtils.toInt(args[1])); + } + return new ParticleData(str, 0); + } private final String effect; private final int extraData; From cba5a5d9f27346a87b68dbf8464f541a276d97c6 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:03:15 -0800 Subject: [PATCH 091/261] When creating sound data catch the number format exception --- .../dynamicgui/core/effect/SoundWrapper.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index a4222c75e..84600b6ac 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -50,10 +50,14 @@ public static SoundData fromString(String str) { if(str.contains(",")) { String[] args = str.split(","); if(args.length == 3) { - String sound = args[0]; - float volume = Float.parseFloat(args[1]); - float pitch = Float.parseFloat(args[2]); - return new SoundData(sound, volume, pitch); + try { + String sound = args[0]; + float volume = Float.parseFloat(args[1]); + float pitch = Float.parseFloat(args[2]); + return new SoundData(sound, volume, pitch); + } catch(NumberFormatException ex) { + //Don't do anything if invalid format + } } } return new SoundData(null, 0f, 0f); From f0817e33f30f67a41ae566f7d0ca8795d1f53f08 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:08:14 -0800 Subject: [PATCH 092/261] Rename isAsync -> async in ThreadUtil --- .../com/clubobsidian/dynamicgui/core/util/ThreadUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java index 395786b15..4b6178472 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java @@ -6,10 +6,10 @@ public final class ThreadUtil { - public static void run(Runnable runnable, boolean isAsync) { + public static void run(Runnable runnable, boolean async) { Platform server = DynamicGui.get().getPlatform(); Scheduler scheduler = server.getScheduler(); - if(isAsync) { + if(async) { scheduler.runAsynchronousDelayedTask(runnable, 0); } else { if(!server.isMainThread()) { From 683c3542f4b62caacf5bbb8841ca367d864f0143 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:10:06 -0800 Subject: [PATCH 093/261] Rename ServerType -> PlatformType --- .../dynamicgui/bukkit/platform/BukkitPlatform.java | 6 +++--- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 4 ++-- .../com/clubobsidian/dynamicgui/core/server/Platform.java | 2 +- .../core/server/{ServerType.java => PlatformType.java} | 2 +- .../dynamicgui/core/test/mock/plugin/MockPlatform.java | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/server/{ServerType.java => PlatformType.java} (96%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index 3470df55f..61d0c963f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -25,7 +25,7 @@ import com.clubobsidian.dynamicgui.core.proxy.Proxy; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.server.ServerType; +import com.clubobsidian.dynamicgui.core.server.PlatformType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; @@ -97,8 +97,8 @@ public int getGlobalPlayerCount() { } @Override - public ServerType getType() { - return ServerType.SPIGOT; + public PlatformType getType() { + return PlatformType.SPIGOT; } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 086768cfe..3620b7c64 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -30,7 +30,7 @@ import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.server.ServerType; +import com.clubobsidian.dynamicgui.core.server.PlatformType; import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.dynamicgui.core.util.HashUtil; import com.clubobsidian.dynamicgui.core.util.ThreadUtil; @@ -217,7 +217,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu } Platform server = DynamicGui.get().getPlatform(); - if(server.getType() == ServerType.SPONGE) { + if(server.getType() == PlatformType.SPONGE) { server.getScheduler().runSyncDelayedTask(() -> { playerWrapper.openInventory(inventoryWrapper); }, 1L); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java index a266d841b..af5088d38 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java @@ -44,7 +44,7 @@ public interface Platform { int getGlobalPlayerCount(); - ServerType getType(); + PlatformType getType(); void registerOutgoingPluginChannel(DynamicGuiPlugin plugin, String channel); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/ServerType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java similarity index 96% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/server/ServerType.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java index 4ffdadfc3..f59446e10 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/ServerType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.server; -public enum ServerType { +public enum PlatformType { SPONGE, SPIGOT diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 2d850364f..0fff78f41 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -21,7 +21,7 @@ import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.server.ServerType; +import com.clubobsidian.dynamicgui.core.server.PlatformType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import java.util.ArrayList; @@ -92,7 +92,7 @@ public int getGlobalPlayerCount() { } @Override - public ServerType getType() { + public PlatformType getType() { return null; } From 041ab52c088a48a7787d782e0d1e141f987db9d4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:10:57 -0800 Subject: [PATCH 094/261] Rename spigot platform type to bukkit --- .../clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java | 2 +- .../com/clubobsidian/dynamicgui/core/server/PlatformType.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index 61d0c963f..870b64e1a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -98,7 +98,7 @@ public int getGlobalPlayerCount() { @Override public PlatformType getType() { - return PlatformType.SPIGOT; + return PlatformType.BUKKIT; } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java index f59446e10..7ae8597a5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java @@ -17,7 +17,7 @@ public enum PlatformType { + BUKKIT, SPONGE, - SPIGOT } \ No newline at end of file From 802ae4d6e7be00541224e6482b1f169653b61adc Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:11:49 -0800 Subject: [PATCH 095/261] Repackage core server package classes into platform package --- .../dynamicgui/bukkit/inject/BukkitPluginModule.java | 2 +- .../dynamicgui/bukkit/platform/BukkitPlatform.java | 4 ++-- .../clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java | 2 +- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 2 +- .../dynamicgui/core/inject/module/PluginModule.java | 2 +- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 4 ++-- .../core/manager/dynamicgui/cooldown/CooldownManager.java | 2 +- .../dynamicgui/core/{server => platform}/Platform.java | 2 +- .../dynamicgui/core/{server => platform}/PlatformType.java | 2 +- .../com/clubobsidian/dynamicgui/core/util/ThreadUtil.java | 2 +- .../clubobsidian/dynamicgui/core/test/mock/MockFactory.java | 2 +- .../dynamicgui/core/test/mock/inject/MockPluginModule.java | 2 +- .../dynamicgui/core/test/mock/plugin/MockPlatform.java | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/{server => platform}/Platform.java (97%) rename core/src/main/java/com/clubobsidian/dynamicgui/core/{server => platform}/PlatformType.java (93%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index 53a7f58ac..a0552039c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -29,7 +29,7 @@ import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; public class BukkitPluginModule extends PluginModule { diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index 870b64e1a..bea7e7b53 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -24,8 +24,8 @@ import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.proxy.Proxy; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.server.PlatformType; +import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.platform.PlatformType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 33cf84e1b..3ceb0a7e9 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -42,7 +42,7 @@ import com.clubobsidian.dynamicgui.core.permission.Permission; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.SimpleCommandMap; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 2fcb4cf60..661f3041b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -95,7 +95,7 @@ import com.clubobsidian.dynamicgui.core.registry.replacer.impl.DynamicGuiReplacerRegistry; import com.clubobsidian.dynamicgui.core.registry.replacer.impl.MetadataReplacerRegistry; import com.clubobsidian.dynamicgui.core.replacer.Replacer; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.trident.EventBus; import com.clubobsidian.trident.eventbus.methodhandle.MethodHandleEventBus; import com.clubobsidian.wrappy.Configuration; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 5bd3a1466..d4b762c0c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -23,7 +23,7 @@ import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.google.inject.Binder; import com.google.inject.Guice; import com.google.inject.Module; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 3620b7c64..21a6fd9f5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -29,8 +29,8 @@ import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.server.PlatformType; +import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.platform.PlatformType; import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.dynamicgui.core.util.HashUtil; import com.clubobsidian.dynamicgui.core.util.ThreadUtil; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java index 2a4a91220..5c17728ba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java @@ -17,7 +17,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java index af5088d38..979648050 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/Platform.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.server; +package com.clubobsidian.dynamicgui.core.platform; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java index 7ae8597a5..2714a9455 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/server/PlatformType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.server; +package com.clubobsidian.dynamicgui.core.platform; public enum PlatformType { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java index 4b6178472..37e45e53f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java @@ -2,7 +2,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; public final class ThreadUtil { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index bdc0a6c00..39385afce 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -24,7 +24,7 @@ import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.inject.MockPluginModule; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java index e369eb5c9..857e9edd5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java @@ -24,7 +24,7 @@ import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.server.Platform; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockEntityManager; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockInventoryManager; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockItemStackManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 0fff78f41..d6a6191ac 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -20,8 +20,8 @@ import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.core.server.Platform; -import com.clubobsidian.dynamicgui.core.server.PlatformType; +import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.platform.PlatformType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import java.util.ArrayList; From 3d4b5d36297b1bd0609eb0e8cc14f385d568b09f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:19:10 -0800 Subject: [PATCH 096/261] Make animation package a subpackage of gui property --- .../main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java | 2 +- .../core/{ => gui/property}/animation/AnimationHolder.java | 2 +- .../core/{ => gui/property}/animation/Refreshable.java | 2 +- .../core/manager/dynamicgui/AnimationReplacerManager.java | 2 +- .../core/registry/replacer/AnimationReplacerRegistry.java | 2 +- .../replacer/impl/DynamicGuiAnimationReplacerRegistry.java | 2 +- .../dynamicgui/core/replacer/AnimationReplacer.java | 2 +- .../replacer/animation/impl/MultiLineTestAnimationReplacer.java | 2 +- .../core/replacer/animation/impl/TestAnimationReplacer.java | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/{ => gui/property}/animation/AnimationHolder.java (92%) rename core/src/main/java/com/clubobsidian/dynamicgui/core/{ => gui/property}/animation/Refreshable.java (91%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 7948f8a7b..ccdd4c09d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.gui; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/AnimationHolder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java similarity index 92% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/animation/AnimationHolder.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java index 69e3d92b2..ae1be442d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/AnimationHolder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.animation; +package com.clubobsidian.dynamicgui.core.gui.property.animation; public interface AnimationHolder extends Refreshable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/Refreshable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java similarity index 91% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/animation/Refreshable.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java index e8f855c43..fff08a585 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/animation/Refreshable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.animation; +package com.clubobsidian.dynamicgui.core.gui.property.animation; public interface Refreshable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java index 2fa1eca85..b84118183 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.registry.replacer.AnimationReplacerRegistry; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java index bd8ce1539..58765e3f2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.registry.replacer; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public interface AnimationReplacerRegistry { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java index 5a94fdbe1..c9569ea13 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.registry.replacer.impl; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.registry.replacer.AnimationReplacerRegistry; import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java index 45dda75df..955c9df1d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.replacer; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; public abstract class AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java index 0908aad5a..8137efcd2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.replacer.animation.impl; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java index a90403b30..c88ab1c51 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.replacer.animation.impl; -import com.clubobsidian.dynamicgui.core.animation.AnimationHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; From 82bb536f9327cada8b8ebc898b364c79b42653d2 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:24:16 -0800 Subject: [PATCH 097/261] Rename Action to PlayerAction --- .../bukkit/listener/PlayerInteractListener.java | 4 ++-- .../dynamicgui/core/event/block/PlayerInteractEvent.java | 8 ++++---- .../core/event/player/{Action.java => PlayerAction.java} | 2 +- .../dynamicgui/core/listener/PlayerInteractListener.java | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/{Action.java => PlayerAction.java} (96%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index 7e35f2529..18a61227c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -18,7 +18,7 @@ import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.event.player.Action; +import com.clubobsidian.dynamicgui.core.event.player.PlayerAction; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import org.bukkit.entity.Player; @@ -31,7 +31,7 @@ public class PlayerInteractListener implements Listener { @EventHandler public void interact(final PlayerInteractEvent e) { if(e.getClickedBlock() != null) { - Action action = Action.valueOf(e.getAction().toString()); + PlayerAction action = PlayerAction.valueOf(e.getAction().toString()); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); LocationWrapper locationWrapper = LocationManager.get().toLocationWrapper(e.getClickedBlock().getLocation()); com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent interactEvent = new com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent(playerWrapper, locationWrapper, action); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java index db16e35ce..d01a2323b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java @@ -18,22 +18,22 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.event.LocationEvent; -import com.clubobsidian.dynamicgui.core.event.player.Action; +import com.clubobsidian.dynamicgui.core.event.player.PlayerAction; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; import com.clubobsidian.trident.Cancellable; public class PlayerInteractEvent extends LocationEvent implements Cancellable { - private final Action action; + private final PlayerAction action; private boolean canceled; - public PlayerInteractEvent(PlayerWrapper playerWrapper, LocationWrapper locationWrapper, Action action) { + public PlayerInteractEvent(PlayerWrapper playerWrapper, LocationWrapper locationWrapper, PlayerAction action) { super(playerWrapper, locationWrapper); this.action = action; this.canceled = false; } - public Action getAction() { + public PlayerAction getAction() { return this.action; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/Action.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java similarity index 96% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/Action.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java index 5c99db8f8..9d911e983 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/Action.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core.event.player; -public enum Action { +public enum PlayerAction { LEFT_CLICK_AIR, LEFT_CLICK_BLOCK, diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 82cab310d..55f70e70a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent; -import com.clubobsidian.dynamicgui.core.event.player.Action; +import com.clubobsidian.dynamicgui.core.event.player.PlayerAction; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; @@ -26,7 +26,7 @@ public class PlayerInteractListener { @EventHandler public void playerInteract(final PlayerInteractEvent e) { - if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_BLOCK) { + if(e.getAction() == PlayerAction.RIGHT_CLICK_BLOCK || e.getAction() == PlayerAction.LEFT_CLICK_BLOCK) { if(GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) { return; } From 2ad58305cbf9c0dcf998c19bd1aedb235a57810a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:28:16 -0800 Subject: [PATCH 098/261] Create isBlockClick method in PlayerAction Refactor check if a block is clicked out of the PlayerInteractListener, instead put this logic in PlayerAction --- .../dynamicgui/core/event/player/PlayerAction.java | 5 ++++- .../dynamicgui/core/listener/PlayerInteractListener.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java index 9d911e983..2416b1361 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java @@ -21,6 +21,9 @@ public enum PlayerAction { LEFT_CLICK_BLOCK, RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK, - PHYSICAL + PHYSICAL; + public boolean isBlockClick(PlayerAction action) { + return action == PlayerAction.RIGHT_CLICK_BLOCK || action == PlayerAction.LEFT_CLICK_BLOCK + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 55f70e70a..42e79daf7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -26,7 +26,7 @@ public class PlayerInteractListener { @EventHandler public void playerInteract(final PlayerInteractEvent e) { - if(e.getAction() == PlayerAction.RIGHT_CLICK_BLOCK || e.getAction() == PlayerAction.LEFT_CLICK_BLOCK) { + if(e.getAction().isBlockClick(e.getAction())) { if(GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) { return; } From ea5c3706c0f970292be74371d0c20a89a8a21fee Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:28:40 -0800 Subject: [PATCH 099/261] Woops, add missing semicolon --- .../clubobsidian/dynamicgui/core/event/player/PlayerAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java index 2416b1361..29f0f8c87 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java @@ -24,6 +24,6 @@ public enum PlayerAction { PHYSICAL; public boolean isBlockClick(PlayerAction action) { - return action == PlayerAction.RIGHT_CLICK_BLOCK || action == PlayerAction.LEFT_CLICK_BLOCK + return action == PlayerAction.RIGHT_CLICK_BLOCK || action == PlayerAction.LEFT_CLICK_BLOCK; } } \ No newline at end of file From d03f5c9143e3e57886486009ce3f2aedd034f43e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:34:56 -0800 Subject: [PATCH 100/261] Create ArrayList with copy constructor when returning list of functions --- .../dynamicgui/core/manager/dynamicgui/FunctionManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 7c11da11e..7175cb5b2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -65,9 +65,7 @@ public Function getFunctionByName(String functionName) { } public List getFunctions() { - List funcs = new ArrayList<>(); - funcs.addAll(this.functions.values()); - return funcs; + return new ArrayList<>(this.functions.values()); } public boolean addFunction(Function function) { From db13dc4ebfb8c464b6abe894bf0ab237fe66d507 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:42:51 -0800 Subject: [PATCH 101/261] Make player gui map unmodifiable --- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 21a6fd9f5..9ed74de79 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -48,6 +48,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -132,7 +133,7 @@ public List getGuis() { } public Map getPlayerGuis() { - return this.playerGuis; + return Collections.unmodifiableMap(this.playerGuis); } public boolean hasGuiCurrently(PlayerWrapper playerWrapper) { From 35f1ca639dbf958c607f31ac087328bf26e78645 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:45:53 -0800 Subject: [PATCH 102/261] Refactor player related methods in gui manager --- .../clubobsidian/dynamicgui/core/listener/GuiListener.java | 4 ++-- .../dynamicgui/core/listener/InventoryCloseListener.java | 2 +- .../core/listener/InventoryInteractListener.java | 4 ++-- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 7 ++++--- .../registry/replacer/impl/MetadataReplacerRegistry.java | 2 +- .../dynamicgui/core/replacer/impl/PreviousGuiReplacer.java | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index 93b6011c2..027519c13 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -39,7 +39,7 @@ public GuiListener() { @EventHandler public void onGuiOpen(GuiLoadEvent event) { PlayerWrapper wrapper = event.getPlayerWrapper(); - Gui gui = GuiManager.get().getCurrentGui(wrapper); + Gui gui = GuiManager.get().getPlayerGui(wrapper); PlayerWrapper playerWrapper = event.getPlayerWrapper(); boolean open = (gui != null); if(open) { @@ -54,7 +54,7 @@ public void onClose(InventoryCloseEvent event) { PlayerWrapper playerWrapper = event.getPlayerWrapper(); UUID uuid = playerWrapper.getUniqueId(); if(!this.users.remove(uuid)) { - Gui gui = GuiManager.get().getCurrentGui(playerWrapper); + Gui gui = GuiManager.get().getPlayerGui(playerWrapper); if(gui != null) { FunctionManager.get().tryFunctions(gui, FunctionType.EXIT_MENU, playerWrapper); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java index edb9ba02e..fb901ab82 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java @@ -42,7 +42,7 @@ public void onKick(final PlayerKickEvent e) { private void handleInventoryClose(PlayerWrapper playerWrapper) { if(GuiManager.get().hasGuiCurrently(playerWrapper)) { - GuiManager.get().cleanupGui(playerWrapper); + GuiManager.get().cleanupPlayerGui(playerWrapper); } } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 2160427a7..1c11b51e7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -43,7 +43,7 @@ public void invClick(final InventoryClickEvent e) { return; } - Gui gui = GuiManager.get().getCurrentGui(player); + Gui gui = GuiManager.get().getPlayerGui(player); Slot slot = this.getSlotFromIndex(gui, e.getSlot()); if(slot == null && e.getView() != InventoryView.BOTTOM) { @@ -99,7 +99,7 @@ public void onDrag(InventoryDragEvent e) { return; } - Gui gui = GuiManager.get().getCurrentGui(player); + Gui gui = GuiManager.get().getPlayerGui(player); Iterator>> it = e.getSlotItems().entrySet().iterator(); while(it.hasNext()) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 9ed74de79..e8ef0f415 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -143,14 +143,15 @@ public boolean hasGuiCurrently(PlayerWrapper playerWrapper) { public boolean hasGuiOpen(PlayerWrapper playerWrapper) { if(playerWrapper.getOpenInventoryWrapper() == null) { return false; - } else return this.hasGuiCurrently(playerWrapper); + } + return this.hasGuiCurrently(playerWrapper); } - public void cleanupGui(PlayerWrapper playerWrapper) { + public void cleanupPlayerGui(PlayerWrapper playerWrapper) { this.playerGuis.remove(playerWrapper.getUniqueId()); } - public Gui getCurrentGui(PlayerWrapper playerWrapper) { + public Gui getPlayerGui(PlayerWrapper playerWrapper) { return this.playerGuis.get(playerWrapper.getUniqueId()); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java index 0c02d7075..8d8fdffb4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java @@ -91,7 +91,7 @@ public void onInventoryClose(InventoryCloseEvent event) { PlayerWrapper wrapper = event.getPlayerWrapper(); UUID uuid = wrapper.getUniqueId(); Gui gui = this.cachedGuis.get(uuid); - if(gui != null && gui.equals(GuiManager.get().getCurrentGui(wrapper))) { + if(gui != null && gui.equals(GuiManager.get().getPlayerGui(wrapper))) { this.cachedGuis.remove(uuid); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java index 9a31fdfca..b9d66ab41 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java @@ -74,7 +74,7 @@ public void onInventoryClose(InventoryCloseEvent event) { PlayerWrapper wrapper = event.getPlayerWrapper(); UUID uuid = wrapper.getUniqueId(); Gui gui = this.cachedGuis.get(uuid); - if(gui != null && gui.equals(GuiManager.get().getCurrentGui(wrapper))) { + if(gui != null && gui.equals(GuiManager.get().getPlayerGui(wrapper))) { this.cachedGuis.remove(uuid); } } From fe077e06e83ba5bf3e87d10cbd3b4ed92fae99ea Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 00:51:34 -0800 Subject: [PATCH 103/261] Initialize modified macros and playerGuis outside of constructor --- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index e8ef0f415..d7db57afb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -65,25 +65,23 @@ public class GuiManager { private static GuiManager instance; private Map guis; - private final Map playerGuis; + private final Map playerGuis = new HashMap<>(); private Map cachedGuis; private Map cachedTokens; private Map> globalMacros; private Map> cachedGlobalMacros; private Map guiHashes; private Map globalMacrosTimestamps; - private final Set modifiedMacros; + private final Set modifiedMacros = new HashSet<>(); private GuiManager() { this.guis = new HashMap<>(); - this.playerGuis = new HashMap<>(); this.cachedGuis = new HashMap<>(); this.cachedTokens = new HashMap<>(); this.globalMacros = new LinkedHashMap<>(); this.cachedGlobalMacros = new HashMap<>(); this.guiHashes = new HashMap<>(); this.globalMacrosTimestamps = new HashMap<>(); - this.modifiedMacros = new HashSet<>(); } public static GuiManager get() { From 34d2010a2aedc1be0aaec42a7c7deb7f237e6852 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 05:12:20 -0800 Subject: [PATCH 104/261] Use current action instead of passing in an action for isBlockClick() --- .../dynamicgui/core/event/player/PlayerAction.java | 4 ++-- .../dynamicgui/core/listener/PlayerInteractListener.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java index 29f0f8c87..d88e00453 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java @@ -23,7 +23,7 @@ public enum PlayerAction { RIGHT_CLICK_BLOCK, PHYSICAL; - public boolean isBlockClick(PlayerAction action) { - return action == PlayerAction.RIGHT_CLICK_BLOCK || action == PlayerAction.LEFT_CLICK_BLOCK; + public boolean isBlockClick() { + return this == PlayerAction.RIGHT_CLICK_BLOCK || this == PlayerAction.LEFT_CLICK_BLOCK; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 42e79daf7..7d33e473d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -26,7 +26,7 @@ public class PlayerInteractListener { @EventHandler public void playerInteract(final PlayerInteractEvent e) { - if(e.getAction().isBlockClick(e.getAction())) { + if(e.getAction().isBlockClick()) { if(GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) { return; } From f1cc178951bb22caae90e013625647358ace3df5 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 19:01:15 -0800 Subject: [PATCH 105/261] Create set enchants function test --- .../core/enchantment/EnchantmentWrapper.java | 5 + .../function/impl/SetEnchantsFunction.java | 50 ++++----- .../test/function/SetCloseFunctionTest.java | 10 +- .../function/SetEnchantsFunctionTest.java | 106 ++++++++++++++++++ .../core/test/mock/MockFactory.java | 7 +- ...r.java => MockCloseableFunctionOwner.java} | 2 +- ...ava => MockNonCloseableFunctionOwner.java} | 2 +- .../test/mock/inventory/MockItemStack.java | 20 ++++ .../mock/inventory/MockItemStackWrapper.java | 18 +++ 9 files changed, 186 insertions(+), 34 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/{CloseableFunctionOwner.java => MockCloseableFunctionOwner.java} (93%) rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/{NonCloseableFunctionOwner.java => MockNonCloseableFunctionOwner.java} (92%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java index 728eeab8c..5c834ec70 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java @@ -23,6 +23,11 @@ public class EnchantmentWrapper implements Serializable { * */ private static final long serialVersionUID = 1056076873542226033L; + + public static final String TEST_ENCHANT_1 = "enchant_1"; + public static final String TEST_ENCHANT_2 = "enchant_2"; + public static final String TEST_ENCHANT_3 = "enchant_3"; + private final String enchant; private final int level; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java index 5bdd06a9b..7d319f771 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java @@ -45,39 +45,37 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - - Map enchants = new HashMap(); - if(this.getData().contains(";")) { - for(String str : this.getData().split(";")) { - String[] split = str.split(","); - enchants.put(split[0], Integer.valueOf(split[1])); - } - } else { - String[] split = this.getData().split(","); + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + Map enchants = new HashMap<>(); + if(this.getData().contains(";")) { + for(String str : this.getData().split(";")) { + String[] split = str.split(","); enchants.put(split[0], Integer.valueOf(split[1])); } + } else { + String[] split = this.getData().split(","); + enchants.put(split[0], Integer.valueOf(split[1])); + } - for(EnchantmentWrapper ench : item.getEnchants()) { - item.removeEnchant(ench); - } - - for(String str : enchants.keySet()) { - item.addEnchant(new EnchantmentWrapper(str, enchants.get(str))); - } + for(EnchantmentWrapper wrapper : item.getEnchants()) { + item.removeEnchant(wrapper); + } - inv.setItem(slot.getIndex(), item); - return true; + for(String str : enchants.keySet()) { + item.addEnchant(new EnchantmentWrapper(str, enchants.get(str))); } + + inv.setItem(slot.getIndex(), item); + return true; } } + } return false; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java index e7e71e49e..57254df62 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java @@ -21,8 +21,8 @@ import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.core.test.mock.gui.CloseableFunctionOwner; -import com.clubobsidian.dynamicgui.core.test.mock.gui.NonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -42,7 +42,7 @@ public void nullTest() { @Test public void nonCloseableComponentTest() { Function function = new SetCloseFunction(); - function.setOwner(new NonCloseableFunctionOwner()); + function.setOwner(new MockNonCloseableFunctionOwner()); function.setData("true"); assertFalse(function.function(this.factory.createPlayer())); } @@ -50,7 +50,7 @@ public void nonCloseableComponentTest() { @Test public void invalidDataTest() { Function function = new SetCloseFunction(); - CloseableComponent component = new CloseableFunctionOwner(); + CloseableComponent component = new MockCloseableFunctionOwner(); function.setOwner((FunctionOwner) component); function.setData("a"); assertTrue(function.function(this.factory.createPlayer())); @@ -60,7 +60,7 @@ public void invalidDataTest() { @Test public void validDataTest() { Function function = new SetCloseFunction(); - CloseableComponent component = new CloseableFunctionOwner(); + CloseableComponent component = new MockCloseableFunctionOwner(); function.setOwner((FunctionOwner) component); function.setData("true"); assertTrue(function.function(this.factory.createPlayer())); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java new file mode 100644 index 000000000..e88f98c9c --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java @@ -0,0 +1,106 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetEnchantsFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetEnchantsFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetEnchantsFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void noOwnerTest() { + Function function = new SetEnchantsFunction(); + function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void ownerNotSlotTest() { + Function function = new SetEnchantsFunction(); + function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void testOneEnchant() { + int index = 0; + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + List enchants = new ArrayList<>(); + enchants.add(new EnchantmentWrapper(EnchantmentWrapper.TEST_ENCHANT_1, 1)); + Slot slot = this.factory.createSlot(index, Slot.TEST_MATERIAL, enchants, false); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.factory.createGui("test", slots); + InventoryWrapper inventory = gui.buildInventory(player); + slot.setOwner(gui); + Function function = new SetEnchantsFunction(); + function.setOwner(slot); + function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); + assertTrue(function.function(this.factory.createPlayer())); + assertTrue(inventory.getItem(index).getEnchants().size() == 1); + assertEquals(EnchantmentWrapper.TEST_ENCHANT_2, inventory.getItem(index).getEnchants().get(0).getEnchant()); + } + + @Test + public void testMultipleEnchants() { + int index = 0; + this.factory.inject(); + MockPlayerWrapper player = this.factory.createPlayer(); + List enchants = new ArrayList<>(); + enchants.add(new EnchantmentWrapper(EnchantmentWrapper.TEST_ENCHANT_1, 1)); + Slot slot = this.factory.createSlot(index, Slot.TEST_MATERIAL, enchants, false); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.factory.createGui("test", slots); + InventoryWrapper inventory = gui.buildInventory(player); + slot.setOwner(gui); + Function function = new SetEnchantsFunction(); + function.setOwner(slot); + function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1;" + EnchantmentWrapper.TEST_ENCHANT_3 + ",1"); + assertTrue(function.function(this.factory.createPlayer())); + assertTrue(inventory.getItem(index).getEnchants().size() == 2); + assertEquals(EnchantmentWrapper.TEST_ENCHANT_2, inventory.getItem(index).getEnchants().get(0).getEnchant()); + assertEquals(EnchantmentWrapper.TEST_ENCHANT_3, inventory.getItem(index).getEnchants().get(1).getEnchant()); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 39385afce..c329b75bc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.economy.Economy; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.InventoryType; import com.clubobsidian.dynamicgui.core.gui.ModeEnum; @@ -109,6 +110,10 @@ public Slot createSlot(String type, boolean movable) { } public Slot createSlot(int index, String type, boolean movable) { + return this.createSlot(index, type, new ArrayList<>(), movable); + } + + public Slot createSlot(int index, String type, List enchants, boolean movable) { return new Slot(index, 1, type, @@ -119,7 +124,7 @@ public Slot createSlot(int index, String type, boolean movable) { movable, false, new ArrayList<>(), - new ArrayList<>(), + enchants, new ArrayList<>(), null, null, diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java similarity index 93% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java index 833827095..191c5a8d4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/CloseableFunctionOwner.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java @@ -20,7 +20,7 @@ import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -public class CloseableFunctionOwner implements FunctionOwner, CloseableComponent { +public class MockCloseableFunctionOwner implements FunctionOwner, CloseableComponent { private Boolean close; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java similarity index 92% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java index 1a260ec64..c9c704a15 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/NonCloseableFunctionOwner.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; -public class NonCloseableFunctionOwner implements FunctionOwner { +public class MockNonCloseableFunctionOwner implements FunctionOwner { @Override public FunctionTree getFunctions() { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index a0f23021a..5639f8647 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -16,11 +16,19 @@ package com.clubobsidian.dynamicgui.core.test.mock.inventory; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + public class MockItemStack { private final String type; private int amount; private short durability = 0; + private final Map enchants = new LinkedHashMap<>(); public MockItemStack(String type) { this(type, 1); @@ -50,4 +58,16 @@ public short getDurability() { public void setDurability(short durability) { this.durability = durability; } + + public List getEnchants() { + return new ArrayList<>(this.enchants.values()); + } + + public void addEnchant(EnchantmentWrapper enchant) { + this.enchants.put(enchant.getEnchant(), enchant); + } + + public void removeEnchant(EnchantmentWrapper enchant) { + this.enchants.remove(enchant.getEnchant()); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index e5b52bb6c..ced45f15d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -16,8 +16,11 @@ package com.clubobsidian.dynamicgui.core.test.mock.inventory; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; +import java.util.List; + public abstract class MockItemStackWrapper extends ItemStackWrapper { public MockItemStackWrapper(MockItemStack itemStack) { @@ -48,4 +51,19 @@ public short getDurability() { public void setDurability(short durability) { this.getItemStack().setDurability(durability); } + + @Override + public List getEnchants() { + return this.getItemStack().getEnchants(); + } + + @Override + public void addEnchant(EnchantmentWrapper enchant) { + this.getItemStack().addEnchant(enchant); + } + + @Override + public void removeEnchant(EnchantmentWrapper enchant) { + this.getItemStack().removeEnchant(enchant); + } } From 6a941b616fe740e351ab798727b34469b4be1ca9 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 19:11:23 -0800 Subject: [PATCH 106/261] Cleanup cooldown code --- .../manager/dynamicgui/cooldown/Cooldown.java | 10 ++-- .../dynamicgui/cooldown/CooldownManager.java | 53 ++++++++----------- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java index 2ce0ad2bb..62a4bbc59 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java @@ -18,10 +18,10 @@ public class Cooldown { private final String name; - private final Long time; - private final Long cooldown; + private final long time; + private final long cooldown; - public Cooldown(String name, Long time, Long cooldown) { + public Cooldown(String name, long time, long cooldown) { this.name = name; this.time = time; this.cooldown = cooldown; @@ -31,11 +31,11 @@ public String getName() { return this.name; } - public Long getTime() { + public long getTime() { return this.time; } - public Long getCooldown() { + public long getCooldown() { return this.cooldown; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java index 5c17728ba..f953881a9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java @@ -22,8 +22,11 @@ import com.clubobsidian.wrappy.ConfigurationSection; import java.io.File; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; @@ -42,14 +45,12 @@ public static CooldownManager get() { return instance; } - private final Map> cooldowns; + private final Map> cooldowns = new ConcurrentHashMap<>(); + private final AtomicBoolean updateConfig = new AtomicBoolean(false); private final Configuration cooldownConfig; - private final AtomicBoolean updateConfig; private CooldownManager() { - this.cooldowns = new ConcurrentHashMap<>(); this.cooldownConfig = this.loadConfig(); - this.updateConfig = new AtomicBoolean(false); this.scheduleCooldownUpdate(); this.scheduleConfigUpdate(); } @@ -60,11 +61,10 @@ private Configuration loadConfig() { Configuration config = Configuration.load(cooldownsFile); for(String uuidStr : config.getKeys()) { ConfigurationSection section = config.getConfigurationSection(uuidStr); - Map cooldownMap = new ConcurrentHashMap<>(); for(String cooldownName : section.getKeys()) { - Long time = section.getLong(cooldownName + ".time"); - Long cooldown = section.getLong(cooldownName + ".cooldown"); + long time = section.getLong(cooldownName + ".time"); + long cooldown = section.getLong(cooldownName + ".cooldown"); Cooldown cooldownObj = new Cooldown(cooldownName, time, cooldown); if(this.getRemainingCooldown(cooldownObj) != -1L) { cooldownMap.put(cooldownName, cooldownObj); @@ -72,26 +72,23 @@ private Configuration loadConfig() { section.set(cooldownName, null); } } - if(section.isEmpty()) { config.set(uuidStr, null); } - if(cooldownMap.size() > 0) { UUID uuid = UUID.fromString(uuidStr); this.cooldowns.put(uuid, cooldownMap); } } - config.save(); return config; } - public Long getRemainingCooldown(PlayerWrapper playerWrapper, String name) { + public long getRemainingCooldown(PlayerWrapper playerWrapper, String name) { return this.getRemainingCooldown(playerWrapper.getUniqueId(), name); } - public Long getRemainingCooldown(UUID uuid, String name) { + public long getRemainingCooldown(UUID uuid, String name) { Map cooldownMap = this.cooldowns.get(uuid); if(cooldownMap == null) { return -1L; @@ -105,10 +102,10 @@ public Long getRemainingCooldown(UUID uuid, String name) { return this.getRemainingCooldown(cooldown); } - public Long getRemainingCooldown(Cooldown cooldown) { + public long getRemainingCooldown(Cooldown cooldown) { long currentTime = System.currentTimeMillis(); - Long cooldownTime = cooldown.getTime(); - Long cooldownAmount = cooldown.getCooldown(); + long cooldownTime = cooldown.getTime(); + long cooldownAmount = cooldown.getCooldown(); if((currentTime - cooldownTime) >= cooldownAmount) { return -1L; @@ -125,41 +122,38 @@ public boolean isOnCooldown(UUID uuid, String name) { return this.getRemainingCooldown(uuid, name) != -1L; } - public Collection getCooldown(PlayerWrapper playerWrapper) { + public List getCooldowns(PlayerWrapper playerWrapper) { UUID uuid = playerWrapper.getUniqueId(); return this.getCooldowns(uuid); } - public Collection getCooldowns(UUID uuid) { + public List getCooldowns(UUID uuid) { Map cooldowns = this.cooldowns.get(uuid); if(cooldowns == null) { - return null; + return Collections.emptyList(); } - - return cooldowns.values(); + return new ArrayList<>(cooldowns.values()); } - public Cooldown createCooldown(PlayerWrapper playerWrapper, String name, Long cooldownTime) { + public Cooldown createCooldown(PlayerWrapper playerWrapper, String name, long cooldownTime) { UUID uuid = playerWrapper.getUniqueId(); return this.createCooldown(uuid, name, cooldownTime); } - public Cooldown createCooldown(UUID uuid, String name, Long cooldownTime) { - Long cooldownRemaining = this.getRemainingCooldown(uuid, name); + public Cooldown createCooldown(UUID uuid, String name, long cooldownTime) { + long cooldownRemaining = this.getRemainingCooldown(uuid, name); if(cooldownRemaining == -1L) { - Long currentTime = System.currentTimeMillis(); + long currentTime = System.currentTimeMillis(); Cooldown cooldown = new Cooldown(name, currentTime, cooldownTime); Map cooldownMap = this.cooldowns.get(uuid); if(cooldownMap == null) { cooldownMap = new ConcurrentHashMap<>(); this.cooldowns.put(uuid, cooldownMap); } - this.updateConfig.set(true); cooldownMap.put(name, cooldown); return cooldown; } - return null; } @@ -192,8 +186,8 @@ private void updateAndSaveConfig() { String uuidStr = uuid.toString(); Map cooldownMap = next.getValue(); cooldownMap.forEach((cooldownName, cooldownObj) -> { - Long time = cooldownObj.getTime(); - Long cooldown = cooldownObj.getCooldown(); + long time = cooldownObj.getTime(); + long cooldown = cooldownObj.getCooldown(); ConfigurationSection cooldownSection = this.cooldownConfig.getConfigurationSection(uuidStr + "." + cooldownName); cooldownSection.set("time", time); cooldownSection.set("cooldown", cooldown); @@ -216,7 +210,7 @@ private void updateCache() { Entry cooldownNext = cooldownIt.next(); String cooldownName = cooldownNext.getKey(); Cooldown cooldown = cooldownNext.getValue(); - Long cooldownRemaining = this.getRemainingCooldown(cooldown); + long cooldownRemaining = this.getRemainingCooldown(cooldown); if(cooldownRemaining == -1L) { cooldownIt.remove(); this.cooldownConfig.set(uuidStr + "." + cooldownName, null); @@ -224,7 +218,6 @@ private void updateCache() { } } } - if(modified) { this.updateConfig.set(true); } From 6cfa3353749aad9fa2c3378d9c47845bfb4d8386 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 19:28:10 -0800 Subject: [PATCH 107/261] Create set game rule function test --- .../function/SetGameRuleFunctionTest.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java new file mode 100644 index 000000000..e99ea3489 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java @@ -0,0 +1,72 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorld; +import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorldWrapper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetGameRuleFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetGameRuleFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void dataDoesNotHaveCommaTest() { + Function function = new SetGameRuleFunction(); + function.setData("a"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void sizeNotThreeTest() { + Function function = new SetGameRuleFunction(); + function.setData("a,a"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void worldNullTest() { + this.factory.inject(); + Function function = new SetGameRuleFunction(); + function.setData("test,key,value"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void validTest() { + MockWorldWrapper world = this.factory.inject().createWorld("test"); + this.factory.getPlatform().addWorld(world); + Function function = new SetGameRuleFunction(); + function.setData("test,key,value"); + assertTrue(function.function(this.factory.createPlayer())); + assertEquals("value", DynamicGui.get().getPlatform().getWorld("test").getGameRule("key")); + } +} \ No newline at end of file From e08913b5b8ada79862903aba75906c4d2e00058a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 22:04:13 -0800 Subject: [PATCH 108/261] Create set glow function test --- .../core/function/impl/SetGlowFunction.java | 38 +++++------- .../core/inventory/ItemStackWrapper.java | 2 + .../function/SetGameRuleFunctionTest.java | 1 - .../test/function/SetGlowFunctionTest.java | 58 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 12 ++++ .../test/mock/inventory/MockItemStack.java | 9 +++ .../mock/inventory/MockItemStackWrapper.java | 10 ++++ 7 files changed, 104 insertions(+), 26 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java index 939bc1923..c1901e584 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java @@ -15,7 +15,6 @@ */ package com.clubobsidian.dynamicgui.core.function.impl; -import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; @@ -32,7 +31,7 @@ public class SetGlowFunction extends Function { private static final long serialVersionUID = -3727112026677117024L; public SetGlowFunction() { - super("setglow"); + super("setglow", "setglowing"); } @Override @@ -40,32 +39,21 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - try { - Boolean value = Boolean.valueOf(this.getData()); - if(value != null) { - FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - - item.setGlowing(value); - inv.setItem(slot.getIndex(), item); - return true; - } - } - } + FunctionOwner owner = this.getOwner(); + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + boolean value = Boolean.parseBoolean(this.getData()); + ItemStackWrapper item = slot.getItemStack(); + item.setGlowing(value); + inv.setItem(slot.getIndex(), item); + return true; } } - } catch(Exception ex) { - DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as a glow"); - ex.printStackTrace(); } - return false; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java index b9a0b6163..b44b3002a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java @@ -76,6 +76,8 @@ protected void setItemStack(Object itemStack) { public abstract void setGlowing(boolean glowing); + public abstract boolean isGlowing(); + public abstract void addItemFlags(List itemFlags); public abstract boolean isSimilar(ItemStackWrapper compareTo); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java index e99ea3489..1c2fa2865 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java @@ -20,7 +20,6 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorld; import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorldWrapper; import org.junit.jupiter.api.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java new file mode 100644 index 000000000..3cfc2b071 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetGlowFunction; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetGlowFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetGlowFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void notSlotTest() { + Function function = new SetGlowFunction(); + function.setData("true"); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void slotTest() { + PlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Function function = new SetGlowFunction(); + function.setData("true"); + function.setOwner(slot); + assertTrue(function.function(player)); + assertTrue(slot.getOwner().getInventoryWrapper().getItem(slot.getIndex()).isGlowing()); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index c329b75bc..e20651bd6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -19,6 +19,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.InventoryType; import com.clubobsidian.dynamicgui.core.gui.ModeEnum; @@ -97,6 +98,17 @@ public Gui createGui(String title, List slots) { new HashMap<>()); } + public Slot createSlot(PlayerWrapper player) { + Slot slot = this.inject().createSlot(); + slot.buildItemStack(player); + List slots = new ArrayList<>(); + slots.add(slot); + Gui gui = this.createGui("test", slots); + gui.buildInventory(player); + slot.setOwner(gui); + return slot; + } + public Slot createSlot() { return this.createSlot(Slot.TEST_MATERIAL); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index 5639f8647..904a73b54 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -29,6 +29,7 @@ public class MockItemStack { private int amount; private short durability = 0; private final Map enchants = new LinkedHashMap<>(); + private boolean glowing = false; public MockItemStack(String type) { this(type, 1); @@ -70,4 +71,12 @@ public void addEnchant(EnchantmentWrapper enchant) { public void removeEnchant(EnchantmentWrapper enchant) { this.enchants.remove(enchant.getEnchant()); } + + public void setGlowing(boolean glowing) { + this.glowing = glowing; + } + + public boolean isGlowing() { + return this.glowing; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index ced45f15d..9714ec709 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -66,4 +66,14 @@ public void addEnchant(EnchantmentWrapper enchant) { public void removeEnchant(EnchantmentWrapper enchant) { this.getItemStack().removeEnchant(enchant); } + + @Override + public void setGlowing(boolean glowing) { + this.getItemStack().setGlowing(glowing); + } + + @Override + public boolean isGlowing() { + return this.getItemStack().isGlowing(); + } } From dd34db24d42fb88918958f41854d5906870ee8c5 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 22:16:08 -0800 Subject: [PATCH 109/261] Remove is glowing from item stack wrapper Don't test for glowing, if the function passes we will just assume it worked --- .../dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java | 1 - .../dynamicgui/core/inventory/ItemStackWrapper.java | 2 -- .../dynamicgui/core/test/function/SetGlowFunctionTest.java | 1 - .../dynamicgui/core/test/mock/inventory/MockItemStack.java | 4 ---- .../core/test/mock/inventory/MockItemStackWrapper.java | 5 ----- 5 files changed, 13 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index 4a525be8c..6395b8c7b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -237,7 +237,6 @@ public void setGlowing(boolean glowing) { meta.removeItemFlags(ItemFlag.HIDE_ENCHANTS); } - item.setItemMeta(meta); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java index b44b3002a..b9a0b6163 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java @@ -76,8 +76,6 @@ protected void setItemStack(Object itemStack) { public abstract void setGlowing(boolean glowing); - public abstract boolean isGlowing(); - public abstract void addItemFlags(List itemFlags); public abstract boolean isSimilar(ItemStackWrapper compareTo); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java index 3cfc2b071..1e33509e2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java @@ -53,6 +53,5 @@ public void slotTest() { function.setData("true"); function.setOwner(slot); assertTrue(function.function(player)); - assertTrue(slot.getOwner().getInventoryWrapper().getItem(slot.getIndex()).isGlowing()); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index 904a73b54..b625bb05f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -75,8 +75,4 @@ public void removeEnchant(EnchantmentWrapper enchant) { public void setGlowing(boolean glowing) { this.glowing = glowing; } - - public boolean isGlowing() { - return this.glowing; - } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 9714ec709..26819f3f2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -71,9 +71,4 @@ public void removeEnchant(EnchantmentWrapper enchant) { public void setGlowing(boolean glowing) { this.getItemStack().setGlowing(glowing); } - - @Override - public boolean isGlowing() { - return this.getItemStack().isGlowing(); - } } From 8113b80a6c8e5b12ae6932e0879078718dca5289 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 22:40:50 -0800 Subject: [PATCH 110/261] Create set lore function test --- .../core/function/impl/SetLoreFunction.java | 52 +++++------ .../test/function/SetLoreFunctionTest.java | 88 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 16 +++- .../test/mock/inventory/MockItemStack.java | 10 +++ .../mock/inventory/MockItemStackWrapper.java | 10 +++ 5 files changed, 144 insertions(+), 32 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java index 19e771f80..78881b9c0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java @@ -43,40 +43,32 @@ public SetLoreFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { - return false; - } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - List lore = new ArrayList<>(); - if(this.getData() == null) { - lore = null; - } else { - - String newData = this.getData(); - newData = ReplacerManager.get().replace(ChatColor.translateAlternateColorCodes('&', this.getData()), playerWrapper); - newData = AnimationReplacerManager.get().replace(slot, playerWrapper, newData); - - if(newData.contains("\n")) { - for(String str : this.getData().split("\n")) { - lore.add(str); - } - } else { - lore.add(newData); + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + List lore = new ArrayList<>(); + if(this.getData() == null) { + lore = null; + } else { + String newData = ReplacerManager.get().replace(this.getData(), playerWrapper); + newData = AnimationReplacerManager.get().replace(slot, playerWrapper, newData); + newData = ChatColor.translateAlternateColorCodes('&', newData); + if(newData.contains("\n")) { + for(String str : this.getData().split("\n")) { + lore.add(str); } + } else { + lore.add(newData); } - - item.setLore(lore); - inv.setItem(slot.getIndex(), item); - return true; } + item.setLore(lore); + inv.setItem(slot.getIndex(), item); + return true; } } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java new file mode 100644 index 000000000..cf7a833a2 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetLoreFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetLoreFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + PlayerWrapper player = this.factory.createPlayer(); + String line = "test"; + List lore = new ArrayList<>(); + lore.add(line); + Slot slot = this.factory.createSlot(player, lore); + Function function = new SetLoreFunction(); + function.setOwner(slot); + Gui gui = slot.getOwner(); + assertTrue(function.function(player)); + assertTrue(gui.getInventoryWrapper().getItem(slot.getIndex()).getLore().size() == 0); + } + + @Test + public void nonSlotTest() { + Function function = new SetLoreFunction(); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void oneLineTest() { + PlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Function function = new SetLoreFunction(); + function.setData("test"); + function.setOwner(slot); + Gui gui = slot.getOwner(); + assertTrue(function.function(player)); + List lore = gui.getInventoryWrapper().getItem(slot.getIndex()).getLore(); + assertTrue(lore.size() == 1); + assertEquals("test", lore.get(0)); + } + + @Test + public void multiLineTest() { + PlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Function function = new SetLoreFunction(); + function.setData("test1\ntest2"); + function.setOwner(slot); + Gui gui = slot.getOwner(); + assertTrue(function.function(player)); + List lore = gui.getInventoryWrapper().getItem(slot.getIndex()).getLore(); + assertTrue(lore.size() == 2); + assertEquals("test1", lore.get(0)); + assertEquals("test2", lore.get(1)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index e20651bd6..408655d95 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -99,7 +99,15 @@ public Gui createGui(String title, List slots) { } public Slot createSlot(PlayerWrapper player) { - Slot slot = this.inject().createSlot(); + return this.createSlot(player, new ArrayList<>()); + } + + public Slot createSlot(PlayerWrapper player, List lore) { + Slot slot = this.inject().createSlot(0, + Slot.TEST_MATERIAL, + lore, + new ArrayList<>(), + false); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); @@ -126,6 +134,10 @@ public Slot createSlot(int index, String type, boolean movable) { } public Slot createSlot(int index, String type, List enchants, boolean movable) { + return this.createSlot(index, type, new ArrayList<>(), enchants, movable); + } + + public Slot createSlot(int index, String type, List lore, List enchants, boolean movable) { return new Slot(index, 1, type, @@ -135,7 +147,7 @@ public Slot createSlot(int index, String type, List enchants false, movable, false, - new ArrayList<>(), + lore, enchants, new ArrayList<>(), null, diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index b625bb05f..19dfd3fcb 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -30,6 +30,7 @@ public class MockItemStack { private short durability = 0; private final Map enchants = new LinkedHashMap<>(); private boolean glowing = false; + private List lore = new ArrayList<>(); public MockItemStack(String type) { this(type, 1); @@ -75,4 +76,13 @@ public void removeEnchant(EnchantmentWrapper enchant) { public void setGlowing(boolean glowing) { this.glowing = glowing; } + + public List getLore() { + return this.lore; + } + + public void setLore(List lore) { + List l = lore == null ? new ArrayList<>() : lore; + this.lore = l; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 26819f3f2..16e9a4f6d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -32,6 +32,16 @@ public String getType() { return this.getItemStack().getType(); } + @Override + public List getLore() { + return this.getItemStack().getLore(); + } + + @Override + public void setLore(List lore) { + this.getItemStack().setLore(lore); + } + @Override public int getAmount() { return this.getItemStack().getAmount(); From 5a6773a48f7677940212b61bdb4ad92b1ed5c2fb Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Feb 2022 22:43:45 -0800 Subject: [PATCH 111/261] Add null check for owner for set movable function --- .../function/impl/SetMovableFunction.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java index e0c9320a4..880fe4015 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java @@ -38,23 +38,20 @@ public boolean function(PlayerWrapper playerWrapper) { if(this.getData() == null) { return false; } - if(this.getOwner() instanceof Slot) { - Boolean value = Boolean.valueOf(this.getData()); - if(value != null) { - FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - slot.setMovable(value); - return true; - } + if(this.getOwner() != null && this.getOwner() instanceof Slot) { + boolean value = Boolean.parseBoolean(this.getData()); + FunctionOwner owner = this.getOwner(); + if(owner != null) { + if(owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + slot.setMovable(value); + return true; } } } } - return false; } } \ No newline at end of file From 51ebd746a59fcc3c3d3a8b83f9a0478552050a7f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 14 Feb 2022 01:22:49 -0800 Subject: [PATCH 112/261] Create set movable function test --- .../test/function/SetMovableFunctionTest.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java new file mode 100644 index 000000000..3c397448a --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java @@ -0,0 +1,58 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetMovableFunction; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetMovableFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetMovableFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void notSlotTest() { + Function function = new SetMovableFunction(); + function.setData("a"); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void setMovableTest() { + PlayerWrapper player = this.factory.createPlayer(); + Function function = new SetMovableFunction(); + function.setData("true"); + Slot slot = this.factory.createSlot(player); + function.setOwner(slot); + assertTrue(function.function(this.factory.createPlayer())); + assertTrue(slot.isMovable()); + } +} From 05402f23ca3800a38f83a7ec5f983d8ed2fb1078 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 14 Feb 2022 01:24:23 -0800 Subject: [PATCH 113/261] Create false test for movable function --- .../test/function/SetMovableFunctionTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java index 3c397448a..021b1b188 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java @@ -46,7 +46,18 @@ public void notSlotTest() { } @Test - public void setMovableTest() { + public void setMovableFalseTest() { + PlayerWrapper player = this.factory.createPlayer(); + Function function = new SetMovableFunction(); + function.setData("false"); + Slot slot = this.factory.createSlot(player); + function.setOwner(slot); + assertTrue(function.function(this.factory.createPlayer())); + assertFalse(slot.isMovable()); + } + + @Test + public void setMovableTrueTest() { PlayerWrapper player = this.factory.createPlayer(); Function function = new SetMovableFunction(); function.setData("true"); @@ -55,4 +66,4 @@ public void setMovableTest() { assertTrue(function.function(this.factory.createPlayer())); assertTrue(slot.isMovable()); } -} +} \ No newline at end of file From 91f665bfe09301e2e9ac7d7b5b8d408d330aa544 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 14 Feb 2022 01:39:23 -0800 Subject: [PATCH 114/261] Collapse if in set name function --- .../core/function/impl/SetNameFunction.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java index 9547b232c..6727e8962 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java @@ -43,21 +43,19 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - String newName = ChatColor.translateAlternateColorCodes('&', this.getData()); - newName = ReplacerManager.get().replace(newName, playerWrapper); - newName = AnimationReplacerManager.get().replace(slot, playerWrapper, newName); - item.setName(newName); - inv.setItem(slot.getIndex(), item); - return true; - } + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + String newName = ChatColor.translateAlternateColorCodes('&', this.getData()); + newName = ReplacerManager.get().replace(newName, playerWrapper); + newName = AnimationReplacerManager.get().replace(slot, playerWrapper, newName); + item.setName(newName); + inv.setItem(slot.getIndex(), item); + return true; } } } From 325462111321bf5a1536bbb1ea830842b4615233 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 14 Feb 2022 01:39:59 -0800 Subject: [PATCH 115/261] Collapse more if functions --- .../core/function/impl/SetNBTFunction.java | 22 +++++++++---------- .../core/function/impl/SetTypeFunction.java | 22 +++++++++---------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java index e93f7bfba..c9ad9076b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java @@ -40,18 +40,16 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - item.setNBT(this.getData()); - inv.setItem(slot.getIndex(), item); - return true; - } + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + item.setNBT(this.getData()); + inv.setItem(slot.getIndex(), item); + return true; } } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java index 3ec415068..c64a6ecd9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java @@ -40,18 +40,16 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { - Slot slot = (Slot) owner; - Gui gui = slot.getOwner(); - if(gui != null) { - InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { - ItemStackWrapper item = slot.getItemStack(); - item.setType(this.getData()); - inv.setItem(slot.getIndex(), item); - return true; - } + if(owner != null && owner instanceof Slot) { + Slot slot = (Slot) owner; + Gui gui = slot.getOwner(); + if(gui != null) { + InventoryWrapper inv = gui.getInventoryWrapper(); + if(inv != null) { + ItemStackWrapper item = slot.getItemStack(); + item.setType(this.getData()); + inv.setItem(slot.getIndex(), item); + return true; } } } From 7e9e16bda0436a714b1e5cc4c3cc314943d6aa6e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 17 Feb 2022 01:06:48 -0800 Subject: [PATCH 116/261] Create set name function test --- .../test/function/SetNameFunctionTest.java | 64 +++++++++++++++++++ .../test/mock/inventory/MockItemStack.java | 9 +++ .../mock/inventory/MockItemStackWrapper.java | 10 +++ 3 files changed, 83 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java new file mode 100644 index 000000000..bfd703c41 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetNameFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetNameFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetNameFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void notSlotTest() { + Function function = new SetNameFunction(); + function.setData("asdf"); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void nameTest() { + String name = "asdf"; + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Gui gui = slot.getOwner(); + InventoryWrapper inventory = gui.getInventoryWrapper(); + Function function = new SetNameFunction(); + function.setOwner(slot); + function.setData(name); + assertTrue(function.function(player)); + assertEquals(name, inventory.getItem(slot.getIndex()).getName()); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index 19dfd3fcb..cbac5c6ec 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -31,6 +31,7 @@ public class MockItemStack { private final Map enchants = new LinkedHashMap<>(); private boolean glowing = false; private List lore = new ArrayList<>(); + private String name; public MockItemStack(String type) { this(type, 1); @@ -85,4 +86,12 @@ public void setLore(List lore) { List l = lore == null ? new ArrayList<>() : lore; this.lore = l; } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 16e9a4f6d..8fbffa70d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -81,4 +81,14 @@ public void removeEnchant(EnchantmentWrapper enchant) { public void setGlowing(boolean glowing) { this.getItemStack().setGlowing(glowing); } + + @Override + public void setName(String name) { + this.getItemStack().setName(name); + } + + @Override + public String getName() { + return this.getItemStack().getName(); + } } From 0e3ae902c773309c9bec3348408258faf1d75e55 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Feb 2022 19:49:21 -0800 Subject: [PATCH 117/261] Create set nbt function test --- .../test/function/SetNBTFunctionTest.java | 64 +++++++++++++++++++ .../test/mock/inventory/MockItemStack.java | 9 +++ .../mock/inventory/MockItemStackWrapper.java | 10 +++ 3 files changed, 83 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java new file mode 100644 index 000000000..f058dd244 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetNBTFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetNBTFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetNBTFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void notSlotTest() { + Function function = new SetNBTFunction(); + function.setData("asdf"); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void nameTest() { + String name = "asdf"; + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Gui gui = slot.getOwner(); + InventoryWrapper inventory = gui.getInventoryWrapper(); + Function function = new SetNBTFunction(); + function.setOwner(slot); + function.setData(name); + assertTrue(function.function(player)); + assertEquals(name, inventory.getItem(slot.getIndex()).getNBT()); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index cbac5c6ec..6a168c3e6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -32,6 +32,7 @@ public class MockItemStack { private boolean glowing = false; private List lore = new ArrayList<>(); private String name; + private String nbt; public MockItemStack(String type) { this(type, 1); @@ -94,4 +95,12 @@ public void setName(String name) { public String getName() { return this.name; } + + public String getNBT() { + return this.nbt; + } + + public void setNBT(String nbt) { + this.nbt = nbt; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 8fbffa70d..2ad7f5730 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -91,4 +91,14 @@ public void setName(String name) { public String getName() { return this.getItemStack().getName(); } + + @Override + public String getNBT() { + return this.getItemStack().getNBT(); + } + + @Override + public void setNBT(String nbt) { + this.getItemStack().setNBT(nbt); + } } From c41987174f171f6d5f1ae560547eb995ad0ba1bc Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Feb 2022 19:52:40 -0800 Subject: [PATCH 118/261] Create set type function test --- .../test/function/SetNBTFunctionTest.java | 6 +- .../test/function/SetTypeFunctionTest.java | 64 +++++++++++++++++++ 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java index f058dd244..6d38dfcf4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java @@ -50,15 +50,15 @@ public void notSlotTest() { @Test public void nameTest() { - String name = "asdf"; + String nbt = "asdf"; MockPlayerWrapper player = this.factory.createPlayer(); Slot slot = this.factory.createSlot(player); Gui gui = slot.getOwner(); InventoryWrapper inventory = gui.getInventoryWrapper(); Function function = new SetNBTFunction(); function.setOwner(slot); - function.setData(name); + function.setData(nbt); assertTrue(function.function(player)); - assertEquals(name, inventory.getItem(slot.getIndex()).getNBT()); + assertEquals(nbt, inventory.getItem(slot.getIndex()).getNBT()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java new file mode 100644 index 000000000..74776cde5 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SetTypeFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetTypeFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SetTypeFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void notSlotTest() { + Function function = new SetTypeFunction(); + function.setData(Slot.TEST_MATERIAL); + function.setOwner(new MockNonCloseableFunctionOwner()); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void nameTest() { + String type = Slot.TEST_MATERIAL; + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Gui gui = slot.getOwner(); + InventoryWrapper inventory = gui.getInventoryWrapper(); + Function function = new SetTypeFunction(); + function.setOwner(slot); + function.setData(type); + assertTrue(function.function(player)); + assertEquals(type, inventory.getItem(slot.getIndex()).getType()); + } +} \ No newline at end of file From c0ab28a1600a621f3ce839a54c5aa18497a2ee7c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Feb 2022 20:02:35 -0800 Subject: [PATCH 119/261] Create sound function test --- .../dynamicgui/core/effect/SoundWrapper.java | 22 +++++++ .../test/function/SetNBTFunctionTest.java | 2 +- .../test/function/SetTypeFunctionTest.java | 2 +- .../core/test/function/SoundFunctionTest.java | 59 +++++++++++++++++++ .../test/mock/entity/player/MockPlayer.java | 10 ++++ .../mock/entity/player/MockPlayerWrapper.java | 10 ++++ 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index 84600b6ac..00abda93e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import java.io.Serializable; +import java.util.Objects; public class SoundWrapper implements Serializable { @@ -26,6 +27,8 @@ public class SoundWrapper implements Serializable { */ private static final long serialVersionUID = -8096584636206059158L; + public static final String TEST_SOUND_STRING = "ambient_cave,1.0,1.0"; + private final SoundData data; public SoundWrapper(String str) { @@ -84,5 +87,24 @@ public float getVolume() { public float getPitch() { return this.pitch; } + + @Override + public boolean equals(Object o) { + if(this == o) { + return true; + } + if(!(o instanceof SoundData)) { + return false; + } + SoundData soundData = (SoundData) o; + return Float.compare(soundData.volume, this.volume) == 0 + && Float.compare(soundData.pitch, this.pitch) == 0 + && Objects.equals(this.sound, soundData.sound); + } + + @Override + public int hashCode() { + return Objects.hash(this.sound, this.volume, this.pitch); + } } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java index 6d38dfcf4..a599221e9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java @@ -49,7 +49,7 @@ public void notSlotTest() { } @Test - public void nameTest() { + public void nbtTest() { String nbt = "asdf"; MockPlayerWrapper player = this.factory.createPlayer(); Slot slot = this.factory.createSlot(player); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java index 74776cde5..3061c3e39 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java @@ -49,7 +49,7 @@ public void notSlotTest() { } @Test - public void nameTest() { + public void typeTest() { String type = Slot.TEST_MATERIAL; MockPlayerWrapper player = this.factory.createPlayer(); Slot slot = this.factory.createSlot(player); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java new file mode 100644 index 000000000..2e81c2ab8 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.SoundFunction; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SoundFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullTest() { + Function function = new SoundFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void soundTest() { + String type = SoundWrapper.TEST_SOUND_STRING; + MockPlayerWrapper player = this.factory.createPlayer(); + Slot slot = this.factory.createSlot(player); + Function function = new SoundFunction(); + function.setOwner(slot); + function.setData(type); + assertTrue(function.function(player)); + List sounds = player.getSounds(); + assertTrue(sounds.size() == 1); + assertEquals(new SoundWrapper(SoundWrapper.TEST_SOUND_STRING).getData(), sounds.get(0)); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java index 9a2453470..f3a2a84cc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java @@ -17,6 +17,7 @@ package com.clubobsidian.dynamicgui.core.test.mock.entity.player; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; @@ -37,6 +38,7 @@ public class MockPlayer { private int level = 0; private LocationWrapper location; private final List particles = new ArrayList<>(); + private final List sounds = new ArrayList<>(); public MockPlayer(String name, UUID uuid) { this.name = name; @@ -114,4 +116,12 @@ public void playEffect(ParticleWrapper.ParticleData particleData) { public List getParticles() { return this.particles; } + + public void playSound(SoundWrapper.SoundData soundData) { + this.sounds.add(soundData); + } + + public List getSounds() { + return this.sounds; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index 61fb4cf80..9d633d66f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -17,6 +17,7 @@ package com.clubobsidian.dynamicgui.core.test.mock.entity.player; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; @@ -119,4 +120,13 @@ public void playEffect(ParticleWrapper.ParticleData particleData) { public List getParticles() { return this.getPlayer().getParticles(); } + + @Override + public void playSound(SoundWrapper.SoundData soundData) { + this.getPlayer().playSound(soundData); + } + + public List getSounds() { + return this.getPlayer().getSounds(); + } } \ No newline at end of file From 336c16717d18bb5e4e0fe65a7be53291ece408f6 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 05:53:44 -0800 Subject: [PATCH 120/261] Remove unnecessary default constructors for builder classes --- .../core/builder/EnchantmentBuilder.java | 2 +- .../dynamicgui/core/builder/GuiBuilder.java | 22 ++++++------------- .../dynamicgui/core/builder/SlotBuilder.java | 22 ++++++------------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java index 97ff248e1..91e2c2591 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java @@ -20,7 +20,7 @@ public class EnchantmentBuilder { private String enchantment; - private int level; + private int level = 0; public EnchantmentBuilder setEnchantment(String enchantment) { this.enchantment = enchantment; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index 426741e15..6e539def0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -37,21 +37,13 @@ public class GuiBuilder { private int rows; private Boolean close; private ModeEnum modeEnum; - private final Map> npcIds; - private final List slots; - private final List> locs; - private FunctionTree functionTree; - private final Map metadata; + private final Map> npcIds = new HashMap<>(); + private final List slots = new ArrayList<>(); + private final List> locations = new ArrayList<>(); + private FunctionTree functionTree = new FunctionTree(); + private final Map metadata = new HashMap<>(); private Gui backGui; - public GuiBuilder() { - this.npcIds = new HashMap<>(); - this.slots = new ArrayList<>(); - this.locs = new ArrayList<>(); - this.functionTree = new FunctionTree(); - this.metadata = new HashMap<>(); - } - public GuiBuilder setType(String type) { this.type = type.toUpperCase(); return this; @@ -118,7 +110,7 @@ public GuiBuilder addSlot(Slot slot) { } public GuiBuilder addLocation(LocationWrapper loc) { - this.locs.add(loc); + this.locations.add(loc); return this; } @@ -155,7 +147,7 @@ public GuiBuilder addMetadata(Map metadata) { } public Gui build() { - Gui gui = new Gui(this.name, this.type, this.title, this.rows, this.close, this.modeEnum, this.npcIds, this.slots, this.locs, this.functionTree, this.metadata); + Gui gui = new Gui(this.name, this.type, this.title, this.rows, this.close, this.modeEnum, this.npcIds, this.slots, this.locations, this.functionTree, this.metadata); if(this.backGui != null) { gui.setBack(this.backGui); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java index 869e550dd..73ebe1e59 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java @@ -39,24 +39,16 @@ public class SlotBuilder { private boolean movable; private Boolean close; private List lore; - private final List enchants; - private final List itemFlags; + private final List enchants = new ArrayList<>(); + private final List itemFlags = new ArrayList<>(); private String modelProvider; private String modelData; private int index; - private int amount; - private int updateInterval; - private FunctionTree functionTree; - private final Map metadata; - - public SlotBuilder() { - this.enchants = new ArrayList<>(); - this.itemFlags = new ArrayList<>(); - this.amount = 1; - this.updateInterval = 0; - this.functionTree = new FunctionTree(); - this.metadata = new HashMap<>(); - } + private int amount = 1; + private int updateInterval = 0; + private FunctionTree functionTree = new FunctionTree(); + private final Map metadata = new HashMap<>(); + public SlotBuilder setIcon(String icon) { this.icon = icon; From 74ee1e0ffecba64cad62f891ddfb522ca796c14d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 06:01:32 -0800 Subject: [PATCH 121/261] Add static gui option to parser Starts #232 --- .../dynamicgui/parser/gui/GuiToken.java | 6 +++ .../parser/test/gui/StaticTest.java | 38 +++++++++++++++++++ parser/test/gui/static.yml | 1 + 3 files changed, 45 insertions(+) create mode 100644 parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java create mode 100644 parser/test/gui/static.yml diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java index 538f701fc..baf8f2127 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java @@ -48,6 +48,7 @@ public class GuiToken implements Serializable { private final FunctionTree functions; private final List loadMacros; private final Map metadata; + private final boolean isStatic; public GuiToken(ConfigurationSection section) { this(section, new ArrayList<>()); @@ -79,6 +80,7 @@ public GuiToken(ConfigurationSection section, List macroTokens) { ConfigurationSection metadataSection = section.getConfigurationSection("metadata"); this.metadata = this.parseMetadata(metadataSection); + this.isStatic = section.getBoolean("static"); } public String parseType(String type) { @@ -182,4 +184,8 @@ public List getLoadMacros() { public Map getMetadata() { return this.metadata; } + + public boolean isStatic() { + return this.isStatic; + } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java new file mode 100644 index 000000000..b924e8ad5 --- /dev/null +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.parser.test.gui; + +import com.clubobsidian.dynamicgui.parser.gui.GuiToken; +import com.clubobsidian.wrappy.Configuration; +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class StaticTest { + + @Test + public void testStatic() { + File guiFolder = new File("test", "gui"); + File file = new File(guiFolder, "static.yml"); + Configuration config = Configuration.load(file); + GuiToken token = new GuiToken(config); + boolean isStatic = token.isStatic(); + assertTrue(isStatic); + } +} diff --git a/parser/test/gui/static.yml b/parser/test/gui/static.yml new file mode 100644 index 000000000..a9afeb4a7 --- /dev/null +++ b/parser/test/gui/static.yml @@ -0,0 +1 @@ +static: true \ No newline at end of file From 1651064d03a61f5b889087da581f198cf2344b5f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 06:14:54 -0800 Subject: [PATCH 122/261] Server same gui and inventory if gui is static --- .../com/clubobsidian/dynamicgui/core/gui/Gui.java | 14 +++++++++++++- .../core/manager/dynamicgui/GuiManager.java | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index 95160efc3..955e13b88 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -51,8 +51,12 @@ public class Gui implements Serializable, FunctionOwner, MetadataHolder, Closeab private final FunctionTree functions; private Gui back; private final Map metadata; + private final boolean isStatic; - public Gui(String name, String type, String title, int rows, Boolean close, ModeEnum modeEnum, Map> npcIds, List slots, List> locations, FunctionTree functions, Map metadata) { + public Gui(String name, String type, String title, int rows, Boolean close, + ModeEnum modeEnum, Map> npcIds, List slots, + List> locations, FunctionTree functions, Map metadata, + boolean isStatic) { this.name = name; this.type = type; this.title = ChatColor.translateAlternateColorCodes(title); @@ -66,9 +70,13 @@ public Gui(String name, String type, String title, int rows, Boolean close, Mode this.functions = functions; this.back = null; this.metadata = metadata; + this.isStatic = isStatic; } public InventoryWrapper buildInventory(PlayerWrapper playerWrapper) { + if(this.isStatic && this.inventoryWrapper != null) { //Don't rebuild if gui is static + return this.inventoryWrapper; + } String inventoryTitle = this.formatTitle(playerWrapper); Object nativeInventory = this.createInventory(inventoryTitle); InventoryWrapper inventoryWrapper = InventoryManager.get().createInventoryWrapper(nativeInventory); @@ -175,6 +183,10 @@ public void setBack(Gui back) { this.back = back; } + public boolean isStatic() { + return this.isStatic; + } + public Gui clone() { return SerializationUtils.clone(this); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index d7db57afb..efa2e3c94 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -186,7 +186,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu return; } - Gui clonedGui = gui.clone(); + Gui clonedGui = gui.isStatic() ? gui : gui.clone(); if(back != null) { clonedGui.setBack(back.clone()); } @@ -487,6 +487,10 @@ private Gui createGui(final GuiToken guiToken, final String guiName, final List< Map> npcIds = guiToken.getNpcs(); Map metadata = guiToken.getMetadata(); - return new Gui(guiName, type, title, rows, close, modeEnum, npcIds, slots, locations, guiToken.getFunctions(), metadata); + boolean isStatic = guiToken.isStatic(); + + return new Gui(guiName, type, title, rows, close, modeEnum, + npcIds, slots, locations, guiToken.getFunctions(), metadata, + isStatic); } } \ No newline at end of file From 825a159e39a7dd41e918ea5a80fe721f74bc735e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 06:26:36 -0800 Subject: [PATCH 123/261] Fix project not building due to SlotBuilder SlotBuilder didn't have the updated gui constructor --- .../dynamicgui/core/builder/GuiBuilder.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index 6e539def0..6f19e8531 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -43,6 +43,7 @@ public class GuiBuilder { private FunctionTree functionTree = new FunctionTree(); private final Map metadata = new HashMap<>(); private Gui backGui; + private boolean isStatic = false; public GuiBuilder setType(String type) { this.type = type.toUpperCase(); @@ -146,8 +147,15 @@ public GuiBuilder addMetadata(Map metadata) { return this; } + public GuiBuilder setStatic(boolean isStatic) { + this.isStatic = isStatic; + return this; + } + public Gui build() { - Gui gui = new Gui(this.name, this.type, this.title, this.rows, this.close, this.modeEnum, this.npcIds, this.slots, this.locations, this.functionTree, this.metadata); + Gui gui = new Gui(this.name, this.type, this.title, this.rows, + this.close, this.modeEnum, this.npcIds, this.slots, this.locations, + this.functionTree, this.metadata, this.isStatic); if(this.backGui != null) { gui.setBack(this.backGui); } From 2105b3b08ae1c90469df51b905f5708932846015 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 07:19:06 -0800 Subject: [PATCH 124/261] Don't clone if gui is static --- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index efa2e3c94..1e153f022 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -100,12 +100,15 @@ public boolean hasGuiName(String name) { public Gui getGuiByName(String name) { Gui gui = this.guis.get(name); if(gui != null) { - return gui.clone(); + return getOrCloneGui(gui); } - return null; } + private static Gui getOrCloneGui(Gui gui) { + return gui.isStatic() ? gui : gui.clone(); + } + public void reloadGuis(boolean force) { DynamicGui.get().getLogger().info("Reloading guis!"); DynamicGui.get().getPlugin().unloadCommands(); @@ -186,7 +189,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu return; } - Gui clonedGui = gui.isStatic() ? gui : gui.clone(); + Gui clonedGui = getOrCloneGui(gui); if(back != null) { clonedGui.setBack(back.clone()); } From 1ff5f0944f532261b8bc73a8a85f82c3f3a53258 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 07:19:32 -0800 Subject: [PATCH 125/261] Update slots of cached guis per player --- .../inventory/BukkitInventoryManager.java | 2 +- .../core/manager/dynamicgui/SlotManager.java | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index c29eba65d..09d91a66b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -36,6 +36,6 @@ public Object createInventory(String title, String type) { @Override public InventoryWrapper createInventoryWrapper(Object inventory) { - return new BukkitInventoryWrapper((Inventory) inventory); + return new BukkitInventoryWrapper<>((Inventory) inventory); } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java index fbff26056..773cfb0cd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java @@ -23,7 +23,10 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; -import java.util.Iterator; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import java.util.Map.Entry; import java.util.UUID; @@ -38,20 +41,27 @@ public static SlotManager get() { return instance; } - private SlotManager() { this.updateSlots(); } private void updateSlots() { DynamicGui.get().getPlatform().getScheduler().scheduleSyncRepeatingTask(() -> { - Iterator> it = GuiManager.get().getPlayerGuis().entrySet().iterator(); - while(it.hasNext()) { - Entry next = it.next(); + Map> updatedStaticGui = new HashMap<>(); + for(Entry next : GuiManager.get().getPlayerGuis().entrySet()) { UUID key = next.getKey(); PlayerWrapper playerWrapper = DynamicGui.get().getPlatform().getPlayer(key); Gui gui = next.getValue(); - + System.out.println(gui.hashCode()); + Collection cachedSlots = updatedStaticGui.get(gui); + if(gui.isStatic() && cachedSlots != null) { + InventoryWrapper inventoryWrapper = gui.getInventoryWrapper(); + for(Slot slot : cachedSlots) { + inventoryWrapper.updateItem(slot.getIndex(), playerWrapper); + } + continue; + } + Collection updatedSlots = new ArrayList<>(); for(Slot slot : gui.getSlots()) { if(slot.getUpdateInterval() == 0 && !slot.getUpdate()) { continue; @@ -68,10 +78,14 @@ private void updateSlots() { FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper); if(!slot.getItemStack().getType().equalsIgnoreCase(Slot.IGNORE_MATERIAL)) { inventoryWrapper.updateItem(slotIndex, playerWrapper); + updatedSlots.add(slot); } slot.setUpdate(false); } } + if(gui.isStatic()) { //Cache if gui is static an attempt to update was made + updatedStaticGui.put(gui, updatedSlots); + } } }, 1L, 1L); } From 0a389fa861aebb27b2320e3f3b40f74e7d6b9cc1 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 07:20:49 -0800 Subject: [PATCH 126/261] Fix createGui() mock factory method --- .../clubobsidian/dynamicgui/core/test/mock/MockFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 408655d95..448ae9aef 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -95,7 +95,8 @@ public Gui createGui(String title, List slots) { slots, new ArrayList<>(), new FunctionTree(), - new HashMap<>()); + new HashMap<>(), + false); } public Slot createSlot(PlayerWrapper player) { From e8dd7fa3b8060f85a542c9c66fc75407d17179bd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 07:22:13 -0800 Subject: [PATCH 127/261] Remove hashCode() debug --- .../dynamicgui/core/manager/dynamicgui/SlotManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java index 773cfb0cd..f6c506e69 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java @@ -52,7 +52,6 @@ private void updateSlots() { UUID key = next.getKey(); PlayerWrapper playerWrapper = DynamicGui.get().getPlatform().getPlayer(key); Gui gui = next.getValue(); - System.out.println(gui.hashCode()); Collection cachedSlots = updatedStaticGui.get(gui); if(gui.isStatic() && cachedSlots != null) { InventoryWrapper inventoryWrapper = gui.getInventoryWrapper(); From 4a4e2f47fc0baacb36897f06b25c64a4e1799a89 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 23:08:27 -0800 Subject: [PATCH 128/261] Create is not on cooldown function test --- .../function/IsNotOnCooldownFunctionTest.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java new file mode 100644 index 000000000..f8786e646 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsNotOnCooldownFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class IsNotOnCooldownFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullDataTest() { + Function function = new IsNotOnCooldownFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void notOnCooldownTest() { + this.factory.inject(); + Function function = new IsNotOnCooldownFunction(); + function.setData(UUID.randomUUID().toString()); + assertTrue(function.function(this.factory.createPlayer())); + } +} From 783aff9033373e1a2f7eb4ae4975bfdd8303c2fd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 23:13:28 -0800 Subject: [PATCH 129/261] Use long primitive --- .../core/function/impl/cooldown/SetCooldownFunction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java index 711126be8..237ab0d24 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java @@ -42,7 +42,7 @@ public boolean function(PlayerWrapper playerWrapper) { } String name = split[0]; - Long cooldownTime = 0L; + long cooldownTime = 0L; try { cooldownTime = Long.parseLong(split[1]); } catch(NumberFormatException ex) { From fdadae8572a9c7372ed28a60e6b5419e9e35faf0 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 23:21:55 -0800 Subject: [PATCH 130/261] Create is on cooldown function test --- .../function/IsOnCooldownFunctionTest.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java new file mode 100644 index 000000000..3625cb4de --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsOnCooldownFunction; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class IsOnCooldownFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullDataTest() { + Function function = new IsOnCooldownFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void onCooldownTest() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + String cooldownName = UUID.randomUUID().toString(); + CooldownManager.get().createCooldown(player, cooldownName, 1000); + Function function = new IsOnCooldownFunction(); + function.setData(cooldownName); + assertTrue(function.function(player)); + } +} From e5b49c27f2f0db2f1f1001ebd431614e22e13e4b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 23:29:57 -0800 Subject: [PATCH 131/261] Fix gui metadata test class name --- .../test/gui/{GuitMetadataTest.java => GuiMetadataTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/{GuitMetadataTest.java => GuiMetadataTest.java} (97%) diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java similarity index 97% rename from parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java rename to parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java index 514798890..89f44128b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuitMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -public class GuitMetadataTest { +public class GuiMetadataTest { @Test public void testSlotMetadata() { From 245b94e8377b8e43dd12c07d917932e02a0eee16 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Feb 2022 23:32:58 -0800 Subject: [PATCH 132/261] Simplify parser assertions, some other cleanup --- .../parser/test/FunctionTreeTest.java | 36 ++++++++------- .../parser/test/FunctionTypeParserTest.java | 44 +++++++++---------- .../dynamicgui/parser/test/GuiTokenTest.java | 25 ++++++----- .../dynamicgui/parser/test/SlotTokenTest.java | 14 +++--- .../functiontree/EmptyFunctionTreeTest.java | 4 +- .../dynamicgui/parser/test/gui/AliasTest.java | 4 +- .../parser/test/gui/GuiMetadataTest.java | 6 +-- .../parser/test/gui/InvalidTypeTest.java | 4 +- .../parser/test/gui/LoadMacrosTest.java | 6 +-- .../parser/test/gui/LocationTest.java | 4 +- .../parser/test/gui/NoModeTest.java | 4 +- .../parser/test/gui/ValidTypeTest.java | 4 +- .../parser/test/macro/MacroNonStringTest.java | 10 ++--- .../parser/test/macro/MacroParserTest.java | 42 +++++++++--------- .../parser/test/macro/MacrosTokenTest.java | 12 ++--- .../test/macro/MultiMacroSameFileTest.java | 10 ++--- .../parser/test/slot/EnchantTest.java | 4 +- .../parser/test/slot/InvalidAmountTest.java | 4 +- .../slot/InvalidFunctionTypeMacroTest.java | 4 +- .../test/slot/InvalidSlotDataMacroTest.java | 4 +- .../test/slot/InvalidUpdateIntervalTest.java | 6 +-- .../parser/test/slot/ItemFlagTest.java | 4 +- .../dynamicgui/parser/test/slot/LoreTest.java | 4 +- .../parser/test/slot/SlotIndexTest.java | 4 +- .../parser/test/slot/SlotMetadataTest.java | 8 ++-- .../parser/test/slot/ValidAmountTest.java | 4 +- .../test/slot/ValidFunctionTypeMacroTest.java | 4 +- .../test/slot/ValidSlotDataMacroTest.java | 4 +- .../test/slot/ValidUpdateIntervalTest.java | 4 +- 29 files changed, 148 insertions(+), 139 deletions(-) diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java index ad0da1ef7..66a958647 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java @@ -29,7 +29,9 @@ import java.io.File; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; public class FunctionTreeTest { @@ -48,7 +50,7 @@ public static void loadTree() { @Test public void testRootNodeSize() { int rootNodeSize = tree.getRootNodes().size(); - assertTrue(rootNodeSize == 3); + assertEquals(3, rootNodeSize); } @Test @@ -56,7 +58,7 @@ public void testFunctionTypes() { FunctionNode node = tree.getRootNodes().get(0); FunctionToken token = node.getToken(); FunctionType type = token.getTypes().get(0); - assertTrue(type == FunctionType.LOAD); + assertSame(type, FunctionType.LOAD); } @Test @@ -65,16 +67,16 @@ public void testDescend() { int childrenNodeSize = childrenNodes.size(); FunctionToken token = childrenNodes.get(0).getToken(); FunctionData data = token.getFunctions().get(0); - assertTrue(childrenNodeSize == 1); - assertTrue(data.getName().equals("function")); - assertTrue(data.getData().equals("with other data")); + assertEquals(1, childrenNodeSize); + assertEquals("function", data.getName()); + assertEquals("with other data", data.getData()); } @Test public void testDescendTwoFunctions() { List childrenNodes = tree.getRootNodes().get(1).getChildren(); int childrenNodeSize = childrenNodes.size(); - assertTrue(childrenNodeSize == 2); + assertEquals(2, childrenNodeSize); } @Test @@ -86,10 +88,10 @@ public void testDepthTwo() { String name = node.getToken().getName(); int depth = node.getDepth(); FunctionData data = token.getFunctions().get(0); - assertTrue(depth == 2); - assertTrue(childrenNodeSize == 1); - assertTrue(data.getData().equals("some other data")); - assertTrue(name.equals("depth-2-left")); + assertEquals(2, depth); + assertEquals(1, childrenNodeSize); + assertEquals("some other data", data.getData()); + assertEquals("depth-2-left", name); } @Test @@ -98,7 +100,7 @@ public void testColonParsing() { FunctionToken token = node.getToken(); FunctionData data = token.getFunctions().get(1); String functionData = data.getData(); - assertTrue(functionData.equals("with:a colon")); + assertEquals("with:a colon", functionData); } @Test @@ -107,7 +109,7 @@ public void testTrimming() { FunctionToken token = node.getToken(); FunctionData data = token.getFunctions().get(2); String functionDataStr = data.getData(); - assertTrue(functionDataStr.equals("test trimming")); + assertEquals("test trimming", functionDataStr); } @Test @@ -116,7 +118,7 @@ public void testNormalize() { FunctionToken token = node.getToken(); FunctionData data = token.getFunctions().get(1); String functionName = data.getName(); - assertTrue(functionName.equals("functiontonormalize")); + assertEquals("functiontonormalize", functionName); } @Test @@ -132,7 +134,7 @@ public void testFailFunctionsList() { FunctionData data = token.getFailOnFunctions().get(0); String functionName = data.getName(); - assertTrue(functionName.equals("onfailfunction")); + assertEquals("onfailfunction", functionName); } @Test @@ -148,12 +150,12 @@ public void testFailFunctionsString() { FunctionData data = token.getFailOnFunctions().get(0); String functionName = data.getName(); - assertTrue(functionName.equals("onfailfunctionstring")); + assertEquals("onfailfunctionstring", functionName); } @Test public void testMacroTokens() { List tokens = tree.getMacroParser().getTokens(); - assertTrue(tokens != null); + assertNotNull(tokens); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java index 1be746161..710a1e1b6 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java @@ -18,88 +18,88 @@ import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.FunctionTypeParser; import com.clubobsidian.dynamicgui.parser.macro.MacroParser; -import com.clubobsidian.dynamicgui.parser.macro.MacroToken; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class FunctionTypeParserTest { @Test public void testLeft() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("LEFT").equals(FunctionType.LEFT)); + assertEquals(typeParser.parseType("LEFT"), FunctionType.LEFT); } @Test public void testRight() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("RIGHT").equals(FunctionType.RIGHT)); + assertEquals(typeParser.parseType("RIGHT"), FunctionType.RIGHT); } @Test public void testLowercase() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("left").equals(FunctionType.LEFT)); + assertEquals(typeParser.parseType("left"), FunctionType.LEFT); } @Test public void testParseShiftLeftWithUnderscore() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("SHIFT_LEFT").equals(FunctionType.SHIFT_LEFT)); + assertEquals(typeParser.parseType("SHIFT_LEFT"), FunctionType.SHIFT_LEFT); } @Test public void testParseShiftLeftNoUnderscore() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("SHIFTLEFT").equals(FunctionType.SHIFT_LEFT)); + assertEquals(typeParser.parseType("SHIFTLEFT"), FunctionType.SHIFT_LEFT); } @Test public void testParseShiftRighWithUnderscore() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("SHIFT_RIGHT").equals(FunctionType.SHIFT_RIGHT)); + assertEquals(typeParser.parseType("SHIFT_RIGHT"), FunctionType.SHIFT_RIGHT); } @Test public void testParseShiftRightNoUnderscore() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("SHIFTRIGHT").equals(FunctionType.SHIFT_RIGHT)); + assertEquals(typeParser.parseType("SHIFTRIGHT"), FunctionType.SHIFT_RIGHT); } @Test public void testInvalidFunctionType() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); - assertTrue(typeParser.parseType("DOESNOTEXIST") == null); + assertNull(typeParser.parseType("DOESNOTEXIST")); } @Test public void testFunctionTypeList() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); List types = new ArrayList<>(Arrays.asList("LEFT", "RIGHT")); List parsedTypes = typeParser.parseTypes(types); - assertTrue(parsedTypes.size() == 2); + assertEquals(2, parsedTypes.size()); } @Test public void testFunctionTypeListWithInvalidFunction() { - MacroParser macroParser = new MacroParser(new ArrayList()); + MacroParser macroParser = new MacroParser(new ArrayList<>()); FunctionTypeParser typeParser = new FunctionTypeParser(macroParser); List types = new ArrayList<>(Arrays.asList("LEFT", "DOESNOTEXIST")); List parsedTypes = typeParser.parseTypes(types); - assertTrue(parsedTypes.size() == 1); + assertEquals(1, parsedTypes.size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java index 7c279bd99..266a93e0a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java @@ -32,6 +32,9 @@ import java.util.List; import java.util.Map; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; public class GuiTokenTest { @@ -48,19 +51,19 @@ public static void loadToken() { @Test public void testTitle() { String title = token.getTitle(); - assertTrue(title.equals("test gui title")); + assertEquals("test gui title", title); } @Test public void testRows() { int rows = token.getRows(); - assertTrue(rows == 1); + assertEquals(1, rows); } @Test public void testMode() { GuiMode mode = token.getMode(); - assertTrue(mode == GuiMode.SET); + assertSame(mode, GuiMode.SET); } @Test @@ -73,16 +76,16 @@ public void testClose() { public void testNpcs() { Map> npcs = token.getNpcs(); List npcIds = npcs.get("citizens"); - assertTrue(npcIds != null); - assertTrue(npcIds.size() == 2); - assertTrue(npcIds.get(0) == 5); - assertTrue(npcIds.get(1) == 77); + assertNotNull(npcIds); + assertEquals(2, npcIds.size()); + assertEquals(5, (int) npcIds.get(0)); + assertEquals(77, (int) npcIds.get(1)); } @Test public void testSlots() { Map slots = token.getSlots(); - assertTrue(slots.size() == 6); + assertEquals(6, slots.size()); } @Test @@ -91,13 +94,13 @@ public void testGuiFunctions() { FunctionNode node = tree.getRootNodes().get(0); FunctionData data = node.getToken().getFunctions().get(0); String functionName = data.getName(); - assertTrue(functionName.equals("function2")); + assertEquals("function2", functionName); } @Test public void testMacroToken() { MacroToken macroToken = token.getMacroParser().getTokens().get(0); - assertTrue(macroToken != null); + assertNotNull(macroToken); } @Test @@ -116,6 +119,6 @@ public void testExternalMacroToken() { String title = token.getTitle(); - assertTrue(title.equals("test gui title")); + assertEquals("test gui title", title); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java index 2d2ecec6d..280fd32f6 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java @@ -25,7 +25,9 @@ import java.io.File; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; public class SlotTokenTest { @@ -43,19 +45,19 @@ public static void loadSlotToken() { @Test public void testSlotName() { String name = token.getName(); - assertTrue(name.equals("test")); + assertEquals("test", name); } @Test public void testSlotIcon() { String icon = token.getIcon(); - assertTrue(icon.equals("DIRT")); + assertEquals("DIRT", icon); } @Test public void testSlotNbt() { String nbt = token.getNbt(); - assertTrue(nbt.equals("{SomeKey:\"some value\"}")); + assertEquals("{SomeKey:\"some value\"}", nbt); } @Test @@ -73,7 +75,7 @@ public void testSlotClose() { @Test public void testSlotData() { byte data = token.getData(); - assertTrue(data == 1); + assertEquals(1, data); } @@ -81,12 +83,12 @@ public void testSlotData() { public void testSlotFunctionTree() { FunctionTree tree = token.getFunctionTree(); int nodeSize = tree.getRootNodes().size(); - assertTrue(nodeSize == 1); + assertEquals(1, nodeSize); } @Test public void testMacroToken() { MacroToken macroToken = token.getMacroParser().getTokens().get(0); - assertTrue(macroToken != null); + assertNotNull(macroToken); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java index 96b554b15..75dfd535f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java @@ -19,13 +19,13 @@ import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class EmptyFunctionTreeTest { @Test public void testEmptyFunctionTree() { FunctionTree tree = new FunctionTree(); - assertTrue(tree.getRootNodes().size() == 0); + assertEquals(0, tree.getRootNodes().size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java index 92a26bf11..8da567f84 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java @@ -22,7 +22,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class AliasTest { @@ -33,6 +33,6 @@ public void testAlias() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String alias = token.getAlias().get(0); - assertTrue(alias.equals("test")); + assertEquals("test", alias); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java index 89f44128b..620cf8884 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java @@ -23,7 +23,7 @@ import java.io.File; import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class GuiMetadataTest { @@ -34,7 +34,7 @@ public void testSlotMetadata() { Configuration config = Configuration.load(metadataFile); GuiToken token = new GuiToken(config); Map metadata = token.getMetadata(); - assertTrue(metadata.size() == 1); - assertTrue(metadata.get("some").equals("metadata")); + assertEquals(1, metadata.size()); + assertEquals("metadata", metadata.get("some")); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java index 149aedb5f..31c111cfb 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java @@ -22,7 +22,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class InvalidTypeTest { @@ -33,6 +33,6 @@ public void testType() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String type = token.getType(); - assertTrue(type.equals("CHEST")); + assertEquals("CHEST", type); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java index f4990796b..905f0192d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java @@ -23,7 +23,7 @@ import java.io.File; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class LoadMacrosTest { @@ -34,7 +34,7 @@ public void testLoadMacros() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); List loadMacros = token.getLoadMacros(); - assertTrue(loadMacros.size() == 1); - assertTrue(loadMacros.get(0).equals("test")); + assertEquals(1, loadMacros.size()); + assertEquals("test", loadMacros.get(0)); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java index dba127995..b55b80fde 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java @@ -22,7 +22,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class LocationTest { @@ -33,7 +33,7 @@ public void testAlias() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String location = token.getLocations().get(0); - assertTrue(location.equals("0,0,0,world")); + assertEquals("0,0,0,world", location); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java index 5e145d73b..c1bff3469 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertSame; public class NoModeTest { @@ -34,7 +34,7 @@ public void testAlias() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); GuiMode alias = token.getMode(); - assertTrue(alias == GuiMode.SET); + assertSame(alias, GuiMode.SET); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java index d8cdc298f..b957af045 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java @@ -22,7 +22,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ValidTypeTest { @@ -33,6 +33,6 @@ public void testType() { Configuration config = Configuration.load(file); GuiToken token = new GuiToken(config); String type = token.getType(); - assertTrue(type.equals("DISPENSER")); + assertEquals("DISPENSER", type); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java index ec6808801..6642e8497 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class MacroNonStringTest { @@ -42,7 +42,7 @@ public void testNonStringParseStringMacros() { tokens.add(token); MacroParser parser = new MacroParser(tokens); String parsed = parser.parseStringMacros("%test-non-string%"); - assertTrue(parsed.equals("1")); + assertEquals("1", parsed); } @Test @@ -61,8 +61,8 @@ public void testNonStringParseListMacros() { nonString.add("%test-non-string%"); nonString.add("%test-non-string%"); List parsed = parser.parseListMacros(nonString); - assertTrue(parsed.size() == 2); - assertTrue(parsed.get(0).equals("1")); - assertTrue(parsed.get(1).equals("1")); + assertEquals(2, parsed.size()); + assertEquals("1", parsed.get(0)); + assertEquals("1", parsed.get(1)); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java index ba2389594..c9242d453 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class MacroParserTest { @@ -51,15 +51,15 @@ public void testMultilineParsing() { System.out.println("newLore:" + newLore.toString()); - assertTrue(newLore.size() == 8); - assertTrue(newLore.get(0).equals("This is some text")); - assertTrue(newLore.get(1).equals("Replace some text")); - assertTrue(newLore.get(2).equals("and some other text test")); - assertTrue(newLore.get(3).equals("with some other text")); - assertTrue(newLore.get(4).equals("Replace some text")); - assertTrue(newLore.get(5).equals("and some other text")); - assertTrue(newLore.get(6).equals("with some other text")); - assertTrue(newLore.get(7).equals("not-a-macro")); + assertEquals(8, newLore.size()); + assertEquals("This is some text", newLore.get(0)); + assertEquals("Replace some text", newLore.get(1)); + assertEquals("and some other text test", newLore.get(2)); + assertEquals("with some other text", newLore.get(3)); + assertEquals("Replace some text", newLore.get(4)); + assertEquals("and some other text", newLore.get(5)); + assertEquals("with some other text", newLore.get(6)); + assertEquals("not-a-macro", newLore.get(7)); } @Test @@ -83,9 +83,9 @@ public void testSmallMultiLine() { System.out.println(newLore.toString()); - assertTrue(newLore.size() == 2); - assertTrue(newLore.get(0).equals("Replace some text")); - assertTrue(newLore.get(1).equals("test")); + assertEquals(2, newLore.size()); + assertEquals("Replace some text", newLore.get(0)); + assertEquals("test", newLore.get(1)); } @Test @@ -109,7 +109,7 @@ public void testOutOfIndexSmallMultiLine() { System.out.println("New lore: " + newLore + " Size: " + newLore.size()); - assertTrue(newLore.get(0).equals("Replace some text")); + assertEquals("Replace some text", newLore.get(0)); } @@ -132,7 +132,7 @@ public void testSingleLineParsing() { String newName = parser.parseStringMacros(name); - assertTrue(newName.equals("A name")); + assertEquals("A name", newName); } @Test @@ -159,11 +159,11 @@ public void testMacroChaining() { System.out.println("parsedLore: " + parsedLore.size()); - assertTrue(parsedLore.size() == 5); - assertTrue(parsedLore.get(0).equals("not-a-macro")); - assertTrue(parsedLore.get(1).equals("Replace some text")); - assertTrue(parsedLore.get(2).equals("and some other text test")); - assertTrue(parsedLore.get(3).equals("with some other text")); - assertTrue(parsedLore.get(4).equals("still-not-a-macro")); + assertEquals(5, parsedLore.size()); + assertEquals("not-a-macro", parsedLore.get(0)); + assertEquals("Replace some text", parsedLore.get(1)); + assertEquals("and some other text test", parsedLore.get(2)); + assertEquals("with some other text", parsedLore.get(3)); + assertEquals("still-not-a-macro", parsedLore.get(4)); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java index 92d41ddcd..c5d6438b9 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java @@ -25,6 +25,8 @@ import java.util.List; import java.util.Map; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; public class MacrosTokenTest { @@ -38,7 +40,7 @@ public void testGuiMacroToken() { MacroToken token = new MacroToken(section); Map macros = token.getMacros(); - assertTrue(macros.size() == 2); + assertEquals(2, macros.size()); } @Test @@ -57,7 +59,7 @@ public void testSlotMacroToken() { Object firstMacro = macros.get("%test%"); assertTrue(firstMacro instanceof String); - assertTrue(firstMacro.equals("This is some text")); + assertEquals("This is some text", firstMacro); Object secondMacro = macros.get("%multiline-test%"); assertTrue(secondMacro instanceof List); @@ -65,7 +67,7 @@ public void testSlotMacroToken() { List listMacro = ((List) secondMacro); assertTrue(listMacro.get(0) instanceof String); - assertTrue(listMacro.size() == 3); + assertEquals(3, listMacro.size()); } @@ -80,7 +82,7 @@ public void testEmptyMacroToken() { MacroToken token = new MacroToken(section); Map macros = token.getMacros(); - assertTrue(macros != null); - assertTrue(macros.size() == 0); + assertNotNull(macros); + assertEquals(0, macros.size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java index aa02db7a6..454a7a8c2 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class MultiMacroSameFileTest { @@ -47,7 +47,7 @@ public void stringTest() { String toParse = "%uses-test%"; String parsed = parser.parseStringMacros(toParse); System.out.println(parsed); - assertTrue(parsed.equals("test")); + assertEquals("test", parsed); } @Test @@ -70,9 +70,9 @@ public void listTest() { replaceIn.add(toParse); List parsed = parser.parseListMacros(replaceIn); System.out.println(parsed); - assertTrue(parsed.size() == 2); - assertTrue(parsed.get(0).equals("test1")); - assertTrue(parsed.get(1).equals("test2")); + assertEquals(2, parsed.size()); + assertEquals("test1", parsed.get(0)); + assertEquals("test2", parsed.get(1)); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java index cfc6b4536..dfca14a65 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java @@ -24,7 +24,7 @@ import java.io.File; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class EnchantTest { @@ -36,6 +36,6 @@ public void enchantTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); List enchants = token.getEnchants(); - assertTrue(enchants.size() == 3); + assertEquals(3, enchants.size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java index 76ededb55..1892b5283 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class InvalidAmountTest { @@ -35,6 +35,6 @@ public void amountTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int amount = token.getAmount(); - assertTrue(amount == 1); + assertEquals(1, amount); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java index 64d3c91e0..ddb877769 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java @@ -25,7 +25,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class InvalidFunctionTypeMacroTest { @@ -39,6 +39,6 @@ public void invalidFunctionTypeTest() { SlotToken token = new SlotToken(0, section); FunctionTree tree = token.getFunctionTree(); FunctionToken functionToken = tree.getRootNodes().get(0).getToken(); - assertTrue(functionToken.getTypes().size() == 1); + assertEquals(1, functionToken.getTypes().size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java index 8e8fe8926..c87317d5e 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class InvalidSlotDataMacroTest { @@ -36,6 +36,6 @@ public void testInvalidSlotData() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); byte data = token.getData(); - assertTrue(data == 0); + assertEquals(0, data); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java index 3f6cdb8b4..be904079f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class InvalidUpdateIntervalTest { @@ -35,7 +35,7 @@ public void lessThanZeroupdateIntervalTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int interval = token.getUpdateInterval(); - assertTrue(interval == 0); + assertEquals(0, interval); } @Test @@ -46,6 +46,6 @@ public void invalidIntervalTest() { ConfigurationSection section = config.getConfigurationSection("1"); SlotToken token = new SlotToken(1, section); int interval = token.getUpdateInterval(); - assertTrue(interval == 0); + assertEquals(0, interval); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java index 591babd54..c4886c95a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java @@ -24,7 +24,7 @@ import java.io.File; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ItemFlagTest { @@ -36,6 +36,6 @@ public void enchantTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); List enchants = token.getItemFlags(); - assertTrue(enchants.size() == 2); + assertEquals(2, enchants.size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java index 02db14eda..6bfc4d55e 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java @@ -24,7 +24,7 @@ import java.io.File; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class LoreTest { @@ -36,6 +36,6 @@ public void loreTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); List lore = token.getLore(); - assertTrue(lore.size() == 2); + assertEquals(2, lore.size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java index 7c2be1477..ceefde777 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SlotIndexTest { @@ -34,6 +34,6 @@ public void testSlotIndex() { Configuration config = Configuration.load(file); ConfigurationSection section = config.getConfigurationSection("13"); SlotToken token = new SlotToken(13, section); - assertTrue(token.getIndex() == 13); + assertEquals(13, token.getIndex()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java index d109ede8e..d7c30cd60 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java @@ -24,7 +24,7 @@ import java.io.File; import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class SlotMetadataTest { @@ -36,8 +36,8 @@ public void testSlotMetadata() { ConfigurationSection slot = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, slot); Map metadata = token.getMetadata(); - assertTrue(metadata.size() == 1); - assertTrue(metadata.get("some").equals("metadata")); + assertEquals(1, metadata.size()); + assertEquals("metadata", metadata.get("some")); } @Test @@ -48,6 +48,6 @@ public void testSlotNoMetadata() { ConfigurationSection slot = config.getConfigurationSection("1"); SlotToken token = new SlotToken(1, slot); Map metadata = token.getMetadata(); - assertTrue(metadata.size() == 0); + assertEquals(0, metadata.size()); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java index f5839cfca..132147d1b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ValidAmountTest { @@ -35,6 +35,6 @@ public void amountTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int amount = token.getAmount(); - assertTrue(amount == 32); + assertEquals(32, amount); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java index 8f8c17b37..b51124a7f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java @@ -26,7 +26,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertSame; public class ValidFunctionTypeMacroTest { @@ -40,6 +40,6 @@ public void validFunctionTypeMacroTest() { SlotToken token = new SlotToken(0, section); FunctionTree tree = token.getFunctionTree(); FunctionToken functionToken = tree.getRootNodes().get(0).getToken(); - assertTrue(functionToken.getTypes().get(0) == FunctionType.RIGHT); + assertSame(functionToken.getTypes().get(0), FunctionType.RIGHT); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java index 2650136f7..e2709d8f9 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ValidSlotDataMacroTest { @@ -36,6 +36,6 @@ public void validSlotDataMacroTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); byte data = token.getData(); - assertTrue(data == 1); + assertEquals(1, data); } } \ No newline at end of file diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java index 72498776f..67d74f450 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java @@ -23,7 +23,7 @@ import java.io.File; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ValidUpdateIntervalTest { @@ -35,6 +35,6 @@ public void updateIntervalTest() { ConfigurationSection section = config.getConfigurationSection("0"); SlotToken token = new SlotToken(0, section); int interval = token.getUpdateInterval(); - assertTrue(interval == 5); + assertEquals(5, interval); } } \ No newline at end of file From 0fc8f8992acd2635a872e8a2f0500cf0e00c695d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 27 Feb 2022 07:16:46 -0800 Subject: [PATCH 133/261] Create set cooldown function tests --- .../impl/cooldown/SetCooldownFunction.java | 2 +- .../function/SetCooldownFunctionTest.java | 71 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java index 237ab0d24..17a69efec 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java @@ -42,7 +42,7 @@ public boolean function(PlayerWrapper playerWrapper) { } String name = split[0]; - long cooldownTime = 0L; + long cooldownTime; try { cooldownTime = Long.parseLong(split[1]); } catch(NumberFormatException ex) { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java new file mode 100644 index 000000000..43a15fcc9 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java @@ -0,0 +1,71 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.cooldown.SetCooldownFunction; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SetCooldownFunctionTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void nullDataTest() { + Function function = new SetCooldownFunction(); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void noCommaTest() { + Function function = new SetCooldownFunction(); + function.setData("a"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void invalidNumberTest() { + Function function = new SetCooldownFunction(); + function.setData("a,a"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void lengthNotTwoTest() { + Function function = new SetCooldownFunction(); + function.setData("a,a,a"); + assertFalse(function.function(this.factory.createPlayer())); + } + + @Test + public void onCooldownTest() { + this.factory.inject(); + PlayerWrapper player = this.factory.createPlayer(); + String cooldownName = UUID.randomUUID().toString(); + String data = cooldownName + ",1000"; + Function function = new SetCooldownFunction(); + function.setData(data); + assertTrue(function.function(player)); + } +} \ No newline at end of file From 48098b17cdf4af20eda9589b3c2d1ae8822ee8f1 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Feb 2022 03:06:06 -0800 Subject: [PATCH 134/261] Create enchantment builder test --- .../test/builder/EnchantmentBuilderTest.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java new file mode 100644 index 000000000..7d3f8558a --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java @@ -0,0 +1,44 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.builder; + +import com.clubobsidian.dynamicgui.core.builder.EnchantmentBuilder; +import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class EnchantmentBuilderTest { + + @Test + public void testName() { + String enchantmentName = "test"; + EnchantmentWrapper enchantment = new EnchantmentBuilder() + .setEnchantment(enchantmentName) + .build(); + assertEquals(enchantmentName, enchantment.getEnchant()); + } + + @Test + public void testLevel() { + int enchantmentLevel = 1; + EnchantmentWrapper enchantment = new EnchantmentBuilder() + .setLevel(enchantmentLevel) + .build(); + assertEquals(enchantmentLevel, enchantment.getLevel()); + } +} \ No newline at end of file From ddcb5a0f1ce9bd7ef328e2f7c2814d7e878e6870 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Feb 2022 03:11:05 -0800 Subject: [PATCH 135/261] Remove builder create FunctionData methods --- .../dynamicgui/core/builder/FunctionBuilder.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java index d89689fba..fb7596802 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java @@ -39,18 +39,6 @@ public FunctionBuilder setModifier(FunctionModifier modifier) { return this; } - public FunctionData create(String name, String data) { - return this.create(name, data, FunctionModifier.NONE); - } - - - public FunctionData create(String name, String data, FunctionModifier modifier) { - this.setName(name); - this.setData(data); - this.setModifier(modifier); - return this.build(); - } - public FunctionData build() { return new FunctionData(this.name, this.data, this.modifier); } From 3fae41729a775cccf46fc952282507a1ac53f710 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Feb 2022 03:12:33 -0800 Subject: [PATCH 136/261] Create function builder test --- .../test/builder/FunctionBuilderTest.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java new file mode 100644 index 000000000..1b7237782 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java @@ -0,0 +1,54 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.builder; + +import com.clubobsidian.dynamicgui.core.builder.FunctionBuilder; +import com.clubobsidian.dynamicgui.parser.function.FunctionData; +import com.clubobsidian.dynamicgui.parser.function.FunctionModifier; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class FunctionBuilderTest { + + @Test + public void nameTest() { + String functionName = "test"; + FunctionData function = new FunctionBuilder() + .setName(functionName) + .build(); + assertEquals(functionName, function.getName()); + } + + @Test + public void dataTest() { + String functionData = "data"; + FunctionData function = new FunctionBuilder() + .setData(functionData) + .build(); + assertEquals(functionData, function.getData()); + } + + @Test + public void modifierTest() { + FunctionModifier functionModifier = FunctionModifier.NOT; + FunctionData function = new FunctionBuilder() + .setModifier(functionModifier) + .build(); + assertEquals(functionModifier, function.getModifier()); + } +} From feefaadf8406d929c6bb8a835c187f2ff9dc0fa4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Feb 2022 03:18:15 -0800 Subject: [PATCH 137/261] Initialize variables outside constructor for token builder --- .../core/builder/FunctionTokenBuilder.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java index c9d468e70..e0f9fcfbe 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java @@ -26,17 +26,10 @@ public class FunctionTokenBuilder { - private final String name; - private final List types; - private final List functions; - private final List failOnFunctions; - - public FunctionTokenBuilder() { - this.name = UUID.randomUUID().toString(); - this.types = new ArrayList<>(); - this.functions = new ArrayList<>(); - this.failOnFunctions = new ArrayList<>(); - } + private final String name = UUID.randomUUID().toString(); + private final List types = new ArrayList<>(); + private final List functions = new ArrayList<>(); + private final List failOnFunctions = new ArrayList<>(); public FunctionTokenBuilder addType(String type) { FunctionType functionType = FunctionType.valueOf(type.toUpperCase()); From 51cdc45f2161bfc94d552e6380ea139649477c70 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Feb 2022 03:29:36 -0800 Subject: [PATCH 138/261] Added exceptionally to completable futures Added exceptionally to missing completable futures so that exceptions don't just get swallowed --- .../core/manager/dynamicgui/FunctionManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 7175cb5b2..1e372ab94 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -94,6 +94,10 @@ private CompletableFuture recurFunctionNodes(FunctionResponse fail, PlayerWrapper playerWrapper) { Queue nodeQueue = new ArrayDeque<>(functionNodes); CompletableFuture future = new CompletableFuture<>(); + future.exceptionally((ex) -> { + ex.printStackTrace(); + return null; + }); FunctionNode node = nodeQueue.poll(); if(node != null) { FunctionToken functionToken = node.getToken(); @@ -129,6 +133,10 @@ private CompletableFuture recurFunctionNodes(FunctionResponse fail, private CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { CompletableFuture response = new CompletableFuture<>(); + response.exceptionally((ex) -> { + ex.printStackTrace(); + return null; + }); ThreadUtil.run(() -> { for(int i = 0; i < functionDataList.size(); i++) { FunctionData data = functionDataList.get(i); From 6e349d304bbcdd75514cee614c913a615b8df352 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 1 Mar 2022 22:22:37 -0800 Subject: [PATCH 139/261] ChatColorColorizer -> ChatColorTransformer --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 4 ++-- .../{ChatColorColorizer.java => ChatColorTransformer.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/config/{ChatColorColorizer.java => ChatColorTransformer.java} (90%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 661f3041b..5547523f1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -15,7 +15,7 @@ */ package com.clubobsidian.dynamicgui.core; -import com.clubobsidian.dynamicgui.core.config.ChatColorColorizer; +import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; @@ -200,7 +200,7 @@ private void loadConfig() { Configuration config = Configuration.load(this.plugin.getConfigFile()); ConfigurationSection messageSection = config.getConfigurationSection("message"); Collection transformers = new ArrayList<>(); - transformers.add(new ChatColorColorizer()); + transformers.add(new ChatColorTransformer()); messageSection.inject(this.message, transformers); String version = config.getString("version"); if(version != null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java similarity index 90% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java index e7e551b07..529566496 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorColorizer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java @@ -19,9 +19,9 @@ import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.wrappy.transformer.NodeTransformer; -public class ChatColorColorizer extends NodeTransformer { +public class ChatColorTransformer extends NodeTransformer { - public ChatColorColorizer() { + public ChatColorTransformer() { super(String.class); } From c4ffa41f72d27dda33d282c56154ec8e4535d331 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 1 Mar 2022 22:25:13 -0800 Subject: [PATCH 140/261] Create chat color transformer test --- .../test/config/ChatColorTransformerTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java new file mode 100644 index 000000000..bb0da8925 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.config; + +import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; +import com.clubobsidian.dynamicgui.core.util.ChatColor; +import com.clubobsidian.wrappy.transformer.NodeTransformer; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ChatColorTransformerTest { + + @Test + public void transformTest() { + String str = "&ctest"; + String colorized = ChatColor.FORMATTING_CODE + "ctest"; + NodeTransformer transformer = new ChatColorTransformer(); + String transformed = transformer.transform(str); + assertEquals(colorized, transformed); + } +} \ No newline at end of file From 4f3c55890cf47b1e0fda03f37e3cf0c575263096 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 1 Mar 2022 22:29:30 -0800 Subject: [PATCH 141/261] Create message test --- .../core/test/config/MessageTest.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java new file mode 100644 index 000000000..a61bb40a8 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java @@ -0,0 +1,45 @@ +/* + * Copyright 2021 Club Obsidian and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.config; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class MessageTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void notNullTest() { + this.factory.inject(); + assertNotNull(DynamicGui.get().getMessage()); + } + + @Test + public void noGuiTest() { + this.factory.inject(); + String noGuiMessage = DynamicGui.get().getMessage().getNoGui(); + assertNotNull(noGuiMessage); + assertTrue(noGuiMessage.length() > 0); + } + +} From 092b54dcd2592c44dc59c0c35d3f3473a8707c5a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 2 Mar 2022 02:56:51 -0800 Subject: [PATCH 142/261] Fix fail functions continuing Closes #236 --- .../dynamicgui/core/manager/dynamicgui/FunctionManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 1e372ab94..c6211cd59 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -180,7 +180,10 @@ private CompletableFuture runFunctionData(FunctionOwner owner, //Return if function is async since the async caller will hand //control back to this method after completion or the function will //fail and then complete - if(async) { + //Also return if the future is completed, this is done because if a function is completed + //with a sync function that failed the future will complete, but we don't want to continue + //the loop + if(async || response.isDone()) { return; } } From 377f9163269d659c9aff409b047ae664cedc1d5c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 2 Mar 2022 03:53:50 -0800 Subject: [PATCH 143/261] Added false async testing function --- .../dynamicgui/core/DynamicGui.java | 2 ++ .../function/impl/FalseAsyncFunction.java | 23 +++++++++++++++++++ .../core/test/config/MessageTest.java | 4 +--- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 5547523f1..b7ee5eaba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -25,6 +25,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; +import com.clubobsidian.dynamicgui.core.function.impl.FalseAsyncFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; @@ -358,6 +359,7 @@ private void loadFunctions() { FunctionManager.get().addFunction(new IsBedrockPlayerFunction()); FunctionManager.get().addFunction(new DelayFunction()); + FunctionManager.get().addFunction(new FalseAsyncFunction()); } private void startPlayerCountTimer() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java new file mode 100644 index 000000000..9bbd7e99e --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java @@ -0,0 +1,23 @@ +package com.clubobsidian.dynamicgui.core.function.impl; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; +import org.apache.commons.lang3.math.NumberUtils; + +public class FalseAsyncFunction extends Function { + + public FalseAsyncFunction() { + super("falseasync", true); + } + + @Override + public boolean function(PlayerWrapper playerWrapper) { + try { + Thread.sleep(5000); + return false; + } catch(InterruptedException e) { + e.printStackTrace(); + return false; + } + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java index a61bb40a8..2d564efd6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java @@ -20,7 +20,6 @@ import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -41,5 +40,4 @@ public void noGuiTest() { assertNotNull(noGuiMessage); assertTrue(noGuiMessage.length() > 0); } - -} +} \ No newline at end of file From 41ff9032928ec311f78bf8977c1fc75e4c6419bc Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 2 Mar 2022 05:19:42 -0800 Subject: [PATCH 144/261] Fix fail functions never completing Fix fail functions never completing the future. This wasn't noticed because the code "worked" but it would never complete the future. --- .../listener/InventoryInteractListener.java | 1 - .../manager/dynamicgui/FunctionManager.java | 42 ++++++++++++------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 1c11b51e7..f68a1e3a3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -67,7 +67,6 @@ public void invClick(final InventoryClickEvent e) { return; } - List functions = slot.getFunctions().getRootNodes(); if(functions.size() > 0) { String clickString = e.getClick().toString(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index c6211cd59..1430b759f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -36,6 +36,7 @@ import java.util.Queue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicBoolean; public class FunctionManager { @@ -84,16 +85,19 @@ public boolean removeFunctionByName(String functionName) { } public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { - return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper); + return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, + playerWrapper, null, new AtomicBoolean(true)); } - private CompletableFuture recurFunctionNodes(FunctionResponse fail, + private CompletableFuture recurFunctionNodes(FunctionResponse response, FunctionOwner owner, Collection functionNodes, FunctionType type, - PlayerWrapper playerWrapper) { + PlayerWrapper playerWrapper, + CompletableFuture incomingFuture, + AtomicBoolean returnValue) { Queue nodeQueue = new ArrayDeque<>(functionNodes); - CompletableFuture future = new CompletableFuture<>(); + CompletableFuture future = incomingFuture == null ? new CompletableFuture<>() : incomingFuture; future.exceptionally((ex) -> { ex.printStackTrace(); return null; @@ -104,30 +108,36 @@ private CompletableFuture recurFunctionNodes(FunctionResponse fail, List types = functionToken.getTypes(); if(types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { if(type != FunctionType.FAIL) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { - if(!response.result) { - if(response.failedFunction == null) { + runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { + if(!dataResponse.result) { + if(dataResponse.failedFunction == null) { future.complete(false); } else { - recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper) - .thenAccept((value) -> future.complete(false)); + returnValue.set(false); + recurFunctionNodes(dataResponse, owner, + node.getChildren(), FunctionType.FAIL, + playerWrapper, future, returnValue); } } else { - recurFunctionNodes(response, owner, node.getChildren(), type, playerWrapper); + recurFunctionNodes(dataResponse, owner, + node.getChildren(), type, + playerWrapper, future, returnValue); } }); } else if(type == FunctionType.FAIL) { - if(isFail(fail, functionToken)) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(response -> { - if(!response.result) { - recurFunctionNodes(response, owner, node.getChildren(), FunctionType.FAIL, playerWrapper); - } + if(isFail(response, functionToken)) { + runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { + recurFunctionNodes(dataResponse, owner, + node.getChildren(), FunctionType.FAIL, + playerWrapper, future, returnValue); }); } } } } - future.complete(true); + if(node == null) { + future.complete(returnValue.get()); + } return future; } From bb4f50698a20475fbcfbfc77cb6c1e7efa003e5a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 8 Mar 2022 00:06:33 -0800 Subject: [PATCH 145/261] Reformat code --- .../command/BukkitDynamicGuiCommand.java | 34 ++++---- .../bukkit/command/BukkitGuiCommand.java | 4 +- .../bukkit/command/CustomCommand.java | 2 +- .../bukkit/command/CustomCommandExecutor.java | 2 +- .../bukkit/economy/VaultEconomy.java | 30 +++---- .../bukkit/entity/BukkitPlayerWrapper.java | 6 +- .../bukkit/inject/BukkitPluginModule.java | 2 +- .../inventory/BukkitInventoryWrapper.java | 6 +- .../inventory/BukkitItemStackWrapper.java | 48 ++++++------ .../bukkit/listener/EntityClickListener.java | 2 +- .../listener/InventoryCloseListener.java | 2 +- .../listener/InventoryInteractListener.java | 26 +++---- .../listener/InventoryOpenListener.java | 2 +- .../listener/PlayerInteractListener.java | 4 +- .../manager/entity/BukkitEntityManager.java | 2 +- .../inventory/BukkitItemStackManager.java | 2 +- .../material/BukkitMaterialManager.java | 4 +- .../manager/world/BukkitLocationManager.java | 2 +- .../bukkit/permission/VaultPermission.java | 24 +++--- .../bukkit/platform/BukkitPlatform.java | 10 +-- .../bukkit/plugin/BukkitPlugin.java | 36 ++++----- .../model/ItemsAdderModelProvider.java | 18 ++--- .../registry/model/OraxenModelProvider.java | 16 ++-- .../bukkit/registry/npc/CitizensRegistry.java | 6 +- .../PlaceholderApiReplacerRegistry.java | 2 +- .../dynamicgui/bukkit/util/BukkitNBTUtil.java | 36 ++++----- .../bukkit/util/BukkitPacketUtil.java | 74 +++++++++--------- .../dynamicgui/bukkit/util/VersionUtil.java | 2 +- .../dynamicgui/core/DynamicGui.java | 44 +++++------ .../core/builder/FunctionTokenBuilder.java | 6 +- .../dynamicgui/core/builder/GuiBuilder.java | 10 +-- .../dynamicgui/core/builder/SlotBuilder.java | 14 ++-- .../core/effect/ParticleWrapper.java | 6 +- .../dynamicgui/core/effect/SoundWrapper.java | 10 +-- .../dynamicgui/core/function/Function.java | 4 +- .../function/impl/AddPermissionFunction.java | 2 +- .../impl/CheckItemTypeInHandFunction.java | 6 +- .../function/impl/CheckLevelFunction.java | 4 +- .../function/impl/CheckMovableFunction.java | 4 +- .../impl/CheckPlayerWorldFunction.java | 2 +- .../function/impl/ConsoleCommandFunction.java | 2 +- .../core/function/impl/DelayFunction.java | 4 +- .../function/impl/FalseAsyncFunction.java | 3 +- .../function/impl/GetGameRuleFunction.java | 6 +- .../core/function/impl/LogFunction.java | 2 +- .../function/impl/MoneyBalanceFunction.java | 4 +- .../function/impl/MoneyDepositFunction.java | 4 +- .../function/impl/MoneyWithdrawFunction.java | 6 +- .../function/impl/NoPermissionFunction.java | 2 +- .../core/function/impl/ParticleFunction.java | 2 +- .../function/impl/PermissionFunction.java | 2 +- .../function/impl/PlayerCommandFunction.java | 2 +- .../function/impl/PlayerMessageFunction.java | 2 +- .../impl/PlayerMiniMessageFunction.java | 2 +- .../function/impl/PlayerMsgJsonFunction.java | 2 +- .../core/function/impl/RandomFunction.java | 8 +- .../impl/RemovePermissionFunction.java | 2 +- .../function/impl/RemoveSlotFunction.java | 10 +-- .../function/impl/ResetFrameFunction.java | 2 +- .../core/function/impl/ResetTickFunction.java | 2 +- .../core/function/impl/SendFunction.java | 2 +- .../impl/ServerBroadcastFunction.java | 2 +- .../impl/ServerBroadcastJsonFunction.java | 2 +- .../impl/ServerMiniBroadcastFunction.java | 2 +- .../core/function/impl/SetAmountFunction.java | 10 +-- .../core/function/impl/SetCloseFunction.java | 4 +- .../function/impl/SetDurabilityFunction.java | 10 +-- .../function/impl/SetEnchantsFunction.java | 16 ++-- .../function/impl/SetGameRuleFunction.java | 6 +- .../core/function/impl/SetGlowFunction.java | 8 +- .../core/function/impl/SetLoreFunction.java | 12 +-- .../function/impl/SetMovableFunction.java | 10 +-- .../core/function/impl/SetNBTFunction.java | 8 +- .../core/function/impl/SetNameFunction.java | 8 +- .../core/function/impl/SetTypeFunction.java | 8 +- .../core/function/impl/SoundFunction.java | 4 +- .../impl/condition/AfterDateLazyFunction.java | 4 +- .../condition/BeforeDateLazyFunction.java | 4 +- .../impl/condition/CheckTickFunction.java | 6 +- .../impl/condition/ConditionFunction.java | 4 +- .../impl/condition/ContainsLazyFunction.java | 2 +- .../impl/condition/EndsWithLazyFunction.java | 2 +- .../impl/condition/EqualLazyFunction.java | 2 +- .../IgnoreCaseEqualLazyFunction.java | 2 +- .../condition/StartsWithLazyFunction.java | 2 +- .../cooldown/IsNotOnCooldownFunction.java | 2 +- .../impl/cooldown/IsOnCooldownFunction.java | 2 +- .../impl/cooldown/SetCooldownFunction.java | 6 +- .../core/function/impl/gui/BackFunction.java | 16 ++-- .../core/function/impl/gui/GuiFunction.java | 12 +-- .../function/impl/gui/HasBackFunction.java | 4 +- .../function/impl/gui/RefreshGuiFunction.java | 6 +- .../impl/gui/RefreshSlotFunction.java | 18 ++--- .../function/impl/gui/SetBackFunction.java | 10 +-- .../impl/meta/CopyBackMetadataFunction.java | 6 +- .../impl/meta/HasMetadataFunction.java | 32 ++++---- .../function/impl/meta/IsGuiMetadataSet.java | 4 +- .../impl/meta/SetMetadataFunction.java | 32 ++++---- .../clubobsidian/dynamicgui/core/gui/Gui.java | 14 ++-- .../dynamicgui/core/gui/Slot.java | 36 ++++----- .../core/inject/module/PluginModule.java | 2 +- .../core/inventory/InventoryWrapper.java | 6 +- .../core/listener/EntityClickListener.java | 14 ++-- .../dynamicgui/core/listener/GuiListener.java | 6 +- .../core/listener/InventoryCloseListener.java | 2 +- .../listener/InventoryInteractListener.java | 46 +++++------ .../core/listener/PlayerInteractListener.java | 13 ++-- .../dynamicgui/AnimationReplacerManager.java | 6 +- .../manager/dynamicgui/FunctionManager.java | 52 ++++++------- .../core/manager/dynamicgui/GuiManager.java | 78 +++++++++---------- .../dynamicgui/MiniMessageManager.java | 4 +- .../core/manager/dynamicgui/ModelManager.java | 4 +- .../manager/dynamicgui/ReplacerManager.java | 4 +- .../core/manager/dynamicgui/SlotManager.java | 18 ++--- .../dynamicgui/cooldown/CooldownManager.java | 41 +++++----- .../dynamicgui/core/proxy/Proxy.java | 4 +- .../model/vanilla/VanillaModelProvider.java | 2 +- .../replacer/AnimationReplacerRegistry.java | 2 +- .../impl/CooldownReplacerRegistry.java | 14 ++-- .../DynamicGuiAnimationReplacerRegistry.java | 8 +- .../impl/DynamicGuiReplacerRegistry.java | 10 +-- .../impl/MetadataReplacerRegistry.java | 12 +-- .../core/replacer/AnimationReplacer.java | 2 +- .../impl/MultiLineTestAnimationReplacer.java | 2 +- .../animation/impl/TestAnimationReplacer.java | 2 +- .../replacer/impl/PreviousGuiReplacer.java | 8 +- .../dynamicgui/core/util/ChatColor.java | 10 +-- .../dynamicgui/core/util/HashUtil.java | 4 +- .../dynamicgui/core/util/ReflectionUtil.java | 22 +++--- .../dynamicgui/core/util/ThreadUtil.java | 6 +- .../core/world/LocationWrapper.java | 10 +-- .../dynamicgui/core/world/WorldWrapper.java | 8 +- .../core/test/function/DelayFunctionTest.java | 6 +- .../core/test/function/SendFunctionTest.java | 2 +- .../function/ServerBroadcastFunctionTest.java | 2 +- .../test/function/SetAmountFunctionTest.java | 1 - .../core/test/function/SoundFunctionTest.java | 3 - .../core/test/mock/MockFactory.java | 10 +-- .../test/mock/inject/MockPluginModule.java | 2 +- .../test/mock/inventory/MockInventory.java | 2 +- .../core/test/mock/plugin/MockEconomy.java | 2 +- .../core/test/mock/plugin/MockPlatform.java | 4 +- .../parser/function/FunctionModifier.java | 6 +- .../parser/function/FunctionType.java | 2 +- .../parser/function/FunctionTypeParser.java | 4 +- .../parser/function/tree/FunctionTree.java | 14 ++-- .../dynamicgui/parser/gui/GuiToken.java | 12 +-- .../dynamicgui/parser/macro/MacroParser.java | 38 ++++----- .../dynamicgui/parser/macro/MacroToken.java | 2 +- .../dynamicgui/parser/slot/SlotToken.java | 14 ++-- .../test/macro/MultiMacroSameFileTest.java | 4 +- 151 files changed, 735 insertions(+), 742 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index e4df2146d..5b74e6849 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -33,40 +33,40 @@ public class BukkitDynamicGuiCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if(args.length == 1) { + if (args.length == 1) { String first = args[0]; - if(sender.hasPermission("dynamicgui.reload")) { - if(first.equalsIgnoreCase("reload")) { + if (sender.hasPermission("dynamicgui.reload")) { + if (first.equalsIgnoreCase("reload")) { sender.sendMessage("Guis have been reloaded"); GuiManager.get().reloadGuis(false); DynamicGui.get().getEventBus().callEvent(new DynamicGuiReloadEvent()); return true; - } else if(first.equals("forcereload")) { + } else if (first.equals("forcereload")) { sender.sendMessage("Guis have been force reloaded"); GuiManager.get().reloadGuis(true); DynamicGui.get().getEventBus().callEvent(new DynamicGuiReloadEvent()); return true; } } - } else if(args.length == 2) { + } else if (args.length == 2) { String first = args[0]; String second = args[1]; - if(first.equalsIgnoreCase("close")) { - if(sender.hasPermission("dynamicgui.close")) { - if(second.equalsIgnoreCase("all")) { + if (first.equalsIgnoreCase("close")) { + if (sender.hasPermission("dynamicgui.close")) { + if (second.equalsIgnoreCase("all")) { sender.sendMessage("All open DynamicGui guis have been closed"); - for(UUID uuid : GuiManager.get().getPlayerGuis().keySet()) { + for (UUID uuid : GuiManager.get().getPlayerGuis().keySet()) { Bukkit.getServer().getPlayer(uuid).closeInventory(); } return true; } else { Player player = Bukkit.getServer().getPlayer(second); - if(player == null) { + if (player == null) { sender.sendMessage("That player is not online, so their gui cannot be closed"); return true; } else { - if(GuiManager.get().getPlayerGuis().get(player.getUniqueId()) != null) { + if (GuiManager.get().getPlayerGuis().get(player.getUniqueId()) != null) { sender.sendMessage(player.getName() + "'s gui has been closed"); player.closeInventory(); return true; @@ -78,22 +78,22 @@ public boolean onCommand(CommandSender sender, Command command, String label, St } } } - } else if(args.length == 3) { + } else if (args.length == 3) { String first = args[0]; String second = args[1]; String third = args[2]; - if(first.equalsIgnoreCase("close")) { - if(second.equalsIgnoreCase("all")) { + if (first.equalsIgnoreCase("close")) { + if (second.equalsIgnoreCase("all")) { Gui gui = GuiManager.get().getGuiByName(third); - if(gui == null) { + if (gui == null) { sender.sendMessage("No gui can be found by that name"); return true; } else { sender.sendMessage("Guis of type " + third + " are now closed"); Iterator> it = GuiManager.get().getPlayerGuis().entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); - if(next.getValue().getName().equals(third)) { + if (next.getValue().getName().equals(third)) { Bukkit.getServer().getPlayer(next.getKey()).closeInventory(); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java index 1740dc511..8da91a302 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java @@ -27,8 +27,8 @@ public class BukkitGuiCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if(sender instanceof Player) { - if(args.length == 1) { + if (sender instanceof Player) { + if (args.length == 1) { Player player = (Player) sender; PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); GuiManager.get().openGui(playerWrapper, args[0]); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java index 73d0a85e8..f7a02d114 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java @@ -28,7 +28,7 @@ public CustomCommand(String name) { } public boolean execute(CommandSender sender, String commandLabel, String[] args) { - if(this.executer != null) { + if (this.executer != null) { this.executer.onCommand(sender, this, commandLabel, args); } return false; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java index 4715516b3..b246d0814 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java @@ -33,7 +33,7 @@ public CustomCommandExecutor(String gui) { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if(sender instanceof Player) { + if (sender instanceof Player) { Player player = (Player) sender; PlayerWrapper playerWrapper = new BukkitPlayerWrapper<>(player); GuiManager.get().openGui(playerWrapper, this.gui); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java index 0b7abc56b..b32e3e58a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java @@ -36,18 +36,18 @@ public class VaultEconomy implements Economy { @Override public boolean setup() { Plugin vault = Bukkit.getServer().getPluginManager().getPlugin("Vault"); - if(vault == null) { + if (vault == null) { return false; } try { economyClass = Class.forName("net.milkbowl.vault.economy.Economy"); - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); return false; } - if(this.economyClass == null) { + if (this.economyClass == null) { return false; } @@ -58,18 +58,18 @@ public boolean setup() { @Override public BigDecimal getBalance(PlayerWrapper playerWrapper) { double balance = -1; - if(this.getBalanceMethod == null) { + if (this.getBalanceMethod == null) { try { this.getBalanceMethod = this.economyClass.getDeclaredMethod("getBalance", OfflinePlayer.class); this.getBalanceMethod.setAccessible(true); - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } } try { balance = (double) this.getBalanceMethod.invoke(this.economy, playerWrapper.getPlayer()); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } @@ -78,14 +78,14 @@ public BigDecimal getBalance(PlayerWrapper playerWrapper) { @Override public boolean withdraw(PlayerWrapper playerWrapper, BigDecimal amt) { - if(amt.doubleValue() < 0) + if (amt.doubleValue() < 0) return false; - if(this.withdrawPlayerMethod == null) { + if (this.withdrawPlayerMethod == null) { try { this.withdrawPlayerMethod = this.economyClass.getDeclaredMethod("withdrawPlayer", OfflinePlayer.class, double.class); this.withdrawPlayerMethod.setAccessible(true); - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } } @@ -93,11 +93,11 @@ public boolean withdraw(PlayerWrapper playerWrapper, BigDecimal amt) { double amtDouble = amt.doubleValue(); double balance = this.getBalance(playerWrapper).doubleValue(); - if(balance >= amtDouble) { + if (balance >= amtDouble) { try { this.withdrawPlayerMethod.invoke(this.economy, playerWrapper.getPlayer(), amtDouble); return true; - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } } @@ -107,21 +107,21 @@ public boolean withdraw(PlayerWrapper playerWrapper, BigDecimal amt) { @Override public boolean deposit(PlayerWrapper playerWrapper, BigDecimal amt) { - if(amt.doubleValue() < 0) + if (amt.doubleValue() < 0) return false; - if(this.depositPlayerMethod == null) { + if (this.depositPlayerMethod == null) { try { this.depositPlayerMethod = this.economyClass.getDeclaredMethod("depositPlayer", OfflinePlayer.class, double.class); this.depositPlayerMethod.setAccessible(true); - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } } try { this.depositPlayerMethod.invoke(this.economy, playerWrapper.getPlayer(), amt.doubleValue()); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return true; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index c393ca659..ca8978977 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -105,7 +105,7 @@ public int getLevel() { @Override public InventoryWrapper getOpenInventoryWrapper() { InventoryView openInventory = this.getPlayer().getOpenInventory(); - if(openInventory == null) { + if (openInventory == null) { return null; } return new BukkitInventoryWrapper(openInventory.getTopInventory()); @@ -119,7 +119,7 @@ public ItemStackWrapper getItemInHand() { @Override public void closeInventory() { - if(this.getPlayer().getOpenInventory() != null) { + if (this.getPlayer().getOpenInventory() != null) { this.getPlayer().getOpenInventory().close(); } } @@ -127,7 +127,7 @@ public void closeInventory() { @Override public void openInventory(InventoryWrapper inventoryWrapper) { Object inventory = inventoryWrapper.getInventory(); - if(inventory instanceof Inventory) { + if (inventory instanceof Inventory) { this.getPlayer().openInventory((Inventory) inventory); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index a0552039c..8e26cdfd0 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -28,8 +28,8 @@ import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; public class BukkitPluginModule extends PluginModule { diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java index 499e6296b..03cbce190 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java @@ -41,7 +41,7 @@ public BukkitInventoryWrapper(T inventory) { public ItemStackWrapper[] getContents() { ItemStack[] bukkitContents = this.getInventory().getContents(); ItemStackWrapper[] wrapperContents = new ItemStackWrapper[bukkitContents.length]; - for(int i = 0; i < bukkitContents.length; i++) { + for (int i = 0; i < bukkitContents.length; i++) { ItemStack itemStack = bukkitContents[i]; ItemStackWrapper wrapped = new BukkitItemStackWrapper<>(itemStack); wrapperContents[i] = wrapped; @@ -76,8 +76,8 @@ public int getSize() { @Override public int getCurrentContentSize() { int contentSize = 0; - for(ItemStack item : this.getInventory().getContents()) { - if(item != null && item.getType() != Material.AIR) { + for (ItemStack item : this.getInventory().getContents()) { + if (item != null && item.getType() != Material.AIR) { contentSize += 1; } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index 6395b8c7b..2d4f4cd86 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -48,7 +48,7 @@ private static Method setCustomModelData() { Method set = ItemMeta.class.getDeclaredMethod("setCustomModelData", Integer.class); set.setAccessible(true); return set; - } catch(NoSuchMethodException e) { + } catch (NoSuchMethodException e) { return null; } } @@ -58,7 +58,7 @@ private static Method hasCustomModelData() { Method has = ItemMeta.class.getDeclaredMethod("hasCustomModelData"); has.setAccessible(true); return has; - } catch(NoSuchMethodException e) { + } catch (NoSuchMethodException e) { return null; } } @@ -68,7 +68,7 @@ private static Method getCustomModelData() { Method get = ItemMeta.class.getDeclaredMethod("getCustomModelData"); get.setAccessible(true); return get; - } catch(NoSuchMethodException e) { + } catch (NoSuchMethodException e) { return null; } } @@ -99,7 +99,7 @@ public String getType() { @Override public boolean setType(final String type) { - if(type == null) { + if (type == null) { return false; } @@ -108,7 +108,7 @@ public boolean setType(final String type) { try { mat = Material.valueOf(normalizedType); - } catch(Exception ex) { + } catch (Exception ex) { return false; } @@ -119,7 +119,7 @@ public boolean setType(final String type) { @Override public String getName() { ItemMeta itemMeta = this.getItemStack().getItemMeta(); - if(itemMeta.hasDisplayName()) { + if (itemMeta.hasDisplayName()) { return itemMeta.getDisplayName(); } return null; @@ -135,7 +135,7 @@ public void setName(String name) { @Override public List getLore() { ItemMeta itemMeta = this.getItemStack().getItemMeta(); - if(!itemMeta.hasLore()) { + if (!itemMeta.hasLore()) { return new ArrayList<>(); } @@ -177,9 +177,9 @@ public void removeEnchant(EnchantmentWrapper enchant) { public List getEnchants() { List enchants = new ArrayList<>(); ItemMeta itemMeta = this.getItemStack().getItemMeta(); - if(itemMeta.hasEnchants()) { + if (itemMeta.hasEnchants()) { Iterator> it = itemMeta.getEnchants().entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); enchants.add(new EnchantmentWrapper(next.getKey().getName(), next.getValue())); } @@ -197,25 +197,25 @@ public void setNBT(String nbt) { ItemStack oldItemStack = this.getItemStack(); ItemStack newItemStack = BukkitNBTUtil.setTag(this.getItemStack(), nbt); - if(oldItemStack.hasItemMeta()) { + if (oldItemStack.hasItemMeta()) { ItemMeta meta = oldItemStack.getItemMeta(); ItemMeta newMeta = newItemStack.getItemMeta(); - if(meta.hasDisplayName()) { + if (meta.hasDisplayName()) { newMeta.setDisplayName(meta.getDisplayName()); } - if(meta.hasEnchants()) { + if (meta.hasEnchants()) { Iterator> it = meta.getEnchants().entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); newMeta.addEnchant(next.getKey(), next.getValue(), true); } } - if(meta.hasLore()) { + if (meta.hasLore()) { newMeta.setLore(meta.getLore()); } - for(ItemFlag flag : meta.getItemFlags()) { + for (ItemFlag flag : meta.getItemFlags()) { newMeta.addItemFlags(flag); } @@ -229,7 +229,7 @@ public void setNBT(String nbt) { public void setGlowing(boolean glowing) { ItemStack item = this.getItemStack(); ItemMeta meta = item.getItemMeta(); - if(glowing) { + if (glowing) { meta.addEnchant(Enchantment.DIG_SPEED, -1, true); meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } else { @@ -244,9 +244,9 @@ public void setGlowing(boolean glowing) { public void addItemFlags(List itemFlags) { ItemStack item = this.getItemStack(); ItemMeta meta = item.getItemMeta(); - for(String itemFlag : itemFlags) { + for (String itemFlag : itemFlags) { ItemFlag flag = ItemFlag.valueOf(itemFlag); - if(flag != null) { + if (flag != null) { meta.addItemFlags(flag); } } @@ -260,7 +260,7 @@ public boolean isSimilar(ItemStackWrapper compareTo) { @Override public boolean setModel(int data) { - if(SET_CUSTOM_MODEL_DATA == null) { + if (SET_CUSTOM_MODEL_DATA == null) { return false; } ItemMeta meta = getItemStack().getItemMeta(); @@ -268,7 +268,7 @@ public boolean setModel(int data) { SET_CUSTOM_MODEL_DATA.invoke(meta, data); this.getItemStack().setItemMeta(meta); return true; - } catch(IllegalAccessException | InvocationTargetException ex) { + } catch (IllegalAccessException | InvocationTargetException ex) { ex.printStackTrace(); return false; } @@ -276,13 +276,13 @@ public boolean setModel(int data) { @Override public boolean hasCustomModel() { - if(HAS_CUSTOM_MODEL_DATA == null) { + if (HAS_CUSTOM_MODEL_DATA == null) { return false; } ItemMeta meta = getItemStack().getItemMeta(); try { return (boolean) HAS_CUSTOM_MODEL_DATA.invoke(meta); - } catch(IllegalAccessException | InvocationTargetException ex) { + } catch (IllegalAccessException | InvocationTargetException ex) { ex.printStackTrace(); } return false; @@ -290,13 +290,13 @@ public boolean hasCustomModel() { @Override public int getModelData() { - if(GET_CUSTOM_MODEL_DATA == null) { + if (GET_CUSTOM_MODEL_DATA == null) { return -1; } ItemMeta meta = getItemStack().getItemMeta(); try { return (int) GET_CUSTOM_MODEL_DATA.invoke(meta); - } catch(IllegalAccessException | InvocationTargetException e) { + } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } return -1; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java index 682932e17..af58200da 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java @@ -30,7 +30,7 @@ public class EntityClickListener implements Listener { @EventHandler public void onEntityClick(PlayerInteractEntityEvent e) { - if(e.getRightClicked() != null) { + if (e.getRightClicked() != null) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); EntityWrapper entityWrapper = new BukkitEntityWrapper(e.getRightClicked()); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java index 21e697dbe..704626f86 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java @@ -32,7 +32,7 @@ public class InventoryCloseListener implements Listener { @EventHandler public void inventoryClose(InventoryCloseEvent e) { - if(e.getPlayer() instanceof Player) { + if (e.getPlayer() instanceof Player) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper((Player) e.getPlayer()); InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(e.getInventory()); DynamicGui.get().getEventBus().callEvent(new com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent(playerWrapper, inventoryWrapper)); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index c5b372d75..522f77197 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -43,20 +43,20 @@ public class InventoryInteractListener implements Listener { @EventHandler public void onInventoryClick(InventoryClickEvent e) { Inventory inventory = e.getInventory(); - if(inventory == null) { + if (inventory == null) { return; } int slot = e.getSlot(); int rawSlot = e.getRawSlot(); InventoryView view = InventoryView.TOP; - if(rawSlot >= e.getInventory().getSize()) { + if (rawSlot >= e.getInventory().getSize()) { view = InventoryView.BOTTOM; } - if(e.getWhoClicked() instanceof Player) { + if (e.getWhoClicked() instanceof Player) { Click clickType = null; - if(this.isClick(e.getClick())) { + if (this.isClick(e.getClick())) { clickType = Click.valueOf(e.getClick().toString()); } @@ -64,14 +64,14 @@ public void onInventoryClick(InventoryClickEvent e) { InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(inventory); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); ItemStack itemStack = null; - if(rawSlot >= inventory.getSize()) { + if (rawSlot >= inventory.getSize()) { itemStack = e.getWhoClicked().getInventory().getItem(slot); - } else if(slot >= 0 && slot < inventory.getSize()) { + } else if (slot >= 0 && slot < inventory.getSize()) { itemStack = e.getInventory().getItem(slot); } ItemStackWrapper itemStackWrapper = null; - if(itemStack == null) { + if (itemStack == null) { itemStackWrapper = new BukkitItemStackWrapper(null); } else { itemStackWrapper = new BukkitItemStackWrapper(itemStack); @@ -79,7 +79,7 @@ public void onInventoryClick(InventoryClickEvent e) { com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent clickEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent(playerWrapper, inventoryWrapper, itemStackWrapper, slot, clickType, view); DynamicGui.get().getEventBus().callEvent(clickEvent); - if(clickEvent.isCanceled()) { + if (clickEvent.isCanceled()) { e.setCancelled(true); } } @@ -88,18 +88,18 @@ public void onInventoryClick(InventoryClickEvent e) { @EventHandler public void onInventoryDrag(InventoryDragEvent e) { Inventory inventory = e.getInventory(); - if(inventory == null) { + if (inventory == null) { return; } - if(e.getWhoClicked() instanceof Player) { + if (e.getWhoClicked() instanceof Player) { Player player = (Player) e.getWhoClicked(); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(inventory); Map> slotItems = this.wrapItemStacks(e.getNewItems()); com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent dragEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent(playerWrapper, inventoryWrapper, slotItems); DynamicGui.get().getEventBus().callEvent(dragEvent); - if(dragEvent.isCanceled()) { + if (dragEvent.isCanceled()) { e.setCancelled(true); } } @@ -108,7 +108,7 @@ public void onInventoryDrag(InventoryDragEvent e) { private Map> wrapItemStacks(Map stackMap) { Map> wrapperMap = new TreeMap<>(); Iterator> it = stackMap.entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); int rawSlot = next.getKey(); ItemStack original = next.getValue(); @@ -120,7 +120,7 @@ private Map> wrapItemStacks(Map } private boolean isClick(ClickType type) { - switch(type) { + switch (type) { case LEFT: return true; case RIGHT: diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java index fe59fd815..0c11d134f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java @@ -31,7 +31,7 @@ public class InventoryOpenListener implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void inventoryOpen(InventoryOpenEvent e) { - if(e.getPlayer() instanceof Player) { + if (e.getPlayer() instanceof Player) { Player player = (Player) e.getPlayer(); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); InventoryWrapper inventoryWrapper = new BukkitInventoryWrapper(e.getInventory()); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index 18a61227c..40f3d3841 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -30,13 +30,13 @@ public class PlayerInteractListener implements Listener { @EventHandler public void interact(final PlayerInteractEvent e) { - if(e.getClickedBlock() != null) { + if (e.getClickedBlock() != null) { PlayerAction action = PlayerAction.valueOf(e.getAction().toString()); PlayerWrapper playerWrapper = new BukkitPlayerWrapper(e.getPlayer()); LocationWrapper locationWrapper = LocationManager.get().toLocationWrapper(e.getClickedBlock().getLocation()); com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent interactEvent = new com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent(playerWrapper, locationWrapper, action); DynamicGui.get().getEventBus().callEvent(interactEvent); - if(interactEvent.isCanceled()) { + if (interactEvent.isCanceled()) { e.setCancelled(true); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java index 21527701b..684189b5e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java @@ -34,7 +34,7 @@ public BukkitEntityManager() { private void loadEntityTypes() { this.entityTypes = new ArrayList<>(); - for(EntityType type : EntityType.values()) { + for (EntityType type : EntityType.values()) { this.entityTypes.add(type.name()); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java index 8cf785a96..cd18a0a7a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java @@ -30,7 +30,7 @@ public Object createItemStack(String type, int quantity) { @Override public ItemStackWrapper createItemStackWrapper(Object itemStack) { - if(itemStack == null) { + if (itemStack == null) { return new BukkitItemStackWrapper<>(null); } return new BukkitItemStackWrapper<>((ItemStack) itemStack); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java index 2f3551643..89196d569 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java @@ -31,7 +31,7 @@ public BukkitMaterialManager() { private void loadMaterials() { this.materials = new ArrayList<>(); - for(Material material : Material.values()) { + for (Material material : Material.values()) { this.materials.add(material.name()); } } @@ -43,7 +43,7 @@ public List getMaterials() { @Override public String normalizeMaterial(String material) { - if(material == null) + if (material == null) return null; return material.toUpperCase(); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java index 4300361ae..943dcf7fc 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java @@ -31,7 +31,7 @@ public LocationWrapper toLocationWrapper(String world, int x, int y, int z) { @Override public LocationWrapper toLocationWrapper(Object obj) { - if(!(obj instanceof Location)) { + if (!(obj instanceof Location)) { return null; } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java index 9d785a594..7cb371760 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java @@ -36,18 +36,18 @@ public class VaultPermission implements Permission { @Override public boolean setup() { Plugin vault = Bukkit.getServer().getPluginManager().getPlugin("Vault"); - if(vault == null) { + if (vault == null) { return false; } try { this.permissionClass = Class.forName("net.milkbowl.vault.permission.Permission"); - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); return false; } - if(this.permissionClass == null) { + if (this.permissionClass == null) { return false; } @@ -57,10 +57,10 @@ public boolean setup() { @Override public boolean hasPermission(PlayerWrapper playerWrapper, String permission) { - if(this.playerHas == null) { + if (this.playerHas == null) { try { this.playerHas = this.permissionClass.getDeclaredMethod("playerHas", String.class, OfflinePlayer.class, String.class); - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); return false; } @@ -68,7 +68,7 @@ public boolean hasPermission(PlayerWrapper playerWrapper, String permission) try { return (boolean) this.playerHas.invoke(this.permission, null, playerWrapper.getPlayer(), permission); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); return false; } @@ -76,17 +76,17 @@ public boolean hasPermission(PlayerWrapper playerWrapper, String permission) @Override public boolean addPermission(PlayerWrapper playerWrapper, String permission) { - if(this.playerAdd == null) { + if (this.playerAdd == null) { try { this.playerAdd = this.permissionClass.getDeclaredMethod("playerAdd", String.class, OfflinePlayer.class, String.class); - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); return false; } } try { return (boolean) this.playerAdd.invoke(this.permission, null, playerWrapper.getPlayer(), permission); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); return false; } @@ -94,10 +94,10 @@ public boolean addPermission(PlayerWrapper playerWrapper, String permission) @Override public boolean removePermission(PlayerWrapper playerWrapper, String permission) { - if(this.playerRemove == null) { + if (this.playerRemove == null) { try { this.playerRemove = this.permissionClass.getDeclaredMethod("playerRemove", String.class, OfflinePlayer.class, String.class); - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); return false; } @@ -105,7 +105,7 @@ public boolean removePermission(PlayerWrapper playerWrapper, String permissio try { return (boolean) this.playerRemove.invoke(this.permission, null, playerWrapper.getPlayer(), permission); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); return false; } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index bea7e7b53..b9819f506 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -21,11 +21,11 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.platform.PlatformType; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.proxy.Proxy; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.core.platform.Platform; -import com.clubobsidian.dynamicgui.core.platform.PlatformType; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; @@ -89,7 +89,7 @@ public Collection> getOnlinePlayers() { @Override public int getGlobalPlayerCount() { - if(DynamicGui.get().getProxy() != Proxy.NONE) { + if (DynamicGui.get().getProxy() != Proxy.NONE) { return DynamicGui.get().getGlobalServerPlayerCount(); } @@ -111,7 +111,7 @@ public void registerIncomingPluginChannel(final DynamicGuiPlugin plugin, final S PluginMessageListener listener = new PluginMessageListener() { @Override public void onPluginMessageReceived(String channel, Player player, byte[] message) { - if(channel.equals(incomingChannel)) { + if (channel.equals(incomingChannel)) { PlayerWrapper playerWrapper = new BukkitPlayerWrapper<>(player); runnable.run(playerWrapper, message); } @@ -123,7 +123,7 @@ public void onPluginMessageReceived(String channel, Player player, byte[] messag @Override public WorldWrapper getWorld(String worldName) { World world = Bukkit.getServer().getWorld(worldName); - if(world == null) { + if (world == null) { return null; } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 3ceb0a7e9..4f6354cff 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -40,9 +40,9 @@ import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ModelManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ReplacerManager; import com.clubobsidian.dynamicgui.core.permission.Permission; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; -import com.clubobsidian.dynamicgui.core.platform.Platform; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.SimpleCommandMap; @@ -87,33 +87,33 @@ public void start() { boolean vault = false; boolean foundry = false; - if(pm.getPlugin("Vault") != null) { + if (pm.getPlugin("Vault") != null) { vault = true; } - if(pm.getPlugin("Foundry") != null) { + if (pm.getPlugin("Foundry") != null) { foundry = true; } - if(vault && foundry) { + if (vault && foundry) { this.permission = new FoundryPermission(); - } else if(vault) { + } else if (vault) { this.permission = new VaultPermission(); } - if(this.permission != null && !this.permission.setup()) { + if (this.permission != null && !this.permission.setup()) { this.permission = null; } - if(permission == null) { + if (permission == null) { this.getLogger().log(Level.SEVERE, "Vault is not installed, permissions will not work"); } this.economy = new VaultEconomy(); - if(!this.economy.setup()) { + if (!this.economy.setup()) { this.economy = null; } - if(this.economy == null) { + if (this.economy == null) { this.getLogger().log(Level.SEVERE, "Vault is not installed, economy functions will not work"); } @@ -122,14 +122,14 @@ public void start() { //Hack for adding citizens late //For some reason citizens sometimes will load after DynamicGui this.getServer().getScheduler().scheduleSyncDelayedTask(this, () -> { - if(this.getServer().getPluginManager().getPlugin("Citizens") != null) { + if (this.getServer().getPluginManager().getPlugin("Citizens") != null) { this.getNPCRegistries().add(new CitizensRegistry()); } }, 1); this.registerModelProviders(pm); - if(this.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) { + if (this.getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) { ReplacerManager.get().registerReplacerRegistry(new PlaceholderApiReplacerRegistry()); } @@ -143,10 +143,10 @@ public void start() { } private void registerModelProviders(PluginManager pm) { - if(pm.getPlugin("Oraxen") != null) { + if (pm.getPlugin("Oraxen") != null) { ModelManager.get().register(new OraxenModelProvider()); } - if(pm.getPlugin("ItemsAdder") != null) { + if (pm.getPlugin("ItemsAdder") != null) { ModelManager.get().register(new ItemsAdderModelProvider()); } } @@ -192,16 +192,16 @@ public File getMacroFolder() { } private final CommandMap getCommandMap() { - if(this.commandMap == null) { + if (this.commandMap == null) { try { final Field f = this.getServer().getClass().getDeclaredField("commandMap"); f.setAccessible(true); this.commandMap = (CommandMap) f.get(this.getServer()); return this.commandMap; - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } - } else if(this.commandMap != null) { + } else if (this.commandMap != null) { return this.commandMap; } return null; @@ -218,7 +218,7 @@ private void unregisterCommand(String alias) { @SuppressWarnings("unchecked") Map commands = (Map) commandField.get(this.getCommandMap()); commands.keySet().remove(alias); - } catch(IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { e.printStackTrace(); } } @@ -239,7 +239,7 @@ public void createCommand(String gui, String alias) { @Override public void unloadCommands() { - for(String cmd : this.getRegisteredCommands()) { + for (String cmd : this.getRegisteredCommands()) { this.unregisterCommand(cmd); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 624802a34..8d6ca6de1 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -33,19 +33,19 @@ private static boolean exists() { try { Class.forName("dev.lone.itemsadder.api.CustomStack"); return true; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return false; } } private static Method instance() { - if(ITEMS_ADDER_EXISTS) { + if (ITEMS_ADDER_EXISTS) { try { Class customStack = Class.forName("dev.lone.itemsadder.api.CustomStack"); Method getInstance = customStack.getDeclaredMethod("getInstance", String.class); getInstance.setAccessible(true); return getInstance; - } catch(ClassNotFoundException | NoSuchMethodException e) { + } catch (ClassNotFoundException | NoSuchMethodException e) { e.printStackTrace(); } } @@ -53,13 +53,13 @@ private static Method instance() { } private static Method itemStack() { - if(ITEMS_ADDER_EXISTS) { + if (ITEMS_ADDER_EXISTS) { try { Class customStack = Class.forName("dev.lone.itemsadder.api.CustomStack"); Method getItemStack = customStack.getDeclaredMethod("getItemStack"); getItemStack.setAccessible(true); return getItemStack; - } catch(ClassNotFoundException | NoSuchMethodException e) { + } catch (ClassNotFoundException | NoSuchMethodException e) { e.printStackTrace(); } } @@ -73,18 +73,18 @@ public String name() { @Override public boolean applyModel(ItemStackWrapper itemStack, String data) { - if(ITEMS_ADDER_EXISTS) { + if (ITEMS_ADDER_EXISTS) { try { Object customStack = GET_INSTANCE.invoke(null, data); - if(customStack != null) { + if (customStack != null) { ItemStackWrapper wrappedCustom = ItemStackManager .get() .createItemStackWrapper(GET_ITEM_STACK.invoke(customStack)); - if(wrappedCustom.hasCustomModel()) { + if (wrappedCustom.hasCustomModel()) { return itemStack.setModel(wrappedCustom.getModelData()); } } - } catch(IllegalAccessException | InvocationTargetException e) { + } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java index 99f69bbfe..169499ea6 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java @@ -33,19 +33,19 @@ private static boolean exists() { try { Class.forName("io.th0rgal.oraxen.items.OraxenItems"); return true; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { return false; } } private static Method getItemById() { - if(ORAXEN_EXISTS) { + if (ORAXEN_EXISTS) { try { Class items = Class.forName("io.th0rgal.oraxen.items.OraxenItems"); Method getItem = items.getDeclaredMethod("getItemById", String.class); getItem.setAccessible(true); return getItem; - } catch(ClassNotFoundException | NoSuchMethodException e) { + } catch (ClassNotFoundException | NoSuchMethodException e) { e.printStackTrace(); } } @@ -53,13 +53,13 @@ private static Method getItemById() { } private static Method getBuild() { - if(ORAXEN_EXISTS) { + if (ORAXEN_EXISTS) { try { Class itemBuilder = Class.forName("io.th0rgal.oraxen.items.ItemBuilder"); Method build = itemBuilder.getDeclaredMethod("build"); build.setAccessible(true); return build; - } catch(ClassNotFoundException | NoSuchMethodException ex) { + } catch (ClassNotFoundException | NoSuchMethodException ex) { ex.printStackTrace(); } } @@ -75,15 +75,15 @@ public String name() { public boolean applyModel(ItemStackWrapper itemStack, String data) { try { Object itemBuilder = GET_ITEM_BY_ID.invoke(null, data); - if(itemBuilder == null) { + if (itemBuilder == null) { return false; } ItemStackWrapper built = ItemStackManager.get().createItemStackWrapper(BUILD.invoke(itemBuilder)); - if(built.hasCustomModel()) { + if (built.hasCustomModel()) { return itemStack.setModel(built.getModelData()); } return false; - } catch(IllegalAccessException | InvocationTargetException e) { + } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return false; } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java index 9d8910b67..38be4352d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java @@ -47,7 +47,7 @@ private Object getNPCRegistry() { try { return this.getNPCRegistryMethod.invoke(null); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } @@ -68,14 +68,14 @@ public boolean isNPC(EntityWrapper entityWrapper) { public NPC getNPC(EntityWrapper entityWrapper) { try { Object npc = this.getNPCMethod.invoke(this.npcRegistry, entityWrapper.getEntity()); - if(npc == null) { + if (npc == null) { return null; } int id = (int) this.getIdMethod.invoke(npc); NPCMeta meta = new NPCMeta(id, CitizensRegistry.PLUGIN_NAME); return new NPC(entityWrapper, meta); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return null; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java index 9c3d354d6..f72449e38 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java @@ -35,7 +35,7 @@ public PlaceholderApiReplacerRegistry() { public String replace(PlayerWrapper playerWrapper, String text) { try { return (String) this.setPlaceHolders.invoke(null, playerWrapper.getPlayer(), text); - } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return null; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index f3e64492a..4c4c4c731 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -36,18 +36,18 @@ private BukkitNBTUtil() { } public static Object parse(String nbtStr) { - if(parse == null) { + if (parse == null) { try { Class mojangParser = Class.forName(PARSER_CLASS_NAME); parse = mojangParser.getDeclaredMethod("parse", String.class); parse.setAccessible(true); - } catch(ClassNotFoundException | NoSuchMethodException | SecurityException e) { + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) { e.printStackTrace(); } } try { return parse.invoke(null, nbtStr); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } return null; @@ -56,7 +56,7 @@ public static Object parse(String nbtStr) { public static String getTag(ItemStack itemStack) { String version = VersionUtil.getVersion(); try { - if(asNMSCopy == null) { + if (asNMSCopy == null) { String craftItemStackClassName = "org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"; Class craftItemStackClass; craftItemStackClass = Class.forName(craftItemStackClassName); @@ -64,13 +64,13 @@ public static String getTag(ItemStack itemStack) { asNMSCopy.setAccessible(true); } - if(getTag == null) { + if (getTag == null) { Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); getTag = nmsItemStackClass.getDeclaredMethod("getTag"); getTag.setAccessible(true); } - if(asBukkitCopy == null) { + if (asBukkitCopy == null) { Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); String craftItemStackClassName = "org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"; Class craftItemStackClass = Class.forName(craftItemStackClassName); @@ -80,12 +80,12 @@ public static String getTag(ItemStack itemStack) { Object nmsItemStack = asNMSCopy.invoke(null, itemStack); Object tag = getTag.invoke(nmsItemStack); - if(tag == null) { + if (tag == null) { return null; } return tag.toString(); - } catch(ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return null; @@ -94,21 +94,21 @@ public static String getTag(ItemStack itemStack) { public static ItemStack setTag(ItemStack itemStack, String nbt) { String version = VersionUtil.getVersion(); try { - if(asNMSCopy == null) { + if (asNMSCopy == null) { String craftItemStackClassName = "org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"; Class craftItemStackClass = Class.forName(craftItemStackClassName); asNMSCopy = craftItemStackClass.getDeclaredMethod("asNMSCopy", ItemStack.class); asNMSCopy.setAccessible(true); } - if(setTag == null) { + if (setTag == null) { Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); Class nbtTagCompoundClass = Class.forName(COMPOUND_CLASS_NAME); setTag = nmsItemStackClass.getDeclaredMethod("setTag", nbtTagCompoundClass); setTag.setAccessible(true); } - if(asBukkitCopy == null) { + if (asBukkitCopy == null) { Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); String craftItemStackClassName = "org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"; Class craftItemStackClass = Class.forName(craftItemStackClassName); @@ -121,7 +121,7 @@ public static ItemStack setTag(ItemStack itemStack, String nbt) { setTag.invoke(nmsItemStack, nbtCompound); ItemStack bukkitItemStack = (ItemStack) asBukkitCopy.invoke(null, nmsItemStack); return bukkitItemStack; - } catch(ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return null; @@ -132,13 +132,13 @@ private static String getItemStackClass() { String className = "net.minecraft.world.item.ItemStack"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".ItemStack"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -149,13 +149,13 @@ private static String getParserClass() { String className = "net.minecraft.nbt.MojangsonParser"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".MojangsonParser"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -166,13 +166,13 @@ private static String getCompoundClass() { String className = "net.minecraft.nbt.NBTTagCompound"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".NBTTagCompound"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java index d0388f6ea..1bbb79633 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java @@ -59,30 +59,30 @@ private BukkitPacketUtil() { public static void sendPacket(Player player, Object packet) { String version = VersionUtil.getVersion(); try { - if(craftPlayerClass == null) { + if (craftPlayerClass == null) { craftPlayerClass = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftPlayer"); } - if(playerHandle == null) { + if (playerHandle == null) { playerHandle = craftPlayerClass.getDeclaredMethod("getHandle"); } - if(nmsPlayerClass == null) { + if (nmsPlayerClass == null) { nmsPlayerClass = Class.forName(ENTITY_PLAYER_CLASS_NAME); } - if(playerConnection == null) { + if (playerConnection == null) { Class conClazz = Class.forName(PLAYER_CONNECTION_CLASS_NAME); playerConnection = ReflectionUtil.getFieldByType(nmsPlayerClass, conClazz); } - if(networkManager == null) { + if (networkManager == null) { Class playerConnection = Class.forName(PLAYER_CONNECTION_CLASS_NAME); Class networkManagerClass = Class.forName(NETWORK_MANAGER_CLASS_NAME); networkManager = ReflectionUtil.getFieldByType(playerConnection, networkManagerClass); } - if(sendPacket == null) { + if (sendPacket == null) { Class networkManagerClass = Class.forName(NETWORK_MANAGER_CLASS_NAME); Class packetClass = Class.forName(PACKET_CLASS_NAME); sendPacket = networkManagerClass.getDeclaredMethod("sendPacket", packetClass); @@ -93,7 +93,7 @@ public static void sendPacket(Player player, Object packet) { Object manager = networkManager.get(con); sendPacket.invoke(manager, packet); - } catch(ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } } @@ -101,37 +101,37 @@ public static void sendPacket(Player player, Object packet) { public static void sendSlotPacket(int index, Player player, ItemStack itemStack) { String version = VersionUtil.getVersion(); try { - if(craftPlayerClass == null) { + if (craftPlayerClass == null) { craftPlayerClass = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftPlayer"); } - if(craftItemClass == null) { + if (craftItemClass == null) { craftItemClass = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"); } - if(itemStackHandle == null) { + if (itemStackHandle == null) { itemStackHandle = craftItemClass.getDeclaredField("handle"); itemStackHandle.setAccessible(true); } - if(playerHandle == null) { + if (playerHandle == null) { playerHandle = craftPlayerClass.getDeclaredMethod("getHandle"); } - if(nmsPlayerClass == null) { + if (nmsPlayerClass == null) { nmsPlayerClass = Class.forName(ENTITY_PLAYER_CLASS_NAME); } - if(nmsHumanClass == null) { + if (nmsHumanClass == null) { nmsHumanClass = Class.forName(ENTITY_HUMAN_CLASS_NAME); } - if(windowIdField == null) { + if (windowIdField == null) { Class containerClass = Class.forName(CONTAINER_CLASS_NAME); windowIdField = ReflectionUtil.getDeclaredField(containerClass, "windowId", "j"); } - if(activeContainer == null) { + if (activeContainer == null) { Class containerClass = Class.forName(CONTAINER_CLASS_NAME); activeContainer = ReflectionUtil.getFieldByType(nmsHumanClass, containerClass); } @@ -145,10 +145,10 @@ public static void sendSlotPacket(int index, Player player, ItemStack itemStack) //stateId is new in 1.17 //int windowID, int stateID, int slot, ItemStack itemstack Object packet; - if(SET_SLOT_CONSTRUCTOR_LENGTH == 3) { + if (SET_SLOT_CONSTRUCTOR_LENGTH == 3) { packet = PACKET_PLAY_OUT_SET_SLOT_CONSTRUCTOR.newInstance(windowId, index, nmsItemStack); } else { - if(stateIdField == null) { + if (stateIdField == null) { Class containerClass = Class.forName(CONTAINER_CLASS_NAME); stateIdField = ReflectionUtil.getDeclaredField(containerClass, "q"); } @@ -156,7 +156,7 @@ public static void sendSlotPacket(int index, Player player, ItemStack itemStack) packet = PACKET_PLAY_OUT_SET_SLOT_CONSTRUCTOR.newInstance(windowId, stateId, index, nmsItemStack); } sendPacket(player, packet); - } catch(ClassNotFoundException | NoSuchFieldException | SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException e) { + } catch (ClassNotFoundException | NoSuchFieldException | SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException e) { e.printStackTrace(); } } @@ -164,12 +164,12 @@ public static void sendSlotPacket(int index, Player player, ItemStack itemStack) private static Constructor getPacketPlayOutSetSlotConstructor() { try { Class packetClass = Class.forName(PACKET_PLAY_OUT_SET_SLOT_CLASS_NAME); - for(Constructor con : packetClass.getDeclaredConstructors()) { - if(con.getParameterTypes().length > 0 && con.getParameterTypes()[0].equals(int.class)) { + for (Constructor con : packetClass.getDeclaredConstructors()) { + if (con.getParameterTypes().length > 0 && con.getParameterTypes()[0].equals(int.class)) { return con; } } - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; @@ -180,13 +180,13 @@ private static String getItemStackClass() { String className = "net.minecraft.world.item.ItemStack"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".ItemStack"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -197,13 +197,13 @@ private static String getEntityPlayerClassName() { String className = "net.minecraft.server.level.EntityPlayer"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".EntityPlayer"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -214,13 +214,13 @@ private static String getEntityHumanClassName() { String className = "net.minecraft.world.entity.player.EntityHuman"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".EntityHuman"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -231,13 +231,13 @@ private static String getPlayerConnectionClassName() { String className = "net.minecraft.server.network.PlayerConnection"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".PlayerConnection"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -248,13 +248,13 @@ private static String getNetworkManagerClassName() { String className = "net.minecraft.network.NetworkManager"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".NetworkManager"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -265,13 +265,13 @@ private static String getContainerClassName() { String className = "net.minecraft.world.inventory.Container"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".Container"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -282,13 +282,13 @@ private static String getPacketClassName() { String className = "net.minecraft.network.protocol.Packet"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".Packet"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } @@ -299,13 +299,13 @@ private static String getPacketPlayOutSetClassName() { String className = "net.minecraft.network.protocol.game.PacketPlayOutSetSlot"; Class.forName(className); return className; - } catch(ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { String version = VersionUtil.getVersion(); String className = "net.minecraft.server." + version + ".PacketPlayOutSetSlot"; try { Class.forName(className); return className; - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java index 59adcfa6b..fe3923cf4 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java @@ -20,7 +20,7 @@ public class VersionUtil { public synchronized static String getVersion() { - if(Bukkit.getServer() == null) { + if (Bukkit.getServer() == null) { return null; } String packageName = Bukkit.getServer().getClass().getPackage().getName(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index b7ee5eaba..32c2dfff2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -89,6 +89,7 @@ import com.clubobsidian.dynamicgui.core.manager.dynamicgui.SlotManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.proxy.Proxy; import com.clubobsidian.dynamicgui.core.registry.replacer.impl.CooldownReplacerRegistry; @@ -96,7 +97,6 @@ import com.clubobsidian.dynamicgui.core.registry.replacer.impl.DynamicGuiReplacerRegistry; import com.clubobsidian.dynamicgui.core.registry.replacer.impl.MetadataReplacerRegistry; import com.clubobsidian.dynamicgui.core.replacer.Replacer; -import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.trident.EventBus; import com.clubobsidian.trident.eventbus.methodhandle.MethodHandleEventBus; import com.clubobsidian.wrappy.Configuration; @@ -122,7 +122,7 @@ public class DynamicGui { private static DynamicGui instance; public static DynamicGui get() { - if(!instance.initialized) { + if (!instance.initialized) { instance.initialized = true; instance.init(); } @@ -171,26 +171,26 @@ public void shutdown() { } private void setupFileStructure() { - if(!this.plugin.getDataFolder().exists()) { + if (!this.plugin.getDataFolder().exists()) { this.plugin.getDataFolder().mkdirs(); } - if(!this.plugin.getGuiFolder().exists()) { + if (!this.plugin.getGuiFolder().exists()) { this.plugin.getGuiFolder().mkdirs(); } - if(!this.plugin.getMacroFolder().exists()) { + if (!this.plugin.getMacroFolder().exists()) { this.plugin.getMacroFolder().mkdirs(); } } private void saveDefaultConfig() { - if(!this.plugin.getConfigFile().exists()) { + if (!this.plugin.getConfigFile().exists()) { try { FileUtils .copyInputStreamToFile(this.getClass().getClassLoader().getResourceAsStream("config.yml"), this.plugin.getConfigFile()); - } catch(IOException e) { + } catch (IOException e) { e.printStackTrace(); } } @@ -204,12 +204,12 @@ private void loadConfig() { transformers.add(new ChatColorTransformer()); messageSection.inject(this.message, transformers); String version = config.getString("version"); - if(version != null) { + if (version != null) { version = version.trim(); } String proxyStr = config.getString("proxy"); - if(proxyStr == null) { + if (proxyStr == null) { proxyStr = version; config.set("proxy", proxyStr); config.save(); @@ -220,7 +220,7 @@ private void loadConfig() { this.proxy = Proxy.fromString(proxyStr); String dateTimeFormat = config.getString("date-time-format"); - if(dateTimeFormat == null) { + if (dateTimeFormat == null) { dateTimeFormat = "MM dd, yyyy HH:mm:ss"; config.set("date-time-format", dateTimeFormat); config.save(); @@ -230,7 +230,7 @@ private void loadConfig() { this.dateTimeFormat = dateTimeFormat; - for(final String server : config.getStringList("servers")) { + for (final String server : config.getStringList("servers")) { this.serverPlayerCount.put(server, 0); DynamicGuiReplacerRegistry.get().addReplacer(new Replacer("%" + server + "-playercount%") { @@ -248,11 +248,11 @@ private void loadGuis() { public void checkForProxy() { MessagingRunnable runnable = (playerWrapper, message) -> { - if(message.length > 13) { + if (message.length > 13) { ByteArrayDataInput in = ByteStreams.newDataInput(message); String packet = in.readUTF(); - if(packet != null) { - if("PlayerCount".equals(packet)) { + if (packet != null) { + if ("PlayerCount".equals(packet)) { String server = in.readUTF(); int playerCount = in.readInt(); this.serverPlayerCount.put(server, playerCount); @@ -261,11 +261,11 @@ public void checkForProxy() { } }; - if(this.proxy == Proxy.BUNGEECORD) { + if (this.proxy == Proxy.BUNGEECORD) { this.getLogger().info("BungeeCord is enabled!"); this.getPlatform().registerOutgoingPluginChannel(this.getPlugin(), "BungeeCord"); this.getPlatform().registerIncomingPluginChannel(this.getPlugin(), "BungeeCord", runnable); - } else if(this.proxy == Proxy.REDIS_BUNGEE) { + } else if (this.proxy == Proxy.REDIS_BUNGEE) { this.getLogger().info("RedisBungee is enabled"); this.getPlatform().registerOutgoingPluginChannel(this.getPlugin(), "RedisBungee"); this.getPlatform().registerOutgoingPluginChannel(this.getPlugin(), "BungeeCord"); @@ -274,7 +274,7 @@ public void checkForProxy() { this.getLogger().info("A proxy is not in use, please configure the proxy config value if you need proxy support!"); } - if(this.proxy != Proxy.NONE) { + if (this.proxy != Proxy.NONE) { this.startPlayerCountTimer(); } } @@ -364,14 +364,14 @@ private void loadFunctions() { private void startPlayerCountTimer() { this.getPlatform().getScheduler().scheduleSyncRepeatingTask(() -> { - for(String server : this.serverPlayerCount.keySet()) { + for (String server : this.serverPlayerCount.keySet()) { PlayerWrapper player = Iterables.getFirst(this.getPlatform().getOnlinePlayers(), null); - if(player != null) { + if (player != null) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("PlayerCount"); out.writeUTF(server); String sendTo = "BungeeCord"; - if(this.proxy == Proxy.REDIS_BUNGEE) { + if (this.proxy == Proxy.REDIS_BUNGEE) { sendTo = "RedisBungee"; } player.sendPluginMessage(this.getPlugin(), sendTo, out.toByteArray()); @@ -420,7 +420,7 @@ public LoggerWrapper getLogger() { public Integer getGlobalServerPlayerCount() { int globalPlayerCount = 0; - for(int playerCount : this.serverPlayerCount.values()) { + for (int playerCount : this.serverPlayerCount.values()) { globalPlayerCount += playerCount; } @@ -436,7 +436,7 @@ public Injector getInjector() { } public boolean sendToServer(PlayerWrapper playerWrapper, String server) { - if(this.platform != null && (this.proxy == Proxy.BUNGEECORD || this.proxy == Proxy.REDIS_BUNGEE)) { + if (this.platform != null && (this.proxy == Proxy.BUNGEECORD || this.proxy == Proxy.REDIS_BUNGEE)) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(server); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java index e0f9fcfbe..a5974ca04 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java @@ -38,7 +38,7 @@ public FunctionTokenBuilder addType(String type) { } public FunctionTokenBuilder addType(String... types) { - for(String t : types) { + for (String t : types) { this.addType(t); } return this; @@ -58,7 +58,7 @@ public FunctionTokenBuilder addFunction(FunctionData data) { } public FunctionTokenBuilder addFunction(FunctionData... datas) { - for(FunctionData data : datas) { + for (FunctionData data : datas) { this.addFunction(data); } @@ -79,7 +79,7 @@ public FunctionTokenBuilder addFailOnFunction(FunctionData data) { } public FunctionTokenBuilder addFailOnFunction(FunctionData... datas) { - for(FunctionData data : datas) { + for (FunctionData data : datas) { this.addFunction(data); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index 6f19e8531..f81afbf7b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -82,7 +82,7 @@ public GuiBuilder setModeEnum(ModeEnum modeEnum) { public GuiBuilder addNpcId(String plugin, Integer id) { List npcs = this.npcIds.get(plugin); - if(npcs == null) { + if (npcs == null) { npcs = new ArrayList<>(); this.npcIds.put(plugin, npcs); } @@ -92,14 +92,14 @@ public GuiBuilder addNpcId(String plugin, Integer id) { } public GuiBuilder addNpcId(String plugin, Integer[] npcIds) { - for(Integer id : npcIds) { + for (Integer id : npcIds) { this.addNpcId(plugin, id); } return this; } public GuiBuilder addNpcId(String plugin, List npcIds) { - for(Integer id : npcIds) { + for (Integer id : npcIds) { this.addNpcId(plugin, id); } return this; @@ -137,7 +137,7 @@ public GuiBuilder addMetadata(String key, String value) { public GuiBuilder addMetadata(Map metadata) { Iterator> it = metadata.entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); String key = next.getKey(); String value = next.getValue(); @@ -156,7 +156,7 @@ public Gui build() { Gui gui = new Gui(this.name, this.type, this.title, this.rows, this.close, this.modeEnum, this.npcIds, this.slots, this.locations, this.functionTree, this.metadata, this.isStatic); - if(this.backGui != null) { + if (this.backGui != null) { gui.setBack(this.backGui); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java index 73ebe1e59..cc828bb86 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java @@ -116,7 +116,7 @@ public SlotBuilder setUpdateInterval(int interval) { } public SlotBuilder addLore(String lore) { - if(this.lore == null) { + if (this.lore == null) { this.lore = new ArrayList(); this.lore.add(lore); } else { @@ -126,7 +126,7 @@ public SlotBuilder addLore(String lore) { } public SlotBuilder addLore(String... lore) { - for(String l : lore) { + for (String l : lore) { this.addLore(l); } @@ -134,7 +134,7 @@ public SlotBuilder addLore(String... lore) { } public SlotBuilder addLore(List lore) { - for(String l : lore) { + for (String l : lore) { this.addLore(l); } @@ -147,7 +147,7 @@ public SlotBuilder addEnchant(EnchantmentWrapper enchant) { } public SlotBuilder addEnchant(EnchantmentWrapper... enchant) { - for(EnchantmentWrapper ench : enchant) { + for (EnchantmentWrapper ench : enchant) { this.addEnchant(ench); } @@ -155,7 +155,7 @@ public SlotBuilder addEnchant(EnchantmentWrapper... enchant) { } public SlotBuilder addEnchant(List enchant) { - for(EnchantmentWrapper ench : enchant) { + for (EnchantmentWrapper ench : enchant) { this.addEnchant(ench); } @@ -184,7 +184,7 @@ public SlotBuilder addMetadata(String key, String value) { public SlotBuilder addMetadata(Map metadata) { Iterator> it = metadata.entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); String key = next.getKey(); String value = next.getValue(); @@ -202,7 +202,7 @@ public SlotBuilder fromItemStackWrapper(ItemStackWrapper itemStackWrapper) { this.setAmount(itemStackWrapper.getAmount()); this.addLore(itemStackWrapper.getLore()); - for(EnchantmentWrapper enchant : itemStackWrapper.getEnchants()) { + for (EnchantmentWrapper enchant : itemStackWrapper.getEnchants()) { this.addEnchant(enchant); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java index c68bf2929..e38a1d1cd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java @@ -49,7 +49,7 @@ public void spawnEffect(PlayerWrapper player) { public static class ParticleData { public static ParticleData fromString(String str) { - if(str.contains(",")) { + if (str.contains(",")) { String[] args = str.split(","); return new ParticleData(args[0].toUpperCase(), NumberUtils.toInt(args[1])); } @@ -74,8 +74,8 @@ public int getExtraData() { @Override public boolean equals(Object o) { - if(this == o) return true; - if(!(o instanceof ParticleData)) return false; + if (this == o) return true; + if (!(o instanceof ParticleData)) return false; ParticleData that = (ParticleData) o; return extraData == that.extraData && Objects.equals(effect, that.effect); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index 00abda93e..9503188ad 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -50,15 +50,15 @@ public void playSoundToPlayer(PlayerWrapper player) { public static class SoundData { public static SoundData fromString(String str) { - if(str.contains(",")) { + if (str.contains(",")) { String[] args = str.split(","); - if(args.length == 3) { + if (args.length == 3) { try { String sound = args[0]; float volume = Float.parseFloat(args[1]); float pitch = Float.parseFloat(args[2]); return new SoundData(sound, volume, pitch); - } catch(NumberFormatException ex) { + } catch (NumberFormatException ex) { //Don't do anything if invalid format } } @@ -90,10 +90,10 @@ public float getPitch() { @Override public boolean equals(Object o) { - if(this == o) { + if (this == o) { return true; } - if(!(o instanceof SoundData)) { + if (!(o instanceof SoundData)) { return false; } SoundData soundData = (SoundData) o; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 311d1761c..bc21b9bb3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -30,7 +30,7 @@ public abstract class Function implements Cloneable, Serializable { private static final long serialVersionUID = 1492427006104061443L; private static String[] normalizeAliases(String[] aliases) { - for(int i = 0; i < aliases.length; i++) { + for (int i = 0; i < aliases.length; i++) { aliases[i] = StringFuzz.normalize(aliases[i]); } return aliases; @@ -88,7 +88,7 @@ public void setData(String data) { } public boolean setOwner(FunctionOwner owner) { - if(this.owner != null) { + if (this.owner != null) { return false; } this.owner = owner; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java index d2ce9eaac..a3558c1c6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java @@ -31,7 +31,7 @@ public AddPermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return playerWrapper.addPermission(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java index ba6aee212..cf2f2d625 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java @@ -36,18 +36,18 @@ public CheckItemTypeInHandFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } List types = new ArrayList<>(); types.add(this.getData()); - if(this.getData().contains(",")) { + if (this.getData().contains(",")) { types = Arrays.asList(this.getData().split(",")); } //Uppercase - for(int i = 0; i < types.size(); i++) { + for (int i = 0; i < types.size(); i++) { types.set(i, types.get(i).toUpperCase()); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java index d265e6362..092d1e0a2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java @@ -31,13 +31,13 @@ public CheckLevelFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } try { int level = Integer.parseInt(this.getData()); return playerWrapper.getLevel() >= level; - } catch(NumberFormatException ex) { + } catch (NumberFormatException ex) { ex.printStackTrace(); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java index 221bc728d..41fc57226 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java @@ -34,12 +34,12 @@ public CheckMovableFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(!(owner instanceof Slot)) { + if (!(owner instanceof Slot)) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java index 17c7bfae6..13c154346 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java @@ -32,7 +32,7 @@ public CheckPlayerWorldFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } String worldName = this.getData(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java index 16755c86a..fac563c4a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java @@ -33,7 +33,7 @@ public ConsoleCommandFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } DynamicGui.get().getPlatform().dispatchServerCommand(ReplacerManager.get().replace(this.getData(), playerWrapper)); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java index 8ddbecfc8..7335a0464 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java @@ -12,13 +12,13 @@ public DelayFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null || !NumberUtils.isParsable(this.getData())) { + if (this.getData() == null || !NumberUtils.isParsable(this.getData())) { return false; } try { Thread.sleep(Integer.parseInt(this.getData())); return true; - } catch(InterruptedException e) { + } catch (InterruptedException e) { e.printStackTrace(); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java index 9bbd7e99e..7450b6b2e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java @@ -2,7 +2,6 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; -import org.apache.commons.lang3.math.NumberUtils; public class FalseAsyncFunction extends Function { @@ -15,7 +14,7 @@ public boolean function(PlayerWrapper playerWrapper) { try { Thread.sleep(5000); return false; - } catch(InterruptedException e) { + } catch (InterruptedException e) { e.printStackTrace(); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java index efa133c18..be8a762a2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java @@ -34,14 +34,14 @@ public GetGameRuleFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null || !this.getData().contains(",")) { + if (this.getData() == null || !this.getData().contains(",")) { return false; } String[] split = this.getData().split(","); - if(split.length == 3) { + if (split.length == 3) { String worldName = split[0]; WorldWrapper world = DynamicGui.get().getPlatform().getWorld(worldName); - if(world == null) { + if (world == null) { return false; } String rule = split[1]; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java index f23024dd5..cd3db416e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java @@ -32,7 +32,7 @@ public LogFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } DynamicGui.get().getLogger().info(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java index 426f96364..7d5d3a730 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java @@ -38,12 +38,12 @@ public boolean function(final PlayerWrapper playerWrapper) { double amt; try { amt = Double.parseDouble(this.getData()); - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); return false; } - if(DynamicGui.get().getPlugin().getEconomy() == null) { + if (DynamicGui.get().getPlugin().getEconomy() == null) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java index 248bd1f0a..8d07fd102 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java @@ -38,11 +38,11 @@ public boolean function(final PlayerWrapper playerWrapper) { double amt; try { amt = Double.parseDouble(this.getData()); - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); return false; } - if(DynamicGui.get().getPlugin().getEconomy() == null) { + if (DynamicGui.get().getPlugin().getEconomy() == null) { return false; } BigDecimal decimalAmt = new BigDecimal(amt); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java index 610e088d4..ef9909865 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java @@ -37,15 +37,15 @@ public boolean function(final PlayerWrapper playerWrapper) { double amt; try { amt = Double.parseDouble(this.getData()); - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); return false; } - if(DynamicGui.get().getPlugin().getEconomy() == null) { + if (DynamicGui.get().getPlugin().getEconomy() == null) { return false; } BigDecimal decimalAmt = new BigDecimal(amt); - if(DynamicGui.get().getPlugin().getEconomy().getBalance(playerWrapper).compareTo(decimalAmt) == -1) { + if (DynamicGui.get().getPlugin().getEconomy().getBalance(playerWrapper).compareTo(decimalAmt) == -1) { return false; } return DynamicGui.get().getPlugin().getEconomy().withdraw(playerWrapper, decimalAmt); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java index 906aafc05..2365aa0c4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java @@ -31,7 +31,7 @@ public NoPermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return !playerWrapper.hasPermission(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java index 29f145ce6..1bd035ba2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java @@ -32,7 +32,7 @@ public ParticleFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } ParticleWrapper wrapper = new ParticleWrapper(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java index 77903156e..fcbff13ce 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java @@ -31,7 +31,7 @@ public PermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return playerWrapper.hasPermission(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java index a33423fd4..a7d05b46c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java @@ -32,7 +32,7 @@ public PlayerCommandFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } playerWrapper.chat("/" + ReplacerManager.get().replace(this.getData(), playerWrapper)); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java index 42acd5c83..20647946b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java @@ -33,7 +33,7 @@ public PlayerMessageFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } playerWrapper.sendMessage(ChatColor.translateAlternateColorCodes(ReplacerManager.get().replace(this.getData(), playerWrapper))); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java index 45eb848e9..eac444261 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java @@ -33,7 +33,7 @@ public PlayerMiniMessageFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } String json = MiniMessageManager.get().toJson(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java index 667180544..9fc2bff59 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java @@ -31,7 +31,7 @@ public PlayerMsgJsonFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } playerWrapper.sendJsonMessage(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java index 2ad5ee506..b48b8398e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java @@ -33,13 +33,13 @@ public RandomFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } try { - if(this.getData().contains("-")) { + if (this.getData().contains("-")) { String[] split = this.getData().split("-"); - if(split.length == 2) { + if (split.length == 2) { final int end = Integer.parseInt(split[0]); final int win = Integer.parseInt(split[1]); final Random rand = new Random(); @@ -48,7 +48,7 @@ public boolean function(PlayerWrapper playerWrapper) { return generate == win; } } - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); } return false; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java index 5e1f32222..7e1003351 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java @@ -31,7 +31,7 @@ public RemovePermissionFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return playerWrapper.removePermission(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java index da10c5b26..24c135ce2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java @@ -37,14 +37,14 @@ public RemoveSlotFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { FunctionOwner owner = this.getOwner(); - if(this.getData() == null || this.getData().equals("this")) { - if(owner != null) { - if(owner instanceof Slot) { + if (this.getData() == null || this.getData().equals("this")) { + if (owner != null) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); item.setType("AIR"); inv.setItem(slot.getIndex(), item); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java index 903fe88cd..979b457a7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java @@ -32,7 +32,7 @@ public ResetFrameFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getOwner() instanceof Slot) { + if (this.getOwner() instanceof Slot) { Slot slot = (Slot) this.getOwner(); slot.resetFrame(); return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java index 70b1ca1be..77c660110 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java @@ -32,7 +32,7 @@ public ResetTickFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getOwner() instanceof Slot) { + if (this.getOwner() instanceof Slot) { Slot slot = (Slot) this.getOwner(); slot.resetTick(); return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java index e14617b71..a6c1afd0d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java @@ -32,7 +32,7 @@ public SendFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return DynamicGui.get().sendToServer(playerWrapper, this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java index ca4b23649..3e4f81690 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java @@ -35,7 +35,7 @@ public ServerBroadcastFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } String colorized = ChatColor.translateAlternateColorCodes('&', diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java index 71e5e65fb..c6cf2dbf6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java @@ -32,7 +32,7 @@ public ServerBroadcastJsonFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } DynamicGui.get().getPlatform().broadcastJsonMessage(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java index 5438bc449..c6477c8f0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java @@ -34,7 +34,7 @@ public ServerMiniBroadcastFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } String json = MiniMessageManager.get().toJson(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java index e9b504e0b..b3c4141bd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java @@ -37,23 +37,23 @@ public SetAmountFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); try { Integer amount = Integer.parseInt(this.getData()); item.setAmount(amount); inv.setItem(slot.getIndex(), item); return true; - } catch(Exception ex) { + } catch (Exception ex) { DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as an amount"); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java index ec218efdc..e03a8d099 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java @@ -32,11 +32,11 @@ public SetCloseFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } boolean value = Boolean.valueOf(this.getData()); - if(this.getOwner() instanceof CloseableComponent) { + if (this.getOwner() instanceof CloseableComponent) { CloseableComponent component = (CloseableComponent) this.getOwner(); component.setClose(value); return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java index bd2811a2c..c2cc4f14d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java @@ -37,23 +37,23 @@ public SetDurabilityFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); try { short durability = Short.parseShort(this.getData()); item.setDurability(durability); inv.setItem(slot.getIndex(), item); return true; - } catch(Exception ex) { + } catch (Exception ex) { DynamicGui.get().getLogger().info("Unable to parse + " + this.getData() + " as durability"); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java index 7d319f771..6c8b159e3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java @@ -41,20 +41,20 @@ public SetEnchantsFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); Map enchants = new HashMap<>(); - if(this.getData().contains(";")) { - for(String str : this.getData().split(";")) { + if (this.getData().contains(";")) { + for (String str : this.getData().split(";")) { String[] split = str.split(","); enchants.put(split[0], Integer.valueOf(split[1])); } @@ -63,11 +63,11 @@ public boolean function(PlayerWrapper playerWrapper) { enchants.put(split[0], Integer.valueOf(split[1])); } - for(EnchantmentWrapper wrapper : item.getEnchants()) { + for (EnchantmentWrapper wrapper : item.getEnchants()) { item.removeEnchant(wrapper); } - for(String str : enchants.keySet()) { + for (String str : enchants.keySet()) { item.addEnchant(new EnchantmentWrapper(str, enchants.get(str))); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java index cd580932a..44b632b58 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java @@ -33,15 +33,15 @@ public SetGameRuleFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null || !this.getData().contains(",")) { + if (this.getData() == null || !this.getData().contains(",")) { return false; } String[] split = this.getData().split(","); - if(split.length == 3) { + if (split.length == 3) { String worldName = split[0]; WorldWrapper world = DynamicGui.get().getPlatform().getWorld(worldName); - if(world == null) { + if (world == null) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java index c1901e584..274b51ff2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java @@ -36,16 +36,16 @@ public SetGlowFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { boolean value = Boolean.parseBoolean(this.getData()); ItemStackWrapper item = slot.getItemStack(); item.setGlowing(value); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java index 78881b9c0..096c42e48 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java @@ -44,22 +44,22 @@ public SetLoreFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); List lore = new ArrayList<>(); - if(this.getData() == null) { + if (this.getData() == null) { lore = null; } else { String newData = ReplacerManager.get().replace(this.getData(), playerWrapper); newData = AnimationReplacerManager.get().replace(slot, playerWrapper, newData); newData = ChatColor.translateAlternateColorCodes('&', newData); - if(newData.contains("\n")) { - for(String str : this.getData().split("\n")) { + if (newData.contains("\n")) { + for (String str : this.getData().split("\n")) { lore.add(str); } } else { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java index 880fe4015..50a7954dd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java @@ -35,17 +35,17 @@ public SetMovableFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } - if(this.getOwner() != null && this.getOwner() instanceof Slot) { + if (this.getOwner() != null && this.getOwner() instanceof Slot) { boolean value = Boolean.parseBoolean(this.getData()); FunctionOwner owner = this.getOwner(); - if(owner != null) { - if(owner instanceof Slot) { + if (owner != null) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { slot.setMovable(value); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java index c9ad9076b..a2f24d004 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java @@ -36,16 +36,16 @@ public SetNBTFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); item.setNBT(this.getData()); inv.setItem(slot.getIndex(), item); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java index 6727e8962..9f5671d54 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java @@ -39,16 +39,16 @@ public SetNameFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); String newName = ChatColor.translateAlternateColorCodes('&', this.getData()); newName = ReplacerManager.get().replace(newName, playerWrapper); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java index c64a6ecd9..13cf3a4dd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java @@ -36,16 +36,16 @@ public SetTypeFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } FunctionOwner owner = this.getOwner(); - if(owner != null && owner instanceof Slot) { + if (owner != null && owner instanceof Slot) { Slot slot = (Slot) owner; Gui gui = slot.getOwner(); - if(gui != null) { + if (gui != null) { InventoryWrapper inv = gui.getInventoryWrapper(); - if(inv != null) { + if (inv != null) { ItemStackWrapper item = slot.getItemStack(); item.setType(this.getData()); inv.setItem(slot.getIndex(), item); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java index 7906de4ed..9e9a095e7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java @@ -15,9 +15,9 @@ */ package com.clubobsidian.dynamicgui.core.function.impl; +import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; -import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; public class SoundFunction extends Function { @@ -32,7 +32,7 @@ public SoundFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } SoundWrapper wrapper = new SoundWrapper(this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java index 4c30042a0..7d1559cc3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java @@ -38,10 +38,10 @@ public LazyNumber lazyEval(List lazyParams) { String format = DynamicGui.get().getDateTimeFormat(); Date now = Date.from(Instant.now()); Date expected = new SimpleDateFormat(format).parse(lazyParams.get(0).getString()); - if(now.after(expected)) { + if (now.after(expected)) { return ConditionFunction.ONE; } - } catch(ParseException ignore) { + } catch (ParseException ignore) { DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", lazyParams.get(0).getString())); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java index fd7515828..20458a004 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java @@ -22,10 +22,10 @@ public LazyNumber lazyEval(List lazyParams) { String format = DynamicGui.get().getDateTimeFormat(); Date now = Date.from(Instant.now()); Date expected = new SimpleDateFormat(format).parse(lazyParams.get(0).getString()); - if(now.before(expected)) { + if (now.before(expected)) { return ConditionFunction.ONE; } - } catch(ParseException ignore) { + } catch (ParseException ignore) { DynamicGui.get().getLogger().error(String.format("Invalid Date: %s", lazyParams.get(0).getString())); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java index 50f497eaa..3c832a898 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java @@ -35,7 +35,7 @@ public CheckTickFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; int tick = slot.getCurrentTick(); int frame = slot.getFrame(); @@ -47,12 +47,12 @@ public boolean function(PlayerWrapper playerWrapper) { Expression expr = new Expression(tickData); expr.addLazyFunction(new EqualLazyFunction()); - if(!expr.isBoolean()) { + if (!expr.isBoolean()) { return false; } return expr.eval().intValue() == 1; - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java index b4f2ebeeb..c4ccc3520 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java @@ -46,11 +46,11 @@ public boolean function(PlayerWrapper playerWrapper) { expr.addLazyFunction(new AfterDateLazyFunction()); expr.addLazyFunction(new BeforeDateLazyFunction()); - if(!expr.isBoolean()) + if (!expr.isBoolean()) return false; return expr.eval().intValue() == 1; - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java index 7254ad68e..c6e4267d3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java @@ -28,7 +28,7 @@ protected ContainsLazyFunction() { @Override public LazyNumber lazyEval(List lazyParams) { - if(lazyParams.get(0).getString().contains(lazyParams.get(1).getString())) { + if (lazyParams.get(0).getString().contains(lazyParams.get(1).getString())) { return ConditionFunction.ONE; } return ConditionFunction.ZERO; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java index fdf19dc89..d7f393962 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java @@ -28,7 +28,7 @@ protected EndsWithLazyFunction() { @Override public LazyNumber lazyEval(List lazyParams) { - if(lazyParams.get(0).getString().endsWith(lazyParams.get(1).getString())) { + if (lazyParams.get(0).getString().endsWith(lazyParams.get(1).getString())) { return ConditionFunction.ONE; } return ConditionFunction.ZERO; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java index 0dd2b1600..4217e7f13 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java @@ -28,7 +28,7 @@ protected EqualLazyFunction() { @Override public LazyNumber lazyEval(List lazyParams) { - if(lazyParams.get(0).getString().equals(lazyParams.get(1).getString())) { + if (lazyParams.get(0).getString().equals(lazyParams.get(1).getString())) { return ConditionFunction.ONE; } return ConditionFunction.ZERO; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java index 8e13bde21..680177a7e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java @@ -28,7 +28,7 @@ protected IgnoreCaseEqualLazyFunction() { @Override public LazyNumber lazyEval(List lazyParams) { - if(lazyParams.get(0).getString().equalsIgnoreCase(lazyParams.get(1).getString())) { + if (lazyParams.get(0).getString().equalsIgnoreCase(lazyParams.get(1).getString())) { return ConditionFunction.ONE; } return ConditionFunction.ZERO; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java index c86f0d3c6..b06cf0ba8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java @@ -28,7 +28,7 @@ protected StartsWithLazyFunction() { @Override public LazyNumber lazyEval(List lazyParams) { - if(lazyParams.get(0).getString().startsWith(lazyParams.get(1).getString())) { + if (lazyParams.get(0).getString().startsWith(lazyParams.get(1).getString())) { return ConditionFunction.ONE; } return ConditionFunction.ZERO; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java index abb5c2435..8aa6028f7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java @@ -33,7 +33,7 @@ public IsNotOnCooldownFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return !CooldownManager.get().isOnCooldown(playerWrapper, this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java index 3fb1f5de9..977213474 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java @@ -33,7 +33,7 @@ public IsOnCooldownFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; } return CooldownManager.get().isOnCooldown(playerWrapper, this.getData()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java index 17a69efec..a9c00c865 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java @@ -32,12 +32,12 @@ public SetCooldownFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null || !this.getData().contains(",")) { + if (this.getData() == null || !this.getData().contains(",")) { return false; } String[] split = this.getData().split(","); - if(split.length != 2) { + if (split.length != 2) { return false; } @@ -45,7 +45,7 @@ public boolean function(PlayerWrapper playerWrapper) { long cooldownTime; try { cooldownTime = Long.parseLong(split[1]); - } catch(NumberFormatException ex) { + } catch (NumberFormatException ex) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java index 3880046de..6ea63a238 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java @@ -39,32 +39,32 @@ public BackFunction() { public boolean function(PlayerWrapper playerWrapper) { Gui gui = null; FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; gui = slot.getOwner(); slot.setClose(false); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { gui = (Gui) owner; } Gui back = gui.getBack(); - if(back != null) { - if(this.getData() != null) { + if (back != null) { + if (this.getData() != null) { try { Integer backAmount = Integer.parseInt(this.getData()); - for(int i = 1; i < backAmount; i++) { + for (int i = 1; i < backAmount; i++) { Gui nextBack = back.getBack(); - if(nextBack != null) { + if (nextBack != null) { back = nextBack; } } - } catch(NumberFormatException ex) { + } catch (NumberFormatException ex) { return false; } } try { return GuiManager.get().openGui(playerWrapper, back).get(); - } catch(InterruptedException | ExecutionException e) { + } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java index 8ebcaec72..509eb3d7e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java @@ -38,32 +38,32 @@ public GuiFunction() { @Override public boolean function(final PlayerWrapper playerWrapper) { final String gui = this.getData(); - if(gui == null) { + if (gui == null) { return false; } - if(!GuiManager.get().hasGuiName(gui)) { + if (!GuiManager.get().hasGuiName(gui)) { return false; } Gui back = null; FunctionOwner owner = this.getOwner(); //Find root gui - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; back = slot.getOwner(); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { back = (Gui) owner; } //Make it so the gui doesn't close - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; slot.setClose(false); } back.setClose(false); try { return GuiManager.get().openGui(playerWrapper, gui, back).get(); - } catch(InterruptedException | ExecutionException e) { + } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java index 4bb9d6b5e..f15d7f106 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java @@ -37,10 +37,10 @@ public HasBackFunction() { public boolean function(PlayerWrapper playerWrapper) { Gui gui = null; FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; gui = slot.getOwner(); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { gui = (Gui) owner; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java index b1e42309c..ac16a3c5b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java @@ -36,14 +36,14 @@ public RefreshGuiFunction() { public boolean function(PlayerWrapper playerWrapper) { Gui gui = null; FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; gui = slot.getOwner(); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { gui = (Gui) owner; } - for(Slot slot : gui.getSlots()) { + for (Slot slot : gui.getSlots()) { slot.setUpdate(true); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java index 9b19d9e91..e639bbd64 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java @@ -37,8 +37,8 @@ public RefreshSlotFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { - if(this.getOwner() instanceof Gui) { + if (this.getData() == null) { + if (this.getOwner() instanceof Gui) { return false; } @@ -50,12 +50,12 @@ public boolean function(PlayerWrapper playerWrapper) { try { String data = this.getData(); List slotIndexs = new ArrayList<>(); - if(!data.contains(",")) { + if (!data.contains(",")) { int parsed = Integer.parseInt(data); slotIndexs.add(parsed); } else { String[] split = data.split(","); - for(String str : split) { + for (String str : split) { Integer parsed = Integer.parseInt(str); slotIndexs.add(parsed); } @@ -63,22 +63,22 @@ public boolean function(PlayerWrapper playerWrapper) { Gui gui = null; FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; gui = slot.getOwner(); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { gui = (Gui) owner; } List slots = gui.getSlots(); - for(Slot slot : slots) { - if(slotIndexs.contains(slot.getIndex())) { + for (Slot slot : slots) { + if (slotIndexs.contains(slot.getIndex())) { slot.setUpdate(true); } } return true; - } catch(NumberFormatException ex) { + } catch (NumberFormatException ex) { return false; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java index 18b01c902..f779fc193 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java @@ -37,21 +37,21 @@ public SetBackFunction() { public boolean function(PlayerWrapper playerWrapper) { Gui gui = null; FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; gui = slot.getOwner(); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { gui = (Gui) owner; } - if(gui == null) { + if (gui == null) { return false; - } else if(this.getData() == null) { + } else if (this.getData() == null) { return false; } Gui backGui = GuiManager.get().getGuiByName(this.getData()); - if(backGui == null) { + if (backGui == null) { return false; } gui.setBack(backGui); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java index f6feeb80c..c47209602 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java @@ -33,15 +33,15 @@ public CopyBackMetadataFunction() { public boolean function(PlayerWrapper playerWrapper) { Gui gui = null; FunctionOwner owner = this.getOwner(); - if(owner instanceof Slot) { + if (owner instanceof Slot) { Slot slot = (Slot) owner; gui = slot.getOwner(); - } else if(owner instanceof Gui) { + } else if (owner instanceof Gui) { gui = (Gui) owner; } Gui back = gui.getBack(); - if(back == null) { + if (back == null) { return false; } gui.getMetadata().putAll(back.getMetadata()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java index c09ceff4a..9710166af 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java @@ -37,9 +37,9 @@ public HasMetadataFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; - } else if(!this.getData().contains(",")) { + } else if (!this.getData().contains(",")) { return false; } @@ -49,51 +49,51 @@ public boolean function(PlayerWrapper playerWrapper) { String first = split[0]; Gui gui = null; - if(owner instanceof Gui && split.length >= 2) { - if(split.length == 2) { + if (owner instanceof Gui && split.length >= 2) { + if (split.length == 2) { holder = (MetadataHolder) owner; } else { gui = (Gui) owner; } - } else if(owner instanceof Slot && split.length >= 2) { - if(first.equals("gui")) { + } else if (owner instanceof Slot && split.length >= 2) { + if (first.equals("gui")) { holder = ((Slot) this.getOwner()).getOwner(); - } else if(split.length == 2) { + } else if (split.length == 2) { holder = (MetadataHolder) this.getOwner(); - } else if(split.length == 3) { + } else if (split.length == 3) { gui = ((Slot) owner).getOwner(); } } //Check for slots - if(holder == null) { + if (holder == null) { int index = -1; try { index = Integer.valueOf(first); - } catch(Exception ex) { + } catch (Exception ex) { DynamicGui.get().getLogger().error("Invalid index " + first + " in HasMetadata function"); return false; } - for(Slot s : gui.getSlots()) { - if(s.getIndex() == index) { + for (Slot s : gui.getSlots()) { + if (s.getIndex() == index) { holder = s; break; } } } - if(holder != null) { + if (holder != null) { String key = null; String value = null; - if(split.length == 2) { + if (split.length == 2) { key = split[0]; value = split[1]; - } else if(split.length == 3) { + } else if (split.length == 3) { key = split[1]; value = split[2]; } - if(key != null) { + if (key != null) { String metaValue = holder.getMetadata().get(key); return value.equals(metaValue); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java index 57df336bf..9e73ab7f7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java @@ -33,9 +33,9 @@ public IsGuiMetadataSet() { @Override public boolean function(PlayerWrapper playerWrapper) { Gui gui; - if(this.getOwner() instanceof Gui) { + if (this.getOwner() instanceof Gui) { gui = (Gui) this.getOwner(); - } else if(this.getOwner() instanceof Slot) { + } else if (this.getOwner() instanceof Slot) { gui = ((Slot) this.getOwner()).getOwner(); } else { String clazzName = this.getOwner().getClass().getName(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java index 3fff56e6f..3b958bb53 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java @@ -39,9 +39,9 @@ public SetMetadataFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - if(this.getData() == null) { + if (this.getData() == null) { return false; - } else if(!this.getData().contains(",")) { + } else if (!this.getData().contains(",")) { return false; } @@ -51,51 +51,51 @@ public boolean function(PlayerWrapper playerWrapper) { String first = split[0]; Gui gui = null; - if(owner instanceof Gui && split.length >= 2) { - if(split.length == 2) { + if (owner instanceof Gui && split.length >= 2) { + if (split.length == 2) { holder = (MetadataHolder) owner; } else { gui = (Gui) owner; } - } else if(owner instanceof Slot && split.length >= 2) { - if(first.equals("gui")) { + } else if (owner instanceof Slot && split.length >= 2) { + if (first.equals("gui")) { holder = ((Slot) this.getOwner()).getOwner(); - } else if(split.length == 2) { + } else if (split.length == 2) { holder = (MetadataHolder) this.getOwner(); - } else if(split.length == 3) { + } else if (split.length == 3) { gui = ((Slot) owner).getOwner(); } } //Check for slots - if(holder == null) { + if (holder == null) { int index = -1; try { index = Integer.valueOf(first); - } catch(Exception ex) { + } catch (Exception ex) { DynamicGui.get().getLogger().error("Invalid index " + first + " in HasMetadata function"); return false; } - for(Slot s : gui.getSlots()) { - if(s.getIndex() == index) { + for (Slot s : gui.getSlots()) { + if (s.getIndex() == index) { holder = s; break; } } } - if(holder != null && split.length >= 2) { + if (holder != null && split.length >= 2) { String key = null; String value = null; - if(split.length == 2) { + if (split.length == 2) { key = split[0]; value = split[1]; - } else if(split.length == 3) { + } else if (split.length == 3) { key = split[1]; value = split[2]; } - if(key != null) { + if (key != null) { holder.getMetadata().put(key, value); return true; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index 955e13b88..a5f2cf658 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -74,7 +74,7 @@ public Gui(String name, String type, String title, int rows, Boolean close, } public InventoryWrapper buildInventory(PlayerWrapper playerWrapper) { - if(this.isStatic && this.inventoryWrapper != null) { //Don't rebuild if gui is static + if (this.isStatic && this.inventoryWrapper != null) { //Don't rebuild if gui is static return this.inventoryWrapper; } String inventoryTitle = this.formatTitle(playerWrapper); @@ -87,14 +87,14 @@ public InventoryWrapper buildInventory(PlayerWrapper playerWrapper) { private String formatTitle(PlayerWrapper playerWrapper) { String inventoryTitle = ReplacerManager.get().replace(this.title, playerWrapper); - if(inventoryTitle.length() > 32) { + if (inventoryTitle.length() > 32) { inventoryTitle = inventoryTitle.substring(0, 31); } return inventoryTitle; } private Object createInventory(String inventoryTitle) { - if(this.type == null || this.type.equals(InventoryType.CHEST.toString())) { + if (this.type == null || this.type.equals(InventoryType.CHEST.toString())) { return InventoryManager.get().createInventory(this.rows * 9, inventoryTitle); } else { return InventoryManager.get().createInventory(inventoryTitle, this.type); @@ -102,14 +102,14 @@ private Object createInventory(String inventoryTitle) { } private void populateInventory(PlayerWrapper playerWrapper, InventoryWrapper inventoryWrapper) { - for(int i = 0; i < this.slots.size(); i++) { + for (int i = 0; i < this.slots.size(); i++) { Slot slot = this.slots.get(i); - if(slot != null) { + if (slot != null) { slot.setOwner(this); ItemStackWrapper item = slot.buildItemStack(playerWrapper); - if(this.modeEnum == ModeEnum.ADD) { + if (this.modeEnum == ModeEnum.ADD) { int itemIndex = inventoryWrapper.addItem(item); - if(itemIndex != -1) { + if (itemIndex != -1) { slot.setIndex(itemIndex); } } else { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index ccdd4c09d..09eb35135 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -15,11 +15,11 @@ */ package com.clubobsidian.dynamicgui.core.gui; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; import com.clubobsidian.dynamicgui.core.gui.property.MetadataHolder; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.ModelManager; @@ -164,41 +164,41 @@ public FunctionTree getFunctions() { public ItemStackWrapper buildItemStack(PlayerWrapper playerWrapper) { ItemStackWrapper builderItem = this.itemStack; - if(builderItem == null) { + if (builderItem == null) { builderItem = ItemStackManager.get().createItemStackWrapper(this.icon, this.amount); } else { builderItem.setType(this.icon); builderItem.setAmount(this.amount); } - if(!this.icon.toUpperCase().equals(IGNORE_MATERIAL)) { - if(this.data != 0) { + if (!this.icon.toUpperCase().equals(IGNORE_MATERIAL)) { + if (this.data != 0) { builderItem.setDurability(this.data); } - if(this.modelProvider != null && this.modelData != null) { + if (this.modelProvider != null && this.modelData != null) { ModelProvider provider = ModelManager.get().getProvider(this.modelProvider); - if(provider != null) { + if (provider != null) { provider.applyModel(builderItem, this.modelData); } } - if(this.name != null) { + if (this.name != null) { String newName = this.name; newName = ReplacerManager.get().replace(newName, playerWrapper); newName = AnimationReplacerManager.get().replace(this, playerWrapper, newName); builderItem.setName(newName); } - if(this.lore != null) { + if (this.lore != null) { List newLore = new ArrayList<>(); - for(String newString : this.lore) { + for (String newString : this.lore) { String lore = ReplacerManager.get().replace(newString, playerWrapper); lore = AnimationReplacerManager.get().replace(this, playerWrapper, lore); - if(lore.contains("\n")) { + if (lore.contains("\n")) { String[] split = lore.split("\n"); - for(String sp : split) { + for (String sp : split) { newLore.add(sp); } } else { @@ -209,19 +209,19 @@ public ItemStackWrapper buildItemStack(PlayerWrapper playerWrapper) { builderItem.setLore(newLore); } - if(this.enchants != null) { - for(EnchantmentWrapper ench : this.enchants) { + if (this.enchants != null) { + for (EnchantmentWrapper ench : this.enchants) { builderItem.addEnchant(ench); } } builderItem.addItemFlags(this.itemFlags); - if(this.glow) { + if (this.glow) { builderItem.setGlowing(true); } - if(this.nbt != null && !this.nbt.equals("")) { + if (this.nbt != null && !this.nbt.equals("")) { builderItem.setNBT(ReplacerManager.get().replace(this.nbt, playerWrapper)); } } @@ -261,14 +261,14 @@ public void resetTick() { public int tick() { this.tick += 1; - if((this.tick) % 20 == 0) { + if ((this.tick) % 20 == 0) { this.frame += 1; //Reset frame - if(this.tick == Integer.MAX_VALUE) { + if (this.tick == Integer.MAX_VALUE) { this.tick = 0; } - if(this.frame == Integer.MAX_VALUE) { + if (this.frame == Integer.MAX_VALUE) { this.frame = 0; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index d4b762c0c..d0edfde4d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -22,8 +22,8 @@ import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.google.inject.Binder; import com.google.inject.Guice; import com.google.inject.Module; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java index 5fe2071ad..3b49cfd02 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java @@ -50,7 +50,7 @@ public T getInventory() { public int addItem(ItemStackWrapper itemStackWrapper) { int index = this.getCurrentContentSize(); - if(index >= this.getSize()) + if (index >= this.getSize()) return -1; this.setItem(index, itemStackWrapper); @@ -59,9 +59,9 @@ public int addItem(ItemStackWrapper itemStackWrapper) { @Override public boolean equals(Object obj) { - if(obj == null) + if (obj == null) return false; - if(!(obj instanceof InventoryWrapper)) + if (!(obj instanceof InventoryWrapper)) return false; InventoryWrapper wrapper = (InventoryWrapper) obj; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java index fff1107a7..a41db56b2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java @@ -32,23 +32,23 @@ public class EntityClickListener { @EventHandler public void onEntityClick(PlayerInteractEntityEvent e) { - if(GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) + if (GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) return; EntityWrapper entityWrapper = e.getEntityWrapper(); List registeries = DynamicGui.get().getPlugin().getNPCRegistries(); - for(NPCRegistry registry : registeries) { - for(Gui gui : GuiManager.get().getGuis()) { + for (NPCRegistry registry : registeries) { + for (Gui gui : GuiManager.get().getGuis()) { Iterator>> it = gui.getNpcIds().entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry> next = it.next(); String registryName = next.getKey(); List ids = next.getValue(); - if(registryName.equalsIgnoreCase(registry.getName())) { + if (registryName.equalsIgnoreCase(registry.getName())) { NPC npc = registry.getNPC(entityWrapper); - if(npc != null) { - if(ids.contains(npc.getMeta().getId())) { + if (npc != null) { + if (ids.contains(npc.getMeta().getId())) { GuiManager.get().openGui(e.getPlayerWrapper(), gui); break; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index 027519c13..cf79981f5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -42,7 +42,7 @@ public void onGuiOpen(GuiLoadEvent event) { Gui gui = GuiManager.get().getPlayerGui(wrapper); PlayerWrapper playerWrapper = event.getPlayerWrapper(); boolean open = (gui != null); - if(open) { + if (open) { UUID uuid = wrapper.getUniqueId(); this.users.add(uuid); FunctionManager.get().tryFunctions(gui, FunctionType.SWITCH_MENU, playerWrapper); @@ -53,9 +53,9 @@ public void onGuiOpen(GuiLoadEvent event) { public void onClose(InventoryCloseEvent event) { PlayerWrapper playerWrapper = event.getPlayerWrapper(); UUID uuid = playerWrapper.getUniqueId(); - if(!this.users.remove(uuid)) { + if (!this.users.remove(uuid)) { Gui gui = GuiManager.get().getPlayerGui(playerWrapper); - if(gui != null) { + if (gui != null) { FunctionManager.get().tryFunctions(gui, FunctionType.EXIT_MENU, playerWrapper); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java index fb901ab82..06468914a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java @@ -41,7 +41,7 @@ public void onKick(final PlayerKickEvent e) { } private void handleInventoryClose(PlayerWrapper playerWrapper) { - if(GuiManager.get().hasGuiCurrently(playerWrapper)) { + if (GuiManager.get().hasGuiCurrently(playerWrapper)) { GuiManager.get().cleanupPlayerGui(playerWrapper); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index f68a1e3a3..2b918356f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -39,27 +39,27 @@ public class InventoryInteractListener { @EventHandler public void invClick(final InventoryClickEvent e) { PlayerWrapper player = e.getPlayerWrapper(); - if(!GuiManager.get().hasGuiOpen(player)) { + if (!GuiManager.get().hasGuiOpen(player)) { return; } Gui gui = GuiManager.get().getPlayerGui(player); Slot slot = this.getSlotFromIndex(gui, e.getSlot()); - if(slot == null && e.getView() != InventoryView.BOTTOM) { + if (slot == null && e.getView() != InventoryView.BOTTOM) { e.setCancelled(true); return; } ItemStackWrapper item = e.getItemStackWrapper(); - if(e.getClick() == null) { //For other types of clicks besides left, right, middle + if (e.getClick() == null) { //For other types of clicks besides left, right, middle e.setCancelled(true); return; - } else if(item.getItemStack() == null) { + } else if (item.getItemStack() == null) { return; - } else if(e.getView() == InventoryView.BOTTOM) { - if(e.getClick() == Click.SHIFT_LEFT || e.getClick() == Click.SHIFT_RIGHT) { - if(!this.canStack(gui, e.getInventoryWrapper(), item)) { + } else if (e.getView() == InventoryView.BOTTOM) { + if (e.getClick() == Click.SHIFT_LEFT || e.getClick() == Click.SHIFT_RIGHT) { + if (!this.canStack(gui, e.getInventoryWrapper(), item)) { e.setCancelled(true); } } @@ -68,25 +68,25 @@ public void invClick(final InventoryClickEvent e) { } List functions = slot.getFunctions().getRootNodes(); - if(functions.size() > 0) { + if (functions.size() > 0) { String clickString = e.getClick().toString(); FunctionManager.get().tryFunctions(slot, FunctionType.valueOf(clickString), player); } - if(!slot.isMovable()) { + if (!slot.isMovable()) { e.setCancelled(true); } Boolean close; - if(slot.getClose() != null) { + if (slot.getClose() != null) { close = slot.getClose(); - } else if(gui.getClose() != null) { + } else if (gui.getClose() != null) { close = gui.getClose(); } else { close = true; } - if(close) { + if (close) { player.closeInventory(); } } @@ -94,22 +94,22 @@ public void invClick(final InventoryClickEvent e) { @EventHandler public void onDrag(InventoryDragEvent e) { PlayerWrapper player = e.getPlayerWrapper(); - if(!GuiManager.get().hasGuiOpen(player)) { + if (!GuiManager.get().hasGuiOpen(player)) { return; } Gui gui = GuiManager.get().getPlayerGui(player); Iterator>> it = e.getSlotItems().entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry> next = it.next(); int rawSlot = next.getKey(); - if(rawSlot < 0 || rawSlot >= e.getInventoryWrapper().getSize()) { + if (rawSlot < 0 || rawSlot >= e.getInventoryWrapper().getSize()) { return; } Slot slot = this.getSlotFromIndex(gui, rawSlot); - if(slot == null || (slot != null && !slot.isMovable())) { + if (slot == null || (slot != null && !slot.isMovable())) { e.setCancelled(true); return; } @@ -117,8 +117,8 @@ public void onDrag(InventoryDragEvent e) { } private Slot getSlotFromIndex(Gui gui, int index) { - for(Slot s : gui.getSlots()) { - if(index == s.getIndex()) { + for (Slot s : gui.getSlots()) { + if (index == s.getIndex()) { return s; } } @@ -129,14 +129,14 @@ private Slot getSlotFromIndex(Gui gui, int index) { private boolean canStack(Gui gui, InventoryWrapper inventory, ItemStackWrapper clickedItem) { boolean canStack = false; ItemStackWrapper[] contents = inventory.getContents(); - for(int i = 0; i < contents.length; i++) { + for (int i = 0; i < contents.length; i++) { ItemStackWrapper stackTo = contents[i]; - if(stackTo.getItemStack() == null || (stackTo.isSimilar(clickedItem) && validSize(clickedItem, stackTo))) { + if (stackTo.getItemStack() == null || (stackTo.isSimilar(clickedItem) && validSize(clickedItem, stackTo))) { Slot slot = this.getSlotFromIndex(gui, i); - if(slot != null) { - if(slot.isMovable()) { + if (slot != null) { + if (slot.isMovable()) { canStack = true; - } else if(canStack && !slot.isMovable()) { + } else if (canStack && !slot.isMovable()) { canStack = false; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 7d33e473d..14e01f1c2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -16,7 +16,6 @@ package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent; -import com.clubobsidian.dynamicgui.core.event.player.PlayerAction; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; @@ -26,15 +25,15 @@ public class PlayerInteractListener { @EventHandler public void playerInteract(final PlayerInteractEvent e) { - if(e.getAction().isBlockClick()) { - if(GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) { + if (e.getAction().isBlockClick()) { + if (GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) { return; } - for(Gui gui : GuiManager.get().getGuis()) { - if(gui.getLocations() != null) { - for(LocationWrapper guiLocation : gui.getLocations()) { - if(e.getLocationWrapper().equals(guiLocation)) { + for (Gui gui : GuiManager.get().getGuis()) { + if (gui.getLocations() != null) { + for (LocationWrapper guiLocation : gui.getLocations()) { + if (e.getLocationWrapper().equals(guiLocation)) { GuiManager.get().openGui(e.getPlayerWrapper(), gui); e.setCancelled(true); break; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java index b84118183..ccc5bd4b4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.manager.dynamicgui; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.registry.replacer.AnimationReplacerRegistry; import java.util.ArrayList; @@ -33,7 +33,7 @@ private AnimationReplacerManager() { } public static AnimationReplacerManager get() { - if(instance == null) { + if (instance == null) { instance = new AnimationReplacerManager(); } return instance; @@ -41,7 +41,7 @@ public static AnimationReplacerManager get() { public String replace(AnimationHolder holder, PlayerWrapper playerWrapper, String text) { String newText = text; - for(AnimationReplacerRegistry registry : this.registries) { + for (AnimationReplacerRegistry registry : this.registries) { newText = registry.replace(holder, playerWrapper, newText); } return newText; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 1430b759f..0fad23ad7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -49,7 +49,7 @@ private FunctionManager() { } public static FunctionManager get() { - if(instance == null) { + if (instance == null) { instance = new FunctionManager(); } return instance; @@ -58,7 +58,7 @@ public static FunctionManager get() { public Function getFunctionByName(String functionName) { String normalized = StringFuzz.normalize(functionName); Function function = this.functions.get(normalized); - if(function == null) { + if (function == null) { return null; } @@ -71,8 +71,8 @@ public List getFunctions() { public boolean addFunction(Function function) { boolean wasNotNull = this.functions.put(function.getName(), function) != null; - for(String alias : function.getAliases()) { - if(this.functions.put(alias, function) != null) { + for (String alias : function.getAliases()) { + if (this.functions.put(alias, function) != null) { wasNotNull = true; } } @@ -103,14 +103,14 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, return null; }); FunctionNode node = nodeQueue.poll(); - if(node != null) { + if (node != null) { FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); - if(types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { - if(type != FunctionType.FAIL) { + if (types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { + if (type != FunctionType.FAIL) { runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { - if(!dataResponse.result) { - if(dataResponse.failedFunction == null) { + if (!dataResponse.result) { + if (dataResponse.failedFunction == null) { future.complete(false); } else { returnValue.set(false); @@ -124,8 +124,8 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, playerWrapper, future, returnValue); } }); - } else if(type == FunctionType.FAIL) { - if(isFail(response, functionToken)) { + } else if (type == FunctionType.FAIL) { + if (isFail(response, functionToken)) { runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { recurFunctionNodes(dataResponse, owner, node.getChildren(), FunctionType.FAIL, @@ -135,7 +135,7 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, } } } - if(node == null) { + if (node == null) { future.complete(returnValue.get()); } return future; @@ -148,41 +148,41 @@ private CompletableFuture runFunctionData(FunctionOwner owner, return null; }); ThreadUtil.run(() -> { - for(int i = 0; i < functionDataList.size(); i++) { + for (int i = 0; i < functionDataList.size(); i++) { FunctionData data = functionDataList.get(i); String functionName = data.getName(); String functionData = data.getData(); Function function = FunctionManager.get().getFunctionByName(functionName); - if(function == null) { + if (function == null) { DynamicGui.get().getLogger().error("Invalid function " + data.getName()); response.complete(new FunctionResponse(false)); return; } function.setOwner(owner); - if(data.getData() != null) { + if (data.getData() != null) { String newData = ReplacerManager.get().replace(functionData, playerWrapper); function.setData(newData); } boolean async = function.isAsync(); List futureData = async ? new ArrayList<>(functionDataList.size()) : functionDataList; - if(async) { //Load functions into new arraylist if the function is async - for(int j = i + 1; j < functionDataList.size(); j++) { + if (async) { //Load functions into new arraylist if the function is async + for (int j = i + 1; j < functionDataList.size(); j++) { futureData.add(functionDataList.get(j)); } } ThreadUtil.run(() -> { boolean ran = function.function(playerWrapper); - if(data.getModifier() == FunctionModifier.NOT) { + if (data.getModifier() == FunctionModifier.NOT) { ran = !ran; } - if(!ran) { + if (!ran) { response.complete(new FunctionResponse(false, functionName, functionData)); - } else if(async) { + } else if (async) { try { response.complete(runFunctionData(owner, futureData, playerWrapper).get()); - } catch(InterruptedException | ExecutionException ex) { + } catch (InterruptedException | ExecutionException ex) { ex.printStackTrace(); } } @@ -193,7 +193,7 @@ private CompletableFuture runFunctionData(FunctionOwner owner, //Also return if the future is completed, this is done because if a function is completed //with a sync function that failed the future will complete, but we don't want to continue //the loop - if(async || response.isDone()) { + if (async || response.isDone()) { return; } } @@ -203,11 +203,11 @@ private CompletableFuture runFunctionData(FunctionOwner owner, } private boolean isFail(FunctionResponse response, FunctionToken token) { - for(FunctionData data : token.getFailOnFunctions()) { - if(data.getName().equals(response.failedFunction)) { - if(data.getData() == null) { + for (FunctionData data : token.getFailOnFunctions()) { + if (data.getName().equals(response.failedFunction)) { + if (data.getData() == null) { return true; - } else if(data.getData().equals(response.data)) { + } else if (data.getData().equals(response.data)) { return true; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 1e153f022..cd67c6d94 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -28,9 +28,9 @@ import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.platform.PlatformType; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.util.ChatColor; import com.clubobsidian.dynamicgui.core.util.HashUtil; import com.clubobsidian.dynamicgui.core.util.ThreadUtil; @@ -85,7 +85,7 @@ private GuiManager() { } public static GuiManager get() { - if(instance == null) { + if (instance == null) { instance = new GuiManager(); instance.loadGlobalMacros(); instance.loadGuis(); @@ -99,7 +99,7 @@ public boolean hasGuiName(String name) { public Gui getGuiByName(String name) { Gui gui = this.guis.get(name); - if(gui != null) { + if (gui != null) { return getOrCloneGui(gui); } return null; @@ -117,7 +117,7 @@ public void reloadGuis(boolean force) { this.cachedGlobalMacros = this.globalMacros; this.globalMacros = new HashMap<>(); - if(force) { + if (force) { this.cachedTokens = new HashMap<>(); this.cachedGuis = new HashMap<>(); this.guiHashes = new HashMap<>(); @@ -142,7 +142,7 @@ public boolean hasGuiCurrently(PlayerWrapper playerWrapper) { } public boolean hasGuiOpen(PlayerWrapper playerWrapper) { - if(playerWrapper.getOpenInventoryWrapper() == null) { + if (playerWrapper.getOpenInventoryWrapper() == null) { return false; } return this.hasGuiCurrently(playerWrapper); @@ -183,14 +183,14 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu return null; }); ThreadUtil.run(() -> { - if(gui == null) { + if (gui == null) { playerWrapper.sendMessage(DynamicGui.get().getMessage().getNoGui()); future.complete(false); return; } Gui clonedGui = getOrCloneGui(gui); - if(back != null) { + if (back != null) { clonedGui.setBack(back.clone()); } @@ -201,26 +201,26 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu CompletableFuture result = FunctionManager.get().tryFunctions(clonedGui, FunctionType.LOAD, playerWrapper); result.thenAccept((ran) -> ThreadUtil.run(() -> { GuiLoadEvent event = new GuiLoadEvent(clonedGui, playerWrapper); - if(!ran) { + if (!ran) { event.setCancelled(true); } DynamicGui.get().getEventBus().callEvent(event); - if(ran) { + if (ran) { InventoryWrapper inventoryWrapper = clonedGui.buildInventory(playerWrapper); //Run slot load functions - for(Slot slot : clonedGui.getSlots()) { + for (Slot slot : clonedGui.getSlots()) { FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper); } - if(inventoryWrapper == null) { + if (inventoryWrapper == null) { future.complete(false); return; } Platform server = DynamicGui.get().getPlatform(); - if(server.getType() == PlatformType.SPONGE) { + if (server.getType() == PlatformType.SPONGE) { server.getScheduler().runSyncDelayedTask(() -> { playerWrapper.openInventory(inventoryWrapper); }, 1L); @@ -243,10 +243,10 @@ private void loadGlobalMacroFromFile(File file) { String macroName = file.getName().substring(0, file.getName().lastIndexOf(".")); byte[] fileHash = HashUtil.getMD5(file); byte[] cachedHash = this.globalMacrosTimestamps.get(macroName); - if(cachedHash == null || fileHash != cachedHash) { + if (cachedHash == null || fileHash != cachedHash) { List tokens = new ArrayList<>(); Configuration config = Configuration.load(file); - for(String key : config.getKeys()) { + for (String key : config.getKeys()) { ConfigurationSection section = config.getConfigurationSection(key); MacroToken token = new MacroToken(section); tokens.add(token); @@ -266,15 +266,15 @@ private void loadGlobalMacros() { Collection macroFiles = FileUtils.listFiles(macroFolder, new String[]{"yml", "json", "conf", "xml"}, true); - for(File file : macroFiles) { + for (File file : macroFiles) { this.loadGlobalMacroFromFile(file); } Iterator>> it = this.cachedGlobalMacros.entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry> next = it.next(); String macroName = next.getKey(); - if(!this.globalMacros.containsKey(macroName)) { + if (!this.globalMacros.containsKey(macroName)) { it.remove(); this.globalMacrosTimestamps.remove(macroName); } @@ -297,9 +297,9 @@ private void loadGuiFromFile(Configuration yaml, File file) { byte[] cachedHash = this.guiHashes.get(guiName); GuiToken token = this.cachedTokens.get(guiName); byte[] guiHash = HashUtil.getMD5(file); - if(token != null && cachedHash != null && cachedHash == guiHash && !hasUpdatedMacro(token)) { + if (token != null && cachedHash != null && cachedHash == guiHash && !hasUpdatedMacro(token)) { Gui cachedGui = this.cachedGuis.get(guiName); - for(String alias : token.getAlias()) { + for (String alias : token.getAlias()) { plugin.createCommand(guiName, alias); } @@ -309,7 +309,7 @@ private void loadGuiFromFile(Configuration yaml, File file) { this.guiHashes.put(guiName, guiHash); this.loadGuiFromConfiguration(guiName, yaml); } - } catch(NullPointerException ex) { + } catch (NullPointerException ex) { dynamicGui.getLogger().info("Error loading in file: " + file.getName()); ex.printStackTrace(); } @@ -322,8 +322,8 @@ private void loadFileGuis() { Collection ar = FileUtils.listFiles(guiFolder, new String[]{"yml", "json", "conf", "xml"}, true); - if(ar.size() != 0) { - for(File file : ar) { + if (ar.size() != 0) { + for (File file : ar) { Configuration config = Configuration.load(file); this.loadGuiFromFile(config, file); } @@ -334,8 +334,8 @@ private void loadFileGuis() { private boolean hasUpdatedMacro(GuiToken token) { List macros = token.getLoadMacros(); - for(String macro : macros) { - if(this.modifiedMacros.contains(macro)) { + for (String macro : macros) { + if (this.modifiedMacros.contains(macro)) { return true; } } @@ -349,7 +349,7 @@ private void loadRemoteGui(String guiName, String strUrl) { File file = new File(DynamicGui.get().getPlugin().getGuiFolder(), guiName); Configuration yaml = Configuration.load(url, file); this.loadGuiFromFile(yaml, file); - } catch(MalformedURLException e) { + } catch (MalformedURLException e) { e.printStackTrace(); DynamicGui.get().getLogger().error("An error occured when loading from the url " + strUrl + " please ensure you have the correct url."); } @@ -359,9 +359,9 @@ private void loadRemoteGuis() { File configFile = new File(DynamicGui.get().getPlugin().getDataFolder(), "config.yml"); Configuration config = Configuration.load(configFile); - if(config.get("remote-guis") != null) { + if (config.get("remote-guis") != null) { ConfigurationSection remote = config.getConfigurationSection("remote-guis"); - for(String key : remote.getKeys()) { + for (String key : remote.getKeys()) { ConfigurationSection guiSection = remote.getConfigurationSection(key); String strURL = guiSection.getString("url"); String guiName = guiSection.getString("file-name"); @@ -372,10 +372,10 @@ private void loadRemoteGuis() { private void cleanupGuis() { Iterator> it = this.cachedGuis.entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); String guiName = next.getKey(); - if(!this.guis.containsKey(guiName)) { + if (!this.guis.containsKey(guiName)) { it.remove(); this.guiHashes.remove(guiName); this.cachedTokens.remove(guiName); @@ -390,11 +390,11 @@ private void loadGuiFromConfiguration(String guiName, Configuration config) { List guiTokens = new ArrayList<>(); List loadMacros = guiToken.getLoadMacros(); - if(loadMacros.size() > 0) { - for(String macro : loadMacros) { + if (loadMacros.size() > 0) { + for (String macro : loadMacros) { List macroTokens = this.globalMacros.get(macro); - if(macroTokens != null) { - for(MacroToken t : macroTokens) { + if (macroTokens != null) { + for (MacroToken t : macroTokens) { guiTokens.add(t); } } else { @@ -416,7 +416,7 @@ private void loadGuiFromConfiguration(String guiName, Configuration config) { private List createSlots(GuiToken guiToken) { List slots = new ArrayList<>(); Iterator> it = guiToken.getSlots().entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry next = it.next(); int index = next.getKey(); SlotToken slotToken = next.getValue(); @@ -424,20 +424,20 @@ private List createSlots(GuiToken guiToken) { String icon = MaterialManager.get().normalizeMaterial(slotToken.getIcon()); String name = slotToken.getName(); - if(name != null) { + if (name != null) { name = ChatColor.translateAlternateColorCodes('&', name); } String nbt = slotToken.getNbt(); List lore = new ArrayList<>(); - for(String ls : slotToken.getLore()) { + for (String ls : slotToken.getLore()) { lore.add(ChatColor.translateAlternateColorCodes('&', ls)); } List enchants = new ArrayList<>(); - for(String ench : slotToken.getEnchants()) { + for (String ench : slotToken.getEnchants()) { String[] args = ench.split(","); enchants.add(new EnchantmentWrapper(args[0], Integer.parseInt(args[1]))); } @@ -474,14 +474,14 @@ private Gui createGui(final GuiToken guiToken, final String guiName, final List< int rows = guiToken.getRows(); List aliases = guiToken.getAlias(); - for(String alias : aliases) { + for (String alias : aliases) { plugin.createCommand(guiName, alias); } boolean close = guiToken.isClosed(); List> locations = new ArrayList<>(); - for(String location : guiToken.getLocations()) { + for (String location : guiToken.getLocations()) { locations.add(LocationManager.get().toLocationWrapper(location)); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java index d41b67fe1..065f266e0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java @@ -31,7 +31,7 @@ public class MiniMessageManager { public static MiniMessageManager instance; public static MiniMessageManager get() { - if(instance == null) { + if (instance == null) { instance = new MiniMessageManager(); } return instance; @@ -47,7 +47,7 @@ private MiniMessageManager() { public String toJson(String data) { String cached = this.json.get(data); - if(cached == null) { + if (cached == null) { Component component = this.miniMessage.deserialize(data); cached = this.serializer.serialize(component); this.json.put(data, cached); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java index 35c11af94..eff591c22 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java @@ -27,7 +27,7 @@ public class ModelManager { private static ModelManager instance; public static ModelManager get() { - if(instance == null) { + if (instance == null) { instance = new ModelManager(); } return instance; @@ -40,7 +40,7 @@ private ModelManager() { } public ModelProvider getProvider(final String registryName) { - if(registryName == null) { + if (registryName == null) { return null; } String lowerName = registryName.toLowerCase(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java index e64ba924f..d4456ac30 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java @@ -32,7 +32,7 @@ private ReplacerManager() { } public static ReplacerManager get() { - if(instance == null) { + if (instance == null) { instance = new ReplacerManager(); } return instance; @@ -40,7 +40,7 @@ public static ReplacerManager get() { public String replace(String text, PlayerWrapper playerWrapper) { String newText = text; - for(ReplacerRegistry registry : this.registries) { + for (ReplacerRegistry registry : this.registries) { newText = registry.replace(playerWrapper, newText); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java index f6c506e69..d39109d60 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java @@ -35,7 +35,7 @@ public class SlotManager { private static SlotManager instance; public static SlotManager get() { - if(instance == null) { + if (instance == null) { instance = new SlotManager(); } return instance; @@ -48,26 +48,26 @@ private SlotManager() { private void updateSlots() { DynamicGui.get().getPlatform().getScheduler().scheduleSyncRepeatingTask(() -> { Map> updatedStaticGui = new HashMap<>(); - for(Entry next : GuiManager.get().getPlayerGuis().entrySet()) { + for (Entry next : GuiManager.get().getPlayerGuis().entrySet()) { UUID key = next.getKey(); PlayerWrapper playerWrapper = DynamicGui.get().getPlatform().getPlayer(key); Gui gui = next.getValue(); Collection cachedSlots = updatedStaticGui.get(gui); - if(gui.isStatic() && cachedSlots != null) { + if (gui.isStatic() && cachedSlots != null) { InventoryWrapper inventoryWrapper = gui.getInventoryWrapper(); - for(Slot slot : cachedSlots) { + for (Slot slot : cachedSlots) { inventoryWrapper.updateItem(slot.getIndex(), playerWrapper); } continue; } Collection updatedSlots = new ArrayList<>(); - for(Slot slot : gui.getSlots()) { - if(slot.getUpdateInterval() == 0 && !slot.getUpdate()) { + for (Slot slot : gui.getSlots()) { + if (slot.getUpdateInterval() == 0 && !slot.getUpdate()) { continue; } slot.tick(); - if(slot.getUpdate() || (slot.getCurrentTick() % slot.getUpdateInterval() == 0)) { + if (slot.getUpdate() || (slot.getCurrentTick() % slot.getUpdateInterval() == 0)) { ItemStackWrapper itemStackWrapper = slot.buildItemStack(playerWrapper); int slotIndex = slot.getIndex(); @@ -75,14 +75,14 @@ private void updateSlots() { inventoryWrapper.setItem(slotIndex, itemStackWrapper); FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper); - if(!slot.getItemStack().getType().equalsIgnoreCase(Slot.IGNORE_MATERIAL)) { + if (!slot.getItemStack().getType().equalsIgnoreCase(Slot.IGNORE_MATERIAL)) { inventoryWrapper.updateItem(slotIndex, playerWrapper); updatedSlots.add(slot); } slot.setUpdate(false); } } - if(gui.isStatic()) { //Cache if gui is static an attempt to update was made + if (gui.isStatic()) { //Cache if gui is static an attempt to update was made updatedStaticGui.put(gui, updatedSlots); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java index f953881a9..6eae56e8e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java @@ -23,7 +23,6 @@ import java.io.File; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -38,7 +37,7 @@ public class CooldownManager { private static CooldownManager instance; public static CooldownManager get() { - if(instance == null) { + if (instance == null) { instance = new CooldownManager(); } @@ -59,23 +58,23 @@ private Configuration loadConfig() { File dataFolder = DynamicGui.get().getPlugin().getDataFolder(); File cooldownsFile = new File(dataFolder, "cooldowns.yml"); Configuration config = Configuration.load(cooldownsFile); - for(String uuidStr : config.getKeys()) { + for (String uuidStr : config.getKeys()) { ConfigurationSection section = config.getConfigurationSection(uuidStr); Map cooldownMap = new ConcurrentHashMap<>(); - for(String cooldownName : section.getKeys()) { + for (String cooldownName : section.getKeys()) { long time = section.getLong(cooldownName + ".time"); long cooldown = section.getLong(cooldownName + ".cooldown"); Cooldown cooldownObj = new Cooldown(cooldownName, time, cooldown); - if(this.getRemainingCooldown(cooldownObj) != -1L) { + if (this.getRemainingCooldown(cooldownObj) != -1L) { cooldownMap.put(cooldownName, cooldownObj); } else { section.set(cooldownName, null); } } - if(section.isEmpty()) { + if (section.isEmpty()) { config.set(uuidStr, null); } - if(cooldownMap.size() > 0) { + if (cooldownMap.size() > 0) { UUID uuid = UUID.fromString(uuidStr); this.cooldowns.put(uuid, cooldownMap); } @@ -90,12 +89,12 @@ public long getRemainingCooldown(PlayerWrapper playerWrapper, String name) { public long getRemainingCooldown(UUID uuid, String name) { Map cooldownMap = this.cooldowns.get(uuid); - if(cooldownMap == null) { + if (cooldownMap == null) { return -1L; } Cooldown cooldown = cooldownMap.get(name); - if(cooldown == null) { + if (cooldown == null) { return -1L; } @@ -107,7 +106,7 @@ public long getRemainingCooldown(Cooldown cooldown) { long cooldownTime = cooldown.getTime(); long cooldownAmount = cooldown.getCooldown(); - if((currentTime - cooldownTime) >= cooldownAmount) { + if ((currentTime - cooldownTime) >= cooldownAmount) { return -1L; } else { return cooldownAmount - (currentTime - cooldownTime); @@ -129,7 +128,7 @@ public List getCooldowns(PlayerWrapper playerWrapper) { public List getCooldowns(UUID uuid) { Map cooldowns = this.cooldowns.get(uuid); - if(cooldowns == null) { + if (cooldowns == null) { return Collections.emptyList(); } return new ArrayList<>(cooldowns.values()); @@ -142,11 +141,11 @@ public Cooldown createCooldown(PlayerWrapper playerWrapper, String name, long public Cooldown createCooldown(UUID uuid, String name, long cooldownTime) { long cooldownRemaining = this.getRemainingCooldown(uuid, name); - if(cooldownRemaining == -1L) { + if (cooldownRemaining == -1L) { long currentTime = System.currentTimeMillis(); Cooldown cooldown = new Cooldown(name, currentTime, cooldownTime); Map cooldownMap = this.cooldowns.get(uuid); - if(cooldownMap == null) { + if (cooldownMap == null) { cooldownMap = new ConcurrentHashMap<>(); this.cooldowns.put(uuid, cooldownMap); } @@ -163,12 +162,12 @@ public boolean removeCooldown(PlayerWrapper playerWrapper, String name) { public boolean removeCooldown(UUID uuid, String name) { Map cooldownMap = this.cooldowns.get(uuid); - if(cooldownMap == null) { + if (cooldownMap == null) { return false; } boolean removed = cooldownMap.remove(name) != null; - if(removed) { + if (removed) { this.updateConfig.set(true); } return removed; @@ -180,7 +179,7 @@ public void shutdown() { private void updateAndSaveConfig() { Iterator>> it = this.cooldowns.entrySet().iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Entry> next = it.next(); UUID uuid = next.getKey(); String uuidStr = uuid.toString(); @@ -200,25 +199,25 @@ private void updateAndSaveConfig() { private void updateCache() { Iterator>> it = this.cooldowns.entrySet().iterator(); boolean modified = false; - while(it.hasNext()) { + while (it.hasNext()) { Entry> next = it.next(); UUID uuid = next.getKey(); String uuidStr = uuid.toString(); Map cooldownMap = next.getValue(); Iterator> cooldownIt = cooldownMap.entrySet().iterator(); - while(cooldownIt.hasNext()) { + while (cooldownIt.hasNext()) { Entry cooldownNext = cooldownIt.next(); String cooldownName = cooldownNext.getKey(); Cooldown cooldown = cooldownNext.getValue(); long cooldownRemaining = this.getRemainingCooldown(cooldown); - if(cooldownRemaining == -1L) { + if (cooldownRemaining == -1L) { cooldownIt.remove(); this.cooldownConfig.set(uuidStr + "." + cooldownName, null); modified = true; } } } - if(modified) { + if (modified) { this.updateConfig.set(true); } } @@ -235,7 +234,7 @@ private void scheduleConfigUpdate() { DynamicGui dynamicGui = DynamicGui.get(); Platform server = dynamicGui.getPlatform(); server.getScheduler().scheduleAsyncRepeatingTask(() -> { - if(this.updateConfig.get()) { + if (this.updateConfig.get()) { this.updateConfig.set(false); this.updateAndSaveConfig(); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java index 7aaad0cfc..faca51800 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java @@ -24,9 +24,9 @@ public enum Proxy { NONE; public static Proxy fromString(String proxyStr) { - if(proxyStr.toLowerCase(Locale.ROOT).startsWith("bungee")) { + if (proxyStr.toLowerCase(Locale.ROOT).startsWith("bungee")) { return Proxy.BUNGEECORD; - } else if(proxyStr.toLowerCase(Locale.ROOT).startsWith("redis")) { + } else if (proxyStr.toLowerCase(Locale.ROOT).startsWith("redis")) { return Proxy.REDIS_BUNGEE; } return Proxy.NONE; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java index 331aef963..ecb265d9d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java @@ -29,7 +29,7 @@ public String name() { @Override public boolean applyModel(ItemStackWrapper itemStack, String data) { - if(!NumberUtils.isParsable(data)) { + if (!NumberUtils.isParsable(data)) { return false; } int modelData = NumberUtils.toInt(data); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java index 58765e3f2..82452f95a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.registry.replacer; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; public interface AnimationReplacerRegistry { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java index 06518818c..05ccf8af6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java @@ -29,7 +29,7 @@ public class CooldownReplacerRegistry implements ReplacerRegistry { private static CooldownReplacerRegistry instance; public static CooldownReplacerRegistry get() { - if(instance == null) { + if (instance == null) { instance = new CooldownReplacerRegistry(); } @@ -43,32 +43,32 @@ public String replace(PlayerWrapper playerWrapper, String text) { UUID uuid = playerWrapper.getUniqueId(); Collection cooldowns = CooldownManager.get().getCooldowns(uuid); - if(cooldowns == null) { + if (cooldowns == null) { return text; } - for(Cooldown cooldown : cooldowns) { + for (Cooldown cooldown : cooldowns) { String cooldownName = cooldown.getName(); String cooldownReplacer = COOLDOWN_PREFIX + cooldownName; - if(text.contains(cooldownReplacer)) { + if (text.contains(cooldownReplacer)) { long seconds = CooldownManager.get().getRemainingCooldown(playerWrapper, cooldownName) / 1000; String hoursReplacer = COOLDOWN_PREFIX + cooldownName + "_hours%"; - if(text.contains(hoursReplacer)) { + if (text.contains(hoursReplacer)) { long hours = seconds / 3600; text = StringUtils.replace(text, hoursReplacer, String.valueOf(hours)); seconds -= hours * 3600; } String minutesReplacer = COOLDOWN_PREFIX + cooldownName + "_minutes%"; - if(text.contains(minutesReplacer)) { + if (text.contains(minutesReplacer)) { long minutes = seconds / 60; text = StringUtils.replace(text, minutesReplacer, String.valueOf(minutes)); seconds -= minutes * 60; } String secondsReplacer = COOLDOWN_PREFIX + cooldownName + "_seconds%"; - if(text.contains(secondsReplacer)) { + if (text.contains(secondsReplacer)) { text = StringUtils.replace(text, secondsReplacer, String.valueOf(seconds)); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java index c9569ea13..13facd809 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.registry.replacer.impl; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.registry.replacer.AnimationReplacerRegistry; import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; import com.clubobsidian.dynamicgui.core.replacer.animation.impl.MultiLineTestAnimationReplacer; @@ -39,7 +39,7 @@ private DynamicGuiAnimationReplacerRegistry() { } public static DynamicGuiAnimationReplacerRegistry get() { - if(instance == null) { + if (instance == null) { instance = new DynamicGuiAnimationReplacerRegistry(); } return instance; @@ -51,8 +51,8 @@ public boolean addReplacer(AnimationReplacer replacer) { @Override public String replace(AnimationHolder holder, PlayerWrapper playerWrapper, String text) { - for(AnimationReplacer replacer : this.replacers.values()) { - if(text.contains(replacer.getToReplace())) { + for (AnimationReplacer replacer : this.replacers.values()) { + if (text.contains(replacer.getToReplace())) { text = StringUtils.replace(text, replacer.getToReplace(), replacer.replacement(playerWrapper, holder, text)); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java index bf7473ecc..cb59bdeed 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -57,14 +57,14 @@ private DynamicGuiReplacerRegistry() { public String replace(final PlayerWrapper playerWrapper, final String text) { String newText = text; List cachedReplacerList = this.cachedReplacers.get(text); - if(cachedReplacerList != null) { - for(Replacer replacer : cachedReplacerList) { + if (cachedReplacerList != null) { + for (Replacer replacer : cachedReplacerList) { newText = StringUtils.replace(newText, replacer.getToReplace(), replacer.replacement(newText, playerWrapper)); } } else { cachedReplacerList = new ArrayList<>(); - for(Replacer replacer : this.replacers.values()) { - if(newText.contains(replacer.getToReplace())) { + for (Replacer replacer : this.replacers.values()) { + if (newText.contains(replacer.getToReplace())) { newText = StringUtils.replace(newText, replacer.getToReplace(), replacer.replacement(newText, playerWrapper)); cachedReplacerList.add(replacer); } @@ -78,7 +78,7 @@ public String replace(final PlayerWrapper playerWrapper, final String text) { } public static DynamicGuiReplacerRegistry get() { - if(instance == null) { + if (instance == null) { instance = new DynamicGuiReplacerRegistry(); } return instance; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java index 8d8fdffb4..1745c94ae 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java @@ -36,7 +36,7 @@ public class MetadataReplacerRegistry implements ReplacerRegistry { private static MetadataReplacerRegistry instance; public static MetadataReplacerRegistry get() { - if(instance == null) { + if (instance == null) { instance = new MetadataReplacerRegistry(); } @@ -55,15 +55,15 @@ private MetadataReplacerRegistry() { @Override public String replace(PlayerWrapper playerWrapper, String text) { Gui gui = this.cachedGuis.get(playerWrapper.getUniqueId()); - if(gui == null) { + if (gui == null) { return text; } - for(Map.Entry entry : gui.getMetadata().entrySet()) { + for (Map.Entry entry : gui.getMetadata().entrySet()) { String metadataKey = entry.getKey(); String metadataValue = entry.getValue(); String metadataReplacer = METADATA_PREFIX + metadataKey + "%"; - if(text.contains(metadataReplacer)) { + if (text.contains(metadataReplacer)) { text = StringUtils.replace(text, metadataReplacer, metadataValue); } } @@ -80,7 +80,7 @@ public void onGuiLoad(GuiPreloadEvent event) { @EventHandler(priority = EventPriority.HIGHEST) public void onGuiLoad(GuiLoadEvent event) { - if(event.isCancelled()) { + if (event.isCancelled()) { UUID uuid = event.getPlayerWrapper().getUniqueId(); this.cachedGuis.remove(uuid); } @@ -91,7 +91,7 @@ public void onInventoryClose(InventoryCloseEvent event) { PlayerWrapper wrapper = event.getPlayerWrapper(); UUID uuid = wrapper.getUniqueId(); Gui gui = this.cachedGuis.get(uuid); - if(gui != null && gui.equals(GuiManager.get().getPlayerGui(wrapper))) { + if (gui != null && gui.equals(GuiManager.get().getPlayerGui(wrapper))) { this.cachedGuis.remove(uuid); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java index 955c9df1d..5ece33e6f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.replacer; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; public abstract class AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java index 8137efcd2..2a6642a53 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.replacer.animation.impl; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; public class MultiLineTestAnimationReplacer extends AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java index c88ab1c51..a93c8d80a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java @@ -15,8 +15,8 @@ */ package com.clubobsidian.dynamicgui.core.replacer.animation.impl; -import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.property.animation.AnimationHolder; import com.clubobsidian.dynamicgui.core.replacer.AnimationReplacer; public class TestAnimationReplacer extends AnimationReplacer { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java index b9d66ab41..7aec1aea2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java @@ -43,12 +43,12 @@ public PreviousGuiReplacer(String toReplace) { public String replacement(String text, PlayerWrapper playerWrapper) { Gui gui = this.cachedGuis.get(playerWrapper.getUniqueId()); System.out.println("gui: " + gui); - if(gui == null) { + if (gui == null) { return null; } Gui prev = gui.getBack(); System.out.println("prev: " + prev); - if(prev == null) { + if (prev == null) { return null; } return prev.getName(); @@ -63,7 +63,7 @@ public void onGuiLoad(GuiPreloadEvent event) { @EventHandler(priority = EventPriority.HIGHEST) public void onGuiLoad(GuiLoadEvent event) { - if(event.isCancelled()) { + if (event.isCancelled()) { UUID uuid = event.getPlayerWrapper().getUniqueId(); this.cachedGuis.remove(uuid); } @@ -74,7 +74,7 @@ public void onInventoryClose(InventoryCloseEvent event) { PlayerWrapper wrapper = event.getPlayerWrapper(); UUID uuid = wrapper.getUniqueId(); Gui gui = this.cachedGuis.get(uuid); - if(gui != null && gui.equals(GuiManager.get().getPlayerGui(wrapper))) { + if (gui != null && gui.equals(GuiManager.get().getPlayerGui(wrapper))) { this.cachedGuis.remove(uuid); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java index 55af588db..fabd483d3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java @@ -95,11 +95,11 @@ public Color getJavaColor() { public static String translateAlternateColorCodes(char translate, String message) { char[] chars = message.toCharArray(); - for(int i = 0; i < chars.length; i++) { - if(chars[i] == translate) { - if(i + 1 < chars.length) { - for(ChatColor color : ChatColor.values()) { - if(chars[i + 1] == color.getColorCode()) { + for (int i = 0; i < chars.length; i++) { + if (chars[i] == translate) { + if (i + 1 < chars.length) { + for (ChatColor color : ChatColor.values()) { + if (chars[i + 1] == color.getColorCode()) { chars[i] = ChatColor.FORMATTING_CODE; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java index 6483ae34b..4772dfa34 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java @@ -38,7 +38,7 @@ private static byte[] getHash(String hash, File file) { try { byte[] fileBytes = Files.readAllBytes(file.toPath()); return getHash(hash, fileBytes); - } catch(IOException e) { + } catch (IOException e) { e.printStackTrace(); } return new byte[0]; @@ -50,7 +50,7 @@ private static byte[] getHash(String hash, byte[] data) { md.reset(); md.update(data); return md.digest(); - } catch(NoSuchAlgorithmException e) { + } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return new byte[0]; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index a6ec315b6..53dce7674 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -26,7 +26,7 @@ private ReflectionUtil() { public static Class classForName(String name) { try { return Class.forName(name); - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; @@ -37,7 +37,7 @@ public static Method getMethod(Class cl, String methodName) { Method method = cl.getDeclaredMethod(methodName); method.setAccessible(true); return method; - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } return null; @@ -48,15 +48,15 @@ public static Method getMethod(Class cl, String methodName, Class... param Method method = cl.getDeclaredMethod(methodName, params); method.setAccessible(true); return method; - } catch(NoSuchMethodException | SecurityException e) { + } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } return null; } public static Method getMethodByReturnType(Class searchIn, Class returnType) { - for(Method m : searchIn.getDeclaredMethods()) { - if(m.getReturnType().equals(returnType)) { + for (Method m : searchIn.getDeclaredMethods()) { + if (m.getReturnType().equals(returnType)) { m.setAccessible(true); return m; } @@ -69,14 +69,14 @@ public static Field getFieldByName(Class searchIn, String name) { Field f = searchIn.getDeclaredField(name); f.setAccessible(true); return f; - } catch(NoSuchFieldException | SecurityException e) { + } catch (NoSuchFieldException | SecurityException e) { return null; } } public static Field getFieldByType(Class searchIn, Class fieldType) { - for(Field f : searchIn.getDeclaredFields()) { - if(f.getType().equals(fieldType)) { + for (Field f : searchIn.getDeclaredFields()) { + if (f.getType().equals(fieldType)) { f.setAccessible(true); return f; } @@ -85,12 +85,12 @@ public static Field getFieldByType(Class searchIn, Class fieldType) { } public static Field getDeclaredField(Class clazz, String... fields) { - for(String fieldName : fields) { + for (String fieldName : fields) { try { Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); return field; - } catch(NoSuchFieldException e) { + } catch (NoSuchFieldException e) { } } return null; @@ -106,7 +106,7 @@ public T get(Field field) { public T get(Field field, Object getFromClass) { try { return (T) field.get(getFromClass); - } catch(IllegalArgumentException | IllegalAccessException e) { + } catch (IllegalArgumentException | IllegalAccessException e) { return null; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java index 37e45e53f..5950327e5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java @@ -1,18 +1,18 @@ package com.clubobsidian.dynamicgui.core.util; import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; public final class ThreadUtil { public static void run(Runnable runnable, boolean async) { Platform server = DynamicGui.get().getPlatform(); Scheduler scheduler = server.getScheduler(); - if(async) { + if (async) { scheduler.runAsynchronousDelayedTask(runnable, 0); } else { - if(!server.isMainThread()) { + if (!server.isMainThread()) { scheduler.runSyncDelayedTask(runnable, 0); } else { runnable.run(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java index 650a5e532..5ffbc3856 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java @@ -60,17 +60,17 @@ public String toString() { @Override public boolean equals(Object obj) { - if(obj == null) + if (obj == null) return false; - if(!(obj instanceof LocationWrapper)) + if (!(obj instanceof LocationWrapper)) return false; LocationWrapper other = (LocationWrapper) obj; - if(other.getX() != this.getX()) + if (other.getX() != this.getX()) return false; - if(other.getY() != this.getY()) + if (other.getY() != this.getY()) return false; - if(other.getZ() != this.getZ()) + if (other.getZ() != this.getZ()) return false; return other.getWorld().equals(this.world); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java index 75b09acc7..65c572e93 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java @@ -51,17 +51,17 @@ public int hashCode() { @Override @SuppressWarnings("unchecked") public boolean equals(Object obj) { - if(this == obj) { + if (this == obj) { return true; - } else if(obj == null) { + } else if (obj == null) { return false; - } else if(getClass() != obj.getClass()) { + } else if (getClass() != obj.getClass()) { return false; } WorldWrapper otherWrapper = (WorldWrapper) obj; T world = this.getWorld(); - if(world == null) { + if (world == null) { return false; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index 49d3770d0..e2fee4a1e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -54,14 +54,14 @@ public void testInterrupt() { thread.start(); thread.interrupt(); int count = 0; - while(thread.isAlive()) { + while (thread.isAlive()) { try { Thread.sleep(1); count += 1; - if(count > 1000) { + if (count > 1000) { break; //Just so the test doesn't get stuck in an infinite loop } - } catch(InterruptedException e) { + } catch (InterruptedException e) { e.printStackTrace(); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java index ec9f41b2d..3c1458528 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java @@ -71,7 +71,7 @@ private boolean setProxy(Proxy proxy) { proxyField.setAccessible(true); proxyField.set(DynamicGui.get(), proxy); return true; - } catch(NoSuchFieldException | IllegalAccessException e) { + } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); return false; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java index 83ae3d8d7..24c69fa76 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java @@ -43,7 +43,7 @@ public void dataTest() { this.factory.inject(); String data = "&4test"; String colorized = ChatColor.translateAlternateColorCodes(data); - Function function= new ServerBroadcastFunction(); + Function function = new ServerBroadcastFunction(); function.setData(data); assertTrue(function.function(this.factory.createPlayer())); List messages = this.factory.getPlatform().getBroadcastMessages(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java index 4299740a8..bb20355dc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java @@ -22,7 +22,6 @@ import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import org.junit.jupiter.api.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java index 2e81c2ab8..d9c3e352c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java @@ -19,12 +19,9 @@ import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SoundFunction; -import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 448ae9aef..99fd0b28a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -25,8 +25,8 @@ import com.clubobsidian.dynamicgui.core.gui.ModeEnum; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; -import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.inject.MockPluginModule; @@ -182,7 +182,7 @@ public MockFactory inject() { public MockPlatform getPlatform() { Platform platform = DynamicGui.get().getPlatform(); - if(!(platform instanceof MockPlatform)) { + if (!(platform instanceof MockPlatform)) { return null; } return (MockPlatform) platform; @@ -190,7 +190,7 @@ public MockPlatform getPlatform() { public MockLoggerWrapper getLogger() { LoggerWrapper logger = DynamicGui.get().getLogger(); - if(!(logger instanceof MockLoggerWrapper)) { + if (!(logger instanceof MockLoggerWrapper)) { return null; } return (MockLoggerWrapper) logger; @@ -199,7 +199,7 @@ public MockLoggerWrapper getLogger() { public MockEconomy getEconomy() { Economy economy = DynamicGui.get().getPlugin().getEconomy(); ; - if(!(economy instanceof MockEconomy)) { + if (!(economy instanceof MockEconomy)) { return null; } return (MockEconomy) economy; @@ -207,7 +207,7 @@ public MockEconomy getEconomy() { public MockDynamicGuiPlugin getPlugin() { DynamicGuiPlugin plugin = DynamicGui.get().getPlugin(); - if(!(plugin instanceof MockDynamicGuiPlugin)) { + if (!(plugin instanceof MockDynamicGuiPlugin)) { return null; } return (MockDynamicGuiPlugin) plugin; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java index 857e9edd5..cf33137ef 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java @@ -23,8 +23,8 @@ import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; -import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockEntityManager; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockInventoryManager; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockItemStackManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java index c63edbb91..14305ccd7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java @@ -36,7 +36,7 @@ public MockInventory(int size) { public ItemStackWrapper[] getContents() { ItemStackWrapper[] ar = new ItemStackWrapper[this.size]; - for(int i = 0; i < this.size; i++) { + for (int i = 0; i < this.size; i++) { ar[i] = this.getItem(i); } return ar; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java index 98c7a4b3f..50399eab1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java @@ -40,7 +40,7 @@ public BigDecimal getBalance(PlayerWrapper playerWrapper) { @Override public boolean withdraw(PlayerWrapper playerWrapper, BigDecimal amt) { BigDecimal balance = this.getBalance(playerWrapper); - if(balance.intValue() >= amt.intValue()) { + if (balance.intValue() >= amt.intValue()) { balance = balance.subtract(amt); this.balances.put(playerWrapper, balance); return true; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index d6a6191ac..75bc9655f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -18,10 +18,10 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.messaging.MessagingRunnable; -import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.platform.PlatformType; +import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import java.util.ArrayList; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java index 7864f412c..27d77a8c1 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java @@ -31,9 +31,9 @@ public String getModifier() { } public static FunctionModifier findModifier(String functionData) { - for(FunctionModifier modifier : FunctionModifier.values()) { - if(modifier != FunctionModifier.NONE) { - if(functionData.startsWith(modifier.getModifier())) { + for (FunctionModifier modifier : FunctionModifier.values()) { + if (modifier != FunctionModifier.NONE) { + if (functionData.startsWith(modifier.getModifier())) { return modifier; } } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java index 936e6c65e..0d431186e 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java @@ -47,7 +47,7 @@ public boolean isClick() { private final static Map normalizedFunctions = new HashMap<>(); static { - for(FunctionType type : FunctionType.values()) { + for (FunctionType type : FunctionType.values()) { String normalized = StringFuzz.normalize(type.toString()); normalizedFunctions.put(normalized, type); } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java index b85af5985..90030d300 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java @@ -37,9 +37,9 @@ public FunctionTypeParser(MacroParser macroParser) { public List parseTypes(List types) { types = this.macroParser.parseListMacros(types); List typesList = new ArrayList<>(); - for(String type : types) { + for (String type : types) { FunctionType parsedType = this.parseType(type); - if(parsedType == null) + if (parsedType == null) continue; //TODO - warn typesList.add(parsedType); diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java index 4015c6dda..2965066d0 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java @@ -73,7 +73,7 @@ private void parseNodes(ConfigurationSection section) { private String[] parseFunctionData(String functionData) { String[] args = new String[3]; - if(!functionData.contains(":")) { + if (!functionData.contains(":")) { args[0] = StringFuzz.normalize(functionData); FunctionModifier modifier = FunctionModifier.findModifier(args[0]); args[0] = functionData.replaceFirst(modifier.getModifier(), ""); @@ -86,8 +86,8 @@ private String[] parseFunctionData(String functionData) { StringBuilder dat = new StringBuilder(); dat.append(split[1].trim()); - if(split.length > 2) { - for(int i = 2; i < split.length; i++) { + if (split.length > 2) { + for (int i = 2; i < split.length; i++) { dat.append(":"); dat.append(split[i]); } @@ -105,7 +105,7 @@ private List parseFunctionData(final List tokens) { List parsedTokens = this.macroParser.parseListMacros(tokens); List functionTokens = new ArrayList<>(); - for(String token : parsedTokens) { + for (String token : parsedTokens) { String[] parsedFunctionData = this.parseFunctionData(token); String functionName = parsedFunctionData[0]; @@ -119,9 +119,9 @@ private List parseFunctionData(final List tokens) { } private void walkTree(int depth, ConfigurationSection section, FunctionNode parentNode) { - for(String name : section.getKeys()) { + for (String name : section.getKeys()) { ConfigurationSection rootSection = section.getConfigurationSection(name); - if(rootSection.get("functions") == null) { + if (rootSection.get("functions") == null) { continue; } @@ -132,7 +132,7 @@ private void walkTree(int depth, ConfigurationSection section, FunctionNode pare FunctionToken data = new FunctionToken(name, types, functionTokens, failFunctions); FunctionNode childNode = new FunctionNode(depth, data); - if(depth == 0) { + if (depth == 0) { this.rootNodes.add(childNode); } else { parentNode.addChild(childNode); diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java index baf8f2127..4095465e3 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java @@ -84,14 +84,14 @@ public GuiToken(ConfigurationSection section, List macroTokens) { } public String parseType(String type) { - if(type == null) { + if (type == null) { return "CHEST"; } return type.toUpperCase(); } private GuiMode parseMode(String mode) { - if(mode == null) { + if (mode == null) { return GuiMode.SET; } @@ -101,7 +101,7 @@ private GuiMode parseMode(String mode) { private Map> loadNpcs(ConfigurationSection section) { Map> npcs = new HashMap<>(); ConfigurationSection npcSection = section.getConfigurationSection("npcs"); - for(String key : npcSection.getKeys()) { + for (String key : npcSection.getKeys()) { List npcIds = npcSection.getIntegerList(key); npcs.put(key, npcIds); } @@ -110,7 +110,7 @@ private Map> loadNpcs(ConfigurationSection section) { private Map parseMetadata(ConfigurationSection section) { Map metadata = new HashMap<>(); - for(String key : section.getKeys()) { + for (String key : section.getKeys()) { String parsedKey = this.macroParser.parseStringMacros(key); String value = section.getString(parsedKey); value = this.macroParser.parseStringMacros(value); @@ -123,9 +123,9 @@ private Map parseMetadata(ConfigurationSection section) { private Map loadSlots(ConfigurationSection section) { Map slots = new LinkedHashMap<>(); int slotAmt = this.rows * 9; - for(int i = 0; i < slotAmt; i++) { + for (int i = 0; i < slotAmt; i++) { ConfigurationSection slotSection = section.getConfigurationSection(String.valueOf(i)); - if(!slotSection.isEmpty()) { + if (!slotSection.isEmpty()) { SlotToken token = new SlotToken(i, slotSection, this.macroParser.getTokens()); slots.put(i, token); } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java index c75fe6d50..ce07d4441 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java @@ -41,26 +41,26 @@ public List getTokens() { } public String parseStringMacros(final String replaceIn) { - if(replaceIn == null) { + if (replaceIn == null) { return null; } String replace = replaceIn; - for(MacroToken token : this.tokens) { - for(Entry next : token.getMacros().entrySet()) { + for (MacroToken token : this.tokens) { + for (Entry next : token.getMacros().entrySet()) { String key = next.getKey(); Object value = next.getValue(); - if(replace.contains(key)) { + if (replace.contains(key)) { replace = StringUtils.replace(replace, key, value.toString()); } } } - for(MacroToken token : this.tokens) { - for(Entry entry : token.getMacros().entrySet()) { + for (MacroToken token : this.tokens) { + for (Entry entry : token.getMacros().entrySet()) { String key = entry.getKey(); - if(replace.contains(key)) { + if (replace.contains(key)) { return this.parseStringMacros(replace); } } @@ -74,15 +74,15 @@ public List parseListMacros(final List replaceIn) { List newList = new ArrayList<>(replaceIn); - for(MacroToken token : this.tokens) { - for(Entry next : token.getMacros().entrySet()) { + for (MacroToken token : this.tokens) { + for (Entry next : token.getMacros().entrySet()) { String key = next.getKey(); - for(int i = 0; i < newList.size(); i++) { + for (int i = 0; i < newList.size(); i++) { String line = newList.get(i); - if(line.contains(key)) { + if (line.contains(key)) { Object value = next.getValue(); - if(!(value instanceof List)) { + if (!(value instanceof List)) { String stringMacro = value.toString(); newList.remove(i); newList.add(i, StringUtils.replace(line, key, stringMacro)); @@ -104,16 +104,16 @@ public List parseListMacros(final List replaceIn) { String ending = line.substring(endIndex); String appended = ending; - if(listMacro.size() >= 2) { + if (listMacro.size() >= 2) { appended = listMacro.get(1) + ending; } - if(appended.length() > 0) { + if (appended.length() > 0) { i++; newList.add(i, appended); } - for(int j = 2; j < listMacro.size(); j++) { + for (int j = 2; j < listMacro.size(); j++) { i++; newList.add(i, listMacro.get(j)); } @@ -123,11 +123,11 @@ public List parseListMacros(final List replaceIn) { } } - for(MacroToken token : this.tokens) { - for(Entry entry : token.getMacros().entrySet()) { + for (MacroToken token : this.tokens) { + for (Entry entry : token.getMacros().entrySet()) { String key = entry.getKey(); - for(String line : newList) { - if(line.contains(key)) { + for (String line : newList) { + if (line.contains(key)) { return this.parseListMacros(newList); } } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java index 23b306d9d..5ce065918 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java @@ -36,7 +36,7 @@ public MacroToken(ConfigurationSection section) { private void parse(ConfigurationSection section) { this.macros = new LinkedHashMap<>(); - for(String key : section.getKeys()) { + for (String key : section.getKeys()) { this.macros.put(key, section.get(key)); } } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index d81f29a61..60eaad56d 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -89,7 +89,7 @@ public SlotToken(int index, ConfigurationSection section, List macro } private int parseAmount(int amount) { - if(amount == 0) { + if (amount == 0) { return 1; } return amount; @@ -99,18 +99,18 @@ private byte parseByte(String data) { String stringData = this.macroParser.parseStringMacros(data); try { return Byte.parseByte(stringData); - } catch(Exception ex) { + } catch (Exception ex) { return 0; } } private boolean parseBoolean(String data) { - if(data == null) { + if (data == null) { return false; } String parsed = this.macroParser.parseStringMacros(data); - if(data.equals("true")) { + if (data.equals("true")) { return Boolean.parseBoolean(parsed); } @@ -118,14 +118,14 @@ private boolean parseBoolean(String data) { } private int parseInteger(String data) { - if(data == null) { + if (data == null) { return 0; } try { String parsed = this.macroParser.parseStringMacros(data); return Integer.parseInt(parsed); - } catch(Exception ex) { + } catch (Exception ex) { return 0; } } @@ -137,7 +137,7 @@ private int parseUpdateInterval(String data) { private Map parseMetadata(ConfigurationSection section) { Map metadata = new HashMap<>(); - for(String key : section.getKeys()) { + for (String key : section.getKeys()) { String parsedKey = this.macroParser.parseStringMacros(key); String value = section.getString(parsedKey); value = this.macroParser.parseStringMacros(value); diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java index 454a7a8c2..f3a4c3a2b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java @@ -38,7 +38,7 @@ public void stringTest() { Configuration config = Configuration.load(sameFileMacroFile); List tokens = new ArrayList<>(); - for(String key : config.getKeys()) { + for (String key : config.getKeys()) { MacroToken token = new MacroToken(config.getConfigurationSection(key)); tokens.add(token); } @@ -59,7 +59,7 @@ public void listTest() { Configuration config = Configuration.load(sameFileMacroFile); List tokens = new ArrayList<>(); - for(String key : config.getKeys()) { + for (String key : config.getKeys()) { MacroToken token = new MacroToken(config.getConfigurationSection(key)); tokens.add(token); } From d35c0eee831347dde272a6e2d2d300e5827d0ddf Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Mar 2022 01:24:26 -0800 Subject: [PATCH 146/261] Start testing GuiManager --- .gitignore | 2 +- .../command/BukkitDynamicGuiCommand.java | 2 +- core/mock_data/guis/test.yml | 5 +++ .../dynamicgui/core/builder/GuiBuilder.java | 2 +- .../core/function/impl/gui/GuiFunction.java | 2 +- .../function/impl/gui/SetBackFunction.java | 2 +- .../core/manager/dynamicgui/GuiManager.java | 32 +++++++------- .../core/test/manager/GuiManagerTest.java | 42 +++++++++++++++++++ 8 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 core/mock_data/guis/test.yml create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java diff --git a/.gitignore b/.gitignore index 5687275df..865dc1b52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ #DynamicGui -mock_data/ +core/mock_data/cooldowns.yml # Compiled class file *.class diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index 5b74e6849..7ebb45292 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -84,7 +84,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St String third = args[2]; if (first.equalsIgnoreCase("close")) { if (second.equalsIgnoreCase("all")) { - Gui gui = GuiManager.get().getGuiByName(third); + Gui gui = GuiManager.get().getGui(third); if (gui == null) { sender.sendMessage("No gui can be found by that name"); return true; diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml new file mode 100644 index 000000000..f08d45de7 --- /dev/null +++ b/core/mock_data/guis/test.yml @@ -0,0 +1,5 @@ +title: "test" +rows: 5 + +0: + type: "STONE" \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index f81afbf7b..9d1c8928c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -126,7 +126,7 @@ public GuiBuilder setBack(Gui backGui) { } public GuiBuilder setBack(String backGuiName) { - this.backGui = GuiManager.get().getGuiByName(backGuiName); + this.backGui = GuiManager.get().getGui(backGuiName); return this; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java index 509eb3d7e..de7c0376f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java @@ -41,7 +41,7 @@ public boolean function(final PlayerWrapper playerWrapper) { if (gui == null) { return false; } - if (!GuiManager.get().hasGuiName(gui)) { + if (!GuiManager.get().isGuiLoaded(gui)) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java index f779fc193..4f684c4d9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java @@ -50,7 +50,7 @@ public boolean function(PlayerWrapper playerWrapper) { return false; } - Gui backGui = GuiManager.get().getGuiByName(this.getData()); + Gui backGui = GuiManager.get().getGui(this.getData()); if (backGui == null) { return false; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index cd67c6d94..87c07d2ad 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -64,6 +64,19 @@ public class GuiManager { private static GuiManager instance; + public static GuiManager get() { + if (instance == null) { + instance = new GuiManager(); + instance.loadGlobalMacros(); + instance.loadGuis(); + } + return instance; + } + + private static Gui getOrCloneGui(Gui gui) { + return gui.isStatic() ? gui : gui.clone(); + } + private Map guis; private final Map playerGuis = new HashMap<>(); private Map cachedGuis; @@ -84,20 +97,11 @@ private GuiManager() { this.globalMacrosTimestamps = new HashMap<>(); } - public static GuiManager get() { - if (instance == null) { - instance = new GuiManager(); - instance.loadGlobalMacros(); - instance.loadGuis(); - } - return instance; - } - - public boolean hasGuiName(String name) { + public boolean isGuiLoaded(String name) { return this.guis.containsKey(name); } - public Gui getGuiByName(String name) { + public Gui getGui(String name) { Gui gui = this.guis.get(name); if (gui != null) { return getOrCloneGui(gui); @@ -105,10 +109,6 @@ public Gui getGuiByName(String name) { return null; } - private static Gui getOrCloneGui(Gui gui) { - return gui.isStatic() ? gui : gui.clone(); - } - public void reloadGuis(boolean force) { DynamicGui.get().getLogger().info("Reloading guis!"); DynamicGui.get().getPlugin().unloadCommands(); @@ -169,7 +169,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, String } public CompletableFuture openGui(PlayerWrapper playerWrapper, String guiName, Gui back) { - return this.openGui(playerWrapper, this.getGuiByName(guiName), back); + return this.openGui(playerWrapper, this.getGui(guiName), back); } public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gui) { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java new file mode 100644 index 000000000..f0e0844b8 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java @@ -0,0 +1,42 @@ +package com.clubobsidian.dynamicgui.core.test.manager; + +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class GuiManagerTest { + + private static final String TEST_GUI = "test"; + + private final MockFactory factory = new MockFactory(); + + @BeforeEach + public void setup() { + this.factory.inject(); + } + + @Test + public void testGetGuiNotNull() { + Gui gui = GuiManager.get().getGui(TEST_GUI); + assertNotNull(gui); + } + + @Test + public void testHasGui() { + assertTrue(GuiManager.get().isGuiLoaded(TEST_GUI)); + } + + @Test + public void testGetGuis() { + List guis = GuiManager.get().getGuis();; + assertNotNull(guis); + assertTrue(guis.size() == 1); + } +} \ No newline at end of file From f04b6b4522697c4cf5dd1ae68856fa7bac6f6200 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 13 Mar 2022 01:59:18 -0800 Subject: [PATCH 147/261] Start testing function manager --- core/mock_data/guis/test.yml | 9 +++-- .../test/manager/FunctionManagerTest.java | 35 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 1 - .../mock/manager/MockMaterialManager.java | 6 +++- .../core/test/mock/plugin/MockPlatform.java | 2 +- 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index f08d45de7..552be4b70 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -1,5 +1,10 @@ title: "test" rows: 5 -0: - type: "STONE" \ No newline at end of file +'0': + icon: "STONE" + functions: + click: + type: "click" + functions: + - "pmsg: test" \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java new file mode 100644 index 000000000..6c4e173b9 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -0,0 +1,35 @@ +package com.clubobsidian.dynamicgui.core.test.manager; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.gui.Slot; +import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.parser.function.FunctionType; +import org.junit.jupiter.api.Test; + +import java.util.concurrent.ExecutionException; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class FunctionManagerTest { + + private final MockFactory factory = new MockFactory(); + + @Test + public void testTryFunctions() throws ExecutionException, InterruptedException { + this.factory.inject(); + MockPlayerWrapper playerWrapper = this.factory.createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + assertTrue(gui.getSlots().size() >= 1); + Slot slot = gui.getSlots().get(0); + assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); + assertTrue(playerWrapper.getIncomingChat().size() == 1); + assertEquals("test", playerWrapper.getIncomingChat().get(0)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 99fd0b28a..b43974018 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -198,7 +198,6 @@ public MockLoggerWrapper getLogger() { public MockEconomy getEconomy() { Economy economy = DynamicGui.get().getPlugin().getEconomy(); - ; if (!(economy instanceof MockEconomy)) { return null; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java index 9064fa3ee..906f964b3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java @@ -19,6 +19,7 @@ import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import java.util.List; +import java.util.Locale; public class MockMaterialManager extends MaterialManager { @Override @@ -28,6 +29,9 @@ public List getMaterials() { @Override public String normalizeMaterial(String material) { - return null; + if(material == null) { + return null; + } + return material.toUpperCase(); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 75bc9655f..07d77a0e4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -45,7 +45,7 @@ public Scheduler getScheduler() { @Override public boolean isMainThread() { - return false; + return true; //TODO - add multi threading } @Override From 985c4a4703710f60979b83c0926638ca65474c72 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 14 Mar 2022 23:57:07 -0700 Subject: [PATCH 148/261] Test fail functions --- core/mock_data/guis/test.yml | 14 +++++++++++++- .../core/test/manager/FunctionManagerTest.java | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index 552be4b70..0b36e4586 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -7,4 +7,16 @@ rows: 5 click: type: "click" functions: - - "pmsg: test" \ No newline at end of file + - "pmsg: test" +'1': + icon: "STONE" + functions: + click: + type: "click" + functions: + - "haspermission: does.not.exist" + fail-haspermission: + fail-on: "haspermission" + type: "fail" + functions: + - "pmsg: fail" \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 6c4e173b9..771fe9c45 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -15,6 +15,7 @@ import java.util.concurrent.ExecutionException; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; public class FunctionManagerTest { @@ -22,7 +23,7 @@ public class FunctionManagerTest { private final MockFactory factory = new MockFactory(); @Test - public void testTryFunctions() throws ExecutionException, InterruptedException { + public void testPassing() throws ExecutionException, InterruptedException { this.factory.inject(); MockPlayerWrapper playerWrapper = this.factory.createPlayer(); Gui gui = GuiManager.get().getGui("test"); @@ -32,4 +33,16 @@ public void testTryFunctions() throws ExecutionException, InterruptedException { assertTrue(playerWrapper.getIncomingChat().size() == 1); assertEquals("test", playerWrapper.getIncomingChat().get(0)); } + + @Test + public void testFailing() throws ExecutionException, InterruptedException { + this.factory.inject(); + MockPlayerWrapper playerWrapper = this.factory.createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + assertTrue(gui.getSlots().size() >= 1); + Slot slot = gui.getSlots().get(1); + assertFalse(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); + assertTrue(playerWrapper.getIncomingChat().size() == 1); + assertEquals("fail", playerWrapper.getIncomingChat().get(0)); + } } \ No newline at end of file From 840549310a24be7f8527784e064e9aa9e3856ae0 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:27:42 -0700 Subject: [PATCH 149/261] Implement mock scheduler --- .../core/test/mock/plugin/MockPlatform.java | 5 ++- .../{plugin => scheduler}/MockScheduler.java | 27 ++++++++++-- .../core/test/mock/scheduler/MockTask.java | 39 +++++++++++++++++ .../mock/scheduler/MockThreadRunnable.java | 43 +++++++++++++++++++ 4 files changed, 108 insertions(+), 6 deletions(-) rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/{plugin => scheduler}/MockScheduler.java (56%) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 07d77a0e4..4814f4961 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -22,6 +22,7 @@ import com.clubobsidian.dynamicgui.core.platform.PlatformType; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.test.mock.scheduler.MockScheduler; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import java.util.ArrayList; @@ -35,7 +36,7 @@ public class MockPlatform implements Platform { private final Map> worlds = new HashMap<>(); private final List dispatchedServerCommands = new ArrayList<>(); - private final Scheduler scheduler = new MockScheduler(); + private final MockScheduler scheduler = new MockScheduler(); private final List broadcastMessages = new ArrayList<>(); @Override @@ -45,7 +46,7 @@ public Scheduler getScheduler() { @Override public boolean isMainThread() { - return true; //TODO - add multi threading + return this.scheduler.isOnMainThread(); } @Override diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockScheduler.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java similarity index 56% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockScheduler.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java index e85d36025..9e4314e02 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockScheduler.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java @@ -14,29 +14,48 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.test.mock.plugin; +package com.clubobsidian.dynamicgui.core.test.mock.scheduler; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; public class MockScheduler extends Scheduler { + private final MockThreadRunnable synchronous = new MockThreadRunnable(); + private final MockThreadRunnable async = new MockThreadRunnable(); + + private final Thread mainThread = new Thread(this.synchronous); + private final Thread asyncThread = new Thread(this.async); + + public MockScheduler() { + this.mainThread.start(); + this.asyncThread.start(); + } + @Override public void runSyncDelayedTask(Runnable runnable, long delay) { - + this.synchronous.addTask(new MockTask(runnable, delay)); } @Override public void runAsynchronousDelayedTask(Runnable runnable, long delay) { - + this.async.addTask(new MockTask(runnable, delay)); } @Override public void scheduleSyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating) { - + this.synchronous.addTask(new MockTask(runnable, delayInitial, delayRepeating)); } @Override public void scheduleAsyncRepeatingTask(Runnable runnable, long delayInitial, long delayRepeating) { + this.async.addTask(new MockTask(runnable, delayInitial, delayRepeating)); + } + + public boolean isOnMainThread() { + return Thread.currentThread().equals(this.mainThread); + } + public void stop() { + this.synchronous.stop(); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java new file mode 100644 index 000000000..bc8d23b2a --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java @@ -0,0 +1,39 @@ +package com.clubobsidian.dynamicgui.core.test.mock.scheduler; + +public class MockTask implements Runnable { + + private final Runnable runnable; + private final long delayInitial; + private long delay; + private final long delayRepeating; + + public MockTask(Runnable runnable, long delayInitial) { + this(runnable, delayInitial, -1); + } + + public MockTask(Runnable runnable, long delayInitial, long delayRepeating) { + this.runnable = runnable; + this.delayInitial = delayInitial; + this.delay = delayInitial; + this.delayRepeating = delayRepeating; + } + + public long decrementDelay() { + this.delay -= 1; + return this.delay; + } + + public long resetDelay() { + this.delay = this.delayRepeating; + return this.delay; + } + + public boolean isRepeating() { + return this.delayRepeating != -1; + } + + @Override + public void run() { + this.runnable.run(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java new file mode 100644 index 000000000..d58c2bd20 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java @@ -0,0 +1,43 @@ +package com.clubobsidian.dynamicgui.core.test.mock.scheduler; + +import java.util.Collection; +import java.util.Iterator; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicBoolean; + +public class MockThreadRunnable implements Runnable { + + private final AtomicBoolean running = new AtomicBoolean(true); + private final Collection tasks = new ConcurrentLinkedQueue<>(); + + public boolean addTask(MockTask task) { + return this.tasks.add(task); + } + + @Override + public void run() { + while(this.running.get()) { + try { + Thread.sleep(50); + Iterator it = this.tasks.iterator(); + while(it.hasNext()) { + MockTask task = it.next(); + if(task.decrementDelay() <= 0) { + task.run(); + if(task.isRepeating()) { + task.resetDelay(); + } else { + it.remove(); + } + } + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + public void stop() { + this.running.set(false); + } +} From 7c07a46c31fe735bbd19c1b1e8c2c2fdae0f005f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:27:49 -0700 Subject: [PATCH 150/261] Test async functions --- core/mock_data/guis/test.yml | 10 ++++++- .../test/manager/FunctionManagerTest.java | 29 +++++++++++-------- .../core/test/mock/ScheduledTest.java | 29 +++++++++++++++++++ 3 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index 0b36e4586..d369c8522 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -19,4 +19,12 @@ rows: 5 fail-on: "haspermission" type: "fail" functions: - - "pmsg: fail" \ No newline at end of file + - "pmsg: fail" +'2': + icon: "STONE" + functions: + click: + type: "click" + functions: + - "delay: 1000" + - "pmsg: async" \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 771fe9c45..060c8111d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -3,11 +3,9 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; +import com.clubobsidian.dynamicgui.core.test.mock.ScheduledTest; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; @@ -18,16 +16,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class FunctionManagerTest { - - private final MockFactory factory = new MockFactory(); +public class FunctionManagerTest implements ScheduledTest { @Test public void testPassing() throws ExecutionException, InterruptedException { - this.factory.inject(); - MockPlayerWrapper playerWrapper = this.factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); - assertTrue(gui.getSlots().size() >= 1); Slot slot = gui.getSlots().get(0); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); assertTrue(playerWrapper.getIncomingChat().size() == 1); @@ -36,13 +30,24 @@ public void testPassing() throws ExecutionException, InterruptedException { @Test public void testFailing() throws ExecutionException, InterruptedException { - this.factory.inject(); - MockPlayerWrapper playerWrapper = this.factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); - assertTrue(gui.getSlots().size() >= 1); Slot slot = gui.getSlots().get(1); assertFalse(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); assertTrue(playerWrapper.getIncomingChat().size() == 1); assertEquals("fail", playerWrapper.getIncomingChat().get(0)); } + + @Test + public void testAsync() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(2); + long time = System.currentTimeMillis(); + assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); + assertTrue(playerWrapper.getIncomingChat().size() == 1); + assertEquals("async", playerWrapper.getIncomingChat().get(0)); + long delta = System.currentTimeMillis() - time; + assertTrue(delta >= 500); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java new file mode 100644 index 000000000..40bc11248 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java @@ -0,0 +1,29 @@ +package com.clubobsidian.dynamicgui.core.test.mock; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.test.mock.scheduler.MockScheduler; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; + +public interface ScheduledTest { + + MockFactory factory = new MockFactory(); + + default MockFactory getFactory() { + return factory; + } + + @BeforeEach + default void setup() { + factory.inject(); + } + + @AfterEach + default void stop() { + Scheduler scheduler = DynamicGui.get().getPlatform().getScheduler(); + if(scheduler != null) { + ((MockScheduler)scheduler).stop(); + } + } +} From b69c7ce6c867ca3a124428bcdec50988320f4125 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:28:37 -0700 Subject: [PATCH 151/261] Stop the async thread as well --- .../dynamicgui/core/test/mock/scheduler/MockScheduler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java index 9e4314e02..9ce7f9529 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java @@ -57,5 +57,6 @@ public boolean isOnMainThread() { public void stop() { this.synchronous.stop(); + this.async.stop(); } } From 21119926a0310ebe6324c59e63a3d943ed5d3dd1 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:30:03 -0700 Subject: [PATCH 152/261] Reformat code --- .../core/test/mock/scheduler/MockThreadRunnable.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java index d58c2bd20..29222fb93 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java @@ -16,15 +16,15 @@ public boolean addTask(MockTask task) { @Override public void run() { - while(this.running.get()) { + while (this.running.get()) { try { Thread.sleep(50); Iterator it = this.tasks.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { MockTask task = it.next(); - if(task.decrementDelay() <= 0) { + if (task.decrementDelay() <= 0) { task.run(); - if(task.isRepeating()) { + if (task.isRepeating()) { task.resetDelay(); } else { it.remove(); From 3e7ef0a60673a943749eee944bf50c79c50cce8e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:32:07 -0700 Subject: [PATCH 153/261] Refactor out factory into FactoryTest interface --- .../test/manager/FunctionManagerTest.java | 3 +- .../core/test/manager/GuiManagerTest.java | 2 +- .../core/test/mock/ScheduledTest.java | 29 ------------------- .../mock/manager/MockMaterialManager.java | 3 +- .../core/test/test/FactoryTest.java | 18 ++++++++++++ .../core/test/test/ScheduledTest.java | 17 +++++++++++ 6 files changed, 38 insertions(+), 34 deletions(-) delete mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 060c8111d..cae7abab9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -1,11 +1,10 @@ package com.clubobsidian.dynamicgui.core.test.manager; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.core.test.mock.ScheduledTest; +import com.clubobsidian.dynamicgui.core.test.test.ScheduledTest; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java index f0e0844b8..c8ece748c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java @@ -35,7 +35,7 @@ public void testHasGui() { @Test public void testGetGuis() { - List guis = GuiManager.get().getGuis();; + List guis = GuiManager.get().getGuis(); assertNotNull(guis); assertTrue(guis.size() == 1); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java deleted file mode 100644 index 40bc11248..000000000 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/ScheduledTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.clubobsidian.dynamicgui.core.test.mock; - -import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; -import com.clubobsidian.dynamicgui.core.test.mock.scheduler.MockScheduler; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; - -public interface ScheduledTest { - - MockFactory factory = new MockFactory(); - - default MockFactory getFactory() { - return factory; - } - - @BeforeEach - default void setup() { - factory.inject(); - } - - @AfterEach - default void stop() { - Scheduler scheduler = DynamicGui.get().getPlatform().getScheduler(); - if(scheduler != null) { - ((MockScheduler)scheduler).stop(); - } - } -} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java index 906f964b3..a323bcda8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java @@ -19,7 +19,6 @@ import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; import java.util.List; -import java.util.Locale; public class MockMaterialManager extends MaterialManager { @Override @@ -29,7 +28,7 @@ public List getMaterials() { @Override public String normalizeMaterial(String material) { - if(material == null) { + if (material == null) { return null; } return material.toUpperCase(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java new file mode 100644 index 000000000..9c868b0a1 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java @@ -0,0 +1,18 @@ +package com.clubobsidian.dynamicgui.core.test.test; + +import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import org.junit.jupiter.api.BeforeEach; + +public interface FactoryTest { + + MockFactory factory = new MockFactory(); + + default MockFactory getFactory() { + return factory; + } + + @BeforeEach + default void setup() { + factory.inject(); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java new file mode 100644 index 000000000..ce73b8580 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java @@ -0,0 +1,17 @@ +package com.clubobsidian.dynamicgui.core.test.test; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; +import com.clubobsidian.dynamicgui.core.test.mock.scheduler.MockScheduler; +import org.junit.jupiter.api.AfterEach; + +public interface ScheduledTest extends FactoryTest { + + @AfterEach + default void stop() { + Scheduler scheduler = DynamicGui.get().getPlatform().getScheduler(); + if (scheduler != null) { + ((MockScheduler) scheduler).stop(); + } + } +} From 1477e5737b45f4eff3e15ebac12e5f73075cb4c1 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:39:01 -0700 Subject: [PATCH 154/261] Fix tests failing due to null in cooldowns file --- .../clubobsidian/dynamicgui/core/test/mock/MockFactory.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index b43974018..2aced7510 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -44,6 +44,7 @@ import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; import org.mockito.Mockito; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -171,6 +172,10 @@ public MockLocationWrapper createLocation(int x, int y, int z, String worldName) public MockFactory inject() { DynamicGuiPlugin plugin = new MockDynamicGuiPlugin(); + File cooldownsFile = new File(plugin.getDataFolder(), "cooldowns.yml"); + if(cooldownsFile.exists()) { //Have to do manual cleanup of this or tests fail + cooldownsFile.delete(); + } Platform platform = new MockPlatform(); LoggerWrapper logger = new MockLoggerWrapper(new MockLogger()); MockPluginModule module = new MockPluginModule(plugin, platform, logger); From 86bc65498d536c83411c96f01569444c02bac63a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:42:00 -0700 Subject: [PATCH 155/261] Add space --- .../com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 2aced7510..bf83ae045 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -173,7 +173,7 @@ public MockLocationWrapper createLocation(int x, int y, int z, String worldName) public MockFactory inject() { DynamicGuiPlugin plugin = new MockDynamicGuiPlugin(); File cooldownsFile = new File(plugin.getDataFolder(), "cooldowns.yml"); - if(cooldownsFile.exists()) { //Have to do manual cleanup of this or tests fail + if (cooldownsFile.exists()) { //Have to do manual cleanup of this or tests fail cooldownsFile.delete(); } Platform platform = new MockPlatform(); From 84bc0ab21df281d623a660b347ebc8f8074d496e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 00:49:03 -0700 Subject: [PATCH 156/261] Test main thread --- core/mock_data/guis/test.yml | 10 +++++++++- .../dynamicgui/core/DynamicGui.java | 6 +++++- .../impl/{ => test}/FalseAsyncFunction.java | 2 +- .../function/impl/test/MainThreadFunction.java | 17 +++++++++++++++++ .../core/test/manager/FunctionManagerTest.java | 8 ++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/{ => test}/FalseAsyncFunction.java (89%) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index d369c8522..d281d5d73 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -27,4 +27,12 @@ rows: 5 type: "click" functions: - "delay: 1000" - - "pmsg: async" \ No newline at end of file + - "pmsg: async" +'3': + icon: "STONE" + functions: + click: + type: "click" + functions: + - "delay: 1000" + - "IsMainThread" \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 32c2dfff2..4d41bb0dc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -25,7 +25,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; -import com.clubobsidian.dynamicgui.core.function.impl.FalseAsyncFunction; +import com.clubobsidian.dynamicgui.core.function.impl.test.FalseAsyncFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; @@ -75,6 +75,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.meta.HasMetadataFunction; import com.clubobsidian.dynamicgui.core.function.impl.meta.IsGuiMetadataSet; import com.clubobsidian.dynamicgui.core.function.impl.meta.SetMetadataFunction; +import com.clubobsidian.dynamicgui.core.function.impl.test.MainThreadFunction; import com.clubobsidian.dynamicgui.core.listener.EntityClickListener; import com.clubobsidian.dynamicgui.core.listener.GuiListener; import com.clubobsidian.dynamicgui.core.listener.InventoryCloseListener; @@ -359,7 +360,10 @@ private void loadFunctions() { FunctionManager.get().addFunction(new IsBedrockPlayerFunction()); FunctionManager.get().addFunction(new DelayFunction()); + + //Test functions FunctionManager.get().addFunction(new FalseAsyncFunction()); + FunctionManager.get().addFunction(new MainThreadFunction()); } private void startPlayerCountTimer() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java similarity index 89% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java index 7450b6b2e..955d22e5f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/FalseAsyncFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java @@ -1,4 +1,4 @@ -package com.clubobsidian.dynamicgui.core.function.impl; +package com.clubobsidian.dynamicgui.core.function.impl.test; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java new file mode 100644 index 000000000..833fd38be --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java @@ -0,0 +1,17 @@ +package com.clubobsidian.dynamicgui.core.function.impl.test; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; + +public class MainThreadFunction extends Function { + + public MainThreadFunction() { + super("ismainthread"); + } + + @Override + public boolean function(PlayerWrapper playerWrapper) { + return DynamicGui.get().getPlatform().isMainThread(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index cae7abab9..a69b7f3f1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -49,4 +49,12 @@ public void testAsync() throws ExecutionException, InterruptedException { long delta = System.currentTimeMillis() - time; assertTrue(delta >= 500); } + + @Test + public void testMainThread() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(3); + assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); + } } \ No newline at end of file From d605d78ac5f09e489aa2343d33413ab595c341df Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 01:13:13 -0700 Subject: [PATCH 157/261] Fix async functions not always completing If an async function was last in the line to execute the response would not complete. Now what we do is wait for the value and then complete the response with the recurred value. --- .../core/manager/dynamicgui/FunctionManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 0fad23ad7..b9a6564e9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -180,11 +180,9 @@ private CompletableFuture runFunctionData(FunctionOwner owner, if (!ran) { response.complete(new FunctionResponse(false, functionName, functionData)); } else if (async) { - try { - response.complete(runFunctionData(owner, futureData, playerWrapper).get()); - } catch (InterruptedException | ExecutionException ex) { - ex.printStackTrace(); - } + runFunctionData(owner, futureData, playerWrapper).thenAccept((value) -> { + response.complete(value); + }); } }, async); //Return if function is async since the async caller will hand From bd4b62cb6efa90fdd8ce82a9a5fa52b5131525cd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 01:13:50 -0700 Subject: [PATCH 158/261] Test for executing off the main thread --- core/mock_data/guis/test.yml | 11 ++++++++++- .../dynamicgui/core/DynamicGui.java | 2 ++ .../function/impl/test/AsyncThreadFunction.java | 17 +++++++++++++++++ .../core/test/manager/FunctionManagerTest.java | 8 ++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index d281d5d73..6f189fcea 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -35,4 +35,13 @@ rows: 5 type: "click" functions: - "delay: 1000" - - "IsMainThread" \ No newline at end of file + - "IsMainThread" +'4': + icon: "STONE" + functions: + click: + type: "click" + functions: + - "delay: 1000" + - "pmsg: test" + - "isasyncthread" \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 4d41bb0dc..8093ac4c9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -25,6 +25,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; +import com.clubobsidian.dynamicgui.core.function.impl.test.AsyncThreadFunction; import com.clubobsidian.dynamicgui.core.function.impl.test.FalseAsyncFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; @@ -364,6 +365,7 @@ private void loadFunctions() { //Test functions FunctionManager.get().addFunction(new FalseAsyncFunction()); FunctionManager.get().addFunction(new MainThreadFunction()); + FunctionManager.get().addFunction(new AsyncThreadFunction()); } private void startPlayerCountTimer() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java new file mode 100644 index 000000000..de18c0902 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java @@ -0,0 +1,17 @@ +package com.clubobsidian.dynamicgui.core.function.impl.test; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; + +public class AsyncThreadFunction extends Function { + + public AsyncThreadFunction() { + super("isasyncthread", true); + } + + @Override + public boolean function(PlayerWrapper playerWrapper) { + return !DynamicGui.get().getPlatform().isMainThread(); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index a69b7f3f1..e80168b8d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -57,4 +57,12 @@ public void testMainThread() throws ExecutionException, InterruptedException { Slot slot = gui.getSlots().get(3); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); } + + @Test + public void testAsyncThread() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(4); + assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); + } } \ No newline at end of file From bf737dca6776315c1c084e4116d6d1dd99920442 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 01:51:59 -0700 Subject: [PATCH 159/261] Remove getter from factory test --- .../core/test/manager/FunctionManagerTest.java | 10 +++++----- .../dynamicgui/core/test/test/FactoryTest.java | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index e80168b8d..4b929ad80 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -19,7 +19,7 @@ public class FunctionManagerTest implements ScheduledTest { @Test public void testPassing() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + MockPlayerWrapper playerWrapper = factory.createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(0); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); @@ -29,7 +29,7 @@ public void testPassing() throws ExecutionException, InterruptedException { @Test public void testFailing() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + MockPlayerWrapper playerWrapper = factory.createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(1); assertFalse(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); @@ -39,7 +39,7 @@ public void testFailing() throws ExecutionException, InterruptedException { @Test public void testAsync() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + MockPlayerWrapper playerWrapper = factory.createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(2); long time = System.currentTimeMillis(); @@ -52,7 +52,7 @@ public void testAsync() throws ExecutionException, InterruptedException { @Test public void testMainThread() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + MockPlayerWrapper playerWrapper = factory.createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(3); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); @@ -60,7 +60,7 @@ public void testMainThread() throws ExecutionException, InterruptedException { @Test public void testAsyncThread() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + MockPlayerWrapper playerWrapper = factory.createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(4); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java index 9c868b0a1..4542b1aa6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java @@ -7,10 +7,6 @@ public interface FactoryTest { MockFactory factory = new MockFactory(); - default MockFactory getFactory() { - return factory; - } - @BeforeEach default void setup() { factory.inject(); From 576f577674b05ab143f4732baf385d7b9884266b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 04:14:56 -0700 Subject: [PATCH 160/261] Make Scheduled and Factory test abstract classes --- .../test/function/AddPermissionFunctionTest.java | 11 +++++------ .../core/test/manager/FunctionManagerTest.java | 12 ++++++------ .../dynamicgui/core/test/test/FactoryTest.java | 12 ++++++++---- .../dynamicgui/core/test/test/ScheduledTest.java | 4 ++-- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java index 0379176d7..78b5b404b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java @@ -20,19 +20,18 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class AddPermissionFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class AddPermissionFunctionTest extends FactoryTest { @Test public void testNullPermission() { Function function = new AddPermissionFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -40,7 +39,7 @@ public void testPermissionAdded() { String permission = "test"; Function function = new AddPermissionFunction(); function.setData(permission); - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); assertTrue(function.function(player)); } @@ -49,7 +48,7 @@ public void testPermissionNotAdded() { String permission = "test"; Function function = new AddPermissionFunction(); function.setData(permission); - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); player.addPermission(permission); assertFalse(function.function(player)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 4b929ad80..6254e6fc1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -15,11 +15,11 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class FunctionManagerTest implements ScheduledTest { +public class FunctionManagerTest extends ScheduledTest { @Test public void testPassing() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(0); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); @@ -29,7 +29,7 @@ public void testPassing() throws ExecutionException, InterruptedException { @Test public void testFailing() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(1); assertFalse(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); @@ -39,7 +39,7 @@ public void testFailing() throws ExecutionException, InterruptedException { @Test public void testAsync() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(2); long time = System.currentTimeMillis(); @@ -52,7 +52,7 @@ public void testAsync() throws ExecutionException, InterruptedException { @Test public void testMainThread() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(3); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); @@ -60,7 +60,7 @@ public void testMainThread() throws ExecutionException, InterruptedException { @Test public void testAsyncThread() throws ExecutionException, InterruptedException { - MockPlayerWrapper playerWrapper = factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(4); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java index 4542b1aa6..dd9f5e5a2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java @@ -3,12 +3,16 @@ import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.jupiter.api.BeforeEach; -public interface FactoryTest { +public abstract class FactoryTest { - MockFactory factory = new MockFactory(); + private final MockFactory factory = new MockFactory(); + + public MockFactory getFactory() { + return this.factory; + } @BeforeEach - default void setup() { - factory.inject(); + public void setup() { + this.factory.inject(); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java index ce73b8580..ffec0faec 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java @@ -5,10 +5,10 @@ import com.clubobsidian.dynamicgui.core.test.mock.scheduler.MockScheduler; import org.junit.jupiter.api.AfterEach; -public interface ScheduledTest extends FactoryTest { +public abstract class ScheduledTest extends FactoryTest { @AfterEach - default void stop() { + public void stop() { Scheduler scheduler = DynamicGui.get().getPlatform().getScheduler(); if (scheduler != null) { ((MockScheduler) scheduler).stop(); From 4ea913c317f9400daf25066f2312cae8eafe31b9 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 04:15:37 -0700 Subject: [PATCH 161/261] Repackage test classes into mock.test --- .../core/test/function/AddPermissionFunctionTest.java | 3 +-- .../dynamicgui/core/test/manager/FunctionManagerTest.java | 2 +- .../dynamicgui/core/test/{ => mock}/test/FactoryTest.java | 2 +- .../dynamicgui/core/test/{ => mock}/test/ScheduledTest.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/{ => mock}/test/FactoryTest.java (86%) rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/{ => mock}/test/ScheduledTest.java (89%) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java index 78b5b404b..d42159976 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java @@ -19,8 +19,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import com.clubobsidian.dynamicgui.core.test.test.FactoryTest; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 6254e6fc1..b364f044f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -4,7 +4,7 @@ import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.core.test.test.ScheduledTest; +import com.clubobsidian.dynamicgui.core.test.mock.test.ScheduledTest; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java similarity index 86% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java index dd9f5e5a2..bacff2ec8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/FactoryTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java @@ -1,4 +1,4 @@ -package com.clubobsidian.dynamicgui.core.test.test; +package com.clubobsidian.dynamicgui.core.test.mock.test; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import org.junit.jupiter.api.BeforeEach; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java similarity index 89% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java index ffec0faec..9923b4539 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/test/ScheduledTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java @@ -1,4 +1,4 @@ -package com.clubobsidian.dynamicgui.core.test.test; +package com.clubobsidian.dynamicgui.core.test.mock.test; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.scheduler.Scheduler; From 6de9ce61f3c1f189aa50e12a07966082325fa950 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 04:26:51 -0700 Subject: [PATCH 162/261] Convert classes to use FactoryTest class --- .../core/test/config/MessageTest.java | 10 +++--- .../CheckItemInTypeHandFunctionTest.java | 18 +++++------ .../test/function/CheckLevelFunctionTest.java | 16 ++++------ .../function/CheckMovableFunctionTest.java | 16 ++++------ .../CheckPlayerWorldFunctionTest.java | 12 +++---- .../function/ConsoleCommandFunctionTest.java | 12 +++---- .../core/test/function/DelayFunctionTest.java | 14 ++++---- .../function/GetGameRuleFunctionTest.java | 22 ++++++------- .../function/IsBedrockPlayerFunctionTest.java | 8 ++--- .../function/IsNotOnCooldownFunctionTest.java | 12 +++---- .../function/IsOnCooldownFunctionTest.java | 12 +++---- .../core/test/function/LogFunctionTest.java | 12 +++---- .../function/MoneyBalanceFunctionTest.java | 26 +++++++-------- .../function/MoneyDepositFunctionTest.java | 18 +++++------ .../function/MoneyWithdrawFunctionTest.java | 26 +++++++-------- .../function/NoPermissionFunctionTest.java | 16 ++++------ .../test/function/ParticleFunctionTest.java | 10 +++--- .../test/function/PermissionFunctionTest.java | 12 +++---- .../function/PlayerCommandFunctionTest.java | 10 +++--- .../function/PlayerMessageFunctionTest.java | 10 +++--- .../PlayerMiniMessageFunctionTest.java | 12 +++---- .../function/PlayerMsgJsonFunctionTest.java | 10 +++--- .../test/function/RandomFunctionTest.java | 12 +++---- .../RemovePermissionFunctionTest.java | 12 +++---- .../test/function/RemoveSlotFunctionTest.java | 24 +++++++------- .../test/function/ResetFrameFunctionTest.java | 14 ++++---- .../test/function/ResetTickFunctionTest.java | 14 ++++---- .../core/test/function/SendFunctionTest.java | 20 ++++++------ .../function/ServerBroadcastFunctionTest.java | 14 ++++---- .../ServerBroadcastJsonFunctionTest.java | 12 +++---- .../ServerMiniBroadcastFunctionTest.java | 12 +++---- .../test/function/SetAmountFunctionTest.java | 28 ++++++++-------- .../test/function/SetCloseFunctionTest.java | 14 ++++---- .../function/SetCooldownFunctionTest.java | 18 +++++------ .../function/SetDurabilityFunctionTest.java | 28 ++++++++-------- .../function/SetEnchantsFunctionTest.java | 32 +++++++++---------- .../function/SetGameRuleFunctionTest.java | 22 ++++++------- .../test/function/SetGlowFunctionTest.java | 14 ++++---- .../test/function/SetLoreFunctionTest.java | 20 ++++++------ .../test/function/SetMovableFunctionTest.java | 22 ++++++------- .../test/function/SetNBTFunctionTest.java | 14 ++++---- .../test/function/SetNameFunctionTest.java | 14 ++++---- .../test/function/SetTypeFunctionTest.java | 14 ++++---- .../core/test/function/SoundFunctionTest.java | 12 +++---- .../test/manager/FunctionManagerTest.java | 2 +- .../core/test/manager/GuiManagerTest.java | 12 ++----- .../core/test/mock/test/FactoryTest.java | 2 +- 47 files changed, 310 insertions(+), 406 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java index 2d564efd6..64baa9308 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java @@ -17,25 +17,23 @@ package com.clubobsidian.dynamicgui.core.test.config; import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class MessageTest { - - private final MockFactory factory = new MockFactory(); +public class MessageTest extends FactoryTest { @Test public void notNullTest() { - this.factory.inject(); + this.getFactory().inject(); assertNotNull(DynamicGui.get().getMessage()); } @Test public void noGuiTest() { - this.factory.inject(); + this.getFactory().inject(); String noGuiMessage = DynamicGui.get().getMessage().getNoGui(); assertNotNull(noGuiMessage); assertTrue(noGuiMessage.length() > 0); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java index dcb5b1935..aed29d70a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java @@ -19,23 +19,21 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CheckItemInTypeHandFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class CheckItemInTypeHandFunctionTest extends FactoryTest { @Test public void testNull() { String material = "stone"; Function function = new CheckItemTypeInHandFunction(); - ItemStackWrapper hand = this.factory.createItemStack(material); - MockPlayerWrapper player = this.factory.createPlayer(); + ItemStackWrapper hand = this.getFactory().createItemStack(material); + MockPlayerWrapper player = this.getFactory().createPlayer(); player.setItemInHand(hand); assertFalse(function.function(player)); } @@ -45,8 +43,8 @@ public void testOneType() { String material = "stone"; Function function = new CheckItemTypeInHandFunction(); function.setData(material); - ItemStackWrapper hand = this.factory.createItemStack(material); - MockPlayerWrapper player = this.factory.createPlayer(); + ItemStackWrapper hand = this.getFactory().createItemStack(material); + MockPlayerWrapper player = this.getFactory().createPlayer(); player.setItemInHand(hand); assertTrue(function.function(player)); } @@ -57,8 +55,8 @@ public void testTwoTypes() { String functionMaterials = "dirt,stone"; Function function = new CheckItemTypeInHandFunction(); function.setData(functionMaterials); - ItemStackWrapper hand = this.factory.createItemStack(handMaterial); - MockPlayerWrapper player = this.factory.createPlayer(); + ItemStackWrapper hand = this.getFactory().createItemStack(handMaterial); + MockPlayerWrapper player = this.getFactory().createPlayer(); player.setItemInHand(hand); assertTrue(function.function(player)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java index 479272409..abe834587 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java @@ -18,27 +18,25 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CheckLevelFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class CheckLevelFunctionTest extends FactoryTest { @Test public void testNull() { - MockPlayerWrapper wrapper = this.factory.createPlayer(); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); Function function = new CheckLevelFunction(); assertFalse(function.function(wrapper)); } @Test public void testLevelGreater() { - MockPlayerWrapper wrapper = this.factory.createPlayer(); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(10); Function function = new CheckLevelFunction(); function.setData("1"); @@ -47,7 +45,7 @@ public void testLevelGreater() { @Test public void testLevelEqual() { - MockPlayerWrapper wrapper = this.factory.createPlayer(); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(10); Function function = new CheckLevelFunction(); function.setData("10"); @@ -56,7 +54,7 @@ public void testLevelEqual() { @Test public void testLevelLessThan() { - MockPlayerWrapper wrapper = this.factory.createPlayer(); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(1); Function function = new CheckLevelFunction(); function.setData("10"); @@ -65,7 +63,7 @@ public void testLevelLessThan() { @Test public void testInvalidFormat() { - MockPlayerWrapper wrapper = this.factory.createPlayer(); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(1); Function function = new CheckLevelFunction(); function.setData("a"); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java index be18998e0..61adae961 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java @@ -18,21 +18,19 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckMovableFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CheckMovableFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class CheckMovableFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new CheckMovableFunction(); - MockPlayerWrapper wrapper = this.factory.createPlayer(); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); assertFalse(function.function(wrapper)); } @@ -40,8 +38,8 @@ public void nullTest() { public void ownerNotSlotTest() { Function function = new CheckMovableFunction(); function.setData("true"); - function.setOwner(this.factory.createGui("test")); - MockPlayerWrapper wrapper = this.factory.createPlayer(); + function.setOwner(this.getFactory().createGui("test")); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); assertFalse(function.function(wrapper)); } @@ -49,8 +47,8 @@ public void ownerNotSlotTest() { public void isMovableTest() { Function function = new CheckMovableFunction(); function.setData("true"); - function.setOwner(this.factory.createSlot("STONE", true)); - MockPlayerWrapper wrapper = this.factory.createPlayer(); + function.setOwner(this.getFactory().createSlot("STONE", true)); + MockPlayerWrapper wrapper = this.getFactory().createPlayer(); assertTrue(function.function(wrapper)); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java index 03cc5c84d..4a10fac96 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java @@ -18,21 +18,19 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CheckPlayerWorldFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class CheckPlayerWorldFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new CheckPlayerWorldFunction(); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); assertFalse(function.function(player)); } @@ -41,8 +39,8 @@ public void worldEqualsTest() { String worldName = "test"; Function function = new CheckPlayerWorldFunction(); function.setData(worldName); - MockPlayerWrapper player = this.factory.createPlayer(); - player.setLocation(this.factory.createLocation(0, 0, 0, worldName)); + MockPlayerWrapper player = this.getFactory().createPlayer(); + player.setLocation(this.getFactory().createLocation(0, 0, 0, worldName)); assertTrue(function.function(player)); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java index a9de5df19..39bb569e5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java @@ -18,31 +18,29 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ConsoleCommandFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ConsoleCommandFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new ConsoleCommandFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void withDataTest() { String data = "test"; - MockPlatform platform = this.factory.inject().getPlatform(); + MockPlatform platform = this.getFactory().inject().getPlatform(); Function function = new ConsoleCommandFunction(); function.setData(data); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertEquals(data, platform.getDispatchedServerCommands().get(0)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index e2fee4a1e..b9e420dfd 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -18,7 +18,7 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.concurrent.atomic.AtomicBoolean; @@ -26,21 +26,19 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DelayFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class DelayFunctionTest extends FactoryTest { @Test public void testNull() { Function function = new DelayFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void testNonNumber() { Function function = new DelayFunction(); function.setData("a"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -49,7 +47,7 @@ public void testInterrupt() { Thread thread = new Thread(() -> { Function function = new DelayFunction(); function.setData("5000"); - value.set(function.function(this.factory.createPlayer())); + value.set(function.function(this.getFactory().createPlayer())); }); thread.start(); thread.interrupt(); @@ -72,6 +70,6 @@ public void testInterrupt() { public void testValidData() { Function function = new DelayFunction(); function.setData("1"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java index dd40202b9..29f109921 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java @@ -18,55 +18,53 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class GetGameRuleFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class GetGameRuleFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new GetGameRuleFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void noCommaTest() { Function function = new GetGameRuleFunction(); function.setData(""); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void lengthNotThreeTest() { Function function = new GetGameRuleFunction(); function.setData("a,b"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void worldNullTest() { - this.factory.inject().getPlatform(); + this.getFactory().inject().getPlatform(); Function function = new GetGameRuleFunction(); function.setData("test,key,value"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void hasGameRuleTest() { String worldName = "test"; - MockPlatform platform = this.factory.inject().getPlatform(); - WorldWrapper world = this.factory.createWorld(worldName); + MockPlatform platform = this.getFactory().inject().getPlatform(); + WorldWrapper world = this.getFactory().createWorld(worldName); platform.addWorld(world); world.setGameRule("key", "value"); Function function = new GetGameRuleFunction(); function.setData("test,key,value"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java index 7b0221fa6..c2e84cf3e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java @@ -18,23 +18,21 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertTrue; -public class IsBedrockPlayerFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class IsBedrockPlayerFunctionTest extends FactoryTest { @Test public void functionTest() { String name = "test"; UUID uuid = new UUID(0, 1); - MockPlayerWrapper player = this.factory.createPlayer(name, uuid); + MockPlayerWrapper player = this.getFactory().createPlayer(name, uuid); Function function = new IsBedrockPlayerFunction(); assertTrue(function.function(player)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java index f8786e646..1e13f32d9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java @@ -18,7 +18,7 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsNotOnCooldownFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.UUID; @@ -26,21 +26,19 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class IsNotOnCooldownFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class IsNotOnCooldownFunctionTest extends FactoryTest { @Test public void nullDataTest() { Function function = new IsNotOnCooldownFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void notOnCooldownTest() { - this.factory.inject(); + this.getFactory().inject(); Function function = new IsNotOnCooldownFunction(); function.setData(UUID.randomUUID().toString()); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java index 3625cb4de..bd247d467 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java @@ -20,7 +20,7 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsOnCooldownFunction; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown.CooldownManager; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.UUID; @@ -28,20 +28,18 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class IsOnCooldownFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class IsOnCooldownFunctionTest extends FactoryTest { @Test public void nullDataTest() { Function function = new IsOnCooldownFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void onCooldownTest() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); String cooldownName = UUID.randomUUID().toString(); CooldownManager.get().createCooldown(player, cooldownName, 1000); Function function = new IsOnCooldownFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java index 4082e7b77..fb2451a96 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java @@ -19,23 +19,21 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLogger; import com.clubobsidian.dynamicgui.core.test.mock.logger.MockLoggerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class LogFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class LogFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new LogFunction(); - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); assertFalse(function.function(player)); } @@ -44,9 +42,9 @@ public void withDataTest() { String data = "test"; Function function = new LogFunction(); function.setData(data); - MockLoggerWrapper wrapper = this.factory.inject().getLogger(); + MockLoggerWrapper wrapper = this.getFactory().inject().getLogger(); MockLogger logger = wrapper.getLogger(); - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); assertTrue(function.function(player)); assertTrue(logger.getInfoMessages().size() == 1); assertEquals(data, logger.getInfoMessages().get(0)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java index 567253140..51f8c4e1e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java @@ -19,8 +19,8 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyBalanceFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -28,14 +28,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class MoneyBalanceFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class MoneyBalanceFunctionTest extends FactoryTest { @Test public void testBelowBalance() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyBalanceFunction(); function.setData("10"); assertFalse(function.function(player)); @@ -43,8 +41,8 @@ public void testBelowBalance() { @Test public void testInvalidData() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyBalanceFunction(); function.setData("a"); assertFalse(function.function(player)); @@ -52,8 +50,8 @@ public void testInvalidData() { @Test public void testNullEconomy() { - this.factory.inject().getPlugin().economy = null; - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject().getPlugin().economy = null; + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyBalanceFunction(); function.setData("10"); assertFalse(function.function(player)); @@ -61,8 +59,8 @@ public void testNullEconomy() { @Test public void testEqualBalance() { - PlayerWrapper player = this.factory.createPlayer(); - MockEconomy economy = this.factory.inject().getEconomy(); + PlayerWrapper player = this.getFactory().createPlayer(); + MockEconomy economy = this.getFactory().inject().getEconomy(); BigDecimal amount = new BigDecimal(1); economy.deposit(player, amount); Function function = new MoneyBalanceFunction(); @@ -72,8 +70,8 @@ public void testEqualBalance() { @Test public void testAboveBalance() { - PlayerWrapper player = this.factory.createPlayer(); - MockEconomy economy = this.factory.inject().getEconomy(); + PlayerWrapper player = this.getFactory().createPlayer(); + MockEconomy economy = this.getFactory().inject().getEconomy(); int checkAmount = 9; BigDecimal depositAmount = new BigDecimal(checkAmount + 1); economy.deposit(player, depositAmount); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java index b1a8b0cba..ceadaa74c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java @@ -19,20 +19,18 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyDepositFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class MoneyDepositFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class MoneyDepositFunctionTest extends FactoryTest { @Test public void testInvalidData() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyDepositFunction(); function.setData("a"); assertFalse(function.function(player)); @@ -40,8 +38,8 @@ public void testInvalidData() { @Test public void testNullEconomy() { - this.factory.inject().getPlugin().economy = null; - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject().getPlugin().economy = null; + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyDepositFunction(); function.setData("10"); assertFalse(function.function(player)); @@ -49,8 +47,8 @@ public void testNullEconomy() { @Test public void testValidDeposit() { - PlayerWrapper player = this.factory.createPlayer(); - this.factory.inject(); + PlayerWrapper player = this.getFactory().createPlayer(); + this.getFactory().inject(); Function function = new MoneyDepositFunction(); function.setData("10"); assertTrue(function.function(player)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java index 6c2ba6278..3a934c9e3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java @@ -19,8 +19,8 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.MoneyWithdrawFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockEconomy; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -28,14 +28,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class MoneyWithdrawFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class MoneyWithdrawFunctionTest extends FactoryTest { @Test public void testBelowBalance() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyWithdrawFunction(); function.setData("10"); assertFalse(function.function(player)); @@ -43,8 +41,8 @@ public void testBelowBalance() { @Test public void testInvalidData() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyWithdrawFunction(); function.setData("a"); assertFalse(function.function(player)); @@ -52,8 +50,8 @@ public void testInvalidData() { @Test public void testNullEconomy() { - this.factory.inject().getPlugin().economy = null; - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject().getPlugin().economy = null; + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyWithdrawFunction(); function.setData("10"); assertFalse(function.function(player)); @@ -61,8 +59,8 @@ public void testNullEconomy() { @Test public void testEqualBalance() { - PlayerWrapper player = this.factory.createPlayer(); - MockEconomy economy = this.factory.inject().getEconomy(); + PlayerWrapper player = this.getFactory().createPlayer(); + MockEconomy economy = this.getFactory().inject().getEconomy(); BigDecimal amount = new BigDecimal(1); economy.deposit(player, amount); Function function = new MoneyWithdrawFunction(); @@ -72,8 +70,8 @@ public void testEqualBalance() { @Test public void testAboveBalance() { - PlayerWrapper player = this.factory.createPlayer(); - MockEconomy economy = this.factory.inject().getEconomy(); + PlayerWrapper player = this.getFactory().createPlayer(); + MockEconomy economy = this.getFactory().inject().getEconomy(); int withdrawAmount = 9; BigDecimal depositAmount = new BigDecimal(withdrawAmount + 1); economy.deposit(player, depositAmount); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java index 1cb48c22f..0ef754210 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java @@ -19,37 +19,35 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class NoPermissionFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class NoPermissionFunctionTest extends FactoryTest { @Test public void testNullData() { Function function = new NoPermissionFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void testHasNoPermission() { - this.factory.inject(); + this.getFactory().inject(); Function function = new NoPermissionFunction(); function.setData("test"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } @Test public void testHasPermission() { String permission = "test"; - this.factory.inject(); + this.getFactory().inject(); Function function = new NoPermissionFunction(); function.setData(permission); - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); player.addPermission(permission); assertFalse(function.function(player)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java index f800c2f4d..211205186 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java @@ -18,28 +18,26 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ParticleFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ParticleFunctionTest extends FactoryTest { @Test public void testNullData() { Function function = new ParticleFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void testValid() { Function function = new ParticleFunction(); function.setData("test,0"); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); assertTrue(function.function(player)); assertTrue(player.getParticles().size() == 1); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java index e06a0189d..87fc27218 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java @@ -19,20 +19,18 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PermissionFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class PermissionFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new PermissionFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @@ -40,7 +38,7 @@ public void nullTest() { public void doesNotHavePermissionTest() { Function function = new PermissionFunction(); function.setData("test"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -48,7 +46,7 @@ public void hasPermissionTest() { String permission = "test"; Function function = new PermissionFunction(); function.setData(permission); - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); player.addPermission(permission); assertTrue(function.function(player)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java index df9ccdc1f..0459d77c0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java @@ -18,22 +18,20 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PlayerCommandFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class PlayerCommandFunctionTest extends FactoryTest { @Test public void nullDataTest() { Function function = new PlayerCommandFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -42,7 +40,7 @@ public void validTest() { String slashCmd = "/" + cmd; Function function = new PlayerCommandFunction(); function.setData(cmd); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); assertTrue(function.function(player)); assertTrue(player.getOutgoingChat().size() == 1); assertEquals(slashCmd, player.getOutgoingChat().get(0)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java index 5f1fceb40..0c7357450 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java @@ -18,28 +18,26 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PlayerMessageFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class PlayerMessageFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new PlayerMessageFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void withDataTest() { String data = "test"; - MockPlayerWrapper playerWrapper = this.factory.createPlayer(); + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Function function = new PlayerMessageFunction(); function.setData(data); assertTrue(function.function(playerWrapper)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java index e4a43f1e7..becaf6d5d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java @@ -18,31 +18,29 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PlayerMiniMessageFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class PlayerMiniMessageFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new PlayerMiniMessageFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void dataTest() { - this.factory.inject(); + this.getFactory().inject(); String data = "test"; Function function = new PlayerMiniMessageFunction(); function.setData(data); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); assertTrue(function.function(player)); assertEquals(1, player.getIncomingChat().size()); assertEquals("{\"text\":\"test\"}", player.getIncomingChat().get(0)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java index 4a283c728..5064c60ed 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java @@ -18,22 +18,20 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgJsonFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PlayerMsgJsonFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class PlayerMsgJsonFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new PlayerMsgJsonFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -41,7 +39,7 @@ public void dataTest() { String data = "{\"text\":\"test\"}"; Function function = new PlayerMsgJsonFunction(); function.setData(data); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); assertTrue(function.function(player)); assertEquals(1, player.getIncomingChat().size()); assertEquals(data, player.getIncomingChat().get(0)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java index 332b12e00..e9efbefc3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java @@ -18,33 +18,31 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class RandomFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class RandomFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new RandomFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void incorrectLengthTest() { Function function = new RandomFunction(); function.setData("1-1-1"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void correctLengthTest() { Function function = new RandomFunction(); function.setData("1-1"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java index fd62b4847..2a0ce34b9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java @@ -18,21 +18,19 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class RemovePermissionFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class RemovePermissionFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new RemovePermissionFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -40,7 +38,7 @@ public void permissionNotRemovedTest() { String permission = "data"; Function function = new RemovePermissionFunction(); function.setData(permission); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); assertFalse(function.function(player)); } @@ -49,7 +47,7 @@ public void permissionRemoveTest() { String permission = "data"; Function function = new RemovePermissionFunction(); function.setData(permission); - MockPlayerWrapper player = this.factory.createPlayer(); + MockPlayerWrapper player = this.getFactory().createPlayer(); player.addPermission(permission); assertTrue(function.function(player)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java index a7233f8db..3e0119174 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java @@ -20,8 +20,8 @@ import com.clubobsidian.dynamicgui.core.function.impl.RemoveSlotFunction; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -31,25 +31,23 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class RemoveSlotFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class RemoveSlotFunctionTest extends FactoryTest { @Test public void randomDataTest() { Function function = new RemoveSlotFunction(); function.setData(UUID.randomUUID().toString()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void noDataTest() { - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(0, Slot.TEST_MATERIAL, false); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(0, Slot.TEST_MATERIAL, false); slot.buildItemStack(player); List slots = new ArrayList<>(); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); gui.buildInventory(player); slot.setOwner(gui); Function function = new RemoveSlotFunction(); @@ -59,12 +57,12 @@ public void noDataTest() { @Test public void thisDataTest() { - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(0, Slot.TEST_MATERIAL, false); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(0, Slot.TEST_MATERIAL, false); slot.buildItemStack(player); List slots = new ArrayList<>(); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); gui.buildInventory(player); slot.setOwner(gui); Function function = new RemoveSlotFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java index 096c05870..ebbe366c2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java @@ -20,29 +20,27 @@ import com.clubobsidian.dynamicgui.core.function.impl.ResetFrameFunction; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ResetFrameFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ResetFrameFunctionTest extends FactoryTest { @Test public void ownerNotSlotTest() { - Gui gui = this.factory.createGui("test"); + Gui gui = this.getFactory().createGui("test"); Function function = new ResetFrameFunction(); function.setOwner(gui); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void slotOwnerTest() { - Slot slot = this.factory.createSlot(); + Slot slot = this.getFactory().createSlot(); Function function = new ResetFrameFunction(); function.setOwner(slot); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java index 7196c97fb..2cb7e96db 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java @@ -20,29 +20,27 @@ import com.clubobsidian.dynamicgui.core.function.impl.ResetTickFunction; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ResetTickFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ResetTickFunctionTest extends FactoryTest { @Test public void ownerNotSlotTest() { - Gui gui = this.factory.createGui("test"); + Gui gui = this.getFactory().createGui("test"); Function function = new ResetTickFunction(); function.setOwner(gui); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void slotOwnerTest() { - Slot slot = this.factory.createSlot(); + Slot slot = this.getFactory().createSlot(); Function function = new ResetTickFunction(); function.setOwner(slot); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java index 3c1458528..063104e8a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java @@ -20,7 +20,7 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SendFunction; import com.clubobsidian.dynamicgui.core.proxy.Proxy; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.lang.reflect.Field; @@ -28,41 +28,39 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SendFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SendFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SendFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void noProxyTest() { - this.factory.inject(); + this.getFactory().inject(); Function function = new SendFunction(); function.setData("test"); assertTrue(this.setProxy(Proxy.NONE)); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void bungeeCordTest() { - this.factory.inject(); + this.getFactory().inject(); Function function = new SendFunction(); function.setData("test"); assertTrue(this.setProxy(Proxy.BUNGEECORD)); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } @Test public void redisBungeeTest() { - this.factory.inject(); + this.getFactory().inject(); Function function = new SendFunction(); function.setData("test"); assertTrue(this.setProxy(Proxy.REDIS_BUNGEE)); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); } private boolean setProxy(Proxy proxy) { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java index 24c69fa76..07acfa223 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java @@ -18,7 +18,7 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import com.clubobsidian.dynamicgui.core.util.ChatColor; import org.junit.jupiter.api.Test; @@ -28,25 +28,23 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ServerBroadcastFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ServerBroadcastFunctionTest extends FactoryTest { @Test public void noDataTest() { Function function = new ServerBroadcastFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void dataTest() { - this.factory.inject(); + this.getFactory().inject(); String data = "&4test"; String colorized = ChatColor.translateAlternateColorCodes(data); Function function = new ServerBroadcastFunction(); function.setData(data); - assertTrue(function.function(this.factory.createPlayer())); - List messages = this.factory.getPlatform().getBroadcastMessages(); + assertTrue(function.function(this.getFactory().createPlayer())); + List messages = this.getFactory().getPlatform().getBroadcastMessages(); assertTrue(messages.size() == 1); assertEquals(colorized, messages.get(0)); } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java index daed2fe7b..f88627bf4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java @@ -19,8 +19,8 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastJsonFunction; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.List; @@ -29,23 +29,21 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ServerBroadcastJsonFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ServerBroadcastJsonFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new ServerBroadcastJsonFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void dataTest() { - MockPlatform platform = this.factory.inject().getPlatform(); + MockPlatform platform = this.getFactory().inject().getPlatform(); String json = MiniMessageManager.get().toJson("test"); Function function = new ServerBroadcastJsonFunction(); function.setData(json); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); List messages = platform.getBroadcastMessages(); assertTrue(messages.size() == 1); assertEquals(json, messages.get(0)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java index fa705d6a2..c378bf1a1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java @@ -19,8 +19,8 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.ServerMiniBroadcastFunction; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.MiniMessageManager; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.plugin.MockPlatform; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.List; @@ -29,24 +29,22 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ServerMiniBroadcastFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class ServerMiniBroadcastFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new ServerMiniBroadcastFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void dataTest() { - MockPlatform platform = this.factory.inject().getPlatform(); + MockPlatform platform = this.getFactory().inject().getPlatform(); String data = "test"; String json = MiniMessageManager.get().toJson(data); Function function = new ServerMiniBroadcastFunction(); function.setData(data); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); List messages = platform.getBroadcastMessages(); assertTrue(messages.size() == 1); assertEquals(json, messages.get(0)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java index bb20355dc..bf1d0078e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java @@ -21,8 +21,8 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -32,33 +32,31 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetAmountFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetAmountFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetAmountFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void nonSlotOwnerTest() { Function function = new SetAmountFunction(); - function.setOwner(this.factory.createGui("test")); + function.setOwner(this.getFactory().createGui("test")); function.setData("1"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void invalidDataTest() { - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); gui.buildInventory(player); slot.setOwner(gui); Function function = new SetAmountFunction(); @@ -69,14 +67,14 @@ public void invalidDataTest() { @Test public void dataTest() { - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); int newAmount = 2; - Slot slot = this.factory.createSlot(); + Slot slot = this.getFactory().createSlot(); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); InventoryWrapper inventory = gui.buildInventory(player); slot.setOwner(gui); Function function = new SetAmountFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java index 57254df62..21470ad81 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java @@ -20,23 +20,21 @@ import com.clubobsidian.dynamicgui.core.function.impl.SetCloseFunction; import com.clubobsidian.dynamicgui.core.gui.FunctionOwner; import com.clubobsidian.dynamicgui.core.gui.property.CloseableComponent; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockCloseableFunctionOwner; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetCloseFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetCloseFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetCloseFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -44,7 +42,7 @@ public void nonCloseableComponentTest() { Function function = new SetCloseFunction(); function.setOwner(new MockNonCloseableFunctionOwner()); function.setData("true"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -53,7 +51,7 @@ public void invalidDataTest() { CloseableComponent component = new MockCloseableFunctionOwner(); function.setOwner((FunctionOwner) component); function.setData("a"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertEquals(false, component.getClose()); } @@ -63,7 +61,7 @@ public void validDataTest() { CloseableComponent component = new MockCloseableFunctionOwner(); function.setOwner((FunctionOwner) component); function.setData("true"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertEquals(true, component.getClose()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java index 43a15fcc9..a017bb5fe 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.cooldown.SetCooldownFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.UUID; @@ -27,41 +27,39 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetCooldownFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetCooldownFunctionTest extends FactoryTest { @Test public void nullDataTest() { Function function = new SetCooldownFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void noCommaTest() { Function function = new SetCooldownFunction(); function.setData("a"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void invalidNumberTest() { Function function = new SetCooldownFunction(); function.setData("a,a"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void lengthNotTwoTest() { Function function = new SetCooldownFunction(); function.setData("a,a,a"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void onCooldownTest() { - this.factory.inject(); - PlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + PlayerWrapper player = this.getFactory().createPlayer(); String cooldownName = UUID.randomUUID().toString(); String data = cooldownName + ",1000"; Function function = new SetCooldownFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java index 32b2981aa..b8380a51d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java @@ -21,8 +21,8 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -32,33 +32,31 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetDurabilityFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetDurabilityFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetDurabilityFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void nonSlotOwnerTest() { Function function = new SetDurabilityFunction(); - function.setOwner(this.factory.createGui("test")); + function.setOwner(this.getFactory().createGui("test")); function.setData("1"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void invalidDataTest() { - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); gui.buildInventory(player); slot.setOwner(gui); Function function = new SetDurabilityFunction(); @@ -69,14 +67,14 @@ public void invalidDataTest() { @Test public void dataTest() { - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); int newDurability = 2; - Slot slot = this.factory.createSlot(); + Slot slot = this.getFactory().createSlot(); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); InventoryWrapper inventory = gui.buildInventory(player); slot.setOwner(gui); Function function = new SetDurabilityFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java index e88f98c9c..1baffd226 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java @@ -22,9 +22,9 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -34,21 +34,19 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetEnchantsFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetEnchantsFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetEnchantsFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void noOwnerTest() { Function function = new SetEnchantsFunction(); function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -56,27 +54,27 @@ public void ownerNotSlotTest() { Function function = new SetEnchantsFunction(); function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void testOneEnchant() { int index = 0; - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); List enchants = new ArrayList<>(); enchants.add(new EnchantmentWrapper(EnchantmentWrapper.TEST_ENCHANT_1, 1)); - Slot slot = this.factory.createSlot(index, Slot.TEST_MATERIAL, enchants, false); + Slot slot = this.getFactory().createSlot(index, Slot.TEST_MATERIAL, enchants, false); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); InventoryWrapper inventory = gui.buildInventory(player); slot.setOwner(gui); Function function = new SetEnchantsFunction(); function.setOwner(slot); function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertTrue(inventory.getItem(index).getEnchants().size() == 1); assertEquals(EnchantmentWrapper.TEST_ENCHANT_2, inventory.getItem(index).getEnchants().get(0).getEnchant()); } @@ -84,21 +82,21 @@ public void testOneEnchant() { @Test public void testMultipleEnchants() { int index = 0; - this.factory.inject(); - MockPlayerWrapper player = this.factory.createPlayer(); + this.getFactory().inject(); + MockPlayerWrapper player = this.getFactory().createPlayer(); List enchants = new ArrayList<>(); enchants.add(new EnchantmentWrapper(EnchantmentWrapper.TEST_ENCHANT_1, 1)); - Slot slot = this.factory.createSlot(index, Slot.TEST_MATERIAL, enchants, false); + Slot slot = this.getFactory().createSlot(index, Slot.TEST_MATERIAL, enchants, false); slot.buildItemStack(player); List slots = new ArrayList<>(); slots.add(slot); - Gui gui = this.factory.createGui("test", slots); + Gui gui = this.getFactory().createGui("test", slots); InventoryWrapper inventory = gui.buildInventory(player); slot.setOwner(gui); Function function = new SetEnchantsFunction(); function.setOwner(slot); function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1;" + EnchantmentWrapper.TEST_ENCHANT_3 + ",1"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertTrue(inventory.getItem(index).getEnchants().size() == 2); assertEquals(EnchantmentWrapper.TEST_ENCHANT_2, inventory.getItem(index).getEnchants().get(0).getEnchant()); assertEquals(EnchantmentWrapper.TEST_ENCHANT_3, inventory.getItem(index).getEnchants().get(1).getEnchant()); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java index 1c2fa2865..0c15fefb4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java @@ -19,7 +19,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import com.clubobsidian.dynamicgui.core.test.mock.world.MockWorldWrapper; import org.junit.jupiter.api.Test; @@ -27,45 +27,43 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetGameRuleFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetGameRuleFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetGameRuleFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void dataDoesNotHaveCommaTest() { Function function = new SetGameRuleFunction(); function.setData("a"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void sizeNotThreeTest() { Function function = new SetGameRuleFunction(); function.setData("a,a"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void worldNullTest() { - this.factory.inject(); + this.getFactory().inject(); Function function = new SetGameRuleFunction(); function.setData("test,key,value"); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void validTest() { - MockWorldWrapper world = this.factory.inject().createWorld("test"); - this.factory.getPlatform().addWorld(world); + MockWorldWrapper world = this.getFactory().inject().createWorld("test"); + this.getFactory().getPlatform().addWorld(world); Function function = new SetGameRuleFunction(); function.setData("test,key,value"); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertEquals("value", DynamicGui.get().getPlatform().getWorld("test").getGameRule("key")); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java index 1e33509e2..7229862c3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java @@ -20,21 +20,19 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SetGlowFunction; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetGlowFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetGlowFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetGlowFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -42,13 +40,13 @@ public void notSlotTest() { Function function = new SetGlowFunction(); function.setData("true"); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void slotTest() { - PlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + PlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Function function = new SetGlowFunction(); function.setData("true"); function.setOwner(slot); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java index cf7a833a2..6e5641d65 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java @@ -21,8 +21,8 @@ import com.clubobsidian.dynamicgui.core.function.impl.SetLoreFunction; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -32,17 +32,15 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetLoreFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetLoreFunctionTest extends FactoryTest { @Test public void nullTest() { - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); String line = "test"; List lore = new ArrayList<>(); lore.add(line); - Slot slot = this.factory.createSlot(player, lore); + Slot slot = this.getFactory().createSlot(player, lore); Function function = new SetLoreFunction(); function.setOwner(slot); Gui gui = slot.getOwner(); @@ -54,13 +52,13 @@ public void nullTest() { public void nonSlotTest() { Function function = new SetLoreFunction(); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void oneLineTest() { - PlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + PlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Function function = new SetLoreFunction(); function.setData("test"); function.setOwner(slot); @@ -73,8 +71,8 @@ public void oneLineTest() { @Test public void multiLineTest() { - PlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + PlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Function function = new SetLoreFunction(); function.setData("test1\ntest2"); function.setOwner(slot); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java index 021b1b188..9f492f8c8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java @@ -20,21 +20,19 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SetMovableFunction; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetMovableFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetMovableFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetMovableFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -42,28 +40,28 @@ public void notSlotTest() { Function function = new SetMovableFunction(); function.setData("a"); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void setMovableFalseTest() { - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new SetMovableFunction(); function.setData("false"); - Slot slot = this.factory.createSlot(player); + Slot slot = this.getFactory().createSlot(player); function.setOwner(slot); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertFalse(slot.isMovable()); } @Test public void setMovableTrueTest() { - PlayerWrapper player = this.factory.createPlayer(); + PlayerWrapper player = this.getFactory().createPlayer(); Function function = new SetMovableFunction(); function.setData("true"); - Slot slot = this.factory.createSlot(player); + Slot slot = this.getFactory().createSlot(player); function.setOwner(slot); - assertTrue(function.function(this.factory.createPlayer())); + assertTrue(function.function(this.getFactory().createPlayer())); assertTrue(slot.isMovable()); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java index a599221e9..4ae742396 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java @@ -21,23 +21,21 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetNBTFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetNBTFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetNBTFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -45,14 +43,14 @@ public void notSlotTest() { Function function = new SetNBTFunction(); function.setData("asdf"); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void nbtTest() { String nbt = "asdf"; - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Gui gui = slot.getOwner(); InventoryWrapper inventory = gui.getInventoryWrapper(); Function function = new SetNBTFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java index bfd703c41..e0dc64501 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java @@ -21,23 +21,21 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetNameFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetNameFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetNameFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -45,14 +43,14 @@ public void notSlotTest() { Function function = new SetNameFunction(); function.setData("asdf"); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void nameTest() { String name = "asdf"; - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Gui gui = slot.getOwner(); InventoryWrapper inventory = gui.getInventoryWrapper(); Function function = new SetNameFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java index 3061c3e39..c52177e4a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java @@ -21,23 +21,21 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.gui.MockNonCloseableFunctionOwner; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SetTypeFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SetTypeFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SetTypeFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test @@ -45,14 +43,14 @@ public void notSlotTest() { Function function = new SetTypeFunction(); function.setData(Slot.TEST_MATERIAL); function.setOwner(new MockNonCloseableFunctionOwner()); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void typeTest() { String type = Slot.TEST_MATERIAL; - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Gui gui = slot.getOwner(); InventoryWrapper inventory = gui.getInventoryWrapper(); Function function = new SetTypeFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java index d9c3e352c..bebe34339 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java @@ -20,8 +20,8 @@ import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.SoundFunction; import com.clubobsidian.dynamicgui.core.gui.Slot; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.List; @@ -30,21 +30,19 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SoundFunctionTest { - - private final MockFactory factory = new MockFactory(); +public class SoundFunctionTest extends FactoryTest { @Test public void nullTest() { Function function = new SoundFunction(); - assertFalse(function.function(this.factory.createPlayer())); + assertFalse(function.function(this.getFactory().createPlayer())); } @Test public void soundTest() { String type = SoundWrapper.TEST_SOUND_STRING; - MockPlayerWrapper player = this.factory.createPlayer(); - Slot slot = this.factory.createSlot(player); + MockPlayerWrapper player = this.getFactory().createPlayer(); + Slot slot = this.getFactory().createSlot(player); Function function = new SoundFunction(); function.setOwner(slot); function.setData(type); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index b364f044f..282d67767 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -4,8 +4,8 @@ import com.clubobsidian.dynamicgui.core.gui.Slot; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.core.test.mock.test.ScheduledTest; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.ScheduledTest; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java index c8ece748c..273c71643 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java @@ -2,8 +2,7 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; -import org.junit.jupiter.api.BeforeEach; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; import java.util.List; @@ -11,17 +10,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class GuiManagerTest { +public class GuiManagerTest extends FactoryTest { private static final String TEST_GUI = "test"; - private final MockFactory factory = new MockFactory(); - - @BeforeEach - public void setup() { - this.factory.inject(); - } - @Test public void testGetGuiNotNull() { Gui gui = GuiManager.get().getGui(TEST_GUI); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java index bacff2ec8..05bfefe72 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java @@ -13,6 +13,6 @@ public MockFactory getFactory() { @BeforeEach public void setup() { - this.factory.inject(); + this.getFactory().inject(); } } \ No newline at end of file From 2ad7bd6321ddbceebda08f60059b98f382c38b65 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 15 Mar 2022 04:44:04 -0700 Subject: [PATCH 163/261] Update copyright --- .../bukkit/command/BukkitDynamicGuiCommand.java | 2 +- .../bukkit/command/BukkitGuiCommand.java | 2 +- .../dynamicgui/bukkit/command/CustomCommand.java | 2 +- .../bukkit/command/CustomCommandExecutor.java | 2 +- .../dynamicgui/bukkit/economy/VaultEconomy.java | 2 +- .../bukkit/entity/BukkitEntityWrapper.java | 2 +- .../bukkit/entity/BukkitPlayerWrapper.java | 2 +- .../bukkit/inject/BukkitPluginModule.java | 2 +- .../bukkit/inventory/BukkitInventoryWrapper.java | 2 +- .../bukkit/inventory/BukkitItemStackWrapper.java | 2 +- .../bukkit/listener/EntityClickListener.java | 2 +- .../bukkit/listener/InventoryCloseListener.java | 2 +- .../listener/InventoryInteractListener.java | 2 +- .../bukkit/listener/InventoryOpenListener.java | 2 +- .../bukkit/listener/PlayerInteractListener.java | 2 +- .../manager/entity/BukkitEntityManager.java | 2 +- .../inventory/BukkitInventoryManager.java | 2 +- .../inventory/BukkitItemStackManager.java | 2 +- .../manager/material/BukkitMaterialManager.java | 2 +- .../dynamicgui/bukkit/manager/package-info.java | 2 +- .../manager/world/BukkitLocationManager.java | 2 +- .../dynamicgui/bukkit/package-info.java | 2 +- .../bukkit/permission/FoundryPermission.java | 2 +- .../bukkit/permission/VaultPermission.java | 2 +- .../bukkit/platform/BukkitPlatform.java | 2 +- .../dynamicgui/bukkit/plugin/BukkitPlugin.java | 2 +- .../registry/model/ItemsAdderModelProvider.java | 2 +- .../registry/model/OraxenModelProvider.java | 2 +- .../bukkit/registry/npc/CitizensRegistry.java | 2 +- .../dynamicgui/bukkit/registry/package-info.java | 2 +- .../replacer/PlaceholderApiReplacerRegistry.java | 2 +- .../bukkit/scheduler/BukkitScheduler.java | 2 +- .../dynamicgui/bukkit/util/BukkitNBTUtil.java | 2 +- .../dynamicgui/bukkit/util/BukkitPacketUtil.java | 2 +- .../dynamicgui/bukkit/util/VersionUtil.java | 2 +- .../bukkit/world/BukkitWorldWrapper.java | 2 +- .../clubobsidian/dynamicgui/core/DynamicGui.java | 2 +- .../core/builder/EnchantmentBuilder.java | 2 +- .../dynamicgui/core/builder/FunctionBuilder.java | 2 +- .../core/builder/FunctionTokenBuilder.java | 2 +- .../dynamicgui/core/builder/GuiBuilder.java | 2 +- .../dynamicgui/core/builder/SlotBuilder.java | 2 +- .../dynamicgui/core/command/package-info.java | 2 +- .../core/config/ChatColorTransformer.java | 2 +- .../dynamicgui/core/config/Message.java | 2 +- .../dynamicgui/core/economy/Economy.java | 2 +- .../dynamicgui/core/effect/ParticleWrapper.java | 2 +- .../dynamicgui/core/effect/SoundWrapper.java | 2 +- .../core/enchantment/EnchantmentWrapper.java | 2 +- .../dynamicgui/core/entity/EntityWrapper.java | 2 +- .../dynamicgui/core/entity/PlayerWrapper.java | 2 +- .../core/event/DynamicGuiReloadEvent.java | 2 +- .../dynamicgui/core/event/InventoryEvent.java | 2 +- .../dynamicgui/core/event/LocationEvent.java | 2 +- .../dynamicgui/core/event/PlayerEvent.java | 2 +- .../core/event/block/PlayerInteractEvent.java | 2 +- .../dynamicgui/core/event/inventory/Click.java | 2 +- .../core/event/inventory/GuiLoadEvent.java | 2 +- .../core/event/inventory/GuiPreloadEvent.java | 2 +- .../event/inventory/InventoryClickEvent.java | 2 +- .../event/inventory/InventoryCloseEvent.java | 2 +- .../core/event/inventory/InventoryDragEvent.java | 2 +- .../core/event/inventory/InventoryOpenEvent.java | 2 +- .../inventory/PlayerInteractEntityEvent.java | 2 +- .../core/event/player/PlayerAction.java | 2 +- .../core/event/player/PlayerKickEvent.java | 2 +- .../core/event/player/PlayerQuitEvent.java | 2 +- .../dynamicgui/core/function/Function.java | 2 +- .../function/impl/AddPermissionFunction.java | 2 +- .../impl/CheckItemTypeInHandFunction.java | 2 +- .../core/function/impl/CheckLevelFunction.java | 2 +- .../core/function/impl/CheckMovableFunction.java | 2 +- .../function/impl/CheckPlayerWorldFunction.java | 2 +- .../function/impl/ConsoleCommandFunction.java | 2 +- .../core/function/impl/DelayFunction.java | 16 ++++++++++++++++ .../core/function/impl/GetGameRuleFunction.java | 2 +- .../function/impl/IsBedrockPlayerFunction.java | 2 +- .../core/function/impl/LogFunction.java | 2 +- .../core/function/impl/MoneyBalanceFunction.java | 2 +- .../core/function/impl/MoneyDepositFunction.java | 2 +- .../function/impl/MoneyWithdrawFunction.java | 2 +- .../core/function/impl/NoPermissionFunction.java | 2 +- .../core/function/impl/ParticleFunction.java | 2 +- .../core/function/impl/PermissionFunction.java | 2 +- .../function/impl/PlayerCommandFunction.java | 2 +- .../function/impl/PlayerMessageFunction.java | 2 +- .../function/impl/PlayerMiniMessageFunction.java | 2 +- .../function/impl/PlayerMsgJsonFunction.java | 2 +- .../core/function/impl/RandomFunction.java | 2 +- .../function/impl/RemovePermissionFunction.java | 2 +- .../core/function/impl/RemoveSlotFunction.java | 2 +- .../core/function/impl/ResetFrameFunction.java | 2 +- .../core/function/impl/ResetTickFunction.java | 2 +- .../core/function/impl/SendFunction.java | 2 +- .../function/impl/ServerBroadcastFunction.java | 2 +- .../impl/ServerBroadcastJsonFunction.java | 2 +- .../impl/ServerMiniBroadcastFunction.java | 2 +- .../core/function/impl/SetAmountFunction.java | 2 +- .../core/function/impl/SetCloseFunction.java | 2 +- .../function/impl/SetDurabilityFunction.java | 2 +- .../core/function/impl/SetEnchantsFunction.java | 2 +- .../core/function/impl/SetGameRuleFunction.java | 2 +- .../core/function/impl/SetGlowFunction.java | 2 +- .../core/function/impl/SetLoreFunction.java | 2 +- .../core/function/impl/SetMovableFunction.java | 2 +- .../core/function/impl/SetNBTFunction.java | 2 +- .../core/function/impl/SetNameFunction.java | 2 +- .../core/function/impl/SetTypeFunction.java | 2 +- .../core/function/impl/SoundFunction.java | 2 +- .../impl/condition/AfterDateLazyFunction.java | 2 +- .../impl/condition/BeforeDateLazyFunction.java | 16 ++++++++++++++++ .../impl/condition/CheckTickFunction.java | 2 +- .../impl/condition/ConditionFunction.java | 2 +- .../impl/condition/ContainsLazyFunction.java | 2 +- .../impl/condition/EndsWithLazyFunction.java | 2 +- .../impl/condition/EqualLazyFunction.java | 2 +- .../condition/IgnoreCaseEqualLazyFunction.java | 2 +- .../impl/condition/StartsWithLazyFunction.java | 2 +- .../impl/cooldown/IsNotOnCooldownFunction.java | 2 +- .../impl/cooldown/IsOnCooldownFunction.java | 2 +- .../impl/cooldown/SetCooldownFunction.java | 2 +- .../core/function/impl/gui/BackFunction.java | 2 +- .../core/function/impl/gui/GuiFunction.java | 2 +- .../core/function/impl/gui/HasBackFunction.java | 2 +- .../function/impl/gui/RefreshGuiFunction.java | 2 +- .../function/impl/gui/RefreshSlotFunction.java | 2 +- .../core/function/impl/gui/SetBackFunction.java | 2 +- .../impl/meta/CopyBackMetadataFunction.java | 2 +- .../function/impl/meta/HasMetadataFunction.java | 2 +- .../function/impl/meta/IsGuiMetadataSet.java | 2 +- .../function/impl/meta/SetMetadataFunction.java | 2 +- .../function/impl/test/AsyncThreadFunction.java | 16 ++++++++++++++++ .../function/impl/test/FalseAsyncFunction.java | 16 ++++++++++++++++ .../function/impl/test/MainThreadFunction.java | 16 ++++++++++++++++ .../dynamicgui/core/gui/FunctionOwner.java | 2 +- .../clubobsidian/dynamicgui/core/gui/Gui.java | 2 +- .../dynamicgui/core/gui/InventoryType.java | 2 +- .../dynamicgui/core/gui/InventoryView.java | 2 +- .../dynamicgui/core/gui/ModeEnum.java | 2 +- .../clubobsidian/dynamicgui/core/gui/Slot.java | 2 +- .../core/gui/property/CloseableComponent.java | 2 +- .../core/gui/property/MetadataHolder.java | 2 +- .../gui/property/animation/AnimationHolder.java | 2 +- .../core/gui/property/animation/Refreshable.java | 2 +- .../core/inject/module/PluginModule.java | 2 +- .../dynamicgui/core/inject/package-info.java | 2 +- .../core/inventory/InventoryWrapper.java | 2 +- .../core/inventory/ItemStackWrapper.java | 2 +- .../core/listener/EntityClickListener.java | 2 +- .../dynamicgui/core/listener/GuiListener.java | 2 +- .../core/listener/InventoryCloseListener.java | 2 +- .../core/listener/InventoryInteractListener.java | 2 +- .../core/listener/InventoryOpenListener.java | 2 +- .../core/listener/PlayerInteractListener.java | 2 +- .../core/logger/JavaLoggerWrapper.java | 2 +- .../dynamicgui/core/logger/LoggerWrapper.java | 2 +- .../dynamicgui/AnimationReplacerManager.java | 2 +- .../core/manager/dynamicgui/FunctionManager.java | 2 +- .../core/manager/dynamicgui/GuiManager.java | 2 +- .../manager/dynamicgui/MiniMessageManager.java | 2 +- .../core/manager/dynamicgui/ModelManager.java | 2 +- .../core/manager/dynamicgui/ReplacerManager.java | 2 +- .../core/manager/dynamicgui/SlotManager.java | 2 +- .../manager/dynamicgui/cooldown/Cooldown.java | 2 +- .../dynamicgui/cooldown/CooldownManager.java | 2 +- .../core/manager/entity/EntityManager.java | 2 +- .../core/manager/inventory/InventoryManager.java | 2 +- .../core/manager/inventory/ItemStackManager.java | 2 +- .../core/manager/material/MaterialManager.java | 2 +- .../core/manager/world/LocationManager.java | 2 +- .../core/messaging/MessagingRunnable.java | 2 +- .../dynamicgui/core/permission/Permission.java | 2 +- .../dynamicgui/core/platform/Platform.java | 2 +- .../dynamicgui/core/platform/PlatformType.java | 2 +- .../dynamicgui/core/plugin/DynamicGuiPlugin.java | 2 +- .../dynamicgui/core/proxy/Proxy.java | 2 +- .../core/registry/model/ModelProvider.java | 2 +- .../model/vanilla/VanillaModelProvider.java | 2 +- .../dynamicgui/core/registry/npc/NPC.java | 2 +- .../dynamicgui/core/registry/npc/NPCMeta.java | 2 +- .../core/registry/npc/NPCRegistry.java | 2 +- .../dynamicgui/core/registry/package-info.java | 2 +- .../replacer/AnimationReplacerRegistry.java | 2 +- .../core/registry/replacer/ReplacerRegistry.java | 2 +- .../replacer/impl/CooldownReplacerRegistry.java | 2 +- .../DynamicGuiAnimationReplacerRegistry.java | 2 +- .../impl/DynamicGuiReplacerRegistry.java | 2 +- .../replacer/impl/MetadataReplacerRegistry.java | 2 +- .../core/replacer/AnimationReplacer.java | 2 +- .../dynamicgui/core/replacer/Replacer.java | 2 +- .../impl/MultiLineTestAnimationReplacer.java | 2 +- .../animation/impl/TestAnimationReplacer.java | 2 +- .../replacer/impl/GlobalPlayerCountReplacer.java | 2 +- .../replacer/impl/OnlinePlayersReplacer.java | 2 +- .../core/replacer/impl/PlayerLevelReplacer.java | 2 +- .../core/replacer/impl/PlayerReplacer.java | 2 +- .../core/replacer/impl/PreviousGuiReplacer.java | 2 +- .../core/replacer/impl/UUIDReplacer.java | 2 +- .../dynamicgui/core/scheduler/Scheduler.java | 2 +- .../dynamicgui/core/util/ChatColor.java | 2 +- .../dynamicgui/core/util/HashUtil.java | 2 +- .../dynamicgui/core/util/ReflectionUtil.java | 2 +- .../dynamicgui/core/util/ThreadUtil.java | 16 ++++++++++++++++ .../dynamicgui/core/world/LocationWrapper.java | 2 +- .../dynamicgui/core/world/WorldWrapper.java | 2 +- .../test/builder/EnchantmentBuilderTest.java | 2 +- .../core/test/builder/FunctionBuilderTest.java | 2 +- .../test/config/ChatColorTransformerTest.java | 2 +- .../dynamicgui/core/test/config/MessageTest.java | 2 +- .../test/function/AddPermissionFunctionTest.java | 2 +- .../CheckItemInTypeHandFunctionTest.java | 2 +- .../test/function/CheckLevelFunctionTest.java | 2 +- .../test/function/CheckMovableFunctionTest.java | 2 +- .../function/CheckPlayerWorldFunctionTest.java | 2 +- .../function/ConsoleCommandFunctionTest.java | 2 +- .../core/test/function/DelayFunctionTest.java | 2 +- .../test/function/GetGameRuleFunctionTest.java | 2 +- .../function/IsBedrockPlayerFunctionTest.java | 2 +- .../function/IsNotOnCooldownFunctionTest.java | 2 +- .../test/function/IsOnCooldownFunctionTest.java | 2 +- .../core/test/function/LogFunctionTest.java | 2 +- .../test/function/MoneyBalanceFunctionTest.java | 2 +- .../test/function/MoneyDepositFunctionTest.java | 2 +- .../test/function/MoneyWithdrawFunctionTest.java | 2 +- .../test/function/NoPermissionFunctionTest.java | 2 +- .../core/test/function/ParticleFunctionTest.java | 2 +- .../test/function/PermissionFunctionTest.java | 2 +- .../test/function/PlayerCommandFunctionTest.java | 2 +- .../test/function/PlayerMessageFunctionTest.java | 2 +- .../function/PlayerMiniMessageFunctionTest.java | 2 +- .../test/function/PlayerMsgJsonFunctionTest.java | 2 +- .../core/test/function/RandomFunctionTest.java | 2 +- .../function/RemovePermissionFunctionTest.java | 2 +- .../test/function/RemoveSlotFunctionTest.java | 2 +- .../test/function/ResetFrameFunctionTest.java | 2 +- .../test/function/ResetTickFunctionTest.java | 2 +- .../core/test/function/SendFunctionTest.java | 2 +- .../function/ServerBroadcastFunctionTest.java | 2 +- .../ServerBroadcastJsonFunctionTest.java | 2 +- .../ServerMiniBroadcastFunctionTest.java | 2 +- .../test/function/SetAmountFunctionTest.java | 2 +- .../core/test/function/SetCloseFunctionTest.java | 2 +- .../test/function/SetCooldownFunctionTest.java | 2 +- .../test/function/SetDurabilityFunctionTest.java | 2 +- .../test/function/SetEnchantsFunctionTest.java | 2 +- .../test/function/SetGameRuleFunctionTest.java | 2 +- .../core/test/function/SetGlowFunctionTest.java | 2 +- .../core/test/function/SetLoreFunctionTest.java | 2 +- .../test/function/SetMovableFunctionTest.java | 2 +- .../core/test/function/SetNBTFunctionTest.java | 2 +- .../core/test/function/SetNameFunctionTest.java | 2 +- .../core/test/function/SetTypeFunctionTest.java | 2 +- .../core/test/function/SoundFunctionTest.java | 2 +- .../core/test/manager/FunctionManagerTest.java | 16 ++++++++++++++++ .../core/test/manager/GuiManagerTest.java | 16 ++++++++++++++++ .../dynamicgui/core/test/mock/MockFactory.java | 2 +- .../core/test/mock/entity/package-info.java | 2 +- .../core/test/mock/entity/player/MockPlayer.java | 2 +- .../mock/entity/player/MockPlayerWrapper.java | 2 +- .../mock/gui/MockCloseableFunctionOwner.java | 2 +- .../mock/gui/MockNonCloseableFunctionOwner.java | 2 +- .../core/test/mock/inject/MockPluginModule.java | 2 +- .../core/test/mock/inventory/MockInventory.java | 2 +- .../mock/inventory/MockInventoryWrapper.java | 2 +- .../core/test/mock/inventory/MockItemStack.java | 2 +- .../mock/inventory/MockItemStackWrapper.java | 2 +- .../core/test/mock/logger/MockLogger.java | 2 +- .../core/test/mock/logger/MockLoggerWrapper.java | 2 +- .../test/mock/manager/MockEntityManager.java | 2 +- .../test/mock/manager/MockInventoryManager.java | 2 +- .../test/mock/manager/MockItemStackManager.java | 2 +- .../test/mock/manager/MockLocationManager.java | 2 +- .../test/mock/manager/MockMaterialManager.java | 2 +- .../test/mock/plugin/MockDynamicGuiPlugin.java | 2 +- .../core/test/mock/plugin/MockEconomy.java | 2 +- .../core/test/mock/plugin/MockPermission.java | 2 +- .../core/test/mock/plugin/MockPlatform.java | 2 +- .../core/test/mock/scheduler/MockScheduler.java | 2 +- .../core/test/mock/scheduler/MockTask.java | 16 ++++++++++++++++ .../test/mock/scheduler/MockThreadRunnable.java | 16 ++++++++++++++++ .../core/test/mock/test/FactoryTest.java | 16 ++++++++++++++++ .../core/test/mock/test/ScheduledTest.java | 16 ++++++++++++++++ .../core/test/mock/world/MockLocation.java | 2 +- .../test/mock/world/MockLocationWrapper.java | 2 +- .../core/test/mock/world/MockWorld.java | 2 +- .../core/test/mock/world/MockWorldWrapper.java | 2 +- .../dynamicgui/core/test/package-info.java | 2 +- .../dynamicgui/core/test/proxy/ProxyTest.java | 2 +- .../dynamicgui/parser/function/FunctionData.java | 2 +- .../parser/function/FunctionModifier.java | 2 +- .../parser/function/FunctionToken.java | 2 +- .../dynamicgui/parser/function/FunctionType.java | 2 +- .../parser/function/FunctionTypeParser.java | 2 +- .../parser/function/tree/FunctionNode.java | 2 +- .../parser/function/tree/FunctionTree.java | 2 +- .../dynamicgui/parser/gui/GuiMode.java | 2 +- .../dynamicgui/parser/gui/GuiToken.java | 2 +- .../dynamicgui/parser/macro/MacroParser.java | 2 +- .../dynamicgui/parser/macro/MacroToken.java | 2 +- .../dynamicgui/parser/package-info.java | 2 +- .../dynamicgui/parser/slot/SlotToken.java | 2 +- .../dynamicgui/parser/test/FunctionDataTest.java | 2 +- .../parser/test/FunctionModifierTest.java | 2 +- .../dynamicgui/parser/test/FunctionTreeTest.java | 2 +- .../parser/test/FunctionTypeParserTest.java | 2 +- .../dynamicgui/parser/test/FunctionTypeTest.java | 2 +- .../dynamicgui/parser/test/GuiTokenTest.java | 2 +- .../dynamicgui/parser/test/SlotTokenTest.java | 2 +- .../test/functiontree/EmptyFunctionTreeTest.java | 2 +- .../dynamicgui/parser/test/gui/AliasTest.java | 2 +- .../parser/test/gui/GuiMetadataTest.java | 2 +- .../parser/test/gui/InvalidTypeTest.java | 2 +- .../parser/test/gui/LoadMacrosTest.java | 2 +- .../dynamicgui/parser/test/gui/LocationTest.java | 2 +- .../dynamicgui/parser/test/gui/NoModeTest.java | 2 +- .../dynamicgui/parser/test/gui/StaticTest.java | 2 +- .../parser/test/gui/ValidTypeTest.java | 2 +- .../parser/test/macro/MacroNonStringTest.java | 2 +- .../parser/test/macro/MacroParserTest.java | 2 +- .../parser/test/macro/MacrosTokenTest.java | 2 +- .../test/macro/MultiMacroSameFileTest.java | 2 +- .../dynamicgui/parser/test/slot/EnchantTest.java | 2 +- .../parser/test/slot/InvalidAmountTest.java | 2 +- .../test/slot/InvalidFunctionTypeMacroTest.java | 2 +- .../test/slot/InvalidSlotDataMacroTest.java | 2 +- .../test/slot/InvalidUpdateIntervalTest.java | 2 +- .../parser/test/slot/ItemFlagTest.java | 2 +- .../dynamicgui/parser/test/slot/LoreTest.java | 2 +- .../dynamicgui/parser/test/slot/ModelTest.java | 2 +- .../dynamicgui/parser/test/slot/MovableTest.java | 2 +- .../parser/test/slot/SlotIndexTest.java | 2 +- .../parser/test/slot/SlotMetadataTest.java | 2 +- .../parser/test/slot/ValidAmountTest.java | 2 +- .../test/slot/ValidFunctionTypeMacroTest.java | 2 +- .../parser/test/slot/ValidSlotDataMacroTest.java | 2 +- .../test/slot/ValidUpdateIntervalTest.java | 2 +- 336 files changed, 516 insertions(+), 324 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index 7ebb45292..fd39c62ff 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java index 8da91a302..48e0b6340 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java index f7a02d114..28b2f4f4a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java index b246d0814..9968cafa6 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java index b32e3e58a..f169ab318 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java index 9d1676124..616399069 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index ca8978977..411755379 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index 8e26cdfd0..e8bb0c6bb 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java index 03cbce190..85d402d45 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index 2d4f4cd86..328795c2a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java index af58200da..51f25f7d4 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java index 704626f86..ebb84fcb8 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index 522f77197..c3b9e926a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java index 0c11d134f..664c6479f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index 40f3d3841..c4a3d4497 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java index 684189b5e..14464dde2 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index 09d91a66b..f37caa44c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java index cd18a0a7a..128304309 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java index 89196d569..14767f326 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java index 6787f6f40..f661586ca 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java index 943dcf7fc..5e54d93c3 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java index 2191f0431..c615beb8b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java index f63ef647d..61aac5670 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java index 7cb371760..6e539582c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index b9819f506..f51020fcf 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 4f6354cff..6a0e6f1a3 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 8d6ca6de1..8c9398899 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java index 169499ea6..d04a98d30 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java index 38be4352d..c66827a31 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java index ac22ce66b..8cfecae83 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java index f72449e38..57eb73fb1 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java index ee35ceee6..659871664 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index 4c4c4c731..13bf7190b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java index 1bbb79633..1e4148f34 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java index fe3923cf4..f8a380112 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java index fb3a59df3..75446896e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 8093ac4c9..7bd099551 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java index 91e2c2591..7a95d7847 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java index fb7596802..b360f6cb8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java index a5974ca04..2949dfa33 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index 9d1c8928c..d4c781f82 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java index cc828bb86..64e4854c2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java index ae3b14c68..977698320 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java index 529566496..f2358aa6d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java index 3e138404b..1fe65cd55 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java index 0cf8cc3c2..273c171a9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java index e38a1d1cd..abe87f8d0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index 9503188ad..e5e86316f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java index 5c834ec70..6a20fe35a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java index 3d3945074..a10dbf236 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index ba8deae45..bdd7c89da 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java index 679d63a95..b4b22fd5a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java index ce99dda1b..473a13e28 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java index 89306d096..7cfe6f741 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java index 4266b0e67..e05ae6969 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java index d01a2323b..c3a27fa5c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java index 4314b45fc..8736284f0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java index ee68f66d0..606688756 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java index 87076a105..812eeee66 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java index b1c6cbd97..9bfb4150f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java index f93913a84..282e77e0b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java index b9bea3e64..1123026a1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java index 4e3cf08f5..f717a3066 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java index 64d0a13b0..b0ff91298 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java index d88e00453..1565150de 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java index 72bf3f028..7fa659981 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java index 4c2a9c364..c6f37ce9d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index bc21b9bb3..ce5517f62 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java index a3558c1c6..08cea7d46 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java index cf2f2d625..714688ef2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java index 092d1e0a2..0d3089157 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java index 41fc57226..931945b87 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckMovableFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java index 13c154346..a2d4901cc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java index fac563c4a..df56b2a1a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java index 7335a0464..9d0cdae0c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/DelayFunction.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java index be8a762a2..fd56fd7a3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java index 32d6e897e..31dfef9f8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java index cd3db416e..9e8087112 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java index 7d5d3a730..825de61cc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java index 8d07fd102..cfbb2cf2d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java index ef9909865..aace5c39c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java index 2365aa0c4..a8ef666c2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java index 1bd035ba2..21141b8fd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java index fcbff13ce..a34672274 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java index a7d05b46c..d0515de6b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java index 20647946b..699d6ae19 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java index eac444261..68c41e44d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMiniMessageFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java index 9fc2bff59..18849e286 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java index b48b8398e..5134e0338 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java index 7e1003351..ea3d3d23b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java index 24c135ce2..263bab430 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java index 979b457a7..b9ffb5f3c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java index 77c660110..6b69f5f74 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java index a6c1afd0d..835b34d29 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java index 3e4f81690..68a0f7bd8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java index c6cf2dbf6..51fd0db80 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java index c6477c8f0..66f580f95 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerMiniBroadcastFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java index b3c4141bd..10eefe6ab 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java index e03a8d099..c8a62eccd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java index c2cc4f14d..3b868fbe8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java index 6c8b159e3..88716f2a4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java index 44b632b58..c950cd626 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java index 274b51ff2..a0db129a0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java index 096c42e48..4a5d7988d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java index 50a7954dd..14a482fb7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetMovableFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java index a2f24d004..b4725fc1e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java index 9f5671d54..780dd4b1a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java index 13cf3a4dd..28336823c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java index 9e9a095e7..bc18f6874 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java index 7d1559cc3..d20addb26 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/AfterDateLazyFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java index 20458a004..25453c0e9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/BeforeDateLazyFunction.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java index 3c832a898..d47675006 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java index c4ccc3520..46a9f9a35 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java index c6e4267d3..bde8967f3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java index d7f393962..66bcf113c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java index 4217e7f13..323d8084b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java index 680177a7e..51e0994a6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java index b06cf0ba8..a6df758ef 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java index 8aa6028f7..1e9075ae3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java index 977213474..8f3ce3145 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java index a9c00c865..44d83cbad 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java index 6ea63a238..6e564e321 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java index de7c0376f..a188213f4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java index f15d7f106..aae84e9ce 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java index ac16a3c5b..84d7cb1e8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java index e639bbd64..9ba21cfac 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java index 4f684c4d9..e06d43790 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java index c47209602..854a26b56 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java index 9710166af..f3b326450 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java index 9e73ab7f7..bb13e22da 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/IsGuiMetadataSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java index 3b958bb53..b3fbe5271 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java index de18c0902..ae742b51c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/AsyncThreadFunction.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.function.impl.test; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java index 955d22e5f..82476b48a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/FalseAsyncFunction.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.function.impl.test; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java index 833fd38be..590fec5d6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/test/MainThreadFunction.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.function.impl.test; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java index ec47bd63b..6220f4918 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index a5f2cf658..f82665f54 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java index 3822f93de..5ad15f290 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java index 37eacb8a6..9e0f335fe 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java index e4cedbe15..f2629942d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 09eb35135..a4dbbff6c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java index dd9811d83..b7bc71157 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/CloseableComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java index 0f0238329..abc21fdb4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/MetadataHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java index ae1be442d..960935abd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java index fff08a585..ee5435929 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index d0edfde4d..1f9c00f92 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java index 21cd49743..01555e145 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java index 3b49cfd02..7f8ce9b6c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java index b9a0b6163..1049540bd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java index a41db56b2..4c09331da 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index cf79981f5..3097e0666 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java index 06468914a..e1b3abd90 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 2b918356f..7239bff46 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java index e9a17cd19..f5a08e99e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 14e01f1c2..5bec3daf6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java index 46d736861..7c61a9ed3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java index 75a24e723..009e5a8ae 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java index ccc5bd4b4..a48f8df82 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index b9a6564e9..aa7c4da24 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 87c07d2ad..a7c43b0bf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java index 065f266e0..cf8690b11 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java index eff591c22..50ebae5e8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ModelManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java index d4456ac30..a9330a020 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java index d39109d60..2cf8650a1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java index 62a4bbc59..adb45b9b9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java index 6eae56e8e..28c305b0c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java index 9648416f9..52f6a9443 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java index 005daf258..a45d3b63d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java index 1d5046e62..bced4d5d9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java index 8ea57d423..576c5285b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java index 354b52528..41d8963dd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java index 4606f7918..90cce25aa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java index 94abdd1f3..e38f74bdc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java index 979648050..275dd6bb3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java index 2714a9455..c6189f9c1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index 9e416f942..efcaf7ebc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java index faca51800..11dd4d6b3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java index d64b41731..8aefb987f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/ModelProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java index ecb265d9d..a9b540611 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/model/vanilla/VanillaModelProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java index 31973b484..3dadaf9e3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java index c3d176bcf..a1efcc774 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java index c91e1a179..a631b6334 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java index cf0f93faa..36ee52f96 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java index 82452f95a..840d94939 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java index d20c3cdbd..b5d798082 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java index 05ccf8af6..ba1b33929 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java index 13facd809..216298b61 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java index cb59bdeed..8596f8e74 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java index 1745c94ae..2a72ddc5a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java index 5ece33e6f..236271bb8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java index c5b5c9daf..be4381d7f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java index 2a6642a53..8267f3ee7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java index a93c8d80a..cf5335232 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java index 2f8446c76..9dbf04a6a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java index 1d5cd4540..8a16ce9a5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java index 9499d1556..8fb634080 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java index 0aeadb6a3..3e3cbd976 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java index 7aec1aea2..1652e02e4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java index f4d2b15f5..468d1ea79 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java index b936a877e..337760c7e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java index fabd483d3..dc5ca0cbf 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java index 4772dfa34..0f2afe4a4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index 53dce7674..2e6cbc34a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java index 5950327e5..e73a5ba2a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ThreadUtil.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.util; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java index 5ffbc3856..c434f06d3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java index 65c572e93..843b75ff4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java index 7d3f8558a..1a31dff42 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/EnchantmentBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java index 1b7237782..25de7a654 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/builder/FunctionBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java index bb0da8925..bb4a1c82e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java index 64baa9308..9eeee3a80 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/MessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java index d42159976..39baaf93b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java index aed29d70a..1495f9182 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java index abe834587..c7a7351a2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java index 61adae961..42a2c216a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java index 4a10fac96..319a99bb7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java index 39bb569e5..924e99b5e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index b9e420dfd..17992b2e9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java index 29f109921..d00425e58 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java index c2e84cf3e..6125a8577 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java index 1e13f32d9..910d93fa2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java index bd247d467..8593c296f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java index fb2451a96..d9471cc85 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java index 51f8c4e1e..4a3dfec9f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java index ceadaa74c..972fed49c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java index 3a934c9e3..65daa6d8f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java index 0ef754210..6b3d966ff 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java index 211205186..ac847b7ca 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java index 87fc27218..a27f841b0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java index 0459d77c0..b85cb1d51 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java index 0c7357450..9cbbb4a3d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java index becaf6d5d..ef031d525 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java index 5064c60ed..64cd5d8a6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java index e9efbefc3..531d708b9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java index 2a0ce34b9..8c2671a7e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java index 3e0119174..8acbe2004 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java index ebbe366c2..15a294339 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java index 2cb7e96db..db8202500 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java index 063104e8a..801914565 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java index 07acfa223..1740c0ab6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java index f88627bf4..ee91ab91b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java index c378bf1a1..5cd3a135d 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java index bf1d0078e..8056e31e5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java index 21470ad81..1c82268be 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java index a017bb5fe..d13cf35f1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java index b8380a51d..e178a08bf 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java index 1baffd226..5680db308 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java index 0c15fefb4..7bfb52f1a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java index 7229862c3..6e006a1b5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java index 6e5641d65..4b26c74f4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java index 9f492f8c8..a1cc4c5c1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java index 4ae742396..c5f8ed1a1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java index e0dc64501..d0531a37a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java index c52177e4a..f2c15be8f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java index bebe34339..5ac6758cf 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 282d67767..aeacb07de 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.test.manager; import com.clubobsidian.dynamicgui.core.gui.Gui; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java index 273c71643..f0d0d91b7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.test.manager; import com.clubobsidian.dynamicgui.core.gui.Gui; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index bf83ae045..0e29a83ca 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java index fa2b065f6..9be54d3d0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java index f3a2a84cc..25f17bda3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index 9d633d66f..eb3d9e36f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java index 191c5a8d4..eb3a996b8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockCloseableFunctionOwner.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java index c9c704a15..ad23f14cb 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/gui/MockNonCloseableFunctionOwner.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java index cf33137ef..c3f5c2087 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java index 14305ccd7..7ecb8c3f0 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventory.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java index 2d28f959b..bdcf23b14 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockInventoryWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java index 6a168c3e6..c42e2f2f9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStack.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java index 2ad7f5730..eb2e1b240 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inventory/MockItemStackWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java index 948c77ca1..d0c63bba2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java index 844354f0b..63df4757b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/logger/MockLoggerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java index ae8ab311f..022e97b2f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockEntityManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java index 7ee0b0e31..fad2293b1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockInventoryManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java index b84836d1d..55b23c582 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockItemStackManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java index 79171964d..aee872a11 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockLocationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java index a323bcda8..1136e486f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/manager/MockMaterialManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index babb2ef04..c296ca9d2 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java index 50399eab1..1d7d57044 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockEconomy.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java index 2fb5abfe7..e6c8690ce 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPermission.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 4814f4961..664dd0627 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java index 9ce7f9529..d6e5b5191 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockScheduler.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java index bc8d23b2a..49fe47b24 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockTask.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.test.mock.scheduler; public class MockTask implements Runnable { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java index 29222fb93..387cfb9c5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/scheduler/MockThreadRunnable.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.test.mock.scheduler; import java.util.Collection; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java index 05bfefe72..458e940aa 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/FactoryTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.test.mock.test; import com.clubobsidian.dynamicgui.core.test.mock.MockFactory; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java index 9923b4539..85b48e0f5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/test/ScheduledTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.clubobsidian.dynamicgui.core.test.mock.test; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java index 7dc244058..8d98a3cbe 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java index cf3abf97c..57140c802 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockLocationWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java index 464a68782..0f70c3ba8 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorld.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java index 34ec647e6..c50568276 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/world/MockWorldWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java index d7ed98c2a..dbfab3ad1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java index 31e35b077..cfead302a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/proxy/ProxyTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java index 0c26bc6d7..90a22c998 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java index 27d77a8c1..ba8fe6c23 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java index 17f8c06c1..7061f762a 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java index 0d431186e..cef683dd1 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java index 90030d300..fc71e8627 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java index 7ab62d26a..610d66451 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java index 2965066d0..d837506b1 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java index c519aee1a..4ea832fc9 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java index 4095465e3..476a74fad 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java index ce07d4441..1d44d5f94 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java index 5ce065918..fd0561509 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java index e02375768..7990c98b9 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index 60eaad56d..1b120e411 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java index 0227306d7..1424e463b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionDataTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java index 26dda61f0..f1b11260f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionModifierTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java index 66a958647..5e7b9b6cc 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java index 710a1e1b6..adb103e32 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java index c00d4f5b7..a331e52f4 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java index 266a93e0a..a4b0db407 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java index 280fd32f6..6d6666df4 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java index 75dfd535f..86eef514a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/functiontree/EmptyFunctionTreeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java index 8da567f84..f9c3ef41b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/AliasTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java index 620cf8884..69c870497 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/GuiMetadataTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java index 31c111cfb..a2dc2af61 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/InvalidTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java index 905f0192d..a9ede852d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LoadMacrosTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java index b55b80fde..e527b331d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/LocationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java index c1bff3469..b68038c1a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/NoModeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java index b924e8ad5..1a13aeb15 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/StaticTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java index b957af045..7f529301c 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/gui/ValidTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java index 6642e8497..5e7641ebc 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroNonStringTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java index c9242d453..2eb27f213 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacroParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java index c5d6438b9..e372b277b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MacrosTokenTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java index f3a4c3a2b..2f3123a49 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/macro/MultiMacroSameFileTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java index dfca14a65..1459bc245 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/EnchantTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java index 1892b5283..57b0f851a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidAmountTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java index ddb877769..09b3ebdbc 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidFunctionTypeMacroTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java index c87317d5e..d9b120381 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidSlotDataMacroTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java index be904079f..80e44612b 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/InvalidUpdateIntervalTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java index c4886c95a..cc101ee9c 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ItemFlagTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java index 6bfc4d55e..af632481f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/LoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java index afc50cf60..3a117339f 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ModelTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java index e17759a3f..baaa34ee6 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/MovableTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java index ceefde777..1335b9d9e 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotIndexTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java index d7c30cd60..44603360a 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/SlotMetadataTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java index 132147d1b..edfa51669 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidAmountTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java index b51124a7f..9c608af07 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidFunctionTypeMacroTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java index e2709d8f9..ebe05dc42 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidSlotDataMacroTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java index 67d74f450..89e91e04d 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/slot/ValidUpdateIntervalTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Club Obsidian and contributors. + * Copyright 2022 virustotalop and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From c1edb968c77f90975748e106b1c4190731d2d404 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 16 Mar 2022 00:20:51 -0700 Subject: [PATCH 164/261] Create logged in function --- .../bukkit/entity/BukkitPlayerWrapper.java | 5 ++ .../dynamicgui/core/DynamicGui.java | 3 + .../dynamicgui/core/entity/PlayerWrapper.java | 1 + .../core/function/impl/LoggedInFunction.java | 39 ++++++++++++ .../test/function/LoggedInFunctionTest.java | 59 +++++++++++++++++++ .../test/mock/entity/player/MockPlayer.java | 9 +++ .../mock/entity/player/MockPlayerWrapper.java | 9 +++ .../core/test/mock/plugin/MockPlatform.java | 13 +++- 8 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LoggedInFunction.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 411755379..d80b3ac27 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -166,4 +166,9 @@ public LocationWrapper getLocation() { Location bukkitLoc = this.getPlayer().getLocation(); return LocationManager.get().toLocationWrapper(bukkitLoc); } + + @Override + public boolean isOnline() { + return this.getPlayer().isOnline(); + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 7bd099551..ef7c25adb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -25,6 +25,7 @@ import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; +import com.clubobsidian.dynamicgui.core.function.impl.LoggedInFunction; import com.clubobsidian.dynamicgui.core.function.impl.test.AsyncThreadFunction; import com.clubobsidian.dynamicgui.core.function.impl.test.FalseAsyncFunction; import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; @@ -360,7 +361,9 @@ private void loadFunctions() { FunctionManager.get().addFunction(new IsBedrockPlayerFunction()); + //Async related FunctionManager.get().addFunction(new DelayFunction()); + FunctionManager.get().addFunction(new LoggedInFunction()); //Test functions FunctionManager.get().addFunction(new FalseAsyncFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index bdd7c89da..a631eca91 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -76,4 +76,5 @@ public T getPlayer() { public abstract LocationWrapper getLocation(); + public abstract boolean isOnline(); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LoggedInFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LoggedInFunction.java new file mode 100644 index 000000000..b0b9b93c7 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LoggedInFunction.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.function.impl; + +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; + +import java.util.UUID; + +public class LoggedInFunction extends Function { + + public LoggedInFunction() { + super("loggedin"); + } + + @Override + public boolean function(PlayerWrapper playerWrapper) { + Object wrapperNative = playerWrapper.getPlayer(); + UUID uuid = playerWrapper.getUniqueId(); + PlayerWrapper retrieved = DynamicGui.get().getPlatform().getPlayer(uuid); + Object retrievedNative = retrieved != null ? retrieved.getPlayer() : null; + return retrieved == null || !playerWrapper.isOnline() || !wrapperNative.equals(retrievedNative) ? false : true; + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java new file mode 100644 index 000000000..cc4dd40b2 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.function.impl.LoggedInFunction; +import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class LoggedInFunctionTest extends FactoryTest { + + @Test + public void testLoggedOff() { + Function function = new LoggedInFunction(); + MockPlayerWrapper player = this.getFactory().createPlayer(); + this.getFactory().getPlatform().getOnlinePlayers().add(player); + player.setOnline(false); + assertFalse(function.function(player)); + } + + @Test + public void testLoggedOffNullRetrieval() { + Function function = new LoggedInFunction(); + assertFalse(function.function(this.getFactory().createPlayer())); + } + + @Test + public void testLoggedOffAndBackOn() { + Function function = new LoggedInFunction(); + this.getFactory().getPlatform().getOnlinePlayers().add(this.getFactory().createPlayer()); + assertFalse(function.function(this.getFactory().createPlayer())); + } + + @Test + public void testOnline() { + Function function = new LoggedInFunction(); + MockPlayerWrapper player = this.getFactory().createPlayer(); + this.getFactory().getPlatform().getOnlinePlayers().add(player); + assertTrue(function.function(player)); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java index 25f17bda3..def2afd67 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayer.java @@ -39,6 +39,7 @@ public class MockPlayer { private LocationWrapper location; private final List particles = new ArrayList<>(); private final List sounds = new ArrayList<>(); + private boolean online = true; public MockPlayer(String name, UUID uuid) { this.name = name; @@ -124,4 +125,12 @@ public void playSound(SoundWrapper.SoundData soundData) { public List getSounds() { return this.sounds; } + + public boolean isOnline() { + return this.online; + } + + public void setOnline(boolean online) { + this.online = online; + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java index eb3d9e36f..91ee5440c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/player/MockPlayerWrapper.java @@ -129,4 +129,13 @@ public void playSound(SoundWrapper.SoundData soundData) { public List getSounds() { return this.getPlayer().getSounds(); } + + @Override + public boolean isOnline() { + return this.getPlayer().isOnline(); + } + + public void setOnline(boolean online) { + this.getPlayer().setOnline(online); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java index 664dd0627..fba069774 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockPlatform.java @@ -38,6 +38,7 @@ public class MockPlatform implements Platform { private final List dispatchedServerCommands = new ArrayList<>(); private final MockScheduler scheduler = new MockScheduler(); private final List broadcastMessages = new ArrayList<>(); + private final List> players = new ArrayList<>(); @Override public Scheduler getScheduler() { @@ -74,17 +75,27 @@ public List getDispatchedServerCommands() { @Override public PlayerWrapper getPlayer(UUID uuid) { + for (PlayerWrapper player : this.players) { + if(player.getUniqueId().equals(uuid)) { + return player; + } + } return null; } @Override public PlayerWrapper getPlayer(String name) { + for (PlayerWrapper player : this.players) { + if(player.getName().equals(name)) { + return player; + } + } return null; } @Override public Collection> getOnlinePlayers() { - return null; + return this.players; } @Override From 7f1da61dc7f6d0347d42dfd4bdb0af0050a341e7 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 19 Mar 2022 20:19:34 -0700 Subject: [PATCH 165/261] Rename function manager test methods --- .../core/test/manager/FunctionManagerTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index aeacb07de..6fa9a0049 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -34,7 +34,7 @@ public class FunctionManagerTest extends ScheduledTest { @Test - public void testPassing() throws ExecutionException, InterruptedException { + public void testTryFunctionsPassing() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(0); @@ -44,7 +44,7 @@ public void testPassing() throws ExecutionException, InterruptedException { } @Test - public void testFailing() throws ExecutionException, InterruptedException { + public void testTryFunctionsFailing() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(1); @@ -54,7 +54,7 @@ public void testFailing() throws ExecutionException, InterruptedException { } @Test - public void testAsync() throws ExecutionException, InterruptedException { + public void testTryFunctionsAsync() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(2); @@ -67,7 +67,7 @@ public void testAsync() throws ExecutionException, InterruptedException { } @Test - public void testMainThread() throws ExecutionException, InterruptedException { + public void testTryFunctionsMainThread() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(3); @@ -75,7 +75,7 @@ public void testMainThread() throws ExecutionException, InterruptedException { } @Test - public void testAsyncThread() throws ExecutionException, InterruptedException { + public void testTryFunctionsAsyncThread() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Gui gui = GuiManager.get().getGui("test"); Slot slot = gui.getSlots().get(4); From 9990d64c541a9ad9a519140921e0e0973db67414 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 19 Mar 2022 20:36:24 -0700 Subject: [PATCH 166/261] Implement async running function --- .../dynamicgui/core/DynamicGui.java | 2 + .../core/function/AsyncRunningFunction.java | 32 +++++++++++++++ .../manager/dynamicgui/FunctionManager.java | 40 +++++++++++++++++-- .../function/AsyncRunningFunctionTest.java | 35 ++++++++++++++++ .../test/manager/FunctionManagerTest.java | 24 +++++++++++ 5 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index ef7c25adb..bd83fc09c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.AsyncRunningFunction; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; @@ -364,6 +365,7 @@ private void loadFunctions() { //Async related FunctionManager.get().addFunction(new DelayFunction()); FunctionManager.get().addFunction(new LoggedInFunction()); + FunctionManager.get().addFunction(new AsyncRunningFunction()); //Test functions FunctionManager.get().addFunction(new FalseAsyncFunction()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java new file mode 100644 index 000000000..3d5c72762 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java @@ -0,0 +1,32 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.function; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; + +public class AsyncRunningFunction extends Function { + + public AsyncRunningFunction() { + super("asyncrunning"); + } + + @Override + public boolean function(PlayerWrapper playerWrapper) { + return FunctionManager.get().hasAsyncFunctionRunning(playerWrapper); + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index aa7c4da24..52bfa1c21 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -34,18 +34,20 @@ import java.util.List; import java.util.Map; import java.util.Queue; +import java.util.UUID; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; public class FunctionManager { private static FunctionManager instance; - private final Map functions; + private final Map functions = new HashMap<>(); + private final Map runningAsyncFunctions = new ConcurrentHashMap<>(); private FunctionManager() { - this.functions = new HashMap<>(); } public static FunctionManager get() { @@ -84,6 +86,15 @@ public boolean removeFunctionByName(String functionName) { return this.functions.keySet().remove(normalized); } + public boolean hasAsyncFunctionRunning(PlayerWrapper playerWrapper) { + return this.hasAsyncFunctionRunning(playerWrapper.getUniqueId()); + } + + public boolean hasAsyncFunctionRunning(UUID uuid) { + AtomicInteger running = this.runningAsyncFunctions.get(uuid); + return running != null && running.get() > 0; + } + public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper, null, new AtomicBoolean(true)); @@ -142,6 +153,7 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, } private CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { + UUID uuid = playerWrapper.getUniqueId(); CompletableFuture response = new CompletableFuture<>(); response.exceptionally((ex) -> { ex.printStackTrace(); @@ -173,14 +185,26 @@ private CompletableFuture runFunctionData(FunctionOwner owner, } } ThreadUtil.run(() -> { + if(async) { + this.runningAsyncFunctions.compute(uuid, (key, value) -> { + if(value != null) { + value.incrementAndGet(); + } else { + value = new AtomicInteger(1); + } + return value; + }); + } boolean ran = function.function(playerWrapper); if (data.getModifier() == FunctionModifier.NOT) { ran = !ran; } if (!ran) { + cleanupAsync(uuid); response.complete(new FunctionResponse(false, functionName, functionData)); } else if (async) { runFunctionData(owner, futureData, playerWrapper).thenAccept((value) -> { + cleanupAsync(uuid); response.complete(value); }); } @@ -200,6 +224,16 @@ private CompletableFuture runFunctionData(FunctionOwner owner, return response; } + private void cleanupAsync(UUID uuid) { + AtomicInteger num = this.runningAsyncFunctions.get(uuid); + if(num != null) { + int ret = num.decrementAndGet(); + if(ret == 0) { + this.runningAsyncFunctions.remove(uuid); + } + } + } + private boolean isFail(FunctionResponse response, FunctionToken token) { for (FunctionData data : token.getFailOnFunctions()) { if (data.getName().equals(response.failedFunction)) { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java new file mode 100644 index 000000000..fb6954549 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java @@ -0,0 +1,35 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.function; + +import com.clubobsidian.dynamicgui.core.function.AsyncRunningFunction; +import com.clubobsidian.dynamicgui.core.function.Function; +import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +public class AsyncRunningFunctionTest extends FactoryTest { + + //TODO - implement the passing test + + @Test + public void failingTest() { + Function function = new AsyncRunningFunction(); + assertFalse(function.function(this.getFactory().createPlayer())); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 6fa9a0049..0cc109c73 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -25,6 +25,7 @@ import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -33,6 +34,29 @@ public class FunctionManagerTest extends ScheduledTest { + @Test + public void testHasAsyncFunctionRunningPassing() throws InterruptedException, ExecutionException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(2); + CompletableFuture future = FunctionManager + .get() + .tryFunctions(slot, FunctionType.CLICK, playerWrapper); + Thread.sleep(500); + boolean has = FunctionManager.get().hasAsyncFunctionRunning(playerWrapper); + future.get(); + assertTrue(has); + } + + @Test + public void testHasAsyncFunctionRunningFailing() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(2); + FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get(); + assertFalse(FunctionManager.get().hasAsyncFunctionRunning(playerWrapper)); + } + @Test public void testTryFunctionsPassing() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); From edf79b05b5ea02532d3a0d4e3baecfef0430d793 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 19 Mar 2022 22:29:03 -0700 Subject: [PATCH 167/261] Move static method about class variables --- .../core/manager/dynamicgui/FunctionManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 52bfa1c21..aa211bc6d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -44,12 +44,6 @@ public class FunctionManager { private static FunctionManager instance; - private final Map functions = new HashMap<>(); - private final Map runningAsyncFunctions = new ConcurrentHashMap<>(); - - private FunctionManager() { - } - public static FunctionManager get() { if (instance == null) { instance = new FunctionManager(); @@ -57,6 +51,12 @@ public static FunctionManager get() { return instance; } + private final Map functions = new HashMap<>(); + private final Map runningAsyncFunctions = new ConcurrentHashMap<>(); + + private FunctionManager() { + } + public Function getFunctionByName(String functionName) { String normalized = StringFuzz.normalize(functionName); Function function = this.functions.get(normalized); From bfa7181fe69d4a68f27f7c9dbc72ac81a2300d90 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 19 Mar 2022 22:34:40 -0700 Subject: [PATCH 168/261] Drop non-array constructor --- .../com/clubobsidian/dynamicgui/core/function/Function.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index ce5517f62..5442b5942 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -57,10 +57,6 @@ public Function(String... aliases) { this(aliases[0], aliases, false); } - public Function(String name) { - this(name, null); - } - public Function(Function function) { this(function.getName(), function.getData()); } From 6562b4416aaa94fe7cc9ac53465e7527802a336a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 19 Mar 2022 22:35:54 -0700 Subject: [PATCH 169/261] Drop function Function constructor --- .../com/clubobsidian/dynamicgui/core/function/Function.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 5442b5942..73bd43554 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -57,10 +57,6 @@ public Function(String... aliases) { this(aliases[0], aliases, false); } - public Function(Function function) { - this(function.getName(), function.getData()); - } - public abstract boolean function(PlayerWrapper playerWrapper); public boolean isAsync() { From 4970071a8a75784bd53adb07fbc63dec43da1b73 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 19 Mar 2022 23:50:13 -0700 Subject: [PATCH 170/261] Make function aliases a set --- .../dynamicgui/core/function/Function.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 73bd43554..0b4bda4ec 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -21,6 +21,11 @@ import org.apache.commons.lang3.SerializationUtils; import java.io.Serializable; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; public abstract class Function implements Cloneable, Serializable { @@ -29,23 +34,29 @@ public abstract class Function implements Cloneable, Serializable { */ private static final long serialVersionUID = 1492427006104061443L; - private static String[] normalizeAliases(String[] aliases) { - for (int i = 0; i < aliases.length; i++) { - aliases[i] = StringFuzz.normalize(aliases[i]); + private static Set loadAliases(String name, Collection aliases) { + Set aliasSet = new HashSet<>(); + aliasSet.add(name); + for (String alias : aliases) { + aliasSet.add(StringFuzz.normalize(alias)); } - return aliases; + return Collections.unmodifiableSet(aliasSet); } private final String name; private String data; private final boolean async; private FunctionOwner owner; - private final String[] aliases; + private final Set aliases; private int index = -1; public Function(String name, String[] aliases, boolean async) { + this(name, Arrays.asList(aliases), async); + } + + public Function(String name, Collection aliases, boolean async) { this.name = StringFuzz.normalize(name); - this.aliases = normalizeAliases(aliases); + this.aliases = loadAliases(this.name, aliases); this.async = async; } @@ -67,7 +78,7 @@ public String getName() { return this.name; } - public String[] getAliases() { + public Set getAliases() { return this.aliases; } From aa292edb61e78e570a4dda293ae4d83f75f1e9b4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 00:02:02 -0700 Subject: [PATCH 171/261] Store function in running async function map --- .../dynamicgui/core/function/Function.java | 14 ++++++++ .../manager/dynamicgui/FunctionManager.java | 34 ++++++++++++------- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 0b4bda4ec..47f9f705e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import java.util.Objects; import java.util.Set; public abstract class Function implements Cloneable, Serializable { @@ -113,4 +114,17 @@ public int getIndex() { public Function clone() { return SerializationUtils.clone(this); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Function)) return false; + Function function = (Function) o; + return async == function.async && name.equals(function.name) && aliases.equals(function.aliases); + } + + @Override + public int hashCode() { + return Objects.hash(name, async, aliases); + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index aa211bc6d..9e325023d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -52,7 +52,7 @@ public static FunctionManager get() { } private final Map functions = new HashMap<>(); - private final Map runningAsyncFunctions = new ConcurrentHashMap<>(); + private final Map> runningAsyncFunctions = new ConcurrentHashMap<>(); private FunctionManager() { } @@ -63,7 +63,6 @@ public Function getFunctionByName(String functionName) { if (function == null) { return null; } - return function.clone(); } @@ -91,8 +90,8 @@ public boolean hasAsyncFunctionRunning(PlayerWrapper playerWrapper) { } public boolean hasAsyncFunctionRunning(UUID uuid) { - AtomicInteger running = this.runningAsyncFunctions.get(uuid); - return running != null && running.get() > 0; + Map running = this.runningAsyncFunctions.get(uuid); + return running != null && running.size() > 0; } public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { @@ -187,6 +186,11 @@ private CompletableFuture runFunctionData(FunctionOwner owner, ThreadUtil.run(() -> { if(async) { this.runningAsyncFunctions.compute(uuid, (key, value) -> { + if(value == null) { + return new ConcurrentHashMap<>(); + } + return value; + }).compute(function, (key, value) -> { if(value != null) { value.incrementAndGet(); } else { @@ -200,11 +204,11 @@ private CompletableFuture runFunctionData(FunctionOwner owner, ran = !ran; } if (!ran) { - cleanupAsync(uuid); + cleanupAsync(uuid, function); response.complete(new FunctionResponse(false, functionName, functionData)); } else if (async) { runFunctionData(owner, futureData, playerWrapper).thenAccept((value) -> { - cleanupAsync(uuid); + cleanupAsync(uuid, function); response.complete(value); }); } @@ -224,12 +228,18 @@ private CompletableFuture runFunctionData(FunctionOwner owner, return response; } - private void cleanupAsync(UUID uuid) { - AtomicInteger num = this.runningAsyncFunctions.get(uuid); - if(num != null) { - int ret = num.decrementAndGet(); - if(ret == 0) { - this.runningAsyncFunctions.remove(uuid); + private void cleanupAsync(UUID uuid, Function function) { + Map map = this.runningAsyncFunctions.get(uuid); + if(map != null) { + AtomicInteger num = map.get(function); + if(num != null) { + int ret = num.decrementAndGet(); + if (ret == 0) { + map.remove(function); + } + if(map.size() == 0) { //If the map is empty remove + this.runningAsyncFunctions.remove(uuid); + } } } } From 131d0f700c7949fdb612524a2ac05343c42ed114 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 01:43:08 -0700 Subject: [PATCH 172/261] Add testing for running specific async function --- .../core/function/AsyncRunningFunction.java | 5 +++- .../manager/dynamicgui/FunctionManager.java | 17 +++++++++++++- .../function/AsyncRunningFunctionTest.java | 7 ++++++ .../test/manager/FunctionManagerTest.java | 23 +++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java index 3d5c72762..5876e3a14 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java @@ -27,6 +27,9 @@ public AsyncRunningFunction() { @Override public boolean function(PlayerWrapper playerWrapper) { - return FunctionManager.get().hasAsyncFunctionRunning(playerWrapper); + if(this.getData() == null) { + return FunctionManager.get().hasAsyncFunctionRunning(playerWrapper); + } + return FunctionManager.get().hasAsyncFunctionRunning(playerWrapper, this.getData()); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 9e325023d..3ebf4c935 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -94,6 +94,21 @@ public boolean hasAsyncFunctionRunning(UUID uuid) { return running != null && running.size() > 0; } + public boolean hasAsyncFunctionRunning(PlayerWrapper playerWrapper, String functionName) { + return this.hasAsyncFunctionRunning(playerWrapper.getUniqueId(), functionName); + } + + public boolean hasAsyncFunctionRunning(UUID uuid, String functionName) { + Function function = this.functions.get(functionName); + Map functionMap = this.runningAsyncFunctions.get(uuid); + AtomicInteger num = functionMap == null ? null : functionMap.get(function); + return function == null + || !function.isAsync() + || functionMap == null + || num == null + || num.get() == 0 ? false : true; + } + public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, playerWrapper, null, new AtomicBoolean(true)); @@ -234,7 +249,7 @@ private void cleanupAsync(UUID uuid, Function function) { AtomicInteger num = map.get(function); if(num != null) { int ret = num.decrementAndGet(); - if (ret == 0) { + if (ret <= 0) { //Less than 0 shouldn't happen but just to ensure that the map gets cleaned up map.remove(function); } if(map.size() == 0) { //If the map is empty remove diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java index fb6954549..5be1d61f9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java @@ -32,4 +32,11 @@ public void failingTest() { Function function = new AsyncRunningFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } + + @Test + public void failingWithoutDataTest() { + Function function = new AsyncRunningFunction(); + function.setData("delay"); + assertFalse(function.function(this.getFactory().createPlayer())); + } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 0cc109c73..9277e831b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -57,6 +57,29 @@ public void testHasAsyncFunctionRunningFailing() throws ExecutionException, Inte assertFalse(FunctionManager.get().hasAsyncFunctionRunning(playerWrapper)); } + @Test + public void testHasAsyncFunctionRunningWithFunctionNamePassing() throws InterruptedException, ExecutionException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(2); + CompletableFuture future = FunctionManager + .get() + .tryFunctions(slot, FunctionType.CLICK, playerWrapper); + Thread.sleep(500); + boolean has = FunctionManager.get().hasAsyncFunctionRunning(playerWrapper, "delay"); + future.get(); + assertTrue(has); + } + + @Test + public void testHasAsyncFunctionRunningWithFunctionNameFailing() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(2); + FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get(); + assertFalse(FunctionManager.get().hasAsyncFunctionRunning(playerWrapper, "delay")); + } + @Test public void testTryFunctionsPassing() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); From af1905a0847167c8fe3c73b77e8bc0f5e075eb30 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 01:48:13 -0700 Subject: [PATCH 173/261] Fix indentation --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index bd83fc09c..17322bda6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -191,8 +191,9 @@ private void setupFileStructure() { private void saveDefaultConfig() { if (!this.plugin.getConfigFile().exists()) { try { - FileUtils - .copyInputStreamToFile(this.getClass().getClassLoader().getResourceAsStream("config.yml"), + FileUtils.copyInputStreamToFile(this.getClass() + .getClassLoader() + .getResourceAsStream("config.yml"), this.plugin.getConfigFile()); } catch (IOException e) { e.printStackTrace(); From 4d53ab026295c4d0ea3134017fbde0e4bd3b4ed6 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 01:50:04 -0700 Subject: [PATCH 174/261] Use primitive int for server player count --- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 17322bda6..6d1692ea4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -430,17 +430,16 @@ public LoggerWrapper getLogger() { return this.loggerWrapper; } - public Integer getGlobalServerPlayerCount() { + public int getGlobalServerPlayerCount() { int globalPlayerCount = 0; for (int playerCount : this.serverPlayerCount.values()) { globalPlayerCount += playerCount; } - return globalPlayerCount; } - public Integer getServerPlayerCount(String server) { - return this.serverPlayerCount.get(server); + public int getServerPlayerCount(String server) { + return this.serverPlayerCount.getOrDefault(server, -1); } public Injector getInjector() { From 3de4c55ef5edb137815a032590fd338504b78472 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 01:59:56 -0700 Subject: [PATCH 175/261] Use getServerPlayerCount method in replacer --- .../main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 6d1692ea4..07841fc44 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -241,7 +241,7 @@ private void loadConfig() { DynamicGuiReplacerRegistry.get().addReplacer(new Replacer("%" + server + "-playercount%") { @Override public String replacement(String text, PlayerWrapper player) { - return String.valueOf(serverPlayerCount.get(server)); + return String.valueOf(getServerPlayerCount(server)); } }); } From ef9981d97b57d914f55cbbd45615ae4f502b8749 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 02:55:57 -0700 Subject: [PATCH 176/261] Simplify parseBoolean logic --- .../com/clubobsidian/dynamicgui/parser/slot/SlotToken.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index 1b120e411..77542f493 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -108,13 +108,8 @@ private boolean parseBoolean(String data) { if (data == null) { return false; } - String parsed = this.macroParser.parseStringMacros(data); - if (data.equals("true")) { - return Boolean.parseBoolean(parsed); - } - - return false; + return Boolean.parseBoolean(parsed); } private int parseInteger(String data) { From 1156647652ad5ba276f035ca4d03dad5a61a4984 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 20:04:57 -0700 Subject: [PATCH 177/261] Small cleanup --- .../dynamicgui/core/listener/EntityClickListener.java | 7 ++++--- .../clubobsidian/dynamicgui/core/listener/GuiListener.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java index 4c09331da..6da49c6f1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java @@ -32,12 +32,13 @@ public class EntityClickListener { @EventHandler public void onEntityClick(PlayerInteractEntityEvent e) { - if (GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) + if (GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) { return; + } EntityWrapper entityWrapper = e.getEntityWrapper(); - List registeries = DynamicGui.get().getPlugin().getNPCRegistries(); - for (NPCRegistry registry : registeries) { + List registries = DynamicGui.get().getPlugin().getNPCRegistries(); + for (NPCRegistry registry : registries) { for (Gui gui : GuiManager.get().getGuis()) { Iterator>> it = gui.getNpcIds().entrySet().iterator(); while (it.hasNext()) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index 3097e0666..c273f43e6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -37,7 +37,7 @@ public GuiListener() { } @EventHandler - public void onGuiOpen(GuiLoadEvent event) { + public void onGuiLoad(GuiLoadEvent event) { PlayerWrapper wrapper = event.getPlayerWrapper(); Gui gui = GuiManager.get().getPlayerGui(wrapper); PlayerWrapper playerWrapper = event.getPlayerWrapper(); From e31b90d9013f9bb77905dd8e8fe106d827397f08 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 20 Mar 2022 20:26:22 -0700 Subject: [PATCH 178/261] Remove un-used inventory open code --- .../dynamicgui/core/DynamicGui.java | 2 -- .../core/listener/InventoryOpenListener.java | 33 ------------------- 2 files changed, 35 deletions(-) delete mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 07841fc44..39d2318ae 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -83,7 +83,6 @@ import com.clubobsidian.dynamicgui.core.listener.GuiListener; import com.clubobsidian.dynamicgui.core.listener.InventoryCloseListener; import com.clubobsidian.dynamicgui.core.listener.InventoryInteractListener; -import com.clubobsidian.dynamicgui.core.listener.InventoryOpenListener; import com.clubobsidian.dynamicgui.core.listener.PlayerInteractListener; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.AnimationReplacerManager; @@ -288,7 +287,6 @@ private void registerListeners() { this.eventBus.registerEvents(new EntityClickListener()); this.eventBus.registerEvents(new InventoryInteractListener()); this.eventBus.registerEvents(new InventoryCloseListener()); - this.eventBus.registerEvents(new InventoryOpenListener()); this.eventBus.registerEvents(new PlayerInteractListener()); this.eventBus.registerEvents(new GuiListener()); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java deleted file mode 100644 index f5a08e99e..000000000 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryOpenListener.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2022 virustotalop and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.clubobsidian.dynamicgui.core.listener; - -import com.clubobsidian.dynamicgui.core.event.inventory.InventoryOpenEvent; -import com.clubobsidian.trident.EventHandler; - -public class InventoryOpenListener { - - @EventHandler - public void inventoryOpen(final InventoryOpenEvent e) { - /*if(GuiManager.get().hasGuiCurrently(e.getPlayerWrapper())) - { - if(e.getPlayerWrapper().getOpenInventoryWrapper().getInventory() != null) - { - e.getPlayerWrapper().closeInventory(); - } - }*/ - } -} \ No newline at end of file From 706586b7fe803879d545b29098ae803672edb0a7 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 21 Mar 2022 02:13:55 -0700 Subject: [PATCH 179/261] Initialize set outside constructor --- .../clubobsidian/dynamicgui/core/listener/GuiListener.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index c273f43e6..c6c0c471a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -30,11 +30,7 @@ public class GuiListener { - private final Set users; - - public GuiListener() { - this.users = new HashSet<>(); - } + private final Set users = new HashSet<>(); @EventHandler public void onGuiLoad(GuiLoadEvent event) { From 353f6d12724c41b464a0e08c6bfbb1d8073fc525 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 21 Mar 2022 21:43:09 -0700 Subject: [PATCH 180/261] Don't override isAsync method --- .../dynamicgui/core/function/impl/gui/BackFunction.java | 7 +------ .../dynamicgui/core/function/impl/gui/GuiFunction.java | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java index 6e564e321..7442b4f94 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java @@ -32,7 +32,7 @@ public class BackFunction extends Function { private static final long serialVersionUID = 7851730396417693718L; public BackFunction() { - super("back"); + super("back", true); } @Override @@ -70,9 +70,4 @@ public boolean function(PlayerWrapper playerWrapper) { } return false; } - - @Override - public boolean isAsync() { - return true; - } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java index a188213f4..f392e7eba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java @@ -32,7 +32,7 @@ public class GuiFunction extends Function { private static final long serialVersionUID = 848178368629667482L; public GuiFunction() { - super("gui"); + super("gui", true); } @Override @@ -68,9 +68,4 @@ public boolean function(final PlayerWrapper playerWrapper) { return false; } } - - @Override - public boolean isAsync() { - return true; - } } \ No newline at end of file From 45be25db4cabf5570bb8a4c92386b9a0d2e44677 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 21 Mar 2022 21:47:22 -0700 Subject: [PATCH 181/261] Use native int --- .../dynamicgui/core/function/impl/gui/BackFunction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java index 7442b4f94..21650398e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java @@ -51,7 +51,7 @@ public boolean function(PlayerWrapper playerWrapper) { if (back != null) { if (this.getData() != null) { try { - Integer backAmount = Integer.parseInt(this.getData()); + int backAmount = Integer.parseInt(this.getData()); for (int i = 1; i < backAmount; i++) { Gui nextBack = back.getBack(); if (nextBack != null) { From 4a0e2f2fde4e8cb3f14fbb543ad4ea8a2f314893 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 21 Mar 2022 22:10:26 -0700 Subject: [PATCH 182/261] Repackage async running function --- .../main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 2 +- .../core/function/{ => impl}/AsyncRunningFunction.java | 3 ++- .../core/test/function/AsyncRunningFunctionTest.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/function/{ => impl}/AsyncRunningFunction.java (91%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 39d2318ae..775e41c45 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -18,7 +18,7 @@ import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.function.AsyncRunningFunction; +import com.clubobsidian.dynamicgui.core.function.impl.AsyncRunningFunction; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AsyncRunningFunction.java similarity index 91% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AsyncRunningFunction.java index 5876e3a14..f6b177084 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/AsyncRunningFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AsyncRunningFunction.java @@ -14,9 +14,10 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.function; +package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; public class AsyncRunningFunction extends Function { diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java index 5be1d61f9..e0acd024b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java @@ -16,7 +16,7 @@ package com.clubobsidian.dynamicgui.core.test.function; -import com.clubobsidian.dynamicgui.core.function.AsyncRunningFunction; +import com.clubobsidian.dynamicgui.core.function.impl.AsyncRunningFunction; import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.test.mock.test.FactoryTest; import org.junit.jupiter.api.Test; From e0618e1d7e3e9016620c784c30754cc032d8b63d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 23 Mar 2022 02:20:49 -0700 Subject: [PATCH 183/261] Remove form map instead of key set --- .../dynamicgui/core/manager/dynamicgui/FunctionManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 3ebf4c935..d1d0b5686 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -82,7 +82,7 @@ public boolean addFunction(Function function) { public boolean removeFunctionByName(String functionName) { String normalized = StringFuzz.normalize(functionName); - return this.functions.keySet().remove(normalized); + return this.functions.remove(normalized) != null; } public boolean hasAsyncFunctionRunning(PlayerWrapper playerWrapper) { From 404a20c82fb8200e84ca28addc952ef1a8e4e8e8 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 23 Mar 2022 02:43:59 -0700 Subject: [PATCH 184/261] Always send plugin message from DynamicGui --- .../dynamicgui/bukkit/entity/BukkitPlayerWrapper.java | 4 ++-- .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 4 ++-- .../clubobsidian/dynamicgui/core/entity/PlayerWrapper.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index d80b3ac27..601def252 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -133,8 +133,8 @@ public void openInventory(InventoryWrapper inventoryWrapper) { } @Override - public void sendPluginMessage(DynamicGuiPlugin plugin, String channel, byte[] message) { - this.getPlayer().sendPluginMessage((Plugin) plugin, channel, message); + public void sendPluginMessage(String channel, byte[] message) { + this.getPlayer().sendPluginMessage((Plugin) DynamicGui.get().getPlugin(), channel, message); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 775e41c45..c2affe264 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -384,7 +384,7 @@ private void startPlayerCountTimer() { if (this.proxy == Proxy.REDIS_BUNGEE) { sendTo = "RedisBungee"; } - player.sendPluginMessage(this.getPlugin(), sendTo, out.toByteArray()); + player.sendPluginMessage(sendTo, out.toByteArray()); } } }, 1L, 20L); @@ -449,7 +449,7 @@ public boolean sendToServer(PlayerWrapper playerWrapper, String server) { ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF(server); - playerWrapper.sendPluginMessage(DynamicGui.get().getPlugin(), "BungeeCord", out.toByteArray()); + playerWrapper.sendPluginMessage("BungeeCord", out.toByteArray()); return true; } return false; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index a631eca91..04c71395b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -66,7 +66,7 @@ public T getPlayer() { public abstract void openInventory(InventoryWrapper inventoryWrapper); - public abstract void sendPluginMessage(DynamicGuiPlugin plugin, String channel, byte[] message); + public abstract void sendPluginMessage(String channel, byte[] message); public abstract void playSound(SoundWrapper.SoundData soundData); From b9834a79074cd07dcf9892d0d8933a04084ee6e2 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 23 Mar 2022 17:52:29 -0700 Subject: [PATCH 185/261] Add async functions to feature list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index df124ae50..48fcadad8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ A plugin designed to make writing menus for Minecraft easy. Menus can be written ## Features * A number of functions to use to customize menus + * Asynchronous functions * Functions use latebinding * Addons can be written for more functions * Use conditions with replacers using [EvalEx](https://github.com/uklimaschewski/EvalEx) From d98c6d3557e0c91cf8d93260e8c0e6e98074551c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 25 Mar 2022 03:34:20 -0700 Subject: [PATCH 186/261] Use maven publish gradle plugin --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 1482b319e..4a4e2f0a5 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'com.github.johnrengelman.shadow' version '7.1.1' id 'eclipse' id 'idea' + id 'maven-publish' } subprojects { From 41938f528b9dcf191cc46a5dfb98b298479779d4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 25 Mar 2022 03:35:39 -0700 Subject: [PATCH 187/261] Revert "Use maven publish gradle plugin" This reverts commit d98c6d3557e0c91cf8d93260e8c0e6e98074551c. --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4a4e2f0a5..1482b319e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,6 @@ plugins { id 'com.github.johnrengelman.shadow' version '7.1.1' id 'eclipse' id 'idea' - id 'maven-publish' } subprojects { From f88effa55b71dd0520eb86fcf97284fea72cf42c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 25 Mar 2022 04:01:17 -0700 Subject: [PATCH 188/261] Hopefully fix maven publish --- build.gradle | 49 +++++++++++++++++++++++++++++++++++++++++++-- bukkit/build.gradle | 29 +-------------------------- 2 files changed, 48 insertions(+), 30 deletions(-) diff --git a/build.gradle b/build.gradle index 1482b319e..7a6de51b6 100644 --- a/build.gradle +++ b/build.gradle @@ -3,14 +3,30 @@ plugins { id 'com.github.johnrengelman.shadow' version '7.1.1' id 'eclipse' id 'idea' + id 'maven-publish' +} + +allprojects { + group 'com.clubobsidian' + version '5.0.0' } subprojects { apply plugin: 'java-library' apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'maven-publish' - group 'com.clubobsidian' - version '5.0.0' + + publishing { + publications { + shadow(MavenPublication) { + groupId 'com.clubobsidian' + artifactId project.name + version '5.0.0' + artifact shadowJar + } + } + } tasks.withType(JavaCompile) { sourceCompatibility = JavaVersion.VERSION_11 @@ -21,6 +37,35 @@ subprojects { useJUnitPlatform() } + shadowJar { + archiveClassifier.set('') + minimize() + relocate 'org.spongepowered.configurate', 'com.clubobsidian.dynamicgui.shaded.configurate' + relocate 'com.google.common', 'com.clubobsidian.dynamicgui.shaded.guava' + relocate 'com.google.gson', 'com.clubobsidian.dynamicgui.shaded.gson' + relocate 'org.yaml.snakeyaml', 'com.clubobsidian.dynamicgui.shaded.snakeyaml' + relocate 'com.clubobsidian.trident', 'com.clubobsidian.dynamicgui.shaded.trident' + relocate 'com.clubobsidian.wrappy', 'com.clubobsidian.dynamicgui.shaded.wrappy' + relocate 'net.kyori', 'com.clubobsidian.dynamicgui.shaded.kyori' + relocate 'com.clubobsidian.fuzzutil', 'com.clubobsidian.dynamicgui.shaded.fuzzutil' + relocate 'io.leangen', 'com.clubobsidian.dynamicgui.shaded.leangen' + relocate 'org.codehaus.mojo', 'com.clubobsidian.dynamicgui.shaded.mojo' + relocate 'org.checkerframework.framework', 'com.clubobsidian.dynamicgui.shaded.checkerframework.framework' + relocate 'org.checkerframework.common', 'com.clubobsidian.dynamicgui.shaded.checkerframework.common' + relocate 'org.checkerframework.checker', 'com.clubobsidian.dynamicgui.shaded.checkerframework.checker' + relocate 'org.apache.commons', 'com.clubobsidian.dynamicgui.shaded.apachecommons' + relocate 'org.aopalliance.intercept', 'com.clubobsidian.dynamicgui.shaded.aopalliance.intercept' + relocate 'org.aopalliance.aop', 'com.clubobsidian.dynamicgui.shaded.aopalliance.aop' + relocate 'javax.inject', 'com.clubobsidian.dynamicgui.shaded.javax.inject' + relocate 'com.udojava.evalex', 'com.clubobsidian.dynamicgui.shaded.evalex' + relocate 'com.typesafe.config', 'com.clubobsidian.dynamicgui.shaded.typesafeconfig' + relocate 'com.google.j2objc', 'com.clubobsidian.dynamicgui.shaded.j2objc' + relocate 'com.google.inject', 'com.clubobsidian.dynamicgui.shaded.guice' + relocate 'javax.annotation', 'com.clubobsidian.dynamicgui.shaded.javaxannotation' + relocate 'com.google.errorprone', 'com.clubobsidian.dynamicgui.shaded.errorprone' + relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson' + } + repositories { maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"} maven { url = "https://oss.sonatype.org/content/repositories/snapshots" } diff --git a/bukkit/build.gradle b/bukkit/build.gradle index a12df18ba..58b640578 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -9,34 +9,7 @@ processResources { } shadowJar { - minimize() - relocate 'org.spongepowered.configurate', 'com.clubobsidian.dynamicgui.shaded.configurate' - relocate 'com.google.common', 'com.clubobsidian.dynamicgui.shaded.guava' - relocate 'com.google.gson', 'com.clubobsidian.dynamicgui.shaded.gson' - relocate 'org.yaml.snakeyaml', 'com.clubobsidian.dynamicgui.shaded.snakeyaml' - relocate 'com.clubobsidian.trident', 'com.clubobsidian.dynamicgui.shaded.trident' - relocate 'com.clubobsidian.wrappy', 'com.clubobsidian.dynamicgui.shaded.wrappy' - relocate 'net.kyori', 'com.clubobsidian.dynamicgui.shaded.kyori' - relocate 'com.clubobsidian.fuzzutil', 'com.clubobsidian.dynamicgui.shaded.fuzzutil' - relocate 'io.leangen', 'com.clubobsidian.dynamicgui.shaded.leangen' - relocate 'org.codehaus.mojo', 'com.clubobsidian.dynamicgui.shaded.mojo' - relocate 'org.checkerframework.framework', 'com.clubobsidian.dynamicgui.shaded.checkerframework.framework' - relocate 'org.checkerframework.common', 'com.clubobsidian.dynamicgui.shaded.checkerframework.common' - relocate 'org.checkerframework.checker', 'com.clubobsidian.dynamicgui.shaded.checkerframework.checker' - relocate 'org.apache.commons', 'com.clubobsidian.dynamicgui.shaded.apachecommons' - relocate 'org.aopalliance.intercept', 'com.clubobsidian.dynamicgui.shaded.aopalliance.intercept' - relocate 'org.aopalliance.aop', 'com.clubobsidian.dynamicgui.shaded.aopalliance.aop' - relocate 'javax.inject', 'com.clubobsidian.dynamicgui.shaded.javax.inject' - relocate 'com.udojava.evalex', 'com.clubobsidian.dynamicgui.shaded.evalex' - relocate 'com.typesafe.config', 'com.clubobsidian.dynamicgui.shaded.typesafeconfig' - relocate 'com.google.j2objc', 'com.clubobsidian.dynamicgui.shaded.j2objc' - relocate 'com.google.inject', 'com.clubobsidian.dynamicgui.shaded.guice' - relocate 'javax.annotation', 'com.clubobsidian.dynamicgui.shaded.javaxannotation' - relocate 'com.google.errorprone', 'com.clubobsidian.dynamicgui.shaded.errorprone' - relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson' - - archiveBaseName.set('DynamicGui') - archiveClassifier.set('') + archiveBaseName.set('DynamicGui-Bukkit') } dependencies { From 0a1aea6dc6a51ee8bbd2fd54947e0d12b48c7d74 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 25 Mar 2022 04:03:39 -0700 Subject: [PATCH 189/261] Tell jitpack to use openjdk11 --- jitpack.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 000000000..46c852919 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +jdk: + - openjdk11 \ No newline at end of file From db83733429d82714c41004c9a971f7582f003ddf Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 26 Mar 2022 00:32:03 -0700 Subject: [PATCH 190/261] Start working on async slot loading --- .../core/manager/dynamicgui/GuiManager.java | 81 ++++++++++++++----- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index a7c43b0bf..ad1970514 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -59,6 +59,8 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicInteger; public class GuiManager { @@ -208,32 +210,71 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu if (ran) { InventoryWrapper inventoryWrapper = clonedGui.buildInventory(playerWrapper); - - //Run slot load functions - for (Slot slot : clonedGui.getSlots()) { - FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper); - } - if (inventoryWrapper == null) { future.complete(false); return; } - Platform server = DynamicGui.get().getPlatform(); - if (server.getType() == PlatformType.SPONGE) { - server.getScheduler().runSyncDelayedTask(() -> { - playerWrapper.openInventory(inventoryWrapper); - }, 1L); - } else { - playerWrapper.openInventory(inventoryWrapper); - } - - this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); - DynamicGui.get().getPlatform().getScheduler().runSyncDelayedTask(() -> { - playerWrapper.updateInventory(); - }, 2L); + //Run slot load functions + CompletableFuture slotFuture = new CompletableFuture<>(); + ThreadUtil.run(() -> { + List slots = clonedGui.getSlots(); + int slotSize = slots.size(); + AtomicInteger slotCount = new AtomicInteger(0); + for (int i = 0; i < slotSize; i++) { + if(slotFuture.isDone()) { + return; + } + Slot slot = slots.get(i); + FunctionManager.get() + .tryFunctions(slot, FunctionType.LOAD, playerWrapper) + .whenComplete((slotResult, ex) -> { + System.out.println("result: " + slotResult); + System.out.println("ex: " + ex); + if(slotFuture.isDone()) { + return; + } + if(ex != null) { + ex.printStackTrace(); + slotFuture.complete(false); + } else { + int count = slotCount.incrementAndGet(); + System.out.println("count: " + count); + if(slotSize == count) { + slotFuture.complete(true); + } + } + }); + } + }, true); + slotFuture.whenComplete((completed, ex) -> { + System.out.println("Completed: " + completed); + if(ex != null) { + ex.printStackTrace(); + future.complete(false); + } else if(!completed) { + future.complete(false); + } else { + ThreadUtil.run(() -> { + Platform platform = DynamicGui.get().getPlatform(); + if (platform.getType() == PlatformType.SPONGE) { + platform.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.openInventory(inventoryWrapper); + }, 1L); + } else { + playerWrapper.openInventory(inventoryWrapper); + } + this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); + platform.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.updateInventory(); + }, 2L); + future.complete(true); + }, false); + } + }); + } else { + future.complete(false); } - future.complete(ran); }, false)); }, false); return future; From 1d12ce745d9751542603ae1c236ca294037b5ce4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 27 Mar 2022 02:36:33 -0700 Subject: [PATCH 191/261] Fix function nodes not always completing --- .../dynamicgui/core/manager/dynamicgui/FunctionManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index d1d0b5686..391f01da7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -29,6 +29,7 @@ import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -158,6 +159,10 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, }); } } + } else { + recurFunctionNodes(null, owner, + nodeQueue, type, + playerWrapper, future, returnValue); } } if (node == null) { From 238db7140f4dff3b3951426316f4cec9ef1fd511 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 27 Mar 2022 02:52:25 -0700 Subject: [PATCH 192/261] Use equalsIgnoreCase --- .../main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index a4dbbff6c..46f44a877 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -171,7 +171,7 @@ public ItemStackWrapper buildItemStack(PlayerWrapper playerWrapper) { builderItem.setAmount(this.amount); } - if (!this.icon.toUpperCase().equals(IGNORE_MATERIAL)) { + if (!this.icon.equalsIgnoreCase(IGNORE_MATERIAL)) { if (this.data != 0) { builderItem.setDurability(this.data); } From 6bd560be8f2da64e9b851b0d7ec5470359cc37e3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Mar 2022 19:38:28 -0700 Subject: [PATCH 193/261] Fix #245 --- .../manager/dynamicgui/FunctionManager.java | 46 ++++++++++++++----- .../core/manager/dynamicgui/GuiManager.java | 8 +--- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 391f01da7..9da5b5a76 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -103,16 +104,37 @@ public boolean hasAsyncFunctionRunning(UUID uuid, String functionName) { Function function = this.functions.get(functionName); Map functionMap = this.runningAsyncFunctions.get(uuid); AtomicInteger num = functionMap == null ? null : functionMap.get(function); - return function == null - || !function.isAsync() - || functionMap == null - || num == null - || num.get() == 0 ? false : true; + return function != null + && function.isAsync() + && functionMap != null + && num != null + && num.get() != 0; } public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { - return recurFunctionNodes(null, owner, owner.getFunctions().getRootNodes(), type, - playerWrapper, null, new AtomicBoolean(true)); + CompletableFuture future = new CompletableFuture<>(); + List rootNodes = owner.getFunctions().getRootNodes(); + int rootSize = rootNodes.size(); + if (rootSize == 0) { + future.complete(true); + } else { + AtomicBoolean returnValue = new AtomicBoolean(true); + AtomicInteger currentCount = new AtomicInteger(0); + for (FunctionNode node : rootNodes) { + recurFunctionNodes(null, owner, Collections.singletonList(node), type, + playerWrapper, null, new AtomicBoolean(true)) + .whenComplete((ret, ex) -> { + if (ex != null || !ret) { + returnValue.set(false); + } + int inc = currentCount.incrementAndGet(); + if (inc == rootSize) { + future.complete(returnValue.get()); + } + }); + } + } + return future; } private CompletableFuture recurFunctionNodes(FunctionResponse response, @@ -204,14 +226,14 @@ private CompletableFuture runFunctionData(FunctionOwner owner, } } ThreadUtil.run(() -> { - if(async) { + if (async) { this.runningAsyncFunctions.compute(uuid, (key, value) -> { - if(value == null) { + if (value == null) { return new ConcurrentHashMap<>(); } return value; }).compute(function, (key, value) -> { - if(value != null) { + if (value != null) { value.incrementAndGet(); } else { value = new AtomicInteger(1); @@ -255,9 +277,9 @@ private void cleanupAsync(UUID uuid, Function function) { if(num != null) { int ret = num.decrementAndGet(); if (ret <= 0) { //Less than 0 shouldn't happen but just to ensure that the map gets cleaned up - map.remove(function); + map.remove(function); } - if(map.size() == 0) { //If the map is empty remove + if (map.size() == 0) { //If the map is empty remove this.runningAsyncFunctions.remove(uuid); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index ad1970514..62312b73d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -229,8 +229,6 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu FunctionManager.get() .tryFunctions(slot, FunctionType.LOAD, playerWrapper) .whenComplete((slotResult, ex) -> { - System.out.println("result: " + slotResult); - System.out.println("ex: " + ex); if(slotFuture.isDone()) { return; } @@ -239,7 +237,6 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu slotFuture.complete(false); } else { int count = slotCount.incrementAndGet(); - System.out.println("count: " + count); if(slotSize == count) { slotFuture.complete(true); } @@ -248,11 +245,10 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu } }, true); slotFuture.whenComplete((completed, ex) -> { - System.out.println("Completed: " + completed); - if(ex != null) { + if (ex != null) { ex.printStackTrace(); future.complete(false); - } else if(!completed) { + } else if (!completed) { future.complete(false); } else { ThreadUtil.run(() -> { From 59f6652d8d47fa05fae778518922e6da54f31a18 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Mar 2022 22:00:07 -0700 Subject: [PATCH 194/261] Use licenser Closes #244 --- LICENSE_HEADER => HEADER.txt | 2 +- build.gradle | 8 +++++++- .../bukkit/command/BukkitDynamicGuiCommand.java | 1 + .../dynamicgui/bukkit/command/BukkitGuiCommand.java | 1 + .../dynamicgui/bukkit/command/CustomCommand.java | 1 + .../dynamicgui/bukkit/command/CustomCommandExecutor.java | 1 + .../dynamicgui/bukkit/economy/VaultEconomy.java | 1 + .../dynamicgui/bukkit/entity/BukkitEntityWrapper.java | 1 + .../dynamicgui/bukkit/entity/BukkitPlayerWrapper.java | 1 + .../bukkit/inventory/BukkitInventoryWrapper.java | 1 + .../bukkit/inventory/BukkitItemStackWrapper.java | 1 + .../dynamicgui/bukkit/listener/EntityClickListener.java | 1 + .../bukkit/listener/InventoryCloseListener.java | 1 + .../bukkit/listener/InventoryInteractListener.java | 1 + .../dynamicgui/bukkit/listener/InventoryOpenListener.java | 1 + .../bukkit/listener/PlayerInteractListener.java | 1 + .../bukkit/manager/entity/BukkitEntityManager.java | 1 + .../bukkit/manager/inventory/BukkitInventoryManager.java | 1 + .../bukkit/manager/inventory/BukkitItemStackManager.java | 1 + .../bukkit/manager/material/BukkitMaterialManager.java | 1 + .../dynamicgui/bukkit/manager/package-info.java | 2 +- .../bukkit/manager/world/BukkitLocationManager.java | 1 + .../com/clubobsidian/dynamicgui/bukkit/package-info.java | 2 +- .../dynamicgui/bukkit/permission/FoundryPermission.java | 1 + .../dynamicgui/bukkit/permission/VaultPermission.java | 1 + .../dynamicgui/bukkit/platform/BukkitPlatform.java | 1 + .../dynamicgui/bukkit/plugin/BukkitPlugin.java | 1 + .../dynamicgui/bukkit/registry/npc/CitizensRegistry.java | 1 + .../dynamicgui/bukkit/registry/package-info.java | 2 +- .../registry/replacer/PlaceholderApiReplacerRegistry.java | 1 + .../dynamicgui/bukkit/scheduler/BukkitScheduler.java | 1 + .../dynamicgui/bukkit/util/BukkitNBTUtil.java | 1 + .../dynamicgui/bukkit/util/BukkitPacketUtil.java | 1 + .../clubobsidian/dynamicgui/bukkit/util/VersionUtil.java | 1 + .../dynamicgui/bukkit/world/BukkitWorldWrapper.java | 1 + .../java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 1 + .../dynamicgui/core/builder/EnchantmentBuilder.java | 1 + .../dynamicgui/core/builder/FunctionBuilder.java | 1 + .../dynamicgui/core/builder/FunctionTokenBuilder.java | 1 + .../clubobsidian/dynamicgui/core/builder/GuiBuilder.java | 1 + .../clubobsidian/dynamicgui/core/builder/SlotBuilder.java | 1 + .../dynamicgui/core/command/package-info.java | 2 +- .../com/clubobsidian/dynamicgui/core/economy/Economy.java | 1 + .../dynamicgui/core/effect/ParticleWrapper.java | 1 + .../clubobsidian/dynamicgui/core/effect/SoundWrapper.java | 1 + .../dynamicgui/core/enchantment/EnchantmentWrapper.java | 1 + .../dynamicgui/core/entity/EntityWrapper.java | 1 + .../dynamicgui/core/entity/PlayerWrapper.java | 1 + .../dynamicgui/core/event/DynamicGuiReloadEvent.java | 1 + .../dynamicgui/core/event/InventoryEvent.java | 1 + .../clubobsidian/dynamicgui/core/event/LocationEvent.java | 1 + .../clubobsidian/dynamicgui/core/event/PlayerEvent.java | 1 + .../dynamicgui/core/event/block/PlayerInteractEvent.java | 1 + .../dynamicgui/core/event/inventory/Click.java | 1 + .../dynamicgui/core/event/inventory/GuiLoadEvent.java | 1 + .../dynamicgui/core/event/inventory/GuiPreloadEvent.java | 1 + .../core/event/inventory/InventoryClickEvent.java | 1 + .../core/event/inventory/InventoryCloseEvent.java | 1 + .../core/event/inventory/InventoryDragEvent.java | 1 + .../core/event/inventory/InventoryOpenEvent.java | 1 + .../core/event/inventory/PlayerInteractEntityEvent.java | 1 + .../dynamicgui/core/event/player/PlayerAction.java | 1 + .../dynamicgui/core/event/player/PlayerKickEvent.java | 1 + .../dynamicgui/core/event/player/PlayerQuitEvent.java | 1 + .../clubobsidian/dynamicgui/core/function/Function.java | 1 + .../core/function/impl/AddPermissionFunction.java | 1 + .../core/function/impl/CheckItemTypeInHandFunction.java | 1 + .../dynamicgui/core/function/impl/CheckLevelFunction.java | 1 + .../core/function/impl/CheckPlayerWorldFunction.java | 1 + .../core/function/impl/ConsoleCommandFunction.java | 1 + .../core/function/impl/GetGameRuleFunction.java | 1 + .../core/function/impl/IsBedrockPlayerFunction.java | 1 + .../dynamicgui/core/function/impl/LogFunction.java | 1 + .../core/function/impl/MoneyBalanceFunction.java | 1 + .../core/function/impl/MoneyDepositFunction.java | 1 + .../core/function/impl/MoneyWithdrawFunction.java | 1 + .../core/function/impl/NoPermissionFunction.java | 1 + .../dynamicgui/core/function/impl/ParticleFunction.java | 1 + .../dynamicgui/core/function/impl/PermissionFunction.java | 1 + .../core/function/impl/PlayerCommandFunction.java | 1 + .../core/function/impl/PlayerMessageFunction.java | 1 + .../core/function/impl/PlayerMsgJsonFunction.java | 1 + .../dynamicgui/core/function/impl/RandomFunction.java | 1 + .../core/function/impl/RemovePermissionFunction.java | 1 + .../dynamicgui/core/function/impl/RemoveSlotFunction.java | 1 + .../dynamicgui/core/function/impl/ResetFrameFunction.java | 1 + .../dynamicgui/core/function/impl/ResetTickFunction.java | 1 + .../dynamicgui/core/function/impl/SendFunction.java | 1 + .../core/function/impl/ServerBroadcastFunction.java | 1 + .../core/function/impl/ServerBroadcastJsonFunction.java | 1 + .../dynamicgui/core/function/impl/SetAmountFunction.java | 1 + .../dynamicgui/core/function/impl/SetCloseFunction.java | 1 + .../core/function/impl/SetDurabilityFunction.java | 1 + .../core/function/impl/SetEnchantsFunction.java | 1 + .../core/function/impl/SetGameRuleFunction.java | 1 + .../dynamicgui/core/function/impl/SetGlowFunction.java | 1 + .../dynamicgui/core/function/impl/SetLoreFunction.java | 1 + .../dynamicgui/core/function/impl/SetNBTFunction.java | 1 + .../dynamicgui/core/function/impl/SetNameFunction.java | 1 + .../dynamicgui/core/function/impl/SetTypeFunction.java | 1 + .../dynamicgui/core/function/impl/SoundFunction.java | 1 + .../core/function/impl/condition/CheckTickFunction.java | 1 + .../core/function/impl/condition/ConditionFunction.java | 1 + .../function/impl/condition/ContainsLazyFunction.java | 1 + .../function/impl/condition/EndsWithLazyFunction.java | 1 + .../core/function/impl/condition/EqualLazyFunction.java | 1 + .../impl/condition/IgnoreCaseEqualLazyFunction.java | 1 + .../function/impl/condition/StartsWithLazyFunction.java | 1 + .../function/impl/cooldown/IsNotOnCooldownFunction.java | 1 + .../core/function/impl/cooldown/IsOnCooldownFunction.java | 1 + .../core/function/impl/cooldown/SetCooldownFunction.java | 1 + .../dynamicgui/core/function/impl/gui/BackFunction.java | 1 + .../dynamicgui/core/function/impl/gui/GuiFunction.java | 1 + .../core/function/impl/gui/HasBackFunction.java | 1 + .../core/function/impl/gui/RefreshGuiFunction.java | 1 + .../core/function/impl/gui/RefreshSlotFunction.java | 1 + .../core/function/impl/gui/SetBackFunction.java | 1 + .../core/function/impl/meta/CopyBackMetadataFunction.java | 1 + .../core/function/impl/meta/HasMetadataFunction.java | 1 + .../core/function/impl/meta/SetMetadataFunction.java | 1 + .../clubobsidian/dynamicgui/core/gui/FunctionOwner.java | 1 + .../java/com/clubobsidian/dynamicgui/core/gui/Gui.java | 1 + .../clubobsidian/dynamicgui/core/gui/InventoryType.java | 1 + .../clubobsidian/dynamicgui/core/gui/InventoryView.java | 1 + .../com/clubobsidian/dynamicgui/core/gui/ModeEnum.java | 1 + .../java/com/clubobsidian/dynamicgui/core/gui/Slot.java | 1 + .../core/gui/property/animation/AnimationHolder.java | 1 + .../core/gui/property/animation/Refreshable.java | 1 + .../dynamicgui/core/inject/module/PluginModule.java | 1 + .../clubobsidian/dynamicgui/core/inject/package-info.java | 2 +- .../dynamicgui/core/inventory/InventoryWrapper.java | 1 + .../dynamicgui/core/inventory/ItemStackWrapper.java | 1 + .../dynamicgui/core/listener/EntityClickListener.java | 1 + .../dynamicgui/core/listener/GuiListener.java | 1 + .../dynamicgui/core/listener/InventoryCloseListener.java | 1 + .../core/listener/InventoryInteractListener.java | 1 + .../dynamicgui/core/listener/PlayerInteractListener.java | 1 + .../dynamicgui/core/logger/JavaLoggerWrapper.java | 1 + .../dynamicgui/core/logger/LoggerWrapper.java | 1 + .../core/manager/dynamicgui/AnimationReplacerManager.java | 1 + .../core/manager/dynamicgui/FunctionManager.java | 1 + .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 1 + .../core/manager/dynamicgui/ReplacerManager.java | 1 + .../dynamicgui/core/manager/dynamicgui/SlotManager.java | 1 + .../core/manager/dynamicgui/cooldown/Cooldown.java | 1 + .../core/manager/dynamicgui/cooldown/CooldownManager.java | 1 + .../dynamicgui/core/manager/entity/EntityManager.java | 1 + .../core/manager/inventory/InventoryManager.java | 1 + .../core/manager/inventory/ItemStackManager.java | 1 + .../dynamicgui/core/manager/material/MaterialManager.java | 1 + .../dynamicgui/core/manager/world/LocationManager.java | 1 + .../dynamicgui/core/messaging/MessagingRunnable.java | 1 + .../dynamicgui/core/permission/Permission.java | 1 + .../clubobsidian/dynamicgui/core/platform/Platform.java | 1 + .../dynamicgui/core/platform/PlatformType.java | 1 + .../dynamicgui/core/plugin/DynamicGuiPlugin.java | 1 + .../com/clubobsidian/dynamicgui/core/proxy/Proxy.java | 1 + .../clubobsidian/dynamicgui/core/registry/npc/NPC.java | 1 + .../dynamicgui/core/registry/npc/NPCMeta.java | 1 + .../dynamicgui/core/registry/npc/NPCRegistry.java | 1 + .../dynamicgui/core/registry/package-info.java | 1 + .../core/registry/replacer/AnimationReplacerRegistry.java | 1 + .../core/registry/replacer/ReplacerRegistry.java | 1 + .../registry/replacer/impl/CooldownReplacerRegistry.java | 1 + .../impl/DynamicGuiAnimationReplacerRegistry.java | 1 + .../replacer/impl/DynamicGuiReplacerRegistry.java | 1 + .../registry/replacer/impl/MetadataReplacerRegistry.java | 1 + .../dynamicgui/core/replacer/AnimationReplacer.java | 1 + .../clubobsidian/dynamicgui/core/replacer/Replacer.java | 1 + .../animation/impl/MultiLineTestAnimationReplacer.java | 1 + .../replacer/animation/impl/TestAnimationReplacer.java | 1 + .../core/replacer/impl/GlobalPlayerCountReplacer.java | 1 + .../core/replacer/impl/OnlinePlayersReplacer.java | 1 + .../core/replacer/impl/PlayerLevelReplacer.java | 1 + .../dynamicgui/core/replacer/impl/PlayerReplacer.java | 1 + .../core/replacer/impl/PreviousGuiReplacer.java | 1 + .../dynamicgui/core/replacer/impl/UUIDReplacer.java | 1 + .../clubobsidian/dynamicgui/core/scheduler/Scheduler.java | 1 + .../com/clubobsidian/dynamicgui/core/util/ChatColor.java | 1 + .../com/clubobsidian/dynamicgui/core/util/HashUtil.java | 1 + .../clubobsidian/dynamicgui/core/util/ReflectionUtil.java | 1 + .../dynamicgui/core/world/LocationWrapper.java | 1 + .../clubobsidian/dynamicgui/core/world/WorldWrapper.java | 1 + .../dynamicgui/core/test/mock/entity/package-info.java | 2 +- .../clubobsidian/dynamicgui/core/test/package-info.java | 2 +- .../dynamicgui/parser/function/FunctionData.java | 1 + .../dynamicgui/parser/function/FunctionModifier.java | 1 + .../dynamicgui/parser/function/FunctionToken.java | 1 + .../dynamicgui/parser/function/FunctionType.java | 1 + .../dynamicgui/parser/function/FunctionTypeParser.java | 1 + .../dynamicgui/parser/function/tree/FunctionNode.java | 1 + .../dynamicgui/parser/function/tree/FunctionTree.java | 1 + .../com/clubobsidian/dynamicgui/parser/gui/GuiMode.java | 1 + .../com/clubobsidian/dynamicgui/parser/gui/GuiToken.java | 1 + .../clubobsidian/dynamicgui/parser/macro/MacroParser.java | 1 + .../clubobsidian/dynamicgui/parser/macro/MacroToken.java | 1 + .../com/clubobsidian/dynamicgui/parser/package-info.java | 2 +- .../clubobsidian/dynamicgui/parser/slot/SlotToken.java | 1 + .../dynamicgui/parser/test/FunctionTreeTest.java | 1 + .../dynamicgui/parser/test/FunctionTypeParserTest.java | 1 + .../clubobsidian/dynamicgui/parser/test/GuiTokenTest.java | 1 + .../dynamicgui/parser/test/SlotTokenTest.java | 1 + 202 files changed, 208 insertions(+), 10 deletions(-) rename LICENSE_HEADER => HEADER.txt (91%) diff --git a/LICENSE_HEADER b/HEADER.txt similarity index 91% rename from LICENSE_HEADER rename to HEADER.txt index 53369bc80..0a3862c3e 100644 --- a/LICENSE_HEADER +++ b/HEADER.txt @@ -1,4 +1,4 @@ - Copyright 2021 Club Obsidian and contributors. + Copyright 2022 virustotalop and contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index 7a6de51b6..4277e7bf0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java-library' id 'com.github.johnrengelman.shadow' version '7.1.1' + id 'org.cadixdev.licenser' version '0.6.1' id 'eclipse' id 'idea' id 'maven-publish' @@ -14,9 +15,9 @@ allprojects { subprojects { apply plugin: 'java-library' apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'org.cadixdev.licenser' apply plugin: 'maven-publish' - publishing { publications { shadow(MavenPublication) { @@ -33,6 +34,11 @@ subprojects { targetCompatibility = JavaVersion.VERSION_11 } + license { + header = project.rootProject.file('HEADER.txt') + include '**/*.java' + } + test { useJUnitPlatform() } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index fd39c62ff..e484c7b13 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java index 48e0b6340..44f7abe02 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java index 28b2f4f4a..e1e55b990 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.command; import org.bukkit.command.Command; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java index 9968cafa6..31880636e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java index f169ab318..0d4fde067 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/economy/VaultEconomy.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.economy; import com.clubobsidian.dynamicgui.core.economy.Economy; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java index 616399069..e75b494bc 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitEntityWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.entity; import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 601def252..2fbafbf5a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.entity; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java index 85d402d45..e547e7fb1 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitInventoryWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.inventory; import com.clubobsidian.dynamicgui.bukkit.util.BukkitPacketUtil; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java index 328795c2a..a3834f81a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inventory/BukkitItemStackWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.inventory; import com.clubobsidian.dynamicgui.bukkit.util.BukkitNBTUtil; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java index 51f25f7d4..2681110e8 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/EntityClickListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitEntityWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java index ebb84fcb8..1e900c19f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryCloseListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index c3b9e926a..9e2663d29 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java index 664c6479f..c381cb2cc 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryOpenListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index c4a3d4497..c7565ce50 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.listener; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java index 14464dde2..038a78439 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/entity/BukkitEntityManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.manager.entity; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index f37caa44c..211563842 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.manager.inventory; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitInventoryWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java index 128304309..356166195 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitItemStackManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.manager.inventory; import com.clubobsidian.dynamicgui.bukkit.inventory.BukkitItemStackWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java index 14767f326..bb08fce03 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/material/BukkitMaterialManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.manager.material; import com.clubobsidian.dynamicgui.core.manager.material.MaterialManager; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java index f661586ca..692ea238f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.bukkit.manager; \ No newline at end of file +package com.clubobsidian.dynamicgui.bukkit.manager; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java index 5e54d93c3..16d4ea40e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/world/BukkitLocationManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.manager.world; import com.clubobsidian.dynamicgui.bukkit.world.BukkitWorldWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java index c615beb8b..9e26e7c2d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.bukkit; \ No newline at end of file +package com.clubobsidian.dynamicgui.bukkit; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java index 61aac5670..45192ac21 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/FoundryPermission.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.permission; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java index 6e539582c..601f9c78e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/permission/VaultPermission.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.permission; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java index f51020fcf..fec530cb0 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/platform/BukkitPlatform.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.platform; import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 6a0e6f1a3..41dc3362e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.plugin; import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java index c66827a31..ddfe6606c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/npc/CitizensRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.registry.npc; import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java index 8cfecae83..5180272ce 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.bukkit.registry; \ No newline at end of file +package com.clubobsidian.dynamicgui.bukkit.registry; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java index 57eb73fb1..b73469871 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/replacer/PlaceholderApiReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.registry.replacer; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java index 659871664..b22e6aa76 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/scheduler/BukkitScheduler.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.scheduler; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index 13bf7190b..7002b3f92 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.util; import org.bukkit.inventory.ItemStack; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java index 1e4148f34..49c4ad427 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.util; import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java index f8a380112..9b3f45be4 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/VersionUtil.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.util; import org.bukkit.Bukkit; diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java index 75446896e..62fee7c21 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/world/BukkitWorldWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.bukkit.world; import com.clubobsidian.dynamicgui.core.world.WorldWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index c2affe264..f82ac631a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core; import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java index 7a95d7847..6dc0cc411 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/EnchantmentBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java index b360f6cb8..a620c5936 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.parser.function.FunctionData; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java index 2949dfa33..5967316fa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/FunctionTokenBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.parser.function.FunctionData; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java index d4c781f82..3c4bed1d8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/GuiBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.core.gui.Gui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java index 64e4854c2..e0f13f197 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/builder/SlotBuilder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.builder; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java index 977698320..b739b5059 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.command; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.command; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java index 273c171a9..7274f195d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/economy/Economy.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.economy; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java index abe87f8d0..4714ca1c9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/ParticleWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.effect; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java index e5e86316f..7d461cd40 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/effect/SoundWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.effect; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java index 6a20fe35a..6922b4195 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/enchantment/EnchantmentWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.enchantment; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java index a10dbf236..9ed771cd5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/EntityWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.entity; public abstract class EntityWrapper { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index 04c71395b..48435fb06 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.entity; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java index b4b22fd5a..c31435347 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event; import com.clubobsidian.trident.Event; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java index 473a13e28..07df0a3ea 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/InventoryEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java index 7cfe6f741..e5272d00d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/LocationEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java index e05ae6969..ad6d32fd0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/PlayerEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java index c3a27fa5c..8491f3e55 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.block; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java index 8736284f0..507c08479 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/Click.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; public enum Click { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java index 606688756..5bfe06631 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java index 812eeee66..8bfa5f41d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiPreloadEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java index 9bfb4150f..2056ae8d6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java index 282e77e0b..8107074ac 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryCloseEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java index 1123026a1..d68ae4ee5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java index f717a3066..ce0ce8a9a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryOpenEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java index b0ff91298..b48001c96 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/PlayerInteractEntityEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.inventory; import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java index 1565150de..2d6071acd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerAction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.player; public enum PlayerAction { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java index 7fa659981..ebfff7b0e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerKickEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.player; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java index c6f37ce9d..8a5af8db3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/player/PlayerQuitEvent.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.event.player; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 47f9f705e..6b1d5a23f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java index 08cea7d46..4fcfce1d2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/AddPermissionFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java index 714688ef2..345bf5c38 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckItemTypeInHandFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java index 0d3089157..6ad2bef34 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckLevelFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java index a2d4901cc..42b6dcacd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/CheckPlayerWorldFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java index df56b2a1a..492a22a2b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ConsoleCommandFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java index fd56fd7a3..324a818b5 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/GetGameRuleFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java index 31dfef9f8..865a12cb0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/IsBedrockPlayerFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java index 9e8087112..cdc7a67ed 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/LogFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java index 825de61cc..e8586316c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyBalanceFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java index cfbb2cf2d..89df47890 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyDepositFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java index aace5c39c..71df91998 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/MoneyWithdrawFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java index a8ef666c2..ab070eac1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/NoPermissionFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java index 21141b8fd..fd47282ff 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ParticleFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.effect.ParticleWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java index a34672274..4244e96dd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PermissionFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java index d0515de6b..0ccff0a7a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerCommandFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java index 699d6ae19..ccec745a2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMessageFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java index 18849e286..92109b135 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/PlayerMsgJsonFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java index 5134e0338..51aefd98b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RandomFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java index ea3d3d23b..95a1fa81d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemovePermissionFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java index 263bab430..c644baed2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/RemoveSlotFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java index b9ffb5f3c..506011b55 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetFrameFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java index 6b69f5f74..e86104cec 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ResetTickFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java index 835b34d29..52c3ca005 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SendFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java index 68a0f7bd8..860677be6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java index 51fd0db80..f3f52860b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastJsonFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java index 10eefe6ab..07945a49c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetAmountFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java index c8a62eccd..5ee2237b6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetCloseFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java index 3b868fbe8..c4ec59ef8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetDurabilityFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java index 88716f2a4..7fab2b575 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetEnchantsFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java index c950cd626..521e02401 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGameRuleFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java index a0db129a0..b9356ec21 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetGlowFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java index 4a5d7988d..b5632a0a8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java index b4725fc1e..e318a5586 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNBTFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java index 780dd4b1a..b44907716 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java index 28336823c..d4060b2e9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetTypeFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java index bc18f6874..1fb9e5e91 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SoundFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl; import com.clubobsidian.dynamicgui.core.effect.SoundWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java index d47675006..25ba73d7e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/CheckTickFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java index 46a9f9a35..4f4e7ef65 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ConditionFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java index bde8967f3..9b6c293c3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/ContainsLazyFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java index 66bcf113c..b84061f8a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EndsWithLazyFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java index 323d8084b..1e85440a6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/EqualLazyFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java index 51e0994a6..8fc804b89 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/IgnoreCaseEqualLazyFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java index a6df758ef..43b626334 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/condition/StartsWithLazyFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.condition; import com.udojava.evalex.AbstractLazyFunction; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java index 1e9075ae3..41da04fe2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsNotOnCooldownFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.cooldown; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java index 8f3ce3145..9567a3c2c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/IsOnCooldownFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.cooldown; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java index 44d83cbad..987ac9940 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/cooldown/SetCooldownFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.cooldown; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java index 21650398e..b7bb1a152 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/BackFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java index f392e7eba..96ca6da86 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/GuiFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java index aae84e9ce..96697b15b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/HasBackFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java index 84d7cb1e8..70b72141a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshGuiFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java index 9ba21cfac..a7b77a278 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/RefreshSlotFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java index e06d43790..6be502b02 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/gui/SetBackFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java index 854a26b56..fc5ea7c73 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/CopyBackMetadataFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.meta; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java index f3b326450..d2b532da7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/HasMetadataFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.meta; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java index b3fbe5271..aeab27da2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/meta/SetMetadataFunction.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.function.impl.meta; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java index 6220f4918..6c289d601 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/FunctionOwner.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java index f82665f54..aef7ec1c8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Gui.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java index 5ad15f290..0dec21586 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui; public enum InventoryType { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java index 9e0f335fe..3258c6227 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/InventoryView.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui; public enum InventoryView { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java index f2629942d..26815e41e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/ModeEnum.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui; public enum ModeEnum { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java index 46f44a877..7e825823e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/Slot.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java index 960935abd..5933c73a8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/AnimationHolder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui.property.animation; public interface AnimationHolder extends Refreshable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java index ee5435929..895e4d4fa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/gui/property/animation/Refreshable.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.gui.property.animation; public interface Refreshable { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 1f9c00f92..b7083f8fd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.inject.module; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java index 01555e145..87fd819fd 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.inject; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.inject; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java index 7f8ce9b6c..dabbe821b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/InventoryWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.inventory; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java index 1049540bd..628fcd267 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inventory/ItemStackWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.inventory; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java index 6da49c6f1..753502da0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/EntityClickListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index c6c0c471a..11cb5e8ff 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java index e1b3abd90..800c5de08 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryCloseListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 7239bff46..edf80e7d4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java index 5bec3daf6..08b4ea816 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/PlayerInteractListener.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.listener; import com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java index 7c61a9ed3..b204c0552 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/JavaLoggerWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.logger; import java.util.logging.Level; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java index 009e5a8ae..c7020e37c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/logger/LoggerWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.logger; public abstract class LoggerWrapper { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java index a48f8df82..4bf98414a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/AnimationReplacerManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 9da5b5a76..9582fa6b4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 62312b73d..50d590d0a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java index a9330a020..be0f02a3b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/ReplacerManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java index 2cf8650a1..748d71343 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/SlotManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java index adb45b9b9..7a2bb4aaa 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/Cooldown.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown; public class Cooldown { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java index 28c305b0c..1585fbfa6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/cooldown/CooldownManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.dynamicgui.cooldown; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java index 52f6a9443..45ee92d6c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/entity/EntityManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.entity; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java index a45d3b63d..051594d63 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/InventoryManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.inventory; import com.clubobsidian.dynamicgui.core.inventory.InventoryWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java index bced4d5d9..375801552 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/inventory/ItemStackManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.inventory; import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java index 576c5285b..bcc49e697 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/material/MaterialManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.material; import com.google.inject.Inject; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java index 41d8963dd..f595958fb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/world/LocationManager.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.manager.world; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java index 90cce25aa..69ac7e3b8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/messaging/MessagingRunnable.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.messaging; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java index e38f74bdc..fcd68a437 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.permission; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java index 275dd6bb3..bf12e189a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/Platform.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.platform; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java index c6189f9c1..66decb6e3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/platform/PlatformType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.platform; public enum PlatformType { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index efcaf7ebc..be986d646 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.plugin; import com.clubobsidian.dynamicgui.core.economy.Economy; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java index 11dd4d6b3..ebf43f329 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/proxy/Proxy.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.proxy; import java.util.Locale; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java index 3dadaf9e3..53bf48cc6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPC.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.npc; import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java index a1efcc774..6af23588e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCMeta.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.npc; public class NPCMeta { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java index a631b6334..93b54061d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/npc/NPCRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.npc; import com.clubobsidian.dynamicgui.core.entity.EntityWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java index 36ee52f96..e1fd3d39b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/package-info.java @@ -13,4 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java index 840d94939..8049bdd46 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/AnimationReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.replacer; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java index b5d798082..1522529a7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/ReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.replacer; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java index ba1b33929..e48539c72 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/CooldownReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.replacer.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java index 216298b61..eb326a8df 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiAnimationReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.replacer.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java index 8596f8e74..2296a499e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.replacer.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java index 2a72ddc5a..b2e949164 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/MetadataReplacerRegistry.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.registry.replacer.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java index 236271bb8..fb41ab282 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/AnimationReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java index be4381d7f..74751c5d0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/Replacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java index 8267f3ee7..04a7813f9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/MultiLineTestAnimationReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.animation.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java index cf5335232..d337ef69a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/animation/impl/TestAnimationReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.animation.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java index 9dbf04a6a..377010058 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/GlobalPlayerCountReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java index 8a16ce9a5..e7fc983d4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/OnlinePlayersReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java index 8fb634080..f3f14f453 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerLevelReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java index 3e3cbd976..671b549ec 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PlayerReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java index 1652e02e4..8e98d0583 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/PreviousGuiReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.impl; import com.clubobsidian.dynamicgui.core.DynamicGui; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java index 468d1ea79..b560e9b8a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/UUIDReplacer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.replacer.impl; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java index 337760c7e..e1db2af03 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/scheduler/Scheduler.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.scheduler; public abstract class Scheduler { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java index dc5ca0cbf..a03c12ef9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.util; import java.awt.*; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java index 0f2afe4a4..1e8582f16 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/HashUtil.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.util; import java.io.File; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index 2e6cbc34a..25a587d23 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.util; import java.lang.reflect.Field; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java index c434f06d3..4f167f76a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/LocationWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.world; import java.io.Serializable; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java index 843b75ff4..1d01a44e0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/world/WorldWrapper.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.core.world; import java.io.Serializable; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java index 9be54d3d0..b9143b901 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/entity/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.test.mock.entity; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.test.mock.entity; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java index dbfab3ad1..256720cfc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.test; \ No newline at end of file +package com.clubobsidian.dynamicgui.core.test; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java index 90a22c998..721155083 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionData.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function; import com.clubobsidian.fuzzutil.StringFuzz; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java index ba8fe6c23..d500f9f91 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionModifier.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function; public enum FunctionModifier { diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java index 7061f762a..b2681004f 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionToken.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function; import java.io.Serializable; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java index cef683dd1..cc2736e8d 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionType.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function; import com.clubobsidian.fuzzutil.StringFuzz; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java index fc71e8627..7c556efe4 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/FunctionTypeParser.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function; import com.clubobsidian.dynamicgui.parser.macro.MacroParser; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java index 610d66451..03e346581 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function.tree; import com.clubobsidian.dynamicgui.parser.function.FunctionToken; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java index d837506b1..d60f9c88a 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.function.tree; import com.clubobsidian.dynamicgui.parser.function.FunctionData; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java index 4ea832fc9..e6884f100 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiMode.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.gui; public enum GuiMode { diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java index 476a74fad..00587a36f 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.gui; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java index 1d44d5f94..c0c8a70b4 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroParser.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.macro; import org.apache.commons.lang3.StringUtils; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java index fd0561509..7f1d19ea1 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/macro/MacroToken.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.macro; import com.clubobsidian.wrappy.ConfigurationSection; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java index 7990c98b9..57e038c63 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/package-info.java @@ -14,4 +14,4 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.parser; \ No newline at end of file +package com.clubobsidian.dynamicgui.parser; diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index 77542f493..ba988dc1f 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.slot; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java index 5e7b9b6cc..a0681d75e 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTreeTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.test; import com.clubobsidian.dynamicgui.parser.function.FunctionData; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java index adb103e32..6dbdb4600 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/FunctionTypeParserTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.test; import com.clubobsidian.dynamicgui.parser.function.FunctionType; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java index a4b0db407..cee071b69 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/GuiTokenTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.test; import com.clubobsidian.dynamicgui.parser.function.FunctionData; diff --git a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java index 6d6666df4..aacc032e2 100644 --- a/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java +++ b/parser/src/test/java/com/clubobsidian/dynamicgui/parser/test/SlotTokenTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.clubobsidian.dynamicgui.parser.test; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionTree; From e6f3852fc47d05518022e972900a6a9d76fa082f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 28 Mar 2022 23:45:28 -0700 Subject: [PATCH 195/261] Don't call slot load functions on async --- .../core/manager/dynamicgui/GuiManager.java | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 50d590d0a..dbfab44a6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -218,33 +218,31 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu //Run slot load functions CompletableFuture slotFuture = new CompletableFuture<>(); - ThreadUtil.run(() -> { - List slots = clonedGui.getSlots(); - int slotSize = slots.size(); - AtomicInteger slotCount = new AtomicInteger(0); - for (int i = 0; i < slotSize; i++) { - if(slotFuture.isDone()) { - return; - } - Slot slot = slots.get(i); - FunctionManager.get() - .tryFunctions(slot, FunctionType.LOAD, playerWrapper) - .whenComplete((slotResult, ex) -> { - if(slotFuture.isDone()) { - return; - } - if(ex != null) { - ex.printStackTrace(); - slotFuture.complete(false); - } else { - int count = slotCount.incrementAndGet(); - if(slotSize == count) { - slotFuture.complete(true); - } - } - }); + List slots = clonedGui.getSlots(); + int slotSize = slots.size(); + AtomicInteger slotCount = new AtomicInteger(0); + for (int i = 0; i < slotSize; i++) { + if(slotFuture.isDone()) { + return; } - }, true); + Slot slot = slots.get(i); + FunctionManager.get() + .tryFunctions(slot, FunctionType.LOAD, playerWrapper) + .whenComplete((slotResult, ex) -> { + if(slotFuture.isDone()) { + return; + } + if(ex != null) { + ex.printStackTrace(); + slotFuture.complete(false); + } else { + int count = slotCount.incrementAndGet(); + if(slotSize == count) { + slotFuture.complete(true); + } + } + }); + } slotFuture.whenComplete((completed, ex) -> { if (ex != null) { ex.printStackTrace(); From c1f96bdf1a92d1e6845564ae436ab975db5bd2dc Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 29 Mar 2022 00:19:32 -0700 Subject: [PATCH 196/261] Implement skin caching Fixes #190 --- build.gradle | 2 + .../bukkit/entity/BukkitPlayerWrapper.java | 35 +++++++++++++ .../dynamicgui/core/entity/PlayerWrapper.java | 2 + .../impl/DynamicGuiReplacerRegistry.java | 2 + .../replacer/impl/SkinTextureReplacer.java | 50 +++++++++++++++++++ 5 files changed, 91 insertions(+) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/SkinTextureReplacer.java diff --git a/build.gradle b/build.gradle index 4277e7bf0..b22db556f 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,7 @@ subprojects { relocate 'javax.annotation', 'com.clubobsidian.dynamicgui.shaded.javaxannotation' relocate 'com.google.errorprone', 'com.clubobsidian.dynamicgui.shaded.errorprone' relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson' + relocate 'com.github.benmanes.caffeine', 'com.clubobsidian.dynamicgui.shaded.caffeine' } repositories { @@ -87,5 +88,6 @@ subprojects { testImplementation 'org.mockito:mockito-core:4.3.1' api 'org.apache.commons:commons-lang3:3.12.0' api 'com.github.clubobsidian:wrappy:2.3.2' + api 'com.github.ben-manes.caffeine:caffeine:3.0.4' } } \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 2fbafbf5a..82d293646 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -27,6 +27,7 @@ import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.world.LocationWrapper; +import com.google.common.collect.ForwardingMultimap; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.chat.ComponentSerializer; import org.bukkit.Effect; @@ -38,6 +39,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Collection; import java.util.UUID; public class BukkitPlayerWrapper extends PlayerWrapper { @@ -172,4 +176,35 @@ public LocationWrapper getLocation() { public boolean isOnline() { return this.getPlayer().isOnline(); } + + @Override + public String getSkinTexture() { + try { + Object profile = this.getPlayer().getClass().getDeclaredMethod("getProfile").invoke(this.getPlayer()); + Object properties = profile.getClass() + .getDeclaredMethod("getProperties") + .invoke(profile); + Class forwardingMap = Class.forName( + new String(new byte[]{'c', 'o', 'm', '.'}) + + "google." + + "common." + + "collect." + + "ForwardingMultimap"); //We relocate guava so we have to do this + Object property = null; + for (Method m : forwardingMap.getDeclaredMethods()) { + if (m.getName().equals("get")) { + property = ((Collection) (m.invoke(properties, "textures"))) + .stream().findFirst().orElse(null); + break; + } + } + if (property == null) { + return null; + } + return (String) property.getClass().getDeclaredMethod("getValue").invoke(property); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e) { + e.printStackTrace(); + return null; + } + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index 48435fb06..db08558f0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -78,4 +78,6 @@ public T getPlayer() { public abstract LocationWrapper getLocation(); public abstract boolean isOnline(); + + public abstract String getSkinTexture(); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java index 2296a499e..cc9946659 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -26,6 +26,7 @@ import com.clubobsidian.dynamicgui.core.replacer.impl.PlayerLevelReplacer; import com.clubobsidian.dynamicgui.core.replacer.impl.PlayerReplacer; import com.clubobsidian.dynamicgui.core.replacer.impl.PreviousGuiReplacer; +import com.clubobsidian.dynamicgui.core.replacer.impl.SkinTextureReplacer; import com.clubobsidian.dynamicgui.core.replacer.impl.UUIDReplacer; import com.clubobsidian.trident.EventHandler; import org.apache.commons.lang3.StringUtils; @@ -51,6 +52,7 @@ private DynamicGuiReplacerRegistry() { this.addReplacer(new UUIDReplacer("%uuid%")); this.addReplacer(new PlayerLevelReplacer("%player-level%")); this.addReplacer(new PreviousGuiReplacer("%previous-gui-name%")); + this.addReplacer(new SkinTextureReplacer("%skin_texture%")); DynamicGui.get().getEventBus().registerEvents(this); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/SkinTextureReplacer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/SkinTextureReplacer.java new file mode 100644 index 000000000..5d8338695 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/replacer/impl/SkinTextureReplacer.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.replacer.impl; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.replacer.Replacer; +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; + +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public class SkinTextureReplacer extends Replacer { + + private static final String DEFAULT_SKIN_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTY0ODUzNDUwMjUwOCwKIC" + + "AicHJvZmlsZUlkIiA6ICJlYzU2MTUzOGYzZmQ0NjFkYWZmNTA4NmIyMjE1NGJjZSIsCiAgInByb2ZpbGVOYW1lIiA" + + "6ICJBbGV4IiwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4" + + "dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzFhNGFmNzE4NDU1ZDRhYWI1MjhlN2E2MWY4NmZhMjVlNmEzNjlkM" + + "Tc2OGRjYjEzZjdkZjMxOWE3MTNlYjgxMGIiCiAgICB9CiAgfQp9"; + + private final Cache textureCache = Caffeine + .newBuilder() + .expireAfterWrite(5, TimeUnit.MINUTES) + .build(); + + public SkinTextureReplacer(String toReplace) { + super(toReplace); + } + + @Override + public String replacement(String text, PlayerWrapper playerWrapper) { + UUID uuid = playerWrapper.getUniqueId(); + String texture = this.textureCache.get(uuid, (key) -> playerWrapper.getSkinTexture()); + return texture == null ? DEFAULT_SKIN_TEXTURE : texture; + } +} From fc96147bbb0b46a471bc037488877924bd1eb00c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 29 Mar 2022 00:22:57 -0700 Subject: [PATCH 197/261] Relocate checker framework dataflow --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index b22db556f..20f83ed18 100644 --- a/build.gradle +++ b/build.gradle @@ -59,6 +59,7 @@ subprojects { relocate 'org.checkerframework.framework', 'com.clubobsidian.dynamicgui.shaded.checkerframework.framework' relocate 'org.checkerframework.common', 'com.clubobsidian.dynamicgui.shaded.checkerframework.common' relocate 'org.checkerframework.checker', 'com.clubobsidian.dynamicgui.shaded.checkerframework.checker' + relocate 'org.checkerframework.dataflow', 'com.clubobsidian.dynamicgui.shaded.checkerframework.dataflow' relocate 'org.apache.commons', 'com.clubobsidian.dynamicgui.shaded.apachecommons' relocate 'org.aopalliance.intercept', 'com.clubobsidian.dynamicgui.shaded.aopalliance.intercept' relocate 'org.aopalliance.aop', 'com.clubobsidian.dynamicgui.shaded.aopalliance.aop' From f394a40da1b2ac06d737c9d22bc8a693ffe5cb15 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 29 Mar 2022 02:22:43 -0700 Subject: [PATCH 198/261] Implement switch event Closes #243 --- .../core/event/inventory/GuiSwitchEvent.java | 51 +++++++++++++++++++ .../dynamicgui/core/listener/GuiListener.java | 14 ++--- .../core/manager/dynamicgui/GuiManager.java | 5 ++ 3 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiSwitchEvent.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiSwitchEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiSwitchEvent.java new file mode 100644 index 000000000..8b0a66833 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiSwitchEvent.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.event.inventory; + + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.trident.Event; + +public class GuiSwitchEvent extends Event { + + private final Gui switchFrom; + private final Gui switchTo; + private final PlayerWrapper playerWrapper; + + public GuiSwitchEvent(Gui switchFrom, Gui switchTo, PlayerWrapper playerWrapper) { + this.switchFrom = switchFrom; + this.switchTo = switchTo; + this.playerWrapper = playerWrapper; + } + + public Gui gui() { + return this.switchFrom; + } + + public PlayerWrapper getPlayerWrapper() { + return this.playerWrapper; + } + + public Gui getSwitchFrom() { + return this.switchFrom; + } + + public Gui getSwitchTo() { + return this.switchTo; + } +} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java index 11cb5e8ff..f7b2f603e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/GuiListener.java @@ -18,6 +18,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiSwitchEvent; import com.clubobsidian.dynamicgui.core.event.inventory.InventoryCloseEvent; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; @@ -34,16 +35,11 @@ public class GuiListener { private final Set users = new HashSet<>(); @EventHandler - public void onGuiLoad(GuiLoadEvent event) { - PlayerWrapper wrapper = event.getPlayerWrapper(); - Gui gui = GuiManager.get().getPlayerGui(wrapper); + public void onGuiSwitch(GuiSwitchEvent event) { + Gui gui = event.getSwitchFrom(); PlayerWrapper playerWrapper = event.getPlayerWrapper(); - boolean open = (gui != null); - if (open) { - UUID uuid = wrapper.getUniqueId(); - this.users.add(uuid); - FunctionManager.get().tryFunctions(gui, FunctionType.SWITCH_MENU, playerWrapper); - } + FunctionManager.get().tryFunctions(gui, FunctionType.SWITCH_MENU, playerWrapper); + this.users.add(playerWrapper.getUniqueId()); } @EventHandler diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index dbfab44a6..98a608417 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -21,6 +21,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; import com.clubobsidian.dynamicgui.core.event.inventory.GuiPreloadEvent; +import com.clubobsidian.dynamicgui.core.event.inventory.GuiSwitchEvent; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.gui.ModeEnum; import com.clubobsidian.dynamicgui.core.gui.Slot; @@ -210,6 +211,10 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu DynamicGui.get().getEventBus().callEvent(event); if (ran) { + Gui currentGui = this.getPlayerGui(playerWrapper); + if (back != null && back.equals(currentGui)) { + DynamicGui.get().getEventBus().callEvent(new GuiSwitchEvent(back, clonedGui, playerWrapper)); + } InventoryWrapper inventoryWrapper = clonedGui.buildInventory(playerWrapper); if (inventoryWrapper == null) { future.complete(false); From a5b6f318419fe7e61f008a4af5d42ad4a4957b4c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 29 Mar 2022 03:08:54 -0700 Subject: [PATCH 199/261] Fix invalid inventory type not being caught --- .../bukkit/manager/inventory/BukkitInventoryManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java index 211563842..06256bded 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/manager/inventory/BukkitInventoryManager.java @@ -32,7 +32,12 @@ public Object createInventory(int size, String title) { @Override public Object createInventory(String title, String type) { - return Bukkit.getServer().createInventory(null, InventoryType.valueOf(type), title); + try { + return Bukkit.getServer().createInventory(null, InventoryType.valueOf(type), title); + } catch(IllegalArgumentException ex) { + ex.printStackTrace(); + return null; + } } @Override From 284f693a15a4d3f28a377e46d395a5804ab500c3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 30 Mar 2022 22:56:38 -0700 Subject: [PATCH 200/261] Start working on cloud commands --- build.gradle | 9 ++- bukkit/build.gradle | 1 + .../command/BukkitGuiCommandSender.java | 40 ++++++++++++ .../bukkit/inject/BukkitPluginModule.java | 9 ++- .../bukkit/plugin/BukkitPlugin.java | 36 ++++++++++- bukkit/src/main/resources/plugin.yml | 2 - .../dynamicgui/core/DynamicGui.java | 23 ++++++- .../dynamicgui/core/command/GuiCommand.java | 29 ++++----- ...ackage-info.java => GuiCommandSender.java} | 19 ++++++ .../core/inject/module/PluginModule.java | 16 ++++- .../core/permission/Permission.java | 2 + .../core/test/command/MockCommandManager.java | 63 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 6 +- .../test/mock/inject/MockPluginModule.java | 9 ++- 14 files changed, 232 insertions(+), 32 deletions(-) create mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java rename bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java => core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java (50%) rename core/src/main/java/com/clubobsidian/dynamicgui/core/command/{package-info.java => GuiCommandSender.java} (57%) create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java diff --git a/build.gradle b/build.gradle index 20f83ed18..ace8aff02 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,10 @@ plugins { allprojects { group 'com.clubobsidian' version '5.0.0' + ext { + junitVersion = '5.8.2' + cloudVersion = '1.6.2' + } } subprojects { @@ -81,7 +85,7 @@ subprojects { maven { url 'https://jitpack.io' } } - def junitVersion = '5.8.2' + dependencies { testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" @@ -90,5 +94,8 @@ subprojects { api 'org.apache.commons:commons-lang3:3.12.0' api 'com.github.clubobsidian:wrappy:2.3.2' api 'com.github.ben-manes.caffeine:caffeine:3.0.4' + compileOnly "cloud.commandframework:cloud-core:$cloudVersion" + testImplementation "cloud.commandframework:cloud-core:$cloudVersion" + api "cloud.commandframework:cloud-annotations:$cloudVersion" } } \ No newline at end of file diff --git a/bukkit/build.gradle b/bukkit/build.gradle index 58b640578..c56f943d0 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -17,4 +17,5 @@ dependencies { compileOnly 'com.github.clubobsidian:foundry:2.0.1' compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT' compileOnly 'net.md-5:bungeecord-api:1.8-SNAPSHOT' + implementation "cloud.commandframework:cloud-paper:$cloudVersion" } \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java new file mode 100644 index 000000000..4807e6baf --- /dev/null +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.bukkit.command; + +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class BukkitGuiCommandSender implements GuiCommandSender { + + private final CommandSender sender; + + public BukkitGuiCommandSender(CommandSender sender) { + this.sender = sender; + } + + @Override + public Object getNativeSender() { + return this.sender; + } + + @Override + public boolean isPlayer() { + return this.sender instanceof Player; + } +} diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index e8bb0c6bb..9f8dbc76e 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -16,11 +16,13 @@ package com.clubobsidian.dynamicgui.bukkit.inject; +import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.bukkit.manager.entity.BukkitEntityManager; import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitInventoryManager; import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitItemStackManager; import com.clubobsidian.dynamicgui.bukkit.manager.material.BukkitMaterialManager; import com.clubobsidian.dynamicgui.bukkit.manager.world.BukkitLocationManager; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; @@ -33,8 +35,11 @@ public class BukkitPluginModule extends PluginModule { - public BukkitPluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper logger) { - super(plugin, platform, logger); + public BukkitPluginModule(DynamicGuiPlugin plugin, + Platform platform, + LoggerWrapper logger, + CommandManager commandManager) { + super(plugin, platform, logger, commandManager); } @Override diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 41dc3362e..aa77973b2 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -16,8 +16,12 @@ package com.clubobsidian.dynamicgui.bukkit.plugin; +import cloud.commandframework.CommandManager; +import cloud.commandframework.bukkit.CloudBukkitCapabilities; +import cloud.commandframework.execution.CommandExecutionCoordinator; +import cloud.commandframework.paper.PaperCommandManager; import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; -import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommand; +import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommandSender; import com.clubobsidian.dynamicgui.bukkit.command.CustomCommand; import com.clubobsidian.dynamicgui.bukkit.command.CustomCommandExecutor; import com.clubobsidian.dynamicgui.bukkit.economy.VaultEconomy; @@ -35,6 +39,7 @@ import com.clubobsidian.dynamicgui.bukkit.registry.npc.CitizensRegistry; import com.clubobsidian.dynamicgui.bukkit.registry.replacer.PlaceholderApiReplacerRegistry; import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.logger.JavaLoggerWrapper; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; @@ -46,6 +51,7 @@ import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; +import org.bukkit.command.CommandSender; import org.bukkit.command.SimpleCommandMap; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -83,7 +89,9 @@ public void start() { Platform platform = new BukkitPlatform(); LoggerWrapper logger = new JavaLoggerWrapper<>(this.getLogger()); - new BukkitPluginModule(this, platform, logger).bootstrap(); + CommandManager commandManager = this.createCommandSender(); + + new BukkitPluginModule(this, platform, logger, commandManager).bootstrap(); PluginManager pm = this.getServer().getPluginManager(); boolean vault = false; @@ -134,7 +142,7 @@ public void start() { ReplacerManager.get().registerReplacerRegistry(new PlaceholderApiReplacerRegistry()); } - this.getCommand("gui").setExecutor(new BukkitGuiCommand()); + //this.getCommand("gui").setExecutor(new BukkitGuiCommand()); this.getCommand("dynamicgui").setExecutor(new BukkitDynamicGuiCommand()); this.getServer().getPluginManager().registerEvents(new EntityClickListener(), this); this.getServer().getPluginManager().registerEvents(new InventoryInteractListener(), this); @@ -143,6 +151,28 @@ public void start() { this.getServer().getPluginManager().registerEvents(new PlayerInteractListener(), this); } + private CommandManager createCommandSender() { + try { + PaperCommandManager commandManager = new PaperCommandManager(this, + CommandExecutionCoordinator.simpleCoordinator(), + BukkitGuiCommandSender::new, + wrappedSender -> (CommandSender) wrappedSender.getNativeSender() + + ); + //Unfortunately is tied to bukkit so there is no way to do this in core + if (commandManager.queryCapability(CloudBukkitCapabilities.BRIGADIER)) { + commandManager.registerBrigadier(); + } + if(commandManager.queryCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { + commandManager.registerAsynchronousCompletions(); + } + return commandManager; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + private void registerModelProviders(PluginManager pm) { if (pm.getPlugin("Oraxen") != null) { ModelManager.get().register(new OraxenModelProvider()); diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 999664827..7093b75a7 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -5,8 +5,6 @@ author: VirusTotal api-version: 1.13 softdepend: [Vault, PlaceholderAPI, RedisBungee, PlayerPoints, Citizens, Rankup, Foundry, Oraxen, ItemsAdder] commands: - gui: - description: "DynamicGUI gui command!" guilist: description: "Lists out all the guis for DynamicGUI!" dynamicgui: diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index f82ac631a..a33eb718a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -16,6 +16,11 @@ package com.clubobsidian.dynamicgui.core; +import cloud.commandframework.CommandManager; +import cloud.commandframework.annotations.AnnotationParser; +import cloud.commandframework.meta.SimpleCommandMeta; +import com.clubobsidian.dynamicgui.core.command.GuiCommand; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; @@ -142,14 +147,25 @@ public static DynamicGui get() { private final DynamicGuiPlugin plugin; private final Platform platform; private final LoggerWrapper loggerWrapper; + private final CommandManager commandManager; + private final AnnotationParser commandParser; private final Injector injector; private boolean initialized; @Inject - private DynamicGui(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper loggerWrapper, Injector injector) { + private DynamicGui(DynamicGuiPlugin plugin, + Platform platform, + LoggerWrapper loggerWrapper, + CommandManager commandManager, + Injector injector) { this.plugin = plugin; this.platform = platform; this.loggerWrapper = loggerWrapper; + this.commandManager = commandManager; + this.commandParser = new AnnotationParser<>(this.commandManager, + GuiCommandSender.class, + parserParameters -> SimpleCommandMeta.empty()); + this.injector = injector; this.initialized = false; this.setupFileStructure(); @@ -162,6 +178,7 @@ private void init() { this.loadGuis(); this.checkForProxy(); this.registerListeners(); + this.registerCommands(); ReplacerManager.get().registerReplacerRegistry(DynamicGuiReplacerRegistry.get()); ReplacerManager.get().registerReplacerRegistry(CooldownReplacerRegistry.get()); ReplacerManager.get().registerReplacerRegistry(MetadataReplacerRegistry.get()); @@ -292,6 +309,10 @@ private void registerListeners() { this.eventBus.registerEvents(new GuiListener()); } + private void registerCommands() { + this.commandParser.parse(this.injector.getInstance(GuiCommand.class)); + } + private void loadFunctions() { FunctionManager.get().addFunction(new CheckTickFunction()); FunctionManager.get().addFunction(new ConditionFunction()); diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java similarity index 50% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index 44f7abe02..7294f1a0f 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -14,28 +14,23 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.bukkit.command; +package com.clubobsidian.dynamicgui.core.command; -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; +import cloud.commandframework.annotations.Argument; +import cloud.commandframework.annotations.CommandMethod; +import cloud.commandframework.annotations.CommandPermission; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; +import com.clubobsidian.dynamicgui.core.permission.Permission; -public class BukkitGuiCommand implements CommandExecutor { +public class GuiCommand { - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (sender instanceof Player) { - if (args.length == 1) { - Player player = (Player) sender; - PlayerWrapper playerWrapper = new BukkitPlayerWrapper(player); - GuiManager.get().openGui(playerWrapper, args[0]); - return true; - } + @CommandMethod("gui ") + @CommandPermission(Permission.GUI_BASE) + public void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { + PlayerWrapper player = sender.getPlayer().orElse(null); + if(player != null) { + GuiManager.get().openGui(player, guiName); } - return false; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java similarity index 57% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java index b739b5059..7020804f0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/package-info.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java @@ -15,3 +15,22 @@ */ package com.clubobsidian.dynamicgui.core.command; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; + +import java.util.Optional; + +public interface GuiCommandSender { + + Object getNativeSender(); + + boolean isPlayer(); + + default Optional> getPlayer() { + return this.isPlayer() ? + Optional.of(EntityManager + .get() + .createPlayerWrapper(this.getNativeSender())) : Optional.empty(); + } +} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index b7083f8fd..68ca3eb4d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -16,7 +16,10 @@ package com.clubobsidian.dynamicgui.core.inject.module; +import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.command.GuiCommand; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; @@ -40,11 +43,16 @@ public abstract class PluginModule implements Module { private final DynamicGuiPlugin plugin; private final Platform platform; private final LoggerWrapper logger; + private final CommandManager commandManager; - public PluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper logger) { + public PluginModule(DynamicGuiPlugin plugin, + Platform platform, + LoggerWrapper logger, + CommandManager commandManager) { this.plugin = plugin; this.platform = platform; this.logger = logger; + this.commandManager = commandManager; } public abstract Class getEntityManager(); @@ -66,8 +74,10 @@ public void configure(Binder binder) { binder.bind(LocationManager.class).to(this.locationClass); binder.bind(DynamicGuiPlugin.class).toInstance(this.plugin); binder.bind(Platform.class).toInstance(this.platform); - binder.bind(new TypeLiteral>() { - }).toInstance(this.logger); + binder.bind(new TypeLiteral>() {}).toInstance(this.logger); + binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); + + binder.bind(GuiCommand.class).asEagerSingleton(); binder.requestStaticInjection(EntityManager.class); binder.requestStaticInjection(InventoryManager.class); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java index fcd68a437..a2440c287 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java @@ -20,6 +20,8 @@ public interface Permission { + String GUI_BASE = "dynamicgui.command.gui"; + boolean setup(); boolean hasPermission(PlayerWrapper playerWrapper, String permission); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java new file mode 100644 index 000000000..0dc2cc4a1 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java @@ -0,0 +1,63 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.command; + +import cloud.commandframework.CommandManager; +import cloud.commandframework.CommandTree; +import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator; +import cloud.commandframework.execution.CommandExecutionCoordinator; +import cloud.commandframework.internal.CommandRegistrationHandler; +import cloud.commandframework.meta.CommandMeta; +import org.checkerframework.checker.nullness.qual.NonNull; + +import java.util.function.Function; + +public class MockCommandManager extends CommandManager { + + public MockCommandManager() { + this(CommandExecutionCoordinator.simpleCoordinator(), + CommandRegistrationHandler.nullCommandRegistrationHandler()); + } + + /** + * Create a new command manager instance + * + * @param commandExecutionCoordinator Execution coordinator instance. The coordinator is in charge of executing incoming + * commands. Some considerations must be made when picking a suitable execution coordinator + * for your platform. For example, an entirely asynchronous coordinator is not suitable + * when the parsers used in that particular platform are not thread safe. If you have + * commands that perform blocking operations, however, it might not be a good idea to + * use a synchronous execution coordinator. In most cases you will want to pick between + * {@link CommandExecutionCoordinator#simpleCoordinator()} and + * {@link AsynchronousCommandExecutionCoordinator} + * @param commandRegistrationHandler Command registration handler. This will get called every time a new command is + * registered to the command manager. This may be used to forward command registration + */ + protected MockCommandManager(@NonNull Function<@NonNull CommandTree, @NonNull CommandExecutionCoordinator> commandExecutionCoordinator, @NonNull CommandRegistrationHandler commandRegistrationHandler) { + super(commandExecutionCoordinator, commandRegistrationHandler); + } + + @Override + public boolean hasPermission(@NonNull C sender, @NonNull String permission) { + return false; + } + + @Override + public @NonNull CommandMeta createDefaultCommandMeta() { + return null; + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 0e29a83ca..6ba0a977b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -16,7 +16,9 @@ package com.clubobsidian.dynamicgui.core.test.mock; +import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; @@ -27,6 +29,7 @@ import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.test.command.MockCommandManager; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.inject.MockPluginModule; @@ -178,7 +181,8 @@ public MockFactory inject() { } Platform platform = new MockPlatform(); LoggerWrapper logger = new MockLoggerWrapper(new MockLogger()); - MockPluginModule module = new MockPluginModule(plugin, platform, logger); + CommandManager commandManager = new MockCommandManager(); + MockPluginModule module = new MockPluginModule(plugin, platform, logger, commandManager); module.bootstrap(); DynamicGui.get(); //Initializes dynamic gui this.getLogger().getLogger().clear(); //Clear logs for initialization diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java index c3f5c2087..c0abda443 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java @@ -16,6 +16,8 @@ package com.clubobsidian.dynamicgui.core.test.mock.inject; +import cloud.commandframework.CommandManager; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; @@ -33,8 +35,11 @@ public class MockPluginModule extends PluginModule { - public MockPluginModule(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper logger) { - super(plugin, platform, logger); + public MockPluginModule(DynamicGuiPlugin plugin, + Platform platform, + LoggerWrapper logger, + CommandManager commandManager) { + super(plugin, platform, logger, commandManager); } @Override From a5f1e37174b8de302df4a4a481a0fdca3f812e4a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 30 Mar 2022 23:01:34 -0700 Subject: [PATCH 201/261] Use interface defaults for file paths --- .../bukkit/plugin/BukkitPlugin.java | 21 ------------------- .../core/plugin/DynamicGuiPlugin.java | 12 ++++++++--- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index aa77973b2..7e139da36 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -65,9 +65,6 @@ public class BukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { - private File configFile; - private File guiFolder; - private File macroFolder; private Economy economy; private Permission permission; private List npcRegistries; @@ -82,9 +79,6 @@ public void onEnable() { @Override public void start() { this.registeredCommands = new ArrayList<>(); - this.configFile = new File(this.getDataFolder(), "config.yml"); - this.guiFolder = new File(this.getDataFolder(), "guis"); - this.macroFolder = new File(this.getDataFolder(), "macros"); Platform platform = new BukkitPlatform(); LoggerWrapper logger = new JavaLoggerWrapper<>(this.getLogger()); @@ -207,21 +201,6 @@ public List getNPCRegistries() { return this.npcRegistries; } - @Override - public File getConfigFile() { - return this.configFile; - } - - @Override - public File getGuiFolder() { - return this.guiFolder; - } - - @Override - public File getMacroFolder() { - return this.macroFolder; - } - private final CommandMap getCommandMap() { if (this.commandMap == null) { try { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index be986d646..0973beb23 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -37,11 +37,17 @@ public interface DynamicGuiPlugin { File getDataFolder(); - File getConfigFile(); + default File getConfigFile() { + return new File(this.getDataFolder(), "config.yml"); + } - File getGuiFolder(); + default File getGuiFolder() { + return new File(this.getDataFolder(), "guis"); + } - File getMacroFolder(); + default File getMacroFolder() { + return new File(this.getDataFolder(), "macros"); + } List getRegisteredCommands(); From dfc0c07dc6e94b46a1a80acfc1a7faf28eced454 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 30 Mar 2022 23:10:12 -0700 Subject: [PATCH 202/261] Unregister commands on shutdown --- .../bukkit/plugin/BukkitPlugin.java | 25 +++++++++---------- .../dynamicgui/core/DynamicGui.java | 2 ++ .../core/manager/dynamicgui/GuiManager.java | 3 +-- .../core/plugin/DynamicGuiPlugin.java | 5 ++-- .../mock/plugin/MockDynamicGuiPlugin.java | 9 +++++-- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 7e139da36..8cce7cfdc 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -56,9 +56,9 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -69,7 +69,7 @@ public class BukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { private Permission permission; private List npcRegistries; private CommandMap commandMap; - private List registeredCommands; + private List registeredAliases; @Override public void onEnable() { @@ -78,7 +78,7 @@ public void onEnable() { @Override public void start() { - this.registeredCommands = new ArrayList<>(); + this.registeredAliases = new ArrayList<>(); Platform platform = new BukkitPlatform(); LoggerWrapper logger = new JavaLoggerWrapper<>(this.getLogger()); @@ -217,12 +217,15 @@ private final CommandMap getCommandMap() { return null; } - public List getRegisteredCommands() { - return this.registeredCommands; + @Override + public List getRegisteredAliases() { + return Collections.unmodifiableList(this.registeredAliases); } - private void unregisterCommand(String alias) { + @Override + public void unregisterCommand(String alias) { try { + //TODO - unregister brigadier Field commandField = SimpleCommandMap.class.getDeclaredField("knownCommands"); commandField.setAccessible(true); @SuppressWarnings("unchecked") @@ -236,20 +239,16 @@ private void unregisterCommand(String alias) { @Override public void createCommand(String gui, String alias) { DynamicGui.get().getLogger().info("Registered the command \"" + alias + "\" for the gui " + gui); - CustomCommand cmd = new CustomCommand(alias); this.unregisterCommand(alias); - this.getCommandMap().register("", cmd); - - cmd.setExecutor(new CustomCommandExecutor(gui)); - this.getRegisteredCommands().add(alias); + this.registeredAliases.add(alias); } @Override - public void unloadCommands() { - for (String cmd : this.getRegisteredCommands()) { + public void unregisterGuiAliases() { + for (String cmd : this.getRegisteredAliases()) { this.unregisterCommand(cmd); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index a33eb718a..e172bf40f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -189,6 +189,8 @@ private void init() { public void shutdown() { CooldownManager.get().shutdown(); + this.plugin.unregisterCommand("gui"); + this.plugin.unregisterGuiAliases(); } private void setupFileStructure() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 98a608417..0bd0d7751 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -61,7 +61,6 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; public class GuiManager { @@ -115,7 +114,7 @@ public Gui getGui(String name) { public void reloadGuis(boolean force) { DynamicGui.get().getLogger().info("Reloading guis!"); - DynamicGui.get().getPlugin().unloadCommands(); + DynamicGui.get().getPlugin().unregisterGuiAliases(); this.cachedGuis = this.guis; this.guis = new HashMap<>(); this.cachedGlobalMacros = this.globalMacros; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index 0973beb23..85bf7314d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -49,10 +49,11 @@ default File getMacroFolder() { return new File(this.getDataFolder(), "macros"); } - List getRegisteredCommands(); + List getRegisteredAliases(); void createCommand(String guiName, String alias); - void unloadCommands(); + void unregisterGuiAliases(); + void unregisterCommand(String commandName); } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index c296ca9d2..f9cafb067 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -82,7 +82,7 @@ public File getMacroFolder() { } @Override - public List getRegisteredCommands() { + public List getRegisteredAliases() { return new ArrayList<>(); //TODO - implement } @@ -92,7 +92,12 @@ public void createCommand(String guiName, String alias) { } @Override - public void unloadCommands() { + public void unregisterGuiAliases() { + + } + + @Override + public void unregisterCommand(String commandName) { } } From ff3ec9b24b77dfe983226c999c7135913ad61e4e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 30 Mar 2022 23:16:46 -0700 Subject: [PATCH 203/261] Refactor DynamicGui start & stop methods --- .../bukkit/plugin/BukkitPlugin.java | 2 +- .../dynamicgui/core/DynamicGui.java | 38 +++++++++---------- .../core/inject/module/PluginModule.java | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 8cce7cfdc..a9a85eea8 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -183,7 +183,7 @@ public void onDisable() { @Override public void stop() { - DynamicGui.get().shutdown(); + DynamicGui.get().stop(); } @Override diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index e172bf40f..19bf54a20 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -131,11 +131,6 @@ public class DynamicGui { private static DynamicGui instance; public static DynamicGui get() { - if (!instance.initialized) { - instance.initialized = true; - instance.init(); - } - return instance; } @@ -172,22 +167,27 @@ private DynamicGui(DynamicGuiPlugin plugin, this.saveDefaultConfig(); } - private void init() { - this.loadConfig(); - this.loadFunctions(); - this.loadGuis(); - this.checkForProxy(); - this.registerListeners(); - this.registerCommands(); - ReplacerManager.get().registerReplacerRegistry(DynamicGuiReplacerRegistry.get()); - ReplacerManager.get().registerReplacerRegistry(CooldownReplacerRegistry.get()); - ReplacerManager.get().registerReplacerRegistry(MetadataReplacerRegistry.get()); - AnimationReplacerManager.get().registerReplacerRegistry(DynamicGuiAnimationReplacerRegistry.get()); - SlotManager.get(); - CooldownManager.get(); + public boolean start() { + if(!this.initialized) { + this.initialized = true; + this.loadConfig(); + this.loadFunctions(); + this.loadGuis(); + this.checkForProxy(); + this.registerListeners(); + this.registerCommands(); + ReplacerManager.get().registerReplacerRegistry(DynamicGuiReplacerRegistry.get()); + ReplacerManager.get().registerReplacerRegistry(CooldownReplacerRegistry.get()); + ReplacerManager.get().registerReplacerRegistry(MetadataReplacerRegistry.get()); + AnimationReplacerManager.get().registerReplacerRegistry(DynamicGuiAnimationReplacerRegistry.get()); + SlotManager.get(); + CooldownManager.get(); + return true; + } + return false; } - public void shutdown() { + public void stop() { CooldownManager.get().shutdown(); this.plugin.unregisterCommand("gui"); this.plugin.unregisterGuiAliases(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 68ca3eb4d..454cd852e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -89,6 +89,6 @@ public void configure(Binder binder) { public boolean bootstrap() { Guice.createInjector(this); - return DynamicGui.get() != null; + return DynamicGui.get().start(); } } \ No newline at end of file From 7cbf3566dc8fb809243ab68758939c9117df316e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 30 Mar 2022 23:56:51 -0700 Subject: [PATCH 204/261] Lock gui behind permission Close #247 --- .../com/clubobsidian/dynamicgui/core/Key.java | 31 +++++++++++++++++++ .../dynamicgui/core/command/GuiCommand.java | 6 ++-- .../core/permission/Permission.java | 2 -- 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java new file mode 100644 index 000000000..575ed317e --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; + +public final class Key { + + public static final String GUI_BASE_PERMISSION = "dynamicgui.command.gui"; + + public static boolean hasGuiPermission(PlayerWrapper player, String guiName) { + return player.hasPermission(GUI_BASE_PERMISSION + "." + guiName); + } + + private Key() { + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index 7294f1a0f..32e81c0c8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -19,17 +19,17 @@ import cloud.commandframework.annotations.Argument; import cloud.commandframework.annotations.CommandMethod; import cloud.commandframework.annotations.CommandPermission; +import com.clubobsidian.dynamicgui.core.Key; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import com.clubobsidian.dynamicgui.core.permission.Permission; public class GuiCommand { @CommandMethod("gui ") - @CommandPermission(Permission.GUI_BASE) + @CommandPermission(Key.GUI_BASE_PERMISSION) public void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { PlayerWrapper player = sender.getPlayer().orElse(null); - if(player != null) { + if(player != null && Key.hasGuiPermission(player, guiName)) { GuiManager.get().openGui(player, guiName); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java index a2440c287..fcd68a437 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/permission/Permission.java @@ -20,8 +20,6 @@ public interface Permission { - String GUI_BASE = "dynamicgui.command.gui"; - boolean setup(); boolean hasPermission(PlayerWrapper playerWrapper, String permission); From 062f309405df28c78deed6f0be47b70d0bbda050 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 00:25:23 -0700 Subject: [PATCH 205/261] Start preparing for cloud argument parsing --- .../core/command/CloudArgument.java | 83 ++++++++++++++++ .../core/test/command/CloudArgumentTest.java | 96 +++++++++++++++++++ .../core/test/mock/MockFactory.java | 2 +- .../command/MockCommandManager.java | 2 +- 4 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java rename core/src/test/java/com/clubobsidian/dynamicgui/core/test/{ => mock}/command/MockCommandManager.java (98%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java new file mode 100644 index 000000000..b622a07d0 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java @@ -0,0 +1,83 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command; + +import cloud.commandframework.arguments.CommandArgument; +import cloud.commandframework.arguments.standard.BooleanArgument; +import cloud.commandframework.arguments.standard.ByteArgument; +import cloud.commandframework.arguments.standard.CharArgument; +import cloud.commandframework.arguments.standard.DoubleArgument; +import cloud.commandframework.arguments.standard.FloatArgument; +import cloud.commandframework.arguments.standard.IntegerArgument; +import cloud.commandframework.arguments.standard.LongArgument; +import cloud.commandframework.arguments.standard.ShortArgument; +import cloud.commandframework.arguments.standard.StringArgument; +import cloud.commandframework.arguments.standard.UUIDArgument; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; + +public enum CloudArgument { + + //TODO - implement enum & string_array + BOOLEAN((Function) s -> (BooleanArgument) BooleanArgument.of(s)), + BYTE((Function) s -> (ByteArgument) ByteArgument.of(s)), + CHAR((Function) s -> (CharArgument) CharArgument.of(s)), + DOUBLE((Function) s -> (DoubleArgument) DoubleArgument.of(s)), + FLOAT((Function) s -> (FloatArgument) FloatArgument.of(s)), + INTEGER((Function) s -> (IntegerArgument) IntegerArgument.of(s)), + LONG((Function) s -> (LongArgument) LongArgument.of(s)), + SHORT((Function) s -> (ShortArgument) ShortArgument.of(s)), + STRING((Function) s -> (StringArgument) StringArgument.of(s)), + UUID((Function) s -> (UUIDArgument) UUIDArgument.of(s)); + + private static final Map types = new HashMap<>(); + + static { + for(CloudArgument arg : CloudArgument.values()) { + types.put(arg.name().toLowerCase(Locale.ROOT), arg); + } + } + + public static Optional fromType(String type) { + type = type.toLowerCase(Locale.ROOT); + switch (type) { + case "text": + type = "string"; + break; + case "number": + type = "integer"; + break; + default: + break; + } + return Optional.ofNullable(types.get(type)); + } + + private final Function function; + + CloudArgument(Function function) { + this.function = function; + } + + public T argument(String arg) { + return (T) this.function.apply(arg); + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java new file mode 100644 index 000000000..0056e7c27 --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java @@ -0,0 +1,96 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.command; + +import cloud.commandframework.arguments.standard.BooleanArgument; +import cloud.commandframework.arguments.standard.ByteArgument; +import cloud.commandframework.arguments.standard.CharArgument; +import cloud.commandframework.arguments.standard.DoubleArgument; +import cloud.commandframework.arguments.standard.FloatArgument; +import cloud.commandframework.arguments.standard.IntegerArgument; +import cloud.commandframework.arguments.standard.LongArgument; +import cloud.commandframework.arguments.standard.ShortArgument; +import cloud.commandframework.arguments.standard.StringArgument; +import cloud.commandframework.arguments.standard.UUIDArgument; +import com.clubobsidian.dynamicgui.core.command.CloudArgument; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +public class CloudArgumentTest { + + @Test + public void testFromTypeText() { + assertEquals(CloudArgument.STRING, CloudArgument.fromType("text").get()); + } + + @Test + public void testFromTypeNumber() { + assertEquals(CloudArgument.INTEGER, CloudArgument.fromType("number").get()); + } + + @Test + public void testBooleanArgument() { + assertInstanceOf(BooleanArgument.class, CloudArgument.BOOLEAN.argument("test")); + } + + @Test + public void testByteArgument() { + assertInstanceOf(ByteArgument.class, CloudArgument.BYTE.argument("test")); + } + + @Test + public void testCharArgument() { + assertInstanceOf(CharArgument.class, CloudArgument.CHAR.argument("test")); + } + + @Test + public void testDoubleArgument() { + assertInstanceOf(DoubleArgument.class, CloudArgument.DOUBLE.argument("test")); + } + + @Test + public void testFloatArgument() { + assertInstanceOf(FloatArgument.class, CloudArgument.FLOAT.argument("test")); + } + + @Test + public void testIntegerArgument() { + assertInstanceOf(IntegerArgument.class, CloudArgument.INTEGER.argument("test")); + } + + @Test + public void testLongArgument() { + assertInstanceOf(LongArgument.class, CloudArgument.LONG.argument("test")); + } + + @Test + public void testShortArgument() { + assertInstanceOf(ShortArgument.class, CloudArgument.SHORT.argument("test")); + } + + @Test + public void testStringArgument() { + assertInstanceOf(StringArgument.class, CloudArgument.STRING.argument("test")); + } + + @Test + public void testUUIDArgument() { + assertInstanceOf(UUIDArgument.class, CloudArgument.UUID.argument("test")); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java index 6ba0a977b..c11882f49 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/MockFactory.java @@ -29,7 +29,7 @@ import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; -import com.clubobsidian.dynamicgui.core.test.command.MockCommandManager; +import com.clubobsidian.dynamicgui.core.test.mock.command.MockCommandManager; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayer; import com.clubobsidian.dynamicgui.core.test.mock.entity.player.MockPlayerWrapper; import com.clubobsidian.dynamicgui.core.test.mock.inject.MockPluginModule; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCommandManager.java similarity index 98% rename from core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java rename to core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCommandManager.java index 0dc2cc4a1..c040e98a9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/MockCommandManager.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCommandManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.test.command; +package com.clubobsidian.dynamicgui.core.test.mock.command; import cloud.commandframework.CommandManager; import cloud.commandframework.CommandTree; From adc579082454ec56f2d16dcfcff2911369aed343 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 03:14:14 -0700 Subject: [PATCH 206/261] Allow dynamic registering and unregistering --- .../bukkit/plugin/BukkitPlugin.java | 59 ++++++++++++------- .../dynamicgui/core/DynamicGui.java | 59 +++++++++++++++++-- .../core/command/CloudExtender.java | 57 ++++++++++++++++++ .../core/manager/dynamicgui/GuiManager.java | 6 +- .../core/plugin/DynamicGuiPlugin.java | 10 ++-- .../dynamicgui/core/util/ReflectionUtil.java | 9 +++ .../mock/plugin/MockDynamicGuiPlugin.java | 16 ++--- 7 files changed, 169 insertions(+), 47 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index a9a85eea8..d4ba00180 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -17,8 +17,11 @@ package com.clubobsidian.dynamicgui.bukkit.plugin; import cloud.commandframework.CommandManager; +import cloud.commandframework.arguments.CommandArgument; +import cloud.commandframework.bukkit.BukkitPluginRegistrationHandler; import cloud.commandframework.bukkit.CloudBukkitCapabilities; import cloud.commandframework.execution.CommandExecutionCoordinator; +import cloud.commandframework.internal.CommandRegistrationHandler; import cloud.commandframework.paper.PaperCommandManager; import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommandSender; @@ -49,6 +52,8 @@ import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; +import javassist.tools.reflect.Reflection; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.CommandSender; @@ -58,9 +63,10 @@ import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.logging.Level; public class BukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { @@ -69,7 +75,7 @@ public class BukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { private Permission permission; private List npcRegistries; private CommandMap commandMap; - private List registeredAliases; + @Override public void onEnable() { @@ -78,7 +84,6 @@ public void onEnable() { @Override public void start() { - this.registeredAliases = new ArrayList<>(); Platform platform = new BukkitPlatform(); LoggerWrapper logger = new JavaLoggerWrapper<>(this.getLogger()); @@ -147,7 +152,7 @@ public void start() { private CommandManager createCommandSender() { try { - PaperCommandManager commandManager = new PaperCommandManager(this, + PaperCommandManager commandManager = new PaperCommandManager<>(this, CommandExecutionCoordinator.simpleCoordinator(), BukkitGuiCommandSender::new, wrappedSender -> (CommandSender) wrappedSender.getNativeSender() @@ -218,38 +223,48 @@ private final CommandMap getCommandMap() { } @Override - public List getRegisteredAliases() { - return Collections.unmodifiableList(this.registeredAliases); - } - - @Override - public void unregisterCommand(String alias) { + public void unregisterNativeCommand(String alias) { try { //TODO - unregister brigadier Field commandField = SimpleCommandMap.class.getDeclaredField("knownCommands"); commandField.setAccessible(true); @SuppressWarnings("unchecked") Map commands = (Map) commandField.get(this.getCommandMap()); - commands.keySet().remove(alias); + commands.remove(alias); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { e.printStackTrace(); } } @Override - public void createCommand(String gui, String alias) { - DynamicGui.get().getLogger().info("Registered the command \"" + alias + "\" for the gui " + gui); - CustomCommand cmd = new CustomCommand(alias); - this.unregisterCommand(alias); - this.getCommandMap().register("", cmd); - cmd.setExecutor(new CustomCommandExecutor(gui)); - this.registeredAliases.add(alias); + public void unregisterCloudCommand(CommandManager commandManager, String alias) { + BukkitPluginRegistrationHandler handler = (BukkitPluginRegistrationHandler) + commandManager.getCommandRegistrationHandler(); + this.unregisterHandler(handler, alias); + this.unregisterAliases(handler, alias); + this.unregisterBukkitCommand(handler, alias); } - @Override - public void unregisterGuiAliases() { - for (String cmd : this.getRegisteredAliases()) { - this.unregisterCommand(cmd); + private void unregisterBukkitCommand(BukkitPluginRegistrationHandler handler, String alias) { + Map bukkitCommands = + ReflectionUtil.get(handler, handler.getClass(), "bukkitCommands"); + bukkitCommands.remove(alias); + } + + private void unregisterHandler(CommandRegistrationHandler handler, String alias) { + Map, org.bukkit.command.Command> registeredCommands = + ReflectionUtil.get(handler, BukkitPluginRegistrationHandler.class, "registeredCommands"); + Iterator, Command>> it = registeredCommands.entrySet().iterator(); + while(it.hasNext()) { + Command command = it.next().getValue(); + if(command.getName().equals(alias) || command.getAliases().contains(alias)) { + it.remove(); + } } } + + private void unregisterAliases(BukkitPluginRegistrationHandler handler, String alias) { + Set aliases = ReflectionUtil.get(handler, handler.getClass(), "recognizedAliases"); + aliases.remove(alias); + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 19bf54a20..c0e34ae07 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -16,9 +16,12 @@ package com.clubobsidian.dynamicgui.core; +import cloud.commandframework.Command; import cloud.commandframework.CommandManager; +import cloud.commandframework.CommandTree; import cloud.commandframework.annotations.AnnotationParser; import cloud.commandframework.meta.SimpleCommandMeta; +import com.clubobsidian.dynamicgui.core.command.CloudExtender; import com.clubobsidian.dynamicgui.core.command.GuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; @@ -122,6 +125,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -146,6 +152,8 @@ public static DynamicGui get() { private final AnnotationParser commandParser; private final Injector injector; private boolean initialized; + private final List registeredAliases = new ArrayList<>(); + private final Map cloudCommands = new HashMap<>(); @Inject private DynamicGui(DynamicGuiPlugin plugin, @@ -160,7 +168,6 @@ private DynamicGui(DynamicGuiPlugin plugin, this.commandParser = new AnnotationParser<>(this.commandManager, GuiCommandSender.class, parserParameters -> SimpleCommandMeta.empty()); - this.injector = injector; this.initialized = false; this.setupFileStructure(); @@ -189,8 +196,50 @@ public boolean start() { public void stop() { CooldownManager.get().shutdown(); - this.plugin.unregisterCommand("gui"); - this.plugin.unregisterGuiAliases(); + this.unregisterCommand("gui"); + this.unregisterGuiAliases(); + } + + public List getRegisteredAliases() { + return Collections.unmodifiableList(this.registeredAliases); + } + + public void registerCommand(String guiName, String alias) { + this.unregisterCommand(alias); + Command command = this.commandManager.commandBuilder(alias) + .handler(context -> { + PlayerWrapper playerWrapper = context.getSender().getPlayer().get(); + if(playerWrapper != null) { + GuiManager.get().openGui(playerWrapper, guiName); + } + }).build(); + this.commandManager.command(command); + this.cloudCommands.put(alias, command); + this.registeredAliases.add(alias); + this.getLogger().info(String.format("Registered the command \"%s\" for the gui %s", + alias, + guiName + )); + } + + public void unregisterCommand(String alias) { + this.plugin.unregisterNativeCommand(alias); + try { + CloudExtender.unregister(this.commandManager, this.cloudCommands.get(alias), alias); + } catch (Exception e) { + e.printStackTrace(); + } + this.plugin.unregisterCloudCommand(this.commandManager, alias); + this.cloudCommands.remove(alias); + this.registeredAliases.remove(alias); + } + + public void unregisterGuiAliases() { + for (int i = 0; i < this.getRegisteredAliases().size(); i++) { + String cmd = this.getRegisteredAliases().get(i); + this.unregisterCommand(cmd); + i--; + } } private void setupFileStructure() { @@ -213,7 +262,7 @@ private void saveDefaultConfig() { FileUtils.copyInputStreamToFile(this.getClass() .getClassLoader() .getResourceAsStream("config.yml"), - this.plugin.getConfigFile()); + this.plugin.getConfigFile()); } catch (IOException e) { e.printStackTrace(); } @@ -312,6 +361,8 @@ private void registerListeners() { } private void registerCommands() { + this.commandManager.setSetting(CommandManager.ManagerSettings.ALLOW_UNSAFE_REGISTRATION, true); + this.commandManager.setSetting(CommandManager.ManagerSettings.OVERRIDE_EXISTING_COMMANDS, true); this.commandParser.parse(this.injector.getInstance(GuiCommand.class)); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java new file mode 100644 index 000000000..b1ca841fd --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command; + +import cloud.commandframework.Command; +import cloud.commandframework.CommandManager; +import cloud.commandframework.CommandTree; + +import java.lang.reflect.Field; +import java.util.List; + +public final class CloudExtender { + + public static void unregister(CommandManager commandManager, Command command, String commandName) throws Exception { + if(command == null) { + return; + } + unregisterCommandsField(commandManager, command); + unregisterTree(commandManager, commandName); + } + + private static void unregisterTree(CommandManager commandManager, String commandName) throws Exception { + CommandTree commandTree = commandManager.getCommandTree(); + CommandTree.Node commandNode = commandTree.getNamedNode(commandName); + Field internalTreeField = commandTree.getClass().getDeclaredField("internalTree"); + internalTreeField.setAccessible(true); + CommandTree.Node internalTree = (CommandTree.Node) internalTreeField.get(commandTree); + Field childrenField = CommandTree.Node.class.getDeclaredField("children"); + childrenField.setAccessible(true); + List children = (List) childrenField.get(internalTree); + children.remove(commandNode); + } + + private static void unregisterCommandsField(CommandManager commandManager, Command command) throws Exception { + Field commandsField = CommandManager.class.getDeclaredField("commands"); + commandsField.setAccessible(true); + List commands = (List) commandsField.get(commandManager); + commands.remove(command); + } + + private CloudExtender() { + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 0bd0d7751..df38fd408 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -114,7 +114,7 @@ public Gui getGui(String name) { public void reloadGuis(boolean force) { DynamicGui.get().getLogger().info("Reloading guis!"); - DynamicGui.get().getPlugin().unregisterGuiAliases(); + DynamicGui.get().unregisterGuiAliases(); this.cachedGuis = this.guis; this.guis = new HashMap<>(); this.cachedGlobalMacros = this.globalMacros; @@ -340,7 +340,7 @@ private void loadGuiFromFile(Configuration yaml, File file) { if (token != null && cachedHash != null && cachedHash == guiHash && !hasUpdatedMacro(token)) { Gui cachedGui = this.cachedGuis.get(guiName); for (String alias : token.getAlias()) { - plugin.createCommand(guiName, alias); + DynamicGui.get().registerCommand(guiName, alias); } this.guis.put(guiName, cachedGui); @@ -515,7 +515,7 @@ private Gui createGui(final GuiToken guiToken, final String guiName, final List< List aliases = guiToken.getAlias(); for (String alias : aliases) { - plugin.createCommand(guiName, alias); + DynamicGui.get().registerCommand(guiName, alias); } boolean close = guiToken.isClosed(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index 85bf7314d..66bf9dd7c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -16,6 +16,8 @@ package com.clubobsidian.dynamicgui.core.plugin; +import cloud.commandframework.CommandManager; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.permission.Permission; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; @@ -49,11 +51,7 @@ default File getMacroFolder() { return new File(this.getDataFolder(), "macros"); } - List getRegisteredAliases(); + void unregisterNativeCommand(String commandName); - void createCommand(String guiName, String alias); - - void unregisterGuiAliases(); - - void unregisterCommand(String commandName); + void unregisterCloudCommand(CommandManager commandManager, String alias); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index 25a587d23..e4227de67 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -65,6 +65,15 @@ public static Method getMethodByReturnType(Class searchIn, Class returnTyp return null; } + public static T get(Object getFrom, Class searchIn, String name) { + try { + return (T) getFieldByName(searchIn, name).get(getFrom); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + public static Field getFieldByName(Class searchIn, String name) { try { Field f = searchIn.getDeclaredField(name); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index f9cafb067..740e3edab 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -16,6 +16,8 @@ package com.clubobsidian.dynamicgui.core.test.mock.plugin; +import cloud.commandframework.CommandManager; +import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.economy.Economy; import com.clubobsidian.dynamicgui.core.permission.Permission; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; @@ -82,22 +84,12 @@ public File getMacroFolder() { } @Override - public List getRegisteredAliases() { - return new ArrayList<>(); //TODO - implement - } - - @Override - public void createCommand(String guiName, String alias) { - - } - - @Override - public void unregisterGuiAliases() { + public void unregisterNativeCommand(String commandName) { } @Override - public void unregisterCommand(String commandName) { + public void unregisterCloudCommand(CommandManager commandManager, String alias) { } } From 1710ac06bae1030ecffac1b5974acdfb58da8593 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 03:15:44 -0700 Subject: [PATCH 207/261] Remove un-used javassist import --- .../com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index d4ba00180..3ce6280fd 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -53,7 +53,6 @@ import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; -import javassist.tools.reflect.Reflection; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.CommandSender; @@ -84,7 +83,6 @@ public void onEnable() { @Override public void start() { - Platform platform = new BukkitPlatform(); LoggerWrapper logger = new JavaLoggerWrapper<>(this.getLogger()); From 30c2aaf047bf9ac974eab2f6db637771eb493c09 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 03:44:42 -0700 Subject: [PATCH 208/261] Port the DynamicGui command to cloud --- .../command/BukkitGuiCommandSender.java | 5 + .../bukkit/plugin/BukkitPlugin.java | 2 - bukkit/src/main/resources/plugin.yml | 5 +- .../dynamicgui/core/DynamicGui.java | 4 + .../com/clubobsidian/dynamicgui/core/Key.java | 3 + .../core/command/DynamicGuiCommand.java | 105 ++++++++++++++++++ .../dynamicgui/core/command/GuiCommand.java | 2 +- .../core/command/GuiCommandSender.java | 2 + .../core/inject/module/PluginModule.java | 2 + 9 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java index 4807e6baf..beb05bff3 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitGuiCommandSender.java @@ -37,4 +37,9 @@ public Object getNativeSender() { public boolean isPlayer() { return this.sender instanceof Player; } + + @Override + public void sendMessage(String message) { + this.sender.sendMessage(message); + } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 3ce6280fd..38527cbbb 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -139,8 +139,6 @@ public void start() { ReplacerManager.get().registerReplacerRegistry(new PlaceholderApiReplacerRegistry()); } - //this.getCommand("gui").setExecutor(new BukkitGuiCommand()); - this.getCommand("dynamicgui").setExecutor(new BukkitDynamicGuiCommand()); this.getServer().getPluginManager().registerEvents(new EntityClickListener(), this); this.getServer().getPluginManager().registerEvents(new InventoryInteractListener(), this); this.getServer().getPluginManager().registerEvents(new InventoryCloseListener(), this); diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 7093b75a7..45602e1fd 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -6,7 +6,4 @@ api-version: 1.13 softdepend: [Vault, PlaceholderAPI, RedisBungee, PlayerPoints, Citizens, Rankup, Foundry, Oraxen, ItemsAdder] commands: guilist: - description: "Lists out all the guis for DynamicGUI!" - dynamicgui: - descriptions: "Command for handling management of DynamicGui guis" - aliases: ["dyngui"] \ No newline at end of file + description: "Lists out all the guis for DynamicGUI!" \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index c0e34ae07..8a060877b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -22,6 +22,7 @@ import cloud.commandframework.annotations.AnnotationParser; import cloud.commandframework.meta.SimpleCommandMeta; import com.clubobsidian.dynamicgui.core.command.CloudExtender; +import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; @@ -197,6 +198,8 @@ public boolean start() { public void stop() { CooldownManager.get().shutdown(); this.unregisterCommand("gui"); + this.unregisterCommand("dynamicgui"); + this.unregisterCommand("dyngui"); this.unregisterGuiAliases(); } @@ -364,6 +367,7 @@ private void registerCommands() { this.commandManager.setSetting(CommandManager.ManagerSettings.ALLOW_UNSAFE_REGISTRATION, true); this.commandManager.setSetting(CommandManager.ManagerSettings.OVERRIDE_EXISTING_COMMANDS, true); this.commandParser.parse(this.injector.getInstance(GuiCommand.class)); + this.commandParser.parse(this.injector.getInstance(DynamicGuiCommand.class)); } private void loadFunctions() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java index 575ed317e..4f8fd6582 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java @@ -21,6 +21,9 @@ public final class Key { public static final String GUI_BASE_PERMISSION = "dynamicgui.command.gui"; + public static final String DYNAMIC_GUI_COMMAND_BASE_PERMISSION = "dynamicgui.command.admin"; + public static final String DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".reload"; + public static final String DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".close"; public static boolean hasGuiPermission(PlayerWrapper player, String guiName) { return player.hasPermission(GUI_BASE_PERMISSION + "." + guiName); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java new file mode 100644 index 000000000..fb6e1f9d3 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command; + +import cloud.commandframework.annotations.Argument; +import cloud.commandframework.annotations.CommandMethod; +import cloud.commandframework.annotations.CommandPermission; +import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.gui.Gui; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.platform.Platform; + +import javax.inject.Inject; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +public class DynamicGuiCommand { + + private final Platform platform; + + @Inject + private DynamicGuiCommand(Platform platform) { + this.platform = platform; + } + + @CommandMethod("dynamicgui|dyngui reload") + @CommandPermission(Key.DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION) + private void reload(GuiCommandSender sender) { + sender.sendMessage("Guis have been reloaded"); + GuiManager.get().reloadGuis(false); + DynamicGui.get().getEventBus().callEvent(new DynamicGuiReloadEvent()); + } + + @CommandMethod("dynamicgui|dyngui forcereload") + @CommandPermission(Key.DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION) + private void forceReload(GuiCommandSender sender) { + sender.sendMessage("Guis have been force reloaded"); + GuiManager.get().reloadGuis(true); + DynamicGui.get().getEventBus().callEvent(new DynamicGuiReloadEvent()); + } + + @CommandMethod("dynamicgui|dyngui close all [guiName]") + @CommandPermission(Key.DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION) + private void closeAll(GuiCommandSender sender, @Argument("guiName") String guiName) { + if(guiName == null) { + sender.sendMessage("All open DynamicGui guis have been closed"); + for (UUID uuid : GuiManager.get().getPlayerGuis().keySet()) { + PlayerWrapper playerWrapper = this.platform.getPlayer(uuid); + if (playerWrapper != null) { + playerWrapper.closeInventory(); + } + } + } else { + Gui gui = GuiManager.get().getGui(guiName); + if (gui == null) { + sender.sendMessage("No gui can be found by that name"); + } else { + sender.sendMessage(String.format("Guis of type %s are now closed", guiName)); + Iterator> it = GuiManager.get().getPlayerGuis().entrySet().iterator(); + while (it.hasNext()) { + Map.Entry next = it.next(); + UUID uuid = next.getKey(); + PlayerWrapper playerWrapper = this.platform.getPlayer(uuid); + if (playerWrapper != null) { + playerWrapper.closeInventory(); + } + } + } + } + } + + @CommandMethod("dynamicgui|dyngui close ") + @CommandPermission(Key.DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION) + private void closePlayer(GuiCommandSender sender, @Argument("playerName") String playerName) { + PlayerWrapper player = this.platform.getPlayer(playerName); + if (player == null) { + sender.sendMessage("That player is not online, so their gui cannot be closed"); + } else { + if (GuiManager.get().getPlayerGuis().get(player.getUniqueId()) != null) { + sender.sendMessage(String.format("%s's gui has been closed", playerName)); + player.closeInventory(); + } else { + sender.sendMessage(String.format("%s did not have a DynamicGui gui open", playerName)); + } + } + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index 32e81c0c8..17505a445 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -27,7 +27,7 @@ public class GuiCommand { @CommandMethod("gui ") @CommandPermission(Key.GUI_BASE_PERMISSION) - public void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { + private void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { PlayerWrapper player = sender.getPlayer().orElse(null); if(player != null && Key.hasGuiPermission(player, guiName)) { GuiManager.get().openGui(player, guiName); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java index 7020804f0..cdef8c075 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommandSender.java @@ -27,6 +27,8 @@ public interface GuiCommandSender { boolean isPlayer(); + void sendMessage(String message); + default Optional> getPlayer() { return this.isPlayer() ? Optional.of(EntityManager diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 454cd852e..1338922ba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -18,6 +18,7 @@ import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; @@ -78,6 +79,7 @@ public void configure(Binder binder) { binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); binder.bind(GuiCommand.class).asEagerSingleton(); + binder.bind(DynamicGuiCommand.class).asEagerSingleton(); binder.requestStaticInjection(EntityManager.class); binder.requestStaticInjection(InventoryManager.class); From 611550a0bdb83f7c5f95422de27831e85da4274f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 03:46:00 -0700 Subject: [PATCH 209/261] Remove un-used guilist command --- .../clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java | 3 --- bukkit/src/main/resources/plugin.yml | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java index 38527cbbb..0d0ac0d69 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java @@ -23,10 +23,7 @@ import cloud.commandframework.execution.CommandExecutionCoordinator; import cloud.commandframework.internal.CommandRegistrationHandler; import cloud.commandframework.paper.PaperCommandManager; -import com.clubobsidian.dynamicgui.bukkit.command.BukkitDynamicGuiCommand; import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommandSender; -import com.clubobsidian.dynamicgui.bukkit.command.CustomCommand; -import com.clubobsidian.dynamicgui.bukkit.command.CustomCommandExecutor; import com.clubobsidian.dynamicgui.bukkit.economy.VaultEconomy; import com.clubobsidian.dynamicgui.bukkit.inject.BukkitPluginModule; import com.clubobsidian.dynamicgui.bukkit.listener.EntityClickListener; diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 45602e1fd..1bc079f30 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -3,7 +3,4 @@ main: com.clubobsidian.dynamicgui.bukkit.plugin.BukkitPlugin version: ${pluginVersion} author: VirusTotal api-version: 1.13 -softdepend: [Vault, PlaceholderAPI, RedisBungee, PlayerPoints, Citizens, Rankup, Foundry, Oraxen, ItemsAdder] -commands: - guilist: - description: "Lists out all the guis for DynamicGUI!" \ No newline at end of file +softdepend: [Vault, PlaceholderAPI, RedisBungee, PlayerPoints, Citizens, Rankup, Foundry, Oraxen, ItemsAdder] \ No newline at end of file From 3be37b5ecf91ba0dcf10f6d70859db6fab707f1f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 03:48:16 -0700 Subject: [PATCH 210/261] BukkitPlugin -> DynamicGuiBukkitPlugin --- .../plugin/{BukkitPlugin.java => DynamicGuiBukkitPlugin.java} | 2 +- bukkit/src/main/resources/plugin.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/{BukkitPlugin.java => DynamicGuiBukkitPlugin.java} (99%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java similarity index 99% rename from bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java rename to bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java index 0d0ac0d69..f56351ce4 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/BukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java @@ -65,7 +65,7 @@ import java.util.Set; import java.util.logging.Level; -public class BukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { +public class DynamicGuiBukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { private Economy economy; private Permission permission; diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 1bc079f30..cf638925c 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: DynamicGui -main: com.clubobsidian.dynamicgui.bukkit.plugin.BukkitPlugin +main: com.clubobsidian.dynamicgui.bukkit.plugin.DynamicGuiBukkitPlugin version: ${pluginVersion} author: VirusTotal api-version: 1.13 From 208a3df07527ab5a05795420b10247754c4721a6 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 31 Mar 2022 03:55:41 -0700 Subject: [PATCH 211/261] Test two of the same type in one function slot --- core/mock_data/guis/test.yml | 13 ++++++++++++- .../core/test/manager/FunctionManagerTest.java | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index 6f189fcea..289192ebf 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -44,4 +44,15 @@ rows: 5 functions: - "delay: 1000" - "pmsg: test" - - "isasyncthread" \ No newline at end of file + - "isasyncthread" +'5': + icon: "STONE" + functions: + click1: + type: "click" + functions: + - "pmsg: test1" + click2: + type: "click" + functions: + - "pmsg: test2" \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 9277e831b..13b7ecadb 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -25,6 +25,7 @@ import com.clubobsidian.dynamicgui.parser.function.FunctionType; import org.junit.jupiter.api.Test; +import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -128,4 +129,16 @@ public void testTryFunctionsAsyncThread() throws ExecutionException, Interrupted Slot slot = gui.getSlots().get(4); assertTrue(FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get()); } + + @Test + public void testMultipleClickSlots() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test"); + Slot slot = gui.getSlots().get(5); + FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get(); + List chat = playerWrapper.getIncomingChat(); + assertEquals(2, chat.size()); + assertEquals("test1", chat.get(0)); + assertEquals("test2", chat.get(1)); + } } \ No newline at end of file From ff09cfbb2ff955770af399602f349f734bd0a92b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 05:06:53 -0700 Subject: [PATCH 212/261] Small cleanup in GuiManager --- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index df38fd408..6a95cea7b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -330,8 +330,6 @@ private void loadGuis() { private void loadGuiFromFile(Configuration yaml, File file) { DynamicGui dynamicGui = DynamicGui.get(); - DynamicGuiPlugin plugin = dynamicGui.getPlugin(); - try { String guiName = file.getName().substring(0, file.getName().lastIndexOf(".")); byte[] cachedHash = this.guiHashes.get(guiName); @@ -340,7 +338,7 @@ private void loadGuiFromFile(Configuration yaml, File file) { if (token != null && cachedHash != null && cachedHash == guiHash && !hasUpdatedMacro(token)) { Gui cachedGui = this.cachedGuis.get(guiName); for (String alias : token.getAlias()) { - DynamicGui.get().registerCommand(guiName, alias); + dynamicGui.registerCommand(guiName, alias); } this.guis.put(guiName, cachedGui); From 4e28676491d5a0b822c9d59f81184de5e464c900 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 05:08:28 -0700 Subject: [PATCH 213/261] Refactor reload event into plugin package --- .../dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java | 2 +- .../clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java | 2 +- .../core/event/{ => plugin}/DynamicGuiReloadEvent.java | 2 +- .../dynamicgui/core/manager/dynamicgui/MiniMessageManager.java | 2 +- .../core/registry/replacer/impl/DynamicGuiReplacerRegistry.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/event/{ => plugin}/DynamicGuiReloadEvent.java (93%) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java index e484c7b13..78a2fdc20 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java @@ -17,7 +17,7 @@ package com.clubobsidian.dynamicgui.bukkit.command; import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.event.plugin.DynamicGuiReloadEvent; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import org.bukkit.Bukkit; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java index fb6e1f9d3..3ff65e112 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java @@ -22,7 +22,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.Key; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.event.plugin.DynamicGuiReloadEvent; import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.core.platform.Platform; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/plugin/DynamicGuiReloadEvent.java similarity index 93% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/event/plugin/DynamicGuiReloadEvent.java index c31435347..f26d15af1 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/DynamicGuiReloadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/plugin/DynamicGuiReloadEvent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.event; +package com.clubobsidian.dynamicgui.core.event.plugin; import com.clubobsidian.trident.Event; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java index cf8690b11..880108285 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/MiniMessageManager.java @@ -17,7 +17,7 @@ package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.event.plugin.DynamicGuiReloadEvent; import com.clubobsidian.trident.EventHandler; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java index cc9946659..77259ef4a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/registry/replacer/impl/DynamicGuiReplacerRegistry.java @@ -18,7 +18,7 @@ import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.event.DynamicGuiReloadEvent; +import com.clubobsidian.dynamicgui.core.event.plugin.DynamicGuiReloadEvent; import com.clubobsidian.dynamicgui.core.registry.replacer.ReplacerRegistry; import com.clubobsidian.dynamicgui.core.replacer.Replacer; import com.clubobsidian.dynamicgui.core.replacer.impl.GlobalPlayerCountReplacer; From e5be495d4c78eef5eb1eb785491c855d0d5295af Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 05:12:51 -0700 Subject: [PATCH 214/261] Repackage cloud related classes --- .../main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java | 3 +-- .../dynamicgui/core/command/{ => cloud}/CloudArgument.java | 2 +- .../dynamicgui/core/command/{ => cloud}/CloudExtender.java | 2 +- .../dynamicgui/core/test/command/CloudArgumentTest.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/command/{ => cloud}/CloudArgument.java (98%) rename core/src/main/java/com/clubobsidian/dynamicgui/core/command/{ => cloud}/CloudExtender.java (97%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 8a060877b..e4dfda537 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -18,10 +18,9 @@ import cloud.commandframework.Command; import cloud.commandframework.CommandManager; -import cloud.commandframework.CommandTree; import cloud.commandframework.annotations.AnnotationParser; import cloud.commandframework.meta.SimpleCommandMeta; -import com.clubobsidian.dynamicgui.core.command.CloudExtender; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudArgument.java similarity index 98% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudArgument.java index b622a07d0..10e7dc729 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudArgument.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudArgument.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.command; +package com.clubobsidian.dynamicgui.core.command.cloud; import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.standard.BooleanArgument; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java index b1ca841fd..3c11ccceb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.clubobsidian.dynamicgui.core.command; +package com.clubobsidian.dynamicgui.core.command.cloud; import cloud.commandframework.Command; import cloud.commandframework.CommandManager; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java index 0056e7c27..e6c2faacc 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/command/CloudArgumentTest.java @@ -26,7 +26,7 @@ import cloud.commandframework.arguments.standard.ShortArgument; import cloud.commandframework.arguments.standard.StringArgument; import cloud.commandframework.arguments.standard.UUIDArgument; -import com.clubobsidian.dynamicgui.core.command.CloudArgument; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudArgument; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; From 178e665e22c4411b9d180654a58dcaa0b773ab85 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 05:48:15 -0700 Subject: [PATCH 215/261] Abstract cloud command unregistering --- .../command/cloud/BukkitCloudExtender.java | 67 +++++++++++++++++++ .../bukkit/inject/BukkitPluginModule.java | 7 ++ .../bukkit/plugin/DynamicGuiBukkitPlugin.java | 35 ---------- .../dynamicgui/core/DynamicGui.java | 8 ++- .../com/clubobsidian/dynamicgui/core/Key.java | 3 + .../core/command/cloud/CloudExtender.java | 36 +--------- .../cloud/extender/CombinedCloudExtender.java | 44 ++++++++++++ .../cloud/extender/NativeCloudExtender.java | 63 +++++++++++++++++ .../core/inject/module/PluginModule.java | 12 ++++ .../core/plugin/DynamicGuiPlugin.java | 2 - .../test/mock/command/MockCloudExtender.java | 28 ++++++++ .../test/mock/inject/MockPluginModule.java | 7 ++ .../mock/plugin/MockDynamicGuiPlugin.java | 5 -- 13 files changed, 238 insertions(+), 79 deletions(-) create mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java create mode 100644 core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCloudExtender.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java new file mode 100644 index 000000000..884ebb2c7 --- /dev/null +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java @@ -0,0 +1,67 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.bukkit.command.cloud; + +import cloud.commandframework.Command; +import cloud.commandframework.CommandManager; +import cloud.commandframework.arguments.CommandArgument; +import cloud.commandframework.bukkit.BukkitPluginRegistrationHandler; +import cloud.commandframework.internal.CommandRegistrationHandler; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; + +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +public class BukkitCloudExtender implements CloudExtender { + + @Override + public boolean unregister(CommandManager commandManager, Command command, String alias) { + BukkitPluginRegistrationHandler handler = (BukkitPluginRegistrationHandler) + commandManager.getCommandRegistrationHandler(); + return this.unregisterHandler(handler, alias) + || this.unregisterAliases(handler, alias) + || this.unregisterBukkitCommand(handler, alias); + } + + private boolean unregisterBukkitCommand(BukkitPluginRegistrationHandler handler, String alias) { + Map bukkitCommands = + ReflectionUtil.get(handler, handler.getClass(), "bukkitCommands"); + return bukkitCommands.remove(alias) != null; + } + + private boolean unregisterHandler(CommandRegistrationHandler handler, String alias) { + Map, org.bukkit.command.Command> registeredCommands = + ReflectionUtil.get(handler, BukkitPluginRegistrationHandler.class, "registeredCommands"); + Iterator, org.bukkit.command.Command>> it = registeredCommands.entrySet().iterator(); + boolean removed = false; + while (it.hasNext()) { + org.bukkit.command.Command command = it.next().getValue(); + if(command.getName().equals(alias) || command.getAliases().contains(alias)) { + it.remove(); + removed = true; + } + } + return removed; + } + + private boolean unregisterAliases(BukkitPluginRegistrationHandler handler, String alias) { + Set aliases = ReflectionUtil.get(handler, handler.getClass(), "recognizedAliases"); + return aliases.remove(alias); + } +} \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java index 9f8dbc76e..793004bbf 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/inject/BukkitPluginModule.java @@ -17,12 +17,14 @@ package com.clubobsidian.dynamicgui.bukkit.inject; import cloud.commandframework.CommandManager; +import com.clubobsidian.dynamicgui.bukkit.command.cloud.BukkitCloudExtender; import com.clubobsidian.dynamicgui.bukkit.manager.entity.BukkitEntityManager; import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitInventoryManager; import com.clubobsidian.dynamicgui.bukkit.manager.inventory.BukkitItemStackManager; import com.clubobsidian.dynamicgui.bukkit.manager.material.BukkitMaterialManager; import com.clubobsidian.dynamicgui.bukkit.manager.world.BukkitLocationManager; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; @@ -66,4 +68,9 @@ public Class getMaterialManager() { public Class getLocationManger() { return BukkitLocationManager.class; } + + @Override + public Class getPlatformExtender() { + return BukkitCloudExtender.class; + } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java index f56351ce4..825579aa1 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java @@ -17,11 +17,8 @@ package com.clubobsidian.dynamicgui.bukkit.plugin; import cloud.commandframework.CommandManager; -import cloud.commandframework.arguments.CommandArgument; -import cloud.commandframework.bukkit.BukkitPluginRegistrationHandler; import cloud.commandframework.bukkit.CloudBukkitCapabilities; import cloud.commandframework.execution.CommandExecutionCoordinator; -import cloud.commandframework.internal.CommandRegistrationHandler; import cloud.commandframework.paper.PaperCommandManager; import com.clubobsidian.dynamicgui.bukkit.command.BukkitGuiCommandSender; import com.clubobsidian.dynamicgui.bukkit.economy.VaultEconomy; @@ -228,36 +225,4 @@ public void unregisterNativeCommand(String alias) { e.printStackTrace(); } } - - @Override - public void unregisterCloudCommand(CommandManager commandManager, String alias) { - BukkitPluginRegistrationHandler handler = (BukkitPluginRegistrationHandler) - commandManager.getCommandRegistrationHandler(); - this.unregisterHandler(handler, alias); - this.unregisterAliases(handler, alias); - this.unregisterBukkitCommand(handler, alias); - } - - private void unregisterBukkitCommand(BukkitPluginRegistrationHandler handler, String alias) { - Map bukkitCommands = - ReflectionUtil.get(handler, handler.getClass(), "bukkitCommands"); - bukkitCommands.remove(alias); - } - - private void unregisterHandler(CommandRegistrationHandler handler, String alias) { - Map, org.bukkit.command.Command> registeredCommands = - ReflectionUtil.get(handler, BukkitPluginRegistrationHandler.class, "registeredCommands"); - Iterator, Command>> it = registeredCommands.entrySet().iterator(); - while(it.hasNext()) { - Command command = it.next().getValue(); - if(command.getName().equals(alias) || command.getAliases().contains(alias)) { - it.remove(); - } - } - } - - private void unregisterAliases(BukkitPluginRegistrationHandler handler, String alias) { - Set aliases = ReflectionUtil.get(handler, handler.getClass(), "recognizedAliases"); - aliases.remove(alias); - } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index e4dfda537..8b3791869 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -151,6 +151,7 @@ public static DynamicGui get() { private final CommandManager commandManager; private final AnnotationParser commandParser; private final Injector injector; + private final CloudExtender extender; private boolean initialized; private final List registeredAliases = new ArrayList<>(); private final Map cloudCommands = new HashMap<>(); @@ -160,7 +161,8 @@ private DynamicGui(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper loggerWrapper, CommandManager commandManager, - Injector injector) { + Injector injector, + CloudExtender extender) { this.plugin = plugin; this.platform = platform; this.loggerWrapper = loggerWrapper; @@ -169,6 +171,7 @@ private DynamicGui(DynamicGuiPlugin plugin, GuiCommandSender.class, parserParameters -> SimpleCommandMeta.empty()); this.injector = injector; + this.extender = extender; this.initialized = false; this.setupFileStructure(); this.saveDefaultConfig(); @@ -227,11 +230,10 @@ public void registerCommand(String guiName, String alias) { public void unregisterCommand(String alias) { this.plugin.unregisterNativeCommand(alias); try { - CloudExtender.unregister(this.commandManager, this.cloudCommands.get(alias), alias); + this.extender.unregister(this.commandManager, this.cloudCommands.get(alias), alias); } catch (Exception e) { e.printStackTrace(); } - this.plugin.unregisterCloudCommand(this.commandManager, alias); this.cloudCommands.remove(alias); this.registeredAliases.remove(alias); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java index 4f8fd6582..5ef7748ce 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java @@ -25,6 +25,9 @@ public final class Key { public static final String DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".reload"; public static final String DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".close"; + public static final String NATIVE_ANNOTATION = "native"; + public static final String PLATFORM_ANNOTATION = "platform"; + public static boolean hasGuiPermission(PlayerWrapper player, String guiName) { return player.hasPermission(GUI_BASE_PERMISSION + "." + guiName); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java index 3c11ccceb..a52445f08 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/CloudExtender.java @@ -18,40 +18,8 @@ import cloud.commandframework.Command; import cloud.commandframework.CommandManager; -import cloud.commandframework.CommandTree; -import java.lang.reflect.Field; -import java.util.List; +public interface CloudExtender { -public final class CloudExtender { - - public static void unregister(CommandManager commandManager, Command command, String commandName) throws Exception { - if(command == null) { - return; - } - unregisterCommandsField(commandManager, command); - unregisterTree(commandManager, commandName); - } - - private static void unregisterTree(CommandManager commandManager, String commandName) throws Exception { - CommandTree commandTree = commandManager.getCommandTree(); - CommandTree.Node commandNode = commandTree.getNamedNode(commandName); - Field internalTreeField = commandTree.getClass().getDeclaredField("internalTree"); - internalTreeField.setAccessible(true); - CommandTree.Node internalTree = (CommandTree.Node) internalTreeField.get(commandTree); - Field childrenField = CommandTree.Node.class.getDeclaredField("children"); - childrenField.setAccessible(true); - List children = (List) childrenField.get(internalTree); - children.remove(commandNode); - } - - private static void unregisterCommandsField(CommandManager commandManager, Command command) throws Exception { - Field commandsField = CommandManager.class.getDeclaredField("commands"); - commandsField.setAccessible(true); - List commands = (List) commandsField.get(commandManager); - commands.remove(command); - } - - private CloudExtender() { - } + boolean unregister(CommandManager commandManager, Command command, String commandName); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java new file mode 100644 index 000000000..f8d6fdb0b --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command.cloud.extender; + +import cloud.commandframework.Command; +import cloud.commandframework.CommandManager; +import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; + +import javax.inject.Inject; +import javax.inject.Named; + +public class CombinedCloudExtender implements CloudExtender { + + private final CloudExtender nativeExtender; + private final CloudExtender platformExtender; + + @Inject + private CombinedCloudExtender(@Named(Key.NATIVE_ANNOTATION)CloudExtender nativeExtender, + @Named(Key.PLATFORM_ANNOTATION)CloudExtender platformExtender) { + this.nativeExtender = nativeExtender; + this.platformExtender = platformExtender; + } + + @Override + public boolean unregister(CommandManager commandManager, Command command, String commandName) { + return this.nativeExtender.unregister(commandManager, command, commandName) + || this.platformExtender.unregister(commandManager, command, commandName); + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java new file mode 100644 index 000000000..e78af2a35 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java @@ -0,0 +1,63 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command.cloud.extender; + +import cloud.commandframework.Command; +import cloud.commandframework.CommandManager; +import cloud.commandframework.CommandTree; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; + +import java.lang.reflect.Field; +import java.util.List; + +public class NativeCloudExtender implements CloudExtender { + + public boolean unregister(CommandManager commandManager, Command command, String commandName) { + if(command == null) { + return false; + } + boolean commandsUnregistered; + boolean treeUnregistered; + try { + commandsUnregistered = unregisterCommandsField(commandManager, command); + treeUnregistered = unregisterTree(commandManager, commandName); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return commandsUnregistered || treeUnregistered; + } + + private boolean unregisterTree(CommandManager commandManager, String commandName) throws Exception { + CommandTree commandTree = commandManager.getCommandTree(); + CommandTree.Node commandNode = commandTree.getNamedNode(commandName); + Field internalTreeField = commandTree.getClass().getDeclaredField("internalTree"); + internalTreeField.setAccessible(true); + CommandTree.Node internalTree = (CommandTree.Node) internalTreeField.get(commandTree); + Field childrenField = CommandTree.Node.class.getDeclaredField("children"); + childrenField.setAccessible(true); + List children = (List) childrenField.get(internalTree); + return children.remove(commandNode); + } + + private boolean unregisterCommandsField(CommandManager commandManager, Command command) throws Exception { + Field commandsField = CommandManager.class.getDeclaredField("commands"); + commandsField.setAccessible(true); + List commands = (List) commandsField.get(commandManager); + return commands.remove(command); + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 1338922ba..d687ffb74 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -18,9 +18,13 @@ import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.Key; import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; +import com.clubobsidian.dynamicgui.core.command.cloud.extender.CombinedCloudExtender; +import com.clubobsidian.dynamicgui.core.command.cloud.extender.NativeCloudExtender; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; @@ -33,6 +37,7 @@ import com.google.inject.Guice; import com.google.inject.Module; import com.google.inject.TypeLiteral; +import com.google.inject.name.Names; public abstract class PluginModule implements Module { @@ -66,6 +71,8 @@ public PluginModule(DynamicGuiPlugin plugin, public abstract Class getLocationManger(); + public abstract Class getPlatformExtender(); + @Override public void configure(Binder binder) { binder.bind(EntityManager.class).to(this.entityClass); @@ -78,6 +85,11 @@ public void configure(Binder binder) { binder.bind(new TypeLiteral>() {}).toInstance(this.logger); binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.NATIVE_ANNOTATION)).to(NativeCloudExtender.class); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.PLATFORM_ANNOTATION)).to(this.getPlatformExtender()); + binder.bind(CloudExtender.class).to(CombinedCloudExtender.class); + + binder.bind(GuiCommand.class).asEagerSingleton(); binder.bind(DynamicGuiCommand.class).asEagerSingleton(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index 66bf9dd7c..a71a70b48 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -52,6 +52,4 @@ default File getMacroFolder() { } void unregisterNativeCommand(String commandName); - - void unregisterCloudCommand(CommandManager commandManager, String alias); } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCloudExtender.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCloudExtender.java new file mode 100644 index 000000000..85ebef86c --- /dev/null +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/command/MockCloudExtender.java @@ -0,0 +1,28 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.test.mock.command; + +import cloud.commandframework.Command; +import cloud.commandframework.CommandManager; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; + +public class MockCloudExtender implements CloudExtender { + @Override + public boolean unregister(CommandManager commandManager, Command command, String commandName) { + return false; //TODO - implement + } +} diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java index c0abda443..5e0047612 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/inject/MockPluginModule.java @@ -18,6 +18,7 @@ import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.inject.module.PluginModule; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; @@ -27,6 +28,7 @@ import com.clubobsidian.dynamicgui.core.manager.world.LocationManager; import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; +import com.clubobsidian.dynamicgui.core.test.mock.command.MockCloudExtender; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockEntityManager; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockInventoryManager; import com.clubobsidian.dynamicgui.core.test.mock.manager.MockItemStackManager; @@ -66,4 +68,9 @@ public Class getMaterialManager() { public Class getLocationManger() { return MockLocationManager.class; } + + @Override + public Class getPlatformExtender() { + return MockCloudExtender.class; + } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index 740e3edab..669c1a2ef 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -87,9 +87,4 @@ public File getMacroFolder() { public void unregisterNativeCommand(String commandName) { } - - @Override - public void unregisterCloudCommand(CommandManager commandManager, String alias) { - - } } From c7454925780250a918043c3c588da0128114d520 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 06:32:09 -0700 Subject: [PATCH 216/261] Refactor command registration --- .../bukkit/plugin/DynamicGuiBukkitPlugin.java | 11 +- .../dynamicgui/core/DynamicGui.java | 82 ++------------ .../core/command/CommandRegistrar.java | 26 +++++ .../core/command/CommandRegistrarImpl.java | 105 ++++++++++++++++++ .../core/command/DynamicGuiCommand.java | 2 +- .../dynamicgui/core/command/GuiCommand.java | 2 +- .../core/command/RegisteredCommand.java | 20 ++++ .../core/inject/module/PluginModule.java | 19 +++- .../core/manager/dynamicgui/GuiManager.java | 19 +++- .../core/plugin/DynamicGuiPlugin.java | 2 +- .../mock/plugin/MockDynamicGuiPlugin.java | 5 - 11 files changed, 193 insertions(+), 100 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrar.java create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrarImpl.java create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/command/RegisteredCommand.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java index 825579aa1..9ef096105 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java @@ -46,20 +46,14 @@ import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.core.plugin.DynamicGuiPlugin; import com.clubobsidian.dynamicgui.core.registry.npc.NPCRegistry; -import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; -import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.CommandSender; -import org.bukkit.command.SimpleCommandMap; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Set; import java.util.logging.Level; public class DynamicGuiBukkitPlugin extends JavaPlugin implements DynamicGuiPlugin { @@ -69,7 +63,6 @@ public class DynamicGuiBukkitPlugin extends JavaPlugin implements DynamicGuiPlug private List npcRegistries; private CommandMap commandMap; - @Override public void onEnable() { this.start(); @@ -212,7 +205,7 @@ private final CommandMap getCommandMap() { return null; } - @Override + /*@Override public void unregisterNativeCommand(String alias) { try { //TODO - unregister brigadier @@ -224,5 +217,5 @@ public void unregisterNativeCommand(String alias) { } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { e.printStackTrace(); } - } + }*/ } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 8b3791869..84ae6bb43 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -16,14 +16,9 @@ package com.clubobsidian.dynamicgui.core; -import cloud.commandframework.Command; -import cloud.commandframework.CommandManager; -import cloud.commandframework.annotations.AnnotationParser; -import cloud.commandframework.meta.SimpleCommandMeta; -import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; +import com.clubobsidian.dynamicgui.core.command.CommandRegistrar; import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommand; -import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; @@ -118,16 +113,13 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -import com.google.inject.Inject; import com.google.inject.Injector; import org.apache.commons.io.FileUtils; +import javax.inject.Inject; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -148,30 +140,21 @@ public static DynamicGui get() { private final DynamicGuiPlugin plugin; private final Platform platform; private final LoggerWrapper loggerWrapper; - private final CommandManager commandManager; - private final AnnotationParser commandParser; private final Injector injector; - private final CloudExtender extender; + private final CommandRegistrar commandRegistrar; private boolean initialized; - private final List registeredAliases = new ArrayList<>(); - private final Map cloudCommands = new HashMap<>(); @Inject private DynamicGui(DynamicGuiPlugin plugin, Platform platform, LoggerWrapper loggerWrapper, - CommandManager commandManager, Injector injector, - CloudExtender extender) { + CommandRegistrar commandRegistrar) { this.plugin = plugin; this.platform = platform; this.loggerWrapper = loggerWrapper; - this.commandManager = commandManager; - this.commandParser = new AnnotationParser<>(this.commandManager, - GuiCommandSender.class, - parserParameters -> SimpleCommandMeta.empty()); + this.commandRegistrar = commandRegistrar; this.injector = injector; - this.extender = extender; this.initialized = false; this.setupFileStructure(); this.saveDefaultConfig(); @@ -199,51 +182,10 @@ public boolean start() { public void stop() { CooldownManager.get().shutdown(); - this.unregisterCommand("gui"); - this.unregisterCommand("dynamicgui"); - this.unregisterCommand("dyngui"); - this.unregisterGuiAliases(); - } - - public List getRegisteredAliases() { - return Collections.unmodifiableList(this.registeredAliases); - } - - public void registerCommand(String guiName, String alias) { - this.unregisterCommand(alias); - Command command = this.commandManager.commandBuilder(alias) - .handler(context -> { - PlayerWrapper playerWrapper = context.getSender().getPlayer().get(); - if(playerWrapper != null) { - GuiManager.get().openGui(playerWrapper, guiName); - } - }).build(); - this.commandManager.command(command); - this.cloudCommands.put(alias, command); - this.registeredAliases.add(alias); - this.getLogger().info(String.format("Registered the command \"%s\" for the gui %s", - alias, - guiName - )); - } - - public void unregisterCommand(String alias) { - this.plugin.unregisterNativeCommand(alias); - try { - this.extender.unregister(this.commandManager, this.cloudCommands.get(alias), alias); - } catch (Exception e) { - e.printStackTrace(); - } - this.cloudCommands.remove(alias); - this.registeredAliases.remove(alias); - } - - public void unregisterGuiAliases() { - for (int i = 0; i < this.getRegisteredAliases().size(); i++) { - String cmd = this.getRegisteredAliases().get(i); - this.unregisterCommand(cmd); - i--; - } + this.commandRegistrar.unregisterCommand("gui"); + this.commandRegistrar.unregisterCommand("dynamicgui"); + this.commandRegistrar.unregisterCommand("dyngui"); + this.commandRegistrar.unregisterGuiAliases(); } private void setupFileStructure() { @@ -365,10 +307,8 @@ private void registerListeners() { } private void registerCommands() { - this.commandManager.setSetting(CommandManager.ManagerSettings.ALLOW_UNSAFE_REGISTRATION, true); - this.commandManager.setSetting(CommandManager.ManagerSettings.OVERRIDE_EXISTING_COMMANDS, true); - this.commandParser.parse(this.injector.getInstance(GuiCommand.class)); - this.commandParser.parse(this.injector.getInstance(DynamicGuiCommand.class)); + this.commandRegistrar.registerCommand(GuiCommand.class); + this.commandRegistrar.registerCommand(DynamicGuiCommand.class); } private void loadFunctions() { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrar.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrar.java new file mode 100644 index 000000000..db4a1cbbd --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrar.java @@ -0,0 +1,26 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command; + +public interface CommandRegistrar { + + void registerCommand(Class command); + void registerGuiCommand(String guiName, String alias); + void unregisterCommand(String alias); + void unregisterGuiAliases(); + +} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrarImpl.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrarImpl.java new file mode 100644 index 000000000..940fa7a6e --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/CommandRegistrarImpl.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command; + +import cloud.commandframework.Command; +import cloud.commandframework.CommandManager; +import cloud.commandframework.annotations.AnnotationParser; +import cloud.commandframework.meta.SimpleCommandMeta; +import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.google.inject.Injector; + +import javax.inject.Inject; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CommandRegistrarImpl implements CommandRegistrar { + + private final CommandManager commandManager; + private final CloudExtender extender; + private final LoggerWrapper logger; + private final Injector injector; + private final AnnotationParser commandParser; + + private final List registeredAliases = new ArrayList<>(); + private final Map cloudCommands = new HashMap<>(); + + @Inject + private CommandRegistrarImpl(CommandManager commandManager, + CloudExtender extender, + LoggerWrapper logger, + Injector injector) { + this.commandManager = commandManager; + this.extender = extender; + this.logger = logger; + this.injector = injector; + this.commandParser = new AnnotationParser<>(this.commandManager, + GuiCommandSender.class, + parserParameters -> SimpleCommandMeta.empty()); + this.commandManager.setSetting(CommandManager.ManagerSettings.ALLOW_UNSAFE_REGISTRATION, true); + this.commandManager.setSetting(CommandManager.ManagerSettings.OVERRIDE_EXISTING_COMMANDS, true); + } + + @Override + public void registerCommand(Class command) { + this.commandParser.parse(this.injector.getInstance(command)); + } + + @Override + public void registerGuiCommand(String guiName, String alias) { + this.unregisterCommand(alias); + Command command = this.commandManager.commandBuilder(alias) + .handler(context -> { + PlayerWrapper playerWrapper = context.getSender().getPlayer().get(); + if(playerWrapper != null) { + GuiManager.get().openGui(playerWrapper, guiName); + } + }).build(); + this.commandManager.command(command); + this.cloudCommands.put(alias, command); + this.registeredAliases.add(alias); + this.logger.info(String.format("Registered the command \"%s\" for the gui %s", + alias, + guiName + )); + } + + @Override + public void unregisterCommand(String alias) { + try { + this.extender.unregister(this.commandManager, this.cloudCommands.get(alias), alias); + } catch (Exception e) { + e.printStackTrace(); + } + this.cloudCommands.remove(alias); + this.registeredAliases.remove(alias); + } + + @Override + public void unregisterGuiAliases() { + for (int i = 0; i < this.registeredAliases.size(); i++) { + String cmd = this.registeredAliases.get(i); + this.unregisterCommand(cmd); + i--; + } + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java index 3ff65e112..728d678d8 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java @@ -32,7 +32,7 @@ import java.util.Map; import java.util.UUID; -public class DynamicGuiCommand { +public class DynamicGuiCommand implements RegisteredCommand { private final Platform platform; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index 17505a445..fbac5dafc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -23,7 +23,7 @@ import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -public class GuiCommand { +public class GuiCommand implements RegisteredCommand { @CommandMethod("gui ") @CommandPermission(Key.GUI_BASE_PERMISSION) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/RegisteredCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/RegisteredCommand.java new file mode 100644 index 000000000..d79f49c52 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/RegisteredCommand.java @@ -0,0 +1,20 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core.command; + +public interface RegisteredCommand { +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index d687ffb74..8546c724d 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -19,6 +19,8 @@ import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.command.CommandRegistrar; +import com.clubobsidian.dynamicgui.core.command.CommandRegistrarImpl; import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommand; import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; @@ -26,6 +28,7 @@ import com.clubobsidian.dynamicgui.core.command.cloud.extender.CombinedCloudExtender; import com.clubobsidian.dynamicgui.core.command.cloud.extender.NativeCloudExtender; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; +import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; import com.clubobsidian.dynamicgui.core.manager.inventory.InventoryManager; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; @@ -75,6 +78,14 @@ public PluginModule(DynamicGuiPlugin plugin, @Override public void configure(Binder binder) { + binder.bind(new TypeLiteral>() {}).toInstance(this.logger); + + binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.NATIVE_ANNOTATION)).to(NativeCloudExtender.class); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.PLATFORM_ANNOTATION)).to(this.getPlatformExtender()); + binder.bind(CloudExtender.class).to(CombinedCloudExtender.class); + binder.bind(CommandRegistrar.class).to(CommandRegistrarImpl.class).asEagerSingleton(); + binder.bind(EntityManager.class).to(this.entityClass); binder.bind(InventoryManager.class).to(this.inventoryClass); binder.bind(ItemStackManager.class).to(this.itemStackClass); @@ -82,13 +93,8 @@ public void configure(Binder binder) { binder.bind(LocationManager.class).to(this.locationClass); binder.bind(DynamicGuiPlugin.class).toInstance(this.plugin); binder.bind(Platform.class).toInstance(this.platform); - binder.bind(new TypeLiteral>() {}).toInstance(this.logger); - binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); - - binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.NATIVE_ANNOTATION)).to(NativeCloudExtender.class); - binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.PLATFORM_ANNOTATION)).to(this.getPlatformExtender()); - binder.bind(CloudExtender.class).to(CombinedCloudExtender.class); + binder.bind(GuiManager.class); binder.bind(GuiCommand.class).asEagerSingleton(); binder.bind(DynamicGuiCommand.class).asEagerSingleton(); @@ -98,6 +104,7 @@ public void configure(Binder binder) { binder.requestStaticInjection(ItemStackManager.class); binder.requestStaticInjection(MaterialManager.class); binder.requestStaticInjection(LocationManager.class); + binder.requestStaticInjection(GuiManager.class); binder.requestStaticInjection(DynamicGui.class); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 6a95cea7b..e5ce97296 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -17,6 +17,7 @@ package com.clubobsidian.dynamicgui.core.manager.dynamicgui; import com.clubobsidian.dynamicgui.core.DynamicGui; +import com.clubobsidian.dynamicgui.core.command.CommandRegistrar; import com.clubobsidian.dynamicgui.core.enchantment.EnchantmentWrapper; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.event.inventory.GuiLoadEvent; @@ -45,6 +46,7 @@ import com.clubobsidian.wrappy.ConfigurationSection; import org.apache.commons.io.FileUtils; +import javax.inject.Inject; import java.io.File; import java.net.MalformedURLException; import java.net.URL; @@ -65,11 +67,12 @@ public class GuiManager { + @Inject private static GuiManager instance; public static GuiManager get() { - if (instance == null) { - instance = new GuiManager(); + if (!instance.intialized) { + instance.intialized = true; instance.loadGlobalMacros(); instance.loadGuis(); } @@ -89,8 +92,11 @@ private static Gui getOrCloneGui(Gui gui) { private Map guiHashes; private Map globalMacrosTimestamps; private final Set modifiedMacros = new HashSet<>(); + private final CommandRegistrar commandRegistrar; + private boolean intialized = false; - private GuiManager() { + @Inject + private GuiManager(CommandRegistrar commandRegistrar) { this.guis = new HashMap<>(); this.cachedGuis = new HashMap<>(); this.cachedTokens = new HashMap<>(); @@ -98,6 +104,7 @@ private GuiManager() { this.cachedGlobalMacros = new HashMap<>(); this.guiHashes = new HashMap<>(); this.globalMacrosTimestamps = new HashMap<>(); + this.commandRegistrar = commandRegistrar; } public boolean isGuiLoaded(String name) { @@ -114,7 +121,7 @@ public Gui getGui(String name) { public void reloadGuis(boolean force) { DynamicGui.get().getLogger().info("Reloading guis!"); - DynamicGui.get().unregisterGuiAliases(); + this.commandRegistrar.unregisterGuiAliases(); this.cachedGuis = this.guis; this.guis = new HashMap<>(); this.cachedGlobalMacros = this.globalMacros; @@ -338,7 +345,7 @@ private void loadGuiFromFile(Configuration yaml, File file) { if (token != null && cachedHash != null && cachedHash == guiHash && !hasUpdatedMacro(token)) { Gui cachedGui = this.cachedGuis.get(guiName); for (String alias : token.getAlias()) { - dynamicGui.registerCommand(guiName, alias); + this.commandRegistrar.registerGuiCommand(guiName, alias); } this.guis.put(guiName, cachedGui); @@ -513,7 +520,7 @@ private Gui createGui(final GuiToken guiToken, final String guiName, final List< List aliases = guiToken.getAlias(); for (String alias : aliases) { - DynamicGui.get().registerCommand(guiName, alias); + this.commandRegistrar.registerGuiCommand(guiName, alias); } boolean close = guiToken.isClosed(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java index a71a70b48..0c4c88a46 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/plugin/DynamicGuiPlugin.java @@ -51,5 +51,5 @@ default File getMacroFolder() { return new File(this.getDataFolder(), "macros"); } - void unregisterNativeCommand(String commandName); + //void unregisterNativeCommand(String commandName); } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java index 669c1a2ef..40e1ed276 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/mock/plugin/MockDynamicGuiPlugin.java @@ -82,9 +82,4 @@ public File getGuiFolder() { public File getMacroFolder() { return this.macroFolder; } - - @Override - public void unregisterNativeCommand(String commandName) { - - } } From 08ee02be564483d648326308dfff3955584d2683 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 19:30:20 -0700 Subject: [PATCH 217/261] Start debugging cause of tab complete npe --- .../command/cloud/BukkitCloudExtender.java | 47 +++++++++++++++++-- .../bukkit/plugin/DynamicGuiBukkitPlugin.java | 28 ----------- .../cloud/extender/CombinedCloudExtender.java | 9 ++-- .../cloud/extender/NativeCloudExtender.java | 1 + 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java index 884ebb2c7..44af0f1c9 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java @@ -23,7 +23,11 @@ import cloud.commandframework.internal.CommandRegistrationHandler; import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandMap; +import org.bukkit.command.SimpleCommandMap; +import java.lang.reflect.Field; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -34,9 +38,15 @@ public class BukkitCloudExtender implements CloudExtender { public boolean unregister(CommandManager commandManager, Command command, String alias) { BukkitPluginRegistrationHandler handler = (BukkitPluginRegistrationHandler) commandManager.getCommandRegistrationHandler(); - return this.unregisterHandler(handler, alias) - || this.unregisterAliases(handler, alias) - || this.unregisterBukkitCommand(handler, alias); + boolean handlerUnregistered = this.unregisterHandler(handler, alias); + boolean aliasesUnregistered = this.unregisterAliases(handler, alias); + boolean bukkitUnregistered = this.unregisterBukkitCommand(handler, alias); + System.out.println("alias: " + alias); + System.out.println("handler: " + handlerUnregistered); + System.out.println("aliases: " + aliasesUnregistered); + System.out.println("bukkit: " + bukkitUnregistered); + this.unregisterNativeCommand(alias); + return handlerUnregistered || aliasesUnregistered || bukkitUnregistered; } private boolean unregisterBukkitCommand(BukkitPluginRegistrationHandler handler, String alias) { @@ -52,9 +62,13 @@ private boolean unregisterHandler(CommandRegistrationHandler handler, String ali boolean removed = false; while (it.hasNext()) { org.bukkit.command.Command command = it.next().getValue(); - if(command.getName().equals(alias) || command.getAliases().contains(alias)) { + if(command.getName().equals(alias) + || command.getAliases().contains(alias) + || command.getLabel().equals(alias) + || command.getLabel().endsWith(":" + alias)) { it.remove(); removed = true; + System.out.println("removed: " + command.getName() + " " + command.getAliases()); } } return removed; @@ -64,4 +78,29 @@ private boolean unregisterAliases(BukkitPluginRegistrationHandler handler, Strin Set aliases = ReflectionUtil.get(handler, handler.getClass(), "recognizedAliases"); return aliases.remove(alias); } + + private final CommandMap getCommandMap() { + try { + final Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap"); + f.setAccessible(true); + return (CommandMap) f.get(Bukkit.getServer()); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + public void unregisterNativeCommand(String alias) { + try { + //TODO - unregister brigadier + Field commandField = SimpleCommandMap.class.getDeclaredField("knownCommands"); + commandField.setAccessible(true); + @SuppressWarnings("unchecked") + Map commands = (Map) commandField.get(this.getCommandMap()); + commands.remove(alias); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { + e.printStackTrace(); + } + } } \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java index 9ef096105..9e56cb81b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/plugin/DynamicGuiBukkitPlugin.java @@ -189,33 +189,5 @@ public List getNPCRegistries() { return this.npcRegistries; } - private final CommandMap getCommandMap() { - if (this.commandMap == null) { - try { - final Field f = this.getServer().getClass().getDeclaredField("commandMap"); - f.setAccessible(true); - this.commandMap = (CommandMap) f.get(this.getServer()); - return this.commandMap; - } catch (Exception e) { - e.printStackTrace(); - } - } else if (this.commandMap != null) { - return this.commandMap; - } - return null; - } - /*@Override - public void unregisterNativeCommand(String alias) { - try { - //TODO - unregister brigadier - Field commandField = SimpleCommandMap.class.getDeclaredField("knownCommands"); - commandField.setAccessible(true); - @SuppressWarnings("unchecked") - Map commands = (Map) commandField.get(this.getCommandMap()); - commands.remove(alias); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { - e.printStackTrace(); - } - }*/ } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java index f8d6fdb0b..19cbc9ab4 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java @@ -30,15 +30,16 @@ public class CombinedCloudExtender implements CloudExtender { private final CloudExtender platformExtender; @Inject - private CombinedCloudExtender(@Named(Key.NATIVE_ANNOTATION)CloudExtender nativeExtender, - @Named(Key.PLATFORM_ANNOTATION)CloudExtender platformExtender) { + private CombinedCloudExtender(@Named(Key.NATIVE_ANNOTATION) CloudExtender nativeExtender, + @Named(Key.PLATFORM_ANNOTATION) CloudExtender platformExtender) { this.nativeExtender = nativeExtender; this.platformExtender = platformExtender; } @Override public boolean unregister(CommandManager commandManager, Command command, String commandName) { - return this.nativeExtender.unregister(commandManager, command, commandName) - || this.platformExtender.unregister(commandManager, command, commandName); + boolean nativeUnregistered = this.nativeExtender.unregister(commandManager, command, commandName); + boolean platformUnregistered = this.platformExtender.unregister(commandManager, command, commandName); + return nativeUnregistered || platformUnregistered; } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java index e78af2a35..76963a522 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java @@ -39,6 +39,7 @@ public boolean unregister(CommandManager commandManager, Command command, String e.printStackTrace(); return false; } + System.out.println(commandName + ": " + commandsUnregistered + " " + treeUnregistered); return commandsUnregistered || treeUnregistered; } From 30a143ce528f4dd2b55120ebbe87bb2cbeeb17d3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 1 Apr 2022 21:07:46 -0700 Subject: [PATCH 218/261] Unregister namespaced command alias Close #249 --- .../command/cloud/BukkitCloudExtender.java | 46 +++++-------------- .../dynamicgui/core/Constant.java | 38 +++++++++++++++ .../com/clubobsidian/dynamicgui/core/Key.java | 27 ++++++----- .../core/command/DynamicGuiCommand.java | 10 ++-- .../dynamicgui/core/command/GuiCommand.java | 6 +-- .../cloud/extender/CombinedCloudExtender.java | 6 +-- .../cloud/extender/NativeCloudExtender.java | 1 - .../core/inject/module/PluginModule.java | 6 +-- 8 files changed, 79 insertions(+), 61 deletions(-) create mode 100644 core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java index 44af0f1c9..407efc68d 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java @@ -21,6 +21,8 @@ import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.bukkit.BukkitPluginRegistrationHandler; import cloud.commandframework.internal.CommandRegistrationHandler; +import com.clubobsidian.dynamicgui.core.Constant; +import com.clubobsidian.dynamicgui.core.Key; import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import org.bukkit.Bukkit; @@ -41,18 +43,15 @@ public boolean unregister(CommandManager commandManager, Command command, String boolean handlerUnregistered = this.unregisterHandler(handler, alias); boolean aliasesUnregistered = this.unregisterAliases(handler, alias); boolean bukkitUnregistered = this.unregisterBukkitCommand(handler, alias); - System.out.println("alias: " + alias); - System.out.println("handler: " + handlerUnregistered); - System.out.println("aliases: " + aliasesUnregistered); - System.out.println("bukkit: " + bukkitUnregistered); - this.unregisterNativeCommand(alias); return handlerUnregistered || aliasesUnregistered || bukkitUnregistered; } private boolean unregisterBukkitCommand(BukkitPluginRegistrationHandler handler, String alias) { Map bukkitCommands = ReflectionUtil.get(handler, handler.getClass(), "bukkitCommands"); - return bukkitCommands.remove(alias) != null; + boolean removed = bukkitCommands.remove(alias) != null; + boolean namespaceRemoved = bukkitCommands.remove(Key.create(alias).toString()) != null; + return removed || namespaceRemoved; } private boolean unregisterHandler(CommandRegistrationHandler handler, String alias) { @@ -60,15 +59,17 @@ private boolean unregisterHandler(CommandRegistrationHandler handler, String ali ReflectionUtil.get(handler, BukkitPluginRegistrationHandler.class, "registeredCommands"); Iterator, org.bukkit.command.Command>> it = registeredCommands.entrySet().iterator(); boolean removed = false; + String namespaceAlias = Key.create(alias).toString(); while (it.hasNext()) { org.bukkit.command.Command command = it.next().getValue(); if(command.getName().equals(alias) + || command.getName().equals(namespaceAlias) || command.getAliases().contains(alias) + || command.getAliases().contains(namespaceAlias) || command.getLabel().equals(alias) - || command.getLabel().endsWith(":" + alias)) { + || command.getLabel().equals(namespaceAlias)) { it.remove(); removed = true; - System.out.println("removed: " + command.getName() + " " + command.getAliases()); } } return removed; @@ -76,31 +77,8 @@ private boolean unregisterHandler(CommandRegistrationHandler handler, String ali private boolean unregisterAliases(BukkitPluginRegistrationHandler handler, String alias) { Set aliases = ReflectionUtil.get(handler, handler.getClass(), "recognizedAliases"); - return aliases.remove(alias); - } - - private final CommandMap getCommandMap() { - try { - final Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap"); - f.setAccessible(true); - return (CommandMap) f.get(Bukkit.getServer()); - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - - public void unregisterNativeCommand(String alias) { - try { - //TODO - unregister brigadier - Field commandField = SimpleCommandMap.class.getDeclaredField("knownCommands"); - commandField.setAccessible(true); - @SuppressWarnings("unchecked") - Map commands = (Map) commandField.get(this.getCommandMap()); - commands.remove(alias); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { - e.printStackTrace(); - } + boolean original = aliases.remove(alias); + boolean namespace = aliases.remove(Key.create(alias).toString()); + return original || namespace; } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java new file mode 100644 index 000000000..0e426c075 --- /dev/null +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 virustotalop and contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clubobsidian.dynamicgui.core; + +import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; + +public final class Constant { + + public static final String GUI_BASE_PERMISSION = "dynamicgui.command.gui"; + public static final String DYNAMIC_GUI_COMMAND_BASE_PERMISSION = "dynamicgui.command.admin"; + public static final String DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".reload"; + public static final String DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".close"; + + public static final String NATIVE_ANNOTATION = "native"; + public static final String PLATFORM_ANNOTATION = "platform"; + public static final String NAMESPACE = "dynamicgui"; + + public static boolean hasGuiPermission(PlayerWrapper player, String guiName) { + return player.hasPermission(GUI_BASE_PERMISSION + "." + guiName); + } + + private Constant() { + } +} diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java index 5ef7748ce..f55195e95 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Key.java @@ -16,22 +16,25 @@ package com.clubobsidian.dynamicgui.core; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +public class Key { -public final class Key { + public static Key create(String value) { + return new Key(value); + } - public static final String GUI_BASE_PERMISSION = "dynamicgui.command.gui"; - public static final String DYNAMIC_GUI_COMMAND_BASE_PERMISSION = "dynamicgui.command.admin"; - public static final String DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".reload"; - public static final String DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".close"; + private final String namespace; + private final String value; - public static final String NATIVE_ANNOTATION = "native"; - public static final String PLATFORM_ANNOTATION = "platform"; + public Key(String value) { + this(Constant.NAMESPACE, value); + } - public static boolean hasGuiPermission(PlayerWrapper player, String guiName) { - return player.hasPermission(GUI_BASE_PERMISSION + "." + guiName); + public Key(String namespace, String value) { + this.namespace = namespace; + this.value = value; } - private Key() { + public String toString() { + return this.namespace + ":" + value; } -} +} \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java index 728d678d8..1f1f18be0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java @@ -20,7 +20,7 @@ import cloud.commandframework.annotations.CommandMethod; import cloud.commandframework.annotations.CommandPermission; import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.Constant; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.event.plugin.DynamicGuiReloadEvent; import com.clubobsidian.dynamicgui.core.gui.Gui; @@ -42,7 +42,7 @@ private DynamicGuiCommand(Platform platform) { } @CommandMethod("dynamicgui|dyngui reload") - @CommandPermission(Key.DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION) + @CommandPermission(Constant.DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION) private void reload(GuiCommandSender sender) { sender.sendMessage("Guis have been reloaded"); GuiManager.get().reloadGuis(false); @@ -50,7 +50,7 @@ private void reload(GuiCommandSender sender) { } @CommandMethod("dynamicgui|dyngui forcereload") - @CommandPermission(Key.DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION) + @CommandPermission(Constant.DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION) private void forceReload(GuiCommandSender sender) { sender.sendMessage("Guis have been force reloaded"); GuiManager.get().reloadGuis(true); @@ -58,7 +58,7 @@ private void forceReload(GuiCommandSender sender) { } @CommandMethod("dynamicgui|dyngui close all [guiName]") - @CommandPermission(Key.DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION) + @CommandPermission(Constant.DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION) private void closeAll(GuiCommandSender sender, @Argument("guiName") String guiName) { if(guiName == null) { sender.sendMessage("All open DynamicGui guis have been closed"); @@ -88,7 +88,7 @@ private void closeAll(GuiCommandSender sender, @Argument("guiName") String guiNa } @CommandMethod("dynamicgui|dyngui close ") - @CommandPermission(Key.DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION) + @CommandPermission(Constant.DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION) private void closePlayer(GuiCommandSender sender, @Argument("playerName") String playerName) { PlayerWrapper player = this.platform.getPlayer(playerName); if (player == null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index fbac5dafc..cb687beab 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -19,17 +19,17 @@ import cloud.commandframework.annotations.Argument; import cloud.commandframework.annotations.CommandMethod; import cloud.commandframework.annotations.CommandPermission; -import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.Constant; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; public class GuiCommand implements RegisteredCommand { @CommandMethod("gui ") - @CommandPermission(Key.GUI_BASE_PERMISSION) + @CommandPermission(Constant.GUI_BASE_PERMISSION) private void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { PlayerWrapper player = sender.getPlayer().orElse(null); - if(player != null && Key.hasGuiPermission(player, guiName)) { + if(player != null && Constant.hasGuiPermission(player, guiName)) { GuiManager.get().openGui(player, guiName); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java index 19cbc9ab4..c2599de4c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CombinedCloudExtender.java @@ -18,7 +18,7 @@ import cloud.commandframework.Command; import cloud.commandframework.CommandManager; -import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.Constant; import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import javax.inject.Inject; @@ -30,8 +30,8 @@ public class CombinedCloudExtender implements CloudExtender { private final CloudExtender platformExtender; @Inject - private CombinedCloudExtender(@Named(Key.NATIVE_ANNOTATION) CloudExtender nativeExtender, - @Named(Key.PLATFORM_ANNOTATION) CloudExtender platformExtender) { + private CombinedCloudExtender(@Named(Constant.NATIVE_ANNOTATION) CloudExtender nativeExtender, + @Named(Constant.PLATFORM_ANNOTATION) CloudExtender platformExtender) { this.nativeExtender = nativeExtender; this.platformExtender = platformExtender; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java index 76963a522..e78af2a35 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java @@ -39,7 +39,6 @@ public boolean unregister(CommandManager commandManager, Command command, String e.printStackTrace(); return false; } - System.out.println(commandName + ": " + commandsUnregistered + " " + treeUnregistered); return commandsUnregistered || treeUnregistered; } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 8546c724d..2cb3f7997 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -18,7 +18,7 @@ import cloud.commandframework.CommandManager; import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.Key; +import com.clubobsidian.dynamicgui.core.Constant; import com.clubobsidian.dynamicgui.core.command.CommandRegistrar; import com.clubobsidian.dynamicgui.core.command.CommandRegistrarImpl; import com.clubobsidian.dynamicgui.core.command.DynamicGuiCommand; @@ -81,8 +81,8 @@ public void configure(Binder binder) { binder.bind(new TypeLiteral>() {}).toInstance(this.logger); binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); - binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.NATIVE_ANNOTATION)).to(NativeCloudExtender.class); - binder.bind(CloudExtender.class).annotatedWith(Names.named(Key.PLATFORM_ANNOTATION)).to(this.getPlatformExtender()); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Constant.NATIVE_ANNOTATION)).to(NativeCloudExtender.class); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Constant.PLATFORM_ANNOTATION)).to(this.getPlatformExtender()); binder.bind(CloudExtender.class).to(CombinedCloudExtender.class); binder.bind(CommandRegistrar.class).to(CommandRegistrarImpl.class).asEagerSingleton(); From 7e0c6beb9f32e7c3e9d5c901cfc6c351d5d092ff Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 2 Apr 2022 05:51:28 -0700 Subject: [PATCH 219/261] Relocate cloud --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index ace8aff02..62d8be44e 100644 --- a/build.gradle +++ b/build.gradle @@ -76,6 +76,7 @@ subprojects { relocate 'com.google.errorprone', 'com.clubobsidian.dynamicgui.shaded.errorprone' relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson' relocate 'com.github.benmanes.caffeine', 'com.clubobsidian.dynamicgui.shaded.caffeine' + relocate 'cloud', 'com.clubobsidian.dynamicgui.shaded.cloud' } repositories { From 71f8ae3997f2919c36cc6dbad5ebb353304b16ad Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 2 Apr 2022 06:17:52 -0700 Subject: [PATCH 220/261] Move BukkitNBTUtil constructor down --- .../clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index 7002b3f92..3cb3b50c5 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -33,9 +33,6 @@ public final class BukkitNBTUtil { private static Method asBukkitCopy; private static Method getTag; - private BukkitNBTUtil() { - } - public static Object parse(String nbtStr) { if (parse == null) { try { @@ -178,4 +175,7 @@ private static String getCompoundClass() { } } } + + private BukkitNBTUtil() { + } } \ No newline at end of file From be75201778d32af4cd53e1e2ddc4a445efa9bc41 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 2 Apr 2022 23:51:35 -0700 Subject: [PATCH 221/261] Use Function instead of method for gui permission --- .../java/com/clubobsidian/dynamicgui/core/Constant.java | 7 ++----- .../clubobsidian/dynamicgui/core/command/GuiCommand.java | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java index 0e426c075..f644ede19 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java @@ -16,11 +16,12 @@ package com.clubobsidian.dynamicgui.core; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import java.util.function.Function; public final class Constant { public static final String GUI_BASE_PERMISSION = "dynamicgui.command.gui"; + public static final Function GUI_PERMISSION = (gui) -> GUI_BASE_PERMISSION + "." + gui; public static final String DYNAMIC_GUI_COMMAND_BASE_PERMISSION = "dynamicgui.command.admin"; public static final String DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".reload"; public static final String DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".close"; @@ -29,10 +30,6 @@ public final class Constant { public static final String PLATFORM_ANNOTATION = "platform"; public static final String NAMESPACE = "dynamicgui"; - public static boolean hasGuiPermission(PlayerWrapper player, String guiName) { - return player.hasPermission(GUI_BASE_PERMISSION + "." + guiName); - } - private Constant() { } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index cb687beab..f91ca6375 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -29,7 +29,7 @@ public class GuiCommand implements RegisteredCommand { @CommandPermission(Constant.GUI_BASE_PERMISSION) private void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { PlayerWrapper player = sender.getPlayer().orElse(null); - if(player != null && Constant.hasGuiPermission(player, guiName)) { + if(player != null && player.hasPermission(Constant.GUI_PERMISSION.apply(guiName))) { GuiManager.get().openGui(player, guiName); } } From d674a42d596fecbe686274cb8c920e6d266038c9 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 4 Apr 2022 22:27:14 -0700 Subject: [PATCH 222/261] Remove un-used bukkit command classes --- .../command/BukkitDynamicGuiCommand.java | 114 ------------------ .../bukkit/command/CustomCommand.java | 41 ------- .../bukkit/command/CustomCommandExecutor.java | 45 ------- 3 files changed, 200 deletions(-) delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java delete mode 100644 bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java deleted file mode 100644 index 78a2fdc20..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/BukkitDynamicGuiCommand.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2022 virustotalop and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.clubobsidian.dynamicgui.bukkit.command; - -import com.clubobsidian.dynamicgui.core.DynamicGui; -import com.clubobsidian.dynamicgui.core.event.plugin.DynamicGuiReloadEvent; -import com.clubobsidian.dynamicgui.core.gui.Gui; -import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.UUID; - -public class BukkitDynamicGuiCommand implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (args.length == 1) { - String first = args[0]; - if (sender.hasPermission("dynamicgui.reload")) { - if (first.equalsIgnoreCase("reload")) { - sender.sendMessage("Guis have been reloaded"); - GuiManager.get().reloadGuis(false); - DynamicGui.get().getEventBus().callEvent(new DynamicGuiReloadEvent()); - return true; - } else if (first.equals("forcereload")) { - sender.sendMessage("Guis have been force reloaded"); - GuiManager.get().reloadGuis(true); - DynamicGui.get().getEventBus().callEvent(new DynamicGuiReloadEvent()); - return true; - } - } - } else if (args.length == 2) { - String first = args[0]; - String second = args[1]; - if (first.equalsIgnoreCase("close")) { - if (sender.hasPermission("dynamicgui.close")) { - if (second.equalsIgnoreCase("all")) { - sender.sendMessage("All open DynamicGui guis have been closed"); - for (UUID uuid : GuiManager.get().getPlayerGuis().keySet()) { - Bukkit.getServer().getPlayer(uuid).closeInventory(); - } - return true; - } else { - Player player = Bukkit.getServer().getPlayer(second); - if (player == null) { - sender.sendMessage("That player is not online, so their gui cannot be closed"); - return true; - } else { - - if (GuiManager.get().getPlayerGuis().get(player.getUniqueId()) != null) { - sender.sendMessage(player.getName() + "'s gui has been closed"); - player.closeInventory(); - return true; - } else { - sender.sendMessage(player.getName() + " did not have a DynamicGui gui open"); - return true; - } - } - } - } - } - } else if (args.length == 3) { - String first = args[0]; - String second = args[1]; - String third = args[2]; - if (first.equalsIgnoreCase("close")) { - if (second.equalsIgnoreCase("all")) { - Gui gui = GuiManager.get().getGui(third); - if (gui == null) { - sender.sendMessage("No gui can be found by that name"); - return true; - } else { - sender.sendMessage("Guis of type " + third + " are now closed"); - Iterator> it = GuiManager.get().getPlayerGuis().entrySet().iterator(); - while (it.hasNext()) { - Entry next = it.next(); - if (next.getValue().getName().equals(third)) { - Bukkit.getServer().getPlayer(next.getKey()).closeInventory(); - } - } - return true; - } - } - } - } else { - sender.sendMessage("/dynamicgui reload"); - sender.sendMessage("/dynamicgui forcereload"); - sender.sendMessage("/dynamicgui close "); - sender.sendMessage("/dynamicgui close "); - return true; - } - return true; - } -} \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java deleted file mode 100644 index e1e55b990..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2022 virustotalop and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.clubobsidian.dynamicgui.bukkit.command; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -public class CustomCommand extends Command { - - private CommandExecutor executer = null; - - public CustomCommand(String name) { - super(name); - } - - public boolean execute(CommandSender sender, String commandLabel, String[] args) { - if (this.executer != null) { - this.executer.onCommand(sender, this, commandLabel, args); - } - return false; - } - - public void setExecutor(CommandExecutor executer) { - this.executer = executer; - } -} \ No newline at end of file diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java deleted file mode 100644 index 31880636e..000000000 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/CustomCommandExecutor.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 virustotalop and contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.clubobsidian.dynamicgui.bukkit.command; - -import com.clubobsidian.dynamicgui.bukkit.entity.BukkitPlayerWrapper; -import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; -import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class CustomCommandExecutor implements CommandExecutor { - - private final String gui; - - public CustomCommandExecutor(String gui) { - this.gui = gui; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - Player player = (Player) sender; - PlayerWrapper playerWrapper = new BukkitPlayerWrapper<>(player); - GuiManager.get().openGui(playerWrapper, this.gui); - return true; - } - return false; - } -} \ No newline at end of file From 618c9230a96de6dbf3088081f427269c9a275b36 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 4 Apr 2022 23:55:15 -0700 Subject: [PATCH 223/261] Add no permission message to gui command --- .../dynamicgui/core/command/GuiCommand.java | 10 ++++++++-- .../clubobsidian/dynamicgui/core/config/Message.java | 6 ++++++ core/src/main/resources/config.yml | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index f91ca6375..1173fca59 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -20,6 +20,7 @@ import cloud.commandframework.annotations.CommandMethod; import cloud.commandframework.annotations.CommandPermission; import com.clubobsidian.dynamicgui.core.Constant; +import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; @@ -29,8 +30,13 @@ public class GuiCommand implements RegisteredCommand { @CommandPermission(Constant.GUI_BASE_PERMISSION) private void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { PlayerWrapper player = sender.getPlayer().orElse(null); - if(player != null && player.hasPermission(Constant.GUI_PERMISSION.apply(guiName))) { - GuiManager.get().openGui(player, guiName); + if(player != null) { + boolean hasPermission = player.hasPermission(Constant.GUI_PERMISSION.apply(guiName)); + if (hasPermission){ + GuiManager.get().openGui(player, guiName); + } else { + sender.sendMessage(DynamicGui.get().getMessage().getNoGuiPermission()); + } } } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java index 1fe65cd55..353c66819 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/Message.java @@ -22,8 +22,14 @@ public class Message { @Node("no-gui") private String noGui; + @Node("no-gui-permission") + private String noGuiPermission; public String getNoGui() { return this.noGui; } + + public String getNoGuiPermission() { + return this.noGuiPermission; + } } diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index 9b73b4b07..61278ceff 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -1,5 +1,6 @@ message: - no-gui: "&4That gui does not exist!" + no-gui: "&e[&fDynamicGui&e] &cThat gui does not exist!" + no-gui-permission: "&e[&fDynamicGui&e] &cYou do not have permission for that gui!" #Configure proxy types # Proxy types: From e9e8fc98ec38de303fae886dd1f304cd4c4e72b3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Tue, 5 Apr 2022 00:11:29 -0700 Subject: [PATCH 224/261] Create guilist command Close #248 --- .../clubobsidian/dynamicgui/core/Constant.java | 1 + .../core/command/DynamicGuiCommand.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java index f644ede19..3fa11558f 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/Constant.java @@ -25,6 +25,7 @@ public final class Constant { public static final String DYNAMIC_GUI_COMMAND_BASE_PERMISSION = "dynamicgui.command.admin"; public static final String DYNAMIC_GUI_COMMAND_RELOAD_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".reload"; public static final String DYNAMIC_GUI_COMMAND_CLOSE_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".close"; + public static final String DYNAMIC_GUI_LIST_PERMISSION = DYNAMIC_GUI_COMMAND_BASE_PERMISSION + ".list"; public static final String NATIVE_ANNOTATION = "native"; public static final String PLATFORM_ANNOTATION = "platform"; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java index 1f1f18be0..dd7ba35c3 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/DynamicGuiCommand.java @@ -26,11 +26,15 @@ import com.clubobsidian.dynamicgui.core.gui.Gui; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.core.platform.Platform; +import com.clubobsidian.dynamicgui.core.util.ChatColor; import javax.inject.Inject; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; public class DynamicGuiCommand implements RegisteredCommand { @@ -102,4 +106,17 @@ private void closePlayer(GuiCommandSender sender, @Argument("playerName") String } } } + + @CommandMethod("dynamicgui|dyngui list") + @CommandPermission(Constant.DYNAMIC_GUI_LIST_PERMISSION) + private void guiList(GuiCommandSender sender) { + List guiNames = GuiManager + .get() + .getGuis() + .stream() + .map((gui) -> "&a" + gui.getName()) + .collect(Collectors.toList()); + String built = ChatColor.translateAlternateColorCodes(String.join(" &f," + guiNames)); + sender.sendMessage(built); + } } From cc0e1512a3c9c6e41af784400142318b7e6b6e4a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 9 Apr 2022 21:39:31 -0700 Subject: [PATCH 225/261] Write boilerplate for unregistering brigadier --- .../command/cloud/BukkitCloudExtender.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java index 407efc68d..7bcabad81 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/command/cloud/BukkitCloudExtender.java @@ -21,21 +21,18 @@ import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.bukkit.BukkitPluginRegistrationHandler; import cloud.commandframework.internal.CommandRegistrationHandler; -import com.clubobsidian.dynamicgui.core.Constant; import com.clubobsidian.dynamicgui.core.Key; import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandMap; -import org.bukkit.command.SimpleCommandMap; -import java.lang.reflect.Field; import java.util.Iterator; import java.util.Map; import java.util.Set; public class BukkitCloudExtender implements CloudExtender { + private final boolean brigadierEnabled = this.checkForBrigadier(); + @Override public boolean unregister(CommandManager commandManager, Command command, String alias) { BukkitPluginRegistrationHandler handler = (BukkitPluginRegistrationHandler) @@ -43,7 +40,17 @@ public boolean unregister(CommandManager commandManager, Command command, String boolean handlerUnregistered = this.unregisterHandler(handler, alias); boolean aliasesUnregistered = this.unregisterAliases(handler, alias); boolean bukkitUnregistered = this.unregisterBukkitCommand(handler, alias); - return handlerUnregistered || aliasesUnregistered || bukkitUnregistered; + boolean brigadierUnregistered = this.unregisterBrigadier(alias); + return handlerUnregistered || aliasesUnregistered || bukkitUnregistered || brigadierUnregistered; + } + + private boolean checkForBrigadier() { + try { + Class.forName("com.mojang.brigadier.CommandDispatcher"); + return true; + } catch(ClassNotFoundException ex) { + return false; + } } private boolean unregisterBukkitCommand(BukkitPluginRegistrationHandler handler, String alias) { @@ -81,4 +88,11 @@ private boolean unregisterAliases(BukkitPluginRegistrationHandler handler, Strin boolean namespace = aliases.remove(Key.create(alias).toString()); return original || namespace; } + + private boolean unregisterBrigadier(String alias) { + if (this.brigadierEnabled) { + //TODO - implement unregistering brigadier + } + return false; + } } \ No newline at end of file From eb4132ca442be655e44a2b07cd1964635c1e2db8 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 11 Apr 2022 20:24:03 -0700 Subject: [PATCH 226/261] Bump foundry to 2.0.2 --- bukkit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bukkit/build.gradle b/bukkit/build.gradle index c56f943d0..e7ca6ba90 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -14,7 +14,7 @@ shadowJar { dependencies { implementation project(path: ':core') - compileOnly 'com.github.clubobsidian:foundry:2.0.1' + compileOnly 'com.github.clubobsidian:foundry:2.0.2' compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT' compileOnly 'net.md-5:bungeecord-api:1.8-SNAPSHOT' implementation "cloud.commandframework:cloud-paper:$cloudVersion" From 194b84d72eddb1d0a466f5fa37e430e5800269ca Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 14 Apr 2022 23:32:47 -0700 Subject: [PATCH 227/261] NativeCloudExtender -> CoreCloudExtender --- .../{NativeCloudExtender.java => CoreCloudExtender.java} | 2 +- .../dynamicgui/core/inject/module/PluginModule.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/{NativeCloudExtender.java => CoreCloudExtender.java} (97%) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java similarity index 97% rename from core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java rename to core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java index e78af2a35..431f16ea0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/NativeCloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java @@ -24,7 +24,7 @@ import java.lang.reflect.Field; import java.util.List; -public class NativeCloudExtender implements CloudExtender { +public class CoreCloudExtender implements CloudExtender { public boolean unregister(CommandManager commandManager, Command command, String commandName) { if(command == null) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java index 2cb3f7997..b9c25e185 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/inject/module/PluginModule.java @@ -26,7 +26,7 @@ import com.clubobsidian.dynamicgui.core.command.GuiCommandSender; import com.clubobsidian.dynamicgui.core.command.cloud.CloudExtender; import com.clubobsidian.dynamicgui.core.command.cloud.extender.CombinedCloudExtender; -import com.clubobsidian.dynamicgui.core.command.cloud.extender.NativeCloudExtender; +import com.clubobsidian.dynamicgui.core.command.cloud.extender.CoreCloudExtender; import com.clubobsidian.dynamicgui.core.logger.LoggerWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; import com.clubobsidian.dynamicgui.core.manager.entity.EntityManager; @@ -81,7 +81,7 @@ public void configure(Binder binder) { binder.bind(new TypeLiteral>() {}).toInstance(this.logger); binder.bind(new TypeLiteral>(){}).toInstance(this.commandManager); - binder.bind(CloudExtender.class).annotatedWith(Names.named(Constant.NATIVE_ANNOTATION)).to(NativeCloudExtender.class); + binder.bind(CloudExtender.class).annotatedWith(Names.named(Constant.NATIVE_ANNOTATION)).to(CoreCloudExtender.class); binder.bind(CloudExtender.class).annotatedWith(Names.named(Constant.PLATFORM_ANNOTATION)).to(this.getPlatformExtender()); binder.bind(CloudExtender.class).to(CombinedCloudExtender.class); binder.bind(CommandRegistrar.class).to(CommandRegistrarImpl.class).asEagerSingleton(); From b69189c2337a4875e6a78b53c8e2f3fdb64d606b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Thu, 14 Apr 2022 23:35:58 -0700 Subject: [PATCH 228/261] Make sure to override the unregister method --- .../core/command/cloud/extender/CoreCloudExtender.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java index 431f16ea0..55947bb0e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/cloud/extender/CoreCloudExtender.java @@ -26,6 +26,7 @@ public class CoreCloudExtender implements CloudExtender { + @Override public boolean unregister(CommandManager commandManager, Command command, String commandName) { if(command == null) { return false; From 575df0dd8012e8b553236e86016861bcb27b979e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 01:17:46 -0700 Subject: [PATCH 229/261] Use modern setTag method --- .../dynamicgui/bukkit/util/BukkitNBTUtil.java | 19 ++++++++++++++----- .../dynamicgui/core/util/ReflectionUtil.java | 11 +++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index 3cb3b50c5..bf9a0e104 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.bukkit.util; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import org.bukkit.inventory.ItemStack; import java.lang.reflect.InvocationTargetException; @@ -100,10 +101,7 @@ public static ItemStack setTag(ItemStack itemStack, String nbt) { } if (setTag == null) { - Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); - Class nbtTagCompoundClass = Class.forName(COMPOUND_CLASS_NAME); - setTag = nmsItemStackClass.getDeclaredMethod("setTag", nbtTagCompoundClass); - setTag.setAccessible(true); + getSetTagMethod(); } if (asBukkitCopy == null) { @@ -116,7 +114,8 @@ public static ItemStack setTag(ItemStack itemStack, String nbt) { Object nmsItemStack = asNMSCopy.invoke(null, itemStack); Object nbtCompound = BukkitNBTUtil.parse(nbt); - setTag.invoke(nmsItemStack, nbtCompound); + Object invokedSetTag = setTag.invoke(nmsItemStack, nbtCompound); + nmsItemStack = setTag.getReturnType().equals(void.class) ? nmsItemStack : invokedSetTag; ItemStack bukkitItemStack = (ItemStack) asBukkitCopy.invoke(null, nmsItemStack); return bukkitItemStack; } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { @@ -125,6 +124,16 @@ public static ItemStack setTag(ItemStack itemStack, String nbt) { return null; } + private static void getSetTagMethod() { + try { + Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); + setTag = ReflectionUtil.getMethod(nmsItemStackClass, "setTag", "setTagClone"); + setTag.setAccessible(true); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + private static String getItemStackClass() { try { String className = "net.minecraft.world.item.ItemStack"; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index e4227de67..d836a5808 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -44,6 +44,17 @@ public static Method getMethod(Class cl, String methodName) { return null; } + public static Method getMethod(Class cl, String... methods) { + for (Method m : cl.getDeclaredMethods()) { + for (String methodName : methods) { + if(m.getName().equals(methodName)) { + return m; + } + } + } + return null; + } + public static Method getMethod(Class cl, String methodName, Class... params) { try { Method method = cl.getDeclaredMethod(methodName, params); From 9d7da00bd0f3788e56dfe8a7c36300afb16119e2 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 01:45:00 -0700 Subject: [PATCH 230/261] Use modern parser class --- .../dynamicgui/bukkit/util/BukkitNBTUtil.java | 46 +++---------------- .../dynamicgui/core/util/ReflectionUtil.java | 10 ++++ 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index bf9a0e104..f6bb1474a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -25,8 +25,11 @@ public final class BukkitNBTUtil { private static final String ITEM_STACK_CLASS_NAME = getItemStackClass(); - private static final String PARSER_CLASS_NAME = getParserClass(); - private static final String COMPOUND_CLASS_NAME = getCompoundClass(); + private static final Class PARSER_CLASS = ReflectionUtil.getClassIfExists( + "net.minecraft.nbt.TagParser", + "net.minecraft.nbt.MojangsonParser", + "net.minecraft.server." + VersionUtil.getVersion() + ".MojangsonParser" + ); private static Method parse; private static Method asNMSCopy; @@ -37,10 +40,9 @@ public final class BukkitNBTUtil { public static Object parse(String nbtStr) { if (parse == null) { try { - Class mojangParser = Class.forName(PARSER_CLASS_NAME); - parse = mojangParser.getDeclaredMethod("parse", String.class); + parse = ReflectionUtil.getMethod(PARSER_CLASS, "parseTag", "parse"); parse.setAccessible(true); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) { + } catch (SecurityException e) { e.printStackTrace(); } } @@ -151,40 +153,6 @@ private static String getItemStackClass() { } } - private static String getParserClass() { - try { - String className = "net.minecraft.nbt.MojangsonParser"; - Class.forName(className); - return className; - } catch (ClassNotFoundException ex) { - String version = VersionUtil.getVersion(); - String className = "net.minecraft.server." + version + ".MojangsonParser"; - try { - Class.forName(className); - return className; - } catch (ClassNotFoundException e) { - return null; - } - } - } - - private static String getCompoundClass() { - try { - String className = "net.minecraft.nbt.NBTTagCompound"; - Class.forName(className); - return className; - } catch (ClassNotFoundException ex) { - String version = VersionUtil.getVersion(); - String className = "net.minecraft.server." + version + ".NBTTagCompound"; - try { - Class.forName(className); - return className; - } catch (ClassNotFoundException e) { - return null; - } - } - } - private BukkitNBTUtil() { } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index d836a5808..20df16605 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -24,6 +24,16 @@ public final class ReflectionUtil { private ReflectionUtil() { } + public static Class getClassIfExists(String... clazzes) { + for (String className : clazzes) { + try { + return Class.forName(className); + } catch (ClassNotFoundException e) { + } + } + return null; + } + public static Class classForName(String name) { try { return Class.forName(name); From 5742bb914b52b8eed09549e775f1051c8af55355 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 02:24:58 -0700 Subject: [PATCH 231/261] Get nbt working again on modern versions --- .../dynamicgui/bukkit/util/BukkitNBTUtil.java | 53 ++++++++----------- .../core/manager/dynamicgui/GuiManager.java | 4 ++ .../dynamicgui/core/util/ReflectionUtil.java | 10 ++++ 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java index f6bb1474a..bc990e67b 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitNBTUtil.java @@ -24,11 +24,18 @@ public final class BukkitNBTUtil { - private static final String ITEM_STACK_CLASS_NAME = getItemStackClass(); + private static final String VERSION = VersionUtil.getVersion(); + private static final Class NMS_ITEM_STACK_CLASS = ReflectionUtil.getClassIfExists( + "net.minecraft.world.item.ItemStack", + "net.minecraft.server." + VERSION + ".ItemStack" + ); + private static final Class COMPOUND_CLASS = ReflectionUtil.getClassIfExists( + "net.minecraft.nbt.NBTTagCompound", + "net.minecraft.server." + VERSION + ".NBTTagCompound" + ); private static final Class PARSER_CLASS = ReflectionUtil.getClassIfExists( - "net.minecraft.nbt.TagParser", "net.minecraft.nbt.MojangsonParser", - "net.minecraft.server." + VersionUtil.getVersion() + ".MojangsonParser" + "net.minecraft.server." + VERSION + ".MojangsonParser" ); private static Method parse; @@ -40,9 +47,9 @@ public final class BukkitNBTUtil { public static Object parse(String nbtStr) { if (parse == null) { try { - parse = ReflectionUtil.getMethod(PARSER_CLASS, "parseTag", "parse"); + parse = ReflectionUtil.getStaticMethod(PARSER_CLASS, COMPOUND_CLASS); parse.setAccessible(true); - } catch (SecurityException e) { + } catch (NullPointerException | SecurityException e) { e.printStackTrace(); } } @@ -66,16 +73,14 @@ public static String getTag(ItemStack itemStack) { } if (getTag == null) { - Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); - getTag = nmsItemStackClass.getDeclaredMethod("getTag"); + getTag = NMS_ITEM_STACK_CLASS.getDeclaredMethod("getTag"); getTag.setAccessible(true); } if (asBukkitCopy == null) { - Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); String craftItemStackClassName = "org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"; Class craftItemStackClass = Class.forName(craftItemStackClassName); - asBukkitCopy = craftItemStackClass.getDeclaredMethod("asBukkitCopy", nmsItemStackClass); + asBukkitCopy = craftItemStackClass.getDeclaredMethod("asBukkitCopy", NMS_ITEM_STACK_CLASS); asBukkitCopy.setAccessible(true); } @@ -86,7 +91,10 @@ public static String getTag(ItemStack itemStack) { } return tag.toString(); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } catch (ClassNotFoundException | NoSuchMethodException | + SecurityException | IllegalAccessException | + IllegalArgumentException | InvocationTargetException | + NullPointerException e) { e.printStackTrace(); } return null; @@ -107,10 +115,9 @@ public static ItemStack setTag(ItemStack itemStack, String nbt) { } if (asBukkitCopy == null) { - Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); String craftItemStackClassName = "org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"; Class craftItemStackClass = Class.forName(craftItemStackClassName); - asBukkitCopy = craftItemStackClass.getDeclaredMethod("asBukkitCopy", nmsItemStackClass); + asBukkitCopy = craftItemStackClass.getDeclaredMethod("asBukkitCopy", NMS_ITEM_STACK_CLASS); asBukkitCopy.setAccessible(true); } @@ -128,31 +135,13 @@ public static ItemStack setTag(ItemStack itemStack, String nbt) { private static void getSetTagMethod() { try { - Class nmsItemStackClass = Class.forName(ITEM_STACK_CLASS_NAME); - setTag = ReflectionUtil.getMethod(nmsItemStackClass, "setTag", "setTagClone"); + setTag = ReflectionUtil.getMethod(NMS_ITEM_STACK_CLASS, "setTag", "setTagClone"); setTag.setAccessible(true); - } catch (ClassNotFoundException e) { + } catch (NullPointerException e) { e.printStackTrace(); } } - private static String getItemStackClass() { - try { - String className = "net.minecraft.world.item.ItemStack"; - Class.forName(className); - return className; - } catch (ClassNotFoundException ex) { - String version = VersionUtil.getVersion(); - String className = "net.minecraft.server." + version + ".ItemStack"; - try { - Class.forName(className); - return className; - } catch (ClassNotFoundException e) { - return null; - } - } - } - private BukkitNBTUtil() { } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index e5ce97296..aa5c22d0a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -209,6 +209,10 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu //Run gui load functions CompletableFuture result = FunctionManager.get().tryFunctions(clonedGui, FunctionType.LOAD, playerWrapper); + result.exceptionally((ex) -> { + ex.printStackTrace(); + return null; + }); result.thenAccept((ran) -> ThreadUtil.run(() -> { GuiLoadEvent event = new GuiLoadEvent(clonedGui, playerWrapper); if (!ran) { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index 20df16605..d87be7b7a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -18,6 +18,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; public final class ReflectionUtil { @@ -127,6 +128,15 @@ public static Field getDeclaredField(Class clazz, String... fields) { return null; } + public static Method getStaticMethod(Class searchIn, Class returnType) { + for (Method m : searchIn.getDeclaredMethods()) { + if (Modifier.isStatic(m.getModifiers()) && m.getReturnType().equals(returnType)) { + return m; + } + } + return null; + } + public static class ReflectionHelper { public T get(Field field) { From 51dd7d95e6e09f40580d16f3ee9d4c5360e09b9a Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 03:08:36 -0700 Subject: [PATCH 232/261] Fix updating via packets on modern versions --- .../bukkit/util/BukkitPacketUtil.java | 28 +++++------------ .../dynamicgui/core/util/ReflectionUtil.java | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java index 49c4ad427..be92bf4c4 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/util/BukkitPacketUtil.java @@ -30,7 +30,6 @@ public final class BukkitPacketUtil { private BukkitPacketUtil() { } - private static final String ITEM_STACK_CLASS_NAME = getItemStackClass(); private static final String ENTITY_PLAYER_CLASS_NAME = getEntityPlayerClassName(); private static final String ENTITY_HUMAN_CLASS_NAME = getEntityHumanClassName(); private static final String PLAYER_CONNECTION_CLASS_NAME = getPlayerConnectionClassName(); @@ -86,7 +85,8 @@ public static void sendPacket(Player player, Object packet) { if (sendPacket == null) { Class networkManagerClass = Class.forName(NETWORK_MANAGER_CLASS_NAME); Class packetClass = Class.forName(PACKET_CLASS_NAME); - sendPacket = networkManagerClass.getDeclaredMethod("sendPacket", packetClass); + sendPacket = ReflectionUtil.getMethod(networkManagerClass, void.class, packetClass); + } Object nmsPlayer = playerHandle.invoke(player); @@ -94,7 +94,10 @@ public static void sendPacket(Player player, Object packet) { Object manager = networkManager.get(con); sendPacket.invoke(manager, packet); - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { + } catch (NullPointerException | ClassNotFoundException | + NoSuchMethodException | SecurityException | + IllegalArgumentException | IllegalAccessException | + InvocationTargetException e) { e.printStackTrace(); } } @@ -151,7 +154,7 @@ public static void sendSlotPacket(int index, Player player, ItemStack itemStack) } else { if (stateIdField == null) { Class containerClass = Class.forName(CONTAINER_CLASS_NAME); - stateIdField = ReflectionUtil.getDeclaredField(containerClass, "q"); + stateIdField = ReflectionUtil.getDeclaredField(container, containerClass, Integer.class, "r", "q"); } int stateId = stateIdField.getInt(container); packet = PACKET_PLAY_OUT_SET_SLOT_CONSTRUCTOR.newInstance(windowId, stateId, index, nmsItemStack); @@ -176,23 +179,6 @@ private static Constructor getPacketPlayOutSetSlotConstructor() { return null; } - private static String getItemStackClass() { - try { - String className = "net.minecraft.world.item.ItemStack"; - Class.forName(className); - return className; - } catch (ClassNotFoundException ex) { - String version = VersionUtil.getVersion(); - String className = "net.minecraft.server." + version + ".ItemStack"; - try { - Class.forName(className); - return className; - } catch (ClassNotFoundException e) { - return null; - } - } - } - private static String getEntityPlayerClassName() { try { String className = "net.minecraft.server.level.EntityPlayer"; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index d87be7b7a..29b9dd818 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -19,6 +19,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.util.Arrays; public final class ReflectionUtil { @@ -128,6 +129,25 @@ public static Field getDeclaredField(Class clazz, String... fields) { return null; } + public static Field getDeclaredField(Object fieldIn, Class clazz, Class returnType, String... fields) { + for (Field field : clazz.getDeclaredFields()) { + for (String fieldName : fields) { + try { + if (fieldName.equals(field.getName())) { + field.setAccessible(true); + Object got = field.get(fieldIn); + if (got.getClass().equals(returnType)) { + return field; + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + return null; + } + public static Method getStaticMethod(Class searchIn, Class returnType) { for (Method m : searchIn.getDeclaredMethods()) { if (Modifier.isStatic(m.getModifiers()) && m.getReturnType().equals(returnType)) { @@ -137,6 +157,17 @@ public static Method getStaticMethod(Class searchIn, Class returnType) { return null; } + public static Method getMethod(Class searchIn, Class returnType, Class... params) { + for (Method m : searchIn.getDeclaredMethods()) { + if (m.getReturnType().equals(returnType)) { + if (Arrays.equals(m.getParameterTypes(), params)) { + return m; + } + } + } + return null; + } + public static class ReflectionHelper { public T get(Field field) { From 0b373cf730efe84c8bd749908e4dffe817840120 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 03:13:00 -0700 Subject: [PATCH 233/261] Fix ghost items on click on 1.18 For some reason on 1.18 and possibly other versions there are ghost items after clicking. Testing on 1.12 & 1.18 with clearing the cursor the behavior seems to be consistent now with the items getting cleared when the event is cancelled. --- .../bukkit/entity/BukkitPlayerWrapper.java | 5 +++++ .../dynamicgui/core/entity/PlayerWrapper.java | 2 ++ .../core/listener/InventoryInteractListener.java | 14 +++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 82d293646..93c0b0b36 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -207,4 +207,9 @@ public String getSkinTexture() { return null; } } + + @Override + public void clearCursor() { + this.getPlayer().setItemOnCursor(null); + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index db08558f0..c4d15b2da 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -80,4 +80,6 @@ public T getPlayer() { public abstract boolean isOnline(); public abstract String getSkinTexture(); + + public abstract void clearCursor(); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index edf80e7d4..4461a2b33 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -48,23 +48,22 @@ public void invClick(final InventoryClickEvent e) { Slot slot = this.getSlotFromIndex(gui, e.getSlot()); if (slot == null && e.getView() != InventoryView.BOTTOM) { - e.setCancelled(true); + this.cancelClick(e); return; } ItemStackWrapper item = e.getItemStackWrapper(); if (e.getClick() == null) { //For other types of clicks besides left, right, middle - e.setCancelled(true); + this.cancelClick(e); return; } else if (item.getItemStack() == null) { return; } else if (e.getView() == InventoryView.BOTTOM) { if (e.getClick() == Click.SHIFT_LEFT || e.getClick() == Click.SHIFT_RIGHT) { if (!this.canStack(gui, e.getInventoryWrapper(), item)) { - e.setCancelled(true); + this.cancelClick(e); } } - return; } @@ -75,7 +74,7 @@ public void invClick(final InventoryClickEvent e) { } if (!slot.isMovable()) { - e.setCancelled(true); + this.cancelClick(e); } Boolean close; @@ -92,6 +91,11 @@ public void invClick(final InventoryClickEvent e) { } } + private void cancelClick(InventoryClickEvent e) { + e.setCancelled(true); + e.getPlayerWrapper().clearCursor(); + } + @EventHandler public void onDrag(InventoryDragEvent e) { PlayerWrapper player = e.getPlayerWrapper(); From 3c78ac779757bb84760a58a66972dbf69b4fa768 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 17:47:06 -0700 Subject: [PATCH 234/261] Restore close hierarchy Previously broke that the slot, then the gui should take priority for closing since the values got migrated to the primitive variant instead of the boxed variant. Fixup the logic in the interact listener and correctly send the boxed variant instead of the primitive for the close fields. --- .../core/listener/InventoryInteractListener.java | 12 ++---------- .../core/manager/dynamicgui/GuiManager.java | 4 ++-- .../dynamicgui/parser/gui/GuiToken.java | 14 +++++++++++--- .../dynamicgui/parser/slot/SlotToken.java | 14 +++++++++++--- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 4461a2b33..c5841ce6b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -76,16 +76,8 @@ public void invClick(final InventoryClickEvent e) { if (!slot.isMovable()) { this.cancelClick(e); } - - Boolean close; - if (slot.getClose() != null) { - close = slot.getClose(); - } else if (gui.getClose() != null) { - close = gui.getClose(); - } else { - close = true; - } - + + boolean close = slot.getClose() != null ? slot.getClose() : (gui.getClose() != null ? gui.getClose() : true); if (close) { player.closeInventory(); } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index aa5c22d0a..a74e1ac2e 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -495,7 +495,7 @@ private List createSlots(GuiToken guiToken) { int amount = slotToken.getAmount(); - boolean close = slotToken.isClosed(); + Boolean close = slotToken.isClosed(); short data = slotToken.getData(); @@ -527,7 +527,7 @@ private Gui createGui(final GuiToken guiToken, final String guiName, final List< this.commandRegistrar.registerGuiCommand(guiName, alias); } - boolean close = guiToken.isClosed(); + Boolean close = guiToken.isClosed(); List> locations = new ArrayList<>(); for (String location : guiToken.getLocations()) { diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java index 00587a36f..b86746b79 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/gui/GuiToken.java @@ -40,7 +40,7 @@ public class GuiToken implements Serializable { private final String type; private final int rows; private final GuiMode mode; - private final boolean closed; + private final Boolean closed; //This should be boxed private final List alias; private final List locations; private final Map> npcs; @@ -67,7 +67,7 @@ public GuiToken(ConfigurationSection section, List macroTokens) { this.type = this.parseType(section.getString("type")); this.rows = section.getInteger("rows"); this.mode = this.parseMode(section.getString("mode")); - this.closed = section.getBoolean("close"); + this.closed = this.parseBoxedBoolean(section.getString("close")); this.alias = this.macroParser.parseListMacros(section.getStringList("alias")); this.locations = this.macroParser.parseListMacros(section.getStringList("locations")); this.npcs = this.loadNpcs(section); @@ -84,6 +84,14 @@ public GuiToken(ConfigurationSection section, List macroTokens) { this.isStatic = section.getBoolean("static"); } + private Boolean parseBoxedBoolean(String data) { + if(data == null) { + return null; + } + String parsed = this.macroParser.parseStringMacros(data); + return Boolean.parseBoolean(parsed); + } + public String parseType(String type) { if (type == null) { return "CHEST"; @@ -150,7 +158,7 @@ public GuiMode getMode() { return this.mode; } - public boolean isClosed() { + public Boolean isClosed() { return this.closed; } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java index ba988dc1f..04132e054 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/slot/SlotToken.java @@ -41,7 +41,7 @@ public class SlotToken implements Serializable { private final String nbt; private final boolean glow; private final boolean movable; - private final boolean closed; + private final Boolean closed; //This should be boxed private final byte data; private final List lore; private final List enchants; @@ -71,7 +71,7 @@ public SlotToken(int index, ConfigurationSection section, List macro this.nbt = this.macroParser.parseStringMacros(section.getString("nbt")); this.glow = this.parseBoolean(section.getString("glow")); this.movable = this.parseBoolean(section.getString("movable")); - this.closed = this.parseBoolean(section.getString("close")); + this.closed = this.parseBoxedBoolean(section.getString("close")); this.data = this.parseByte(section.getString("data")); this.lore = this.macroParser.parseListMacros(section.getStringList("lore")); this.enchants = this.macroParser.parseListMacros(section.getStringList("enchants")); @@ -113,6 +113,14 @@ private boolean parseBoolean(String data) { return Boolean.parseBoolean(parsed); } + private Boolean parseBoxedBoolean(String data) { + if(data == null) { + return null; + } + String parsed = this.macroParser.parseStringMacros(data); + return Boolean.parseBoolean(parsed); + } + private int parseInteger(String data) { if (data == null) { return 0; @@ -171,7 +179,7 @@ public boolean isMovable() { return this.movable; } - public boolean isClosed() { + public Boolean isClosed() { return this.closed; } From 3ffba102116556d1e4efb789117af5447c036af4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 17:55:45 -0700 Subject: [PATCH 235/261] Revert clearing cursor on click This can have an un-intended bug where if a player has an item from their inventory and then they click in the gui it removes the cursor item and thus the item disappears. We might be able to fix this via a packet instead later. --- .../dynamicgui/bukkit/entity/BukkitPlayerWrapper.java | 5 ----- .../clubobsidian/dynamicgui/core/entity/PlayerWrapper.java | 2 -- .../dynamicgui/core/listener/InventoryInteractListener.java | 3 +-- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 93c0b0b36..82d293646 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -207,9 +207,4 @@ public String getSkinTexture() { return null; } } - - @Override - public void clearCursor() { - this.getPlayer().setItemOnCursor(null); - } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index c4d15b2da..db08558f0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -80,6 +80,4 @@ public T getPlayer() { public abstract boolean isOnline(); public abstract String getSkinTexture(); - - public abstract void clearCursor(); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index c5841ce6b..fbcebe582 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -76,7 +76,7 @@ public void invClick(final InventoryClickEvent e) { if (!slot.isMovable()) { this.cancelClick(e); } - + boolean close = slot.getClose() != null ? slot.getClose() : (gui.getClose() != null ? gui.getClose() : true); if (close) { player.closeInventory(); @@ -85,7 +85,6 @@ public void invClick(final InventoryClickEvent e) { private void cancelClick(InventoryClickEvent e) { e.setCancelled(true); - e.getPlayerWrapper().clearCursor(); } @EventHandler From 442de8d0c8c271814d34acdb43fb0358508c2e92 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 18:57:22 -0700 Subject: [PATCH 236/261] Partially fix 1.18 ghost items --- .../dynamicgui/bukkit/entity/BukkitPlayerWrapper.java | 5 +++++ .../clubobsidian/dynamicgui/core/entity/PlayerWrapper.java | 2 ++ .../core/listener/InventoryInteractListener.java | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java index 82d293646..d6790d046 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/entity/BukkitPlayerWrapper.java @@ -207,4 +207,9 @@ public String getSkinTexture() { return null; } } + + @Override + public void updateCursor() { + this.getPlayer().setItemOnCursor(this.getPlayer().getItemOnCursor()); + } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java index db08558f0..e1bddbdd0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/entity/PlayerWrapper.java @@ -80,4 +80,6 @@ public T getPlayer() { public abstract boolean isOnline(); public abstract String getSkinTexture(); + + public abstract void updateCursor(); } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index fbcebe582..2e76eebe0 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -16,6 +16,7 @@ package com.clubobsidian.dynamicgui.core.listener; +import com.clubobsidian.dynamicgui.core.DynamicGui; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.event.inventory.Click; import com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent; @@ -27,6 +28,7 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.FunctionManager; import com.clubobsidian.dynamicgui.core.manager.dynamicgui.GuiManager; +import com.clubobsidian.dynamicgui.core.platform.Platform; import com.clubobsidian.dynamicgui.parser.function.FunctionType; import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; import com.clubobsidian.trident.EventHandler; @@ -85,6 +87,11 @@ public void invClick(final InventoryClickEvent e) { private void cancelClick(InventoryClickEvent e) { e.setCancelled(true); + Platform platform = DynamicGui.get().getPlatform(); + platform.getScheduler().runSyncDelayedTask(() -> { + PlayerWrapper futurePlayer = platform.getPlayer(e.getPlayerWrapper().getUniqueId()); + futurePlayer.updateCursor(); + }, 1); } @EventHandler From 8f1afed99f1b071bc0cf6c5d64aaaa07be13b2dc Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 20:41:31 -0700 Subject: [PATCH 237/261] Refactor class checking code to ReflectionUtil --- .../registry/model/ItemsAdderModelProvider.java | 12 ++---------- .../dynamicgui/core/util/ReflectionUtil.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java index 8c9398899..7d46b785c 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/ItemsAdderModelProvider.java @@ -19,25 +19,17 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class ItemsAdderModelProvider implements ModelProvider { - private static final boolean ITEMS_ADDER_EXISTS = exists(); + private static final boolean ITEMS_ADDER_EXISTS = ReflectionUtil.classExists("dev.lone.itemsadder.api.CustomStack"); private static final Method GET_INSTANCE = instance(); private static final Method GET_ITEM_STACK = itemStack(); - private static boolean exists() { - try { - Class.forName("dev.lone.itemsadder.api.CustomStack"); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } - private static Method instance() { if (ITEMS_ADDER_EXISTS) { try { diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index 29b9dd818..fa5790077 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -26,6 +26,16 @@ public final class ReflectionUtil { private ReflectionUtil() { } + public static boolean classExists(String className) { + try { + Class.forName(className); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } + + public static Class getClassIfExists(String... clazzes) { for (String className : clazzes) { try { From 611c3f0172789dc0c37c9991a7c47327916ce1d0 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Fri, 15 Apr 2022 20:42:20 -0700 Subject: [PATCH 238/261] Remove reflection helper class --- .../dynamicgui/core/util/ReflectionUtil.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java index fa5790077..b50c3de86 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ReflectionUtil.java @@ -177,20 +177,4 @@ public static Method getMethod(Class searchIn, Class returnType, Class< } return null; } - - public static class ReflectionHelper { - - public T get(Field field) { - return this.get(field, null); - } - - @SuppressWarnings("unchecked") - public T get(Field field, Object getFromClass) { - try { - return (T) field.get(getFromClass); - } catch (IllegalArgumentException | IllegalAccessException e) { - return null; - } - } - } } \ No newline at end of file From 19c9aa7ecb157c7d85dd89192bfde131a3cf7fcd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 16 Apr 2022 17:52:31 -0700 Subject: [PATCH 239/261] Programmatically load in functions Closes #239 --- build.gradle | 5 +- .../dynamicgui/core/DynamicGui.java | 93 +++---------------- 2 files changed, 19 insertions(+), 79 deletions(-) diff --git a/build.gradle b/build.gradle index 62d8be44e..4808138f6 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,9 @@ subprojects { shadowJar { archiveClassifier.set('') - minimize() + minimize() { + exclude(project(":core")) + } relocate 'org.spongepowered.configurate', 'com.clubobsidian.dynamicgui.shaded.configurate' relocate 'com.google.common', 'com.clubobsidian.dynamicgui.shaded.guava' relocate 'com.google.gson', 'com.clubobsidian.dynamicgui.shaded.gson' @@ -98,5 +100,6 @@ subprojects { compileOnly "cloud.commandframework:cloud-core:$cloudVersion" testImplementation "cloud.commandframework:cloud-core:$cloudVersion" api "cloud.commandframework:cloud-annotations:$cloudVersion" + api "com.github.ravenlab:class-scanner:1.0.2" } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 84ae6bb43..4e7d5ff28 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -22,6 +22,7 @@ import com.clubobsidian.dynamicgui.core.config.ChatColorTransformer; import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; +import com.clubobsidian.dynamicgui.core.function.Function; import com.clubobsidian.dynamicgui.core.function.impl.AsyncRunningFunction; import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; @@ -109,6 +110,8 @@ import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; import com.clubobsidian.wrappy.transformer.NodeTransformer; +import com.github.ravenlab.classscanner.ClassScanner; +import com.github.ravenlab.classscanner.JarClassScanner; import com.google.common.collect.Iterables; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; @@ -118,6 +121,7 @@ import javax.inject.Inject; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Map; @@ -312,84 +316,17 @@ private void registerCommands() { } private void loadFunctions() { - FunctionManager.get().addFunction(new CheckTickFunction()); - FunctionManager.get().addFunction(new ConditionFunction()); - FunctionManager.get().addFunction(new ResetFrameFunction()); - FunctionManager.get().addFunction(new ResetTickFunction()); - - FunctionManager.get().addFunction(new ConsoleCommandFunction()); - FunctionManager.get().addFunction(new PlayerCommandFunction()); - - FunctionManager.get().addFunction(new SetCooldownFunction()); - FunctionManager.get().addFunction(new IsOnCooldownFunction()); - FunctionManager.get().addFunction(new IsNotOnCooldownFunction()); - - FunctionManager.get().addFunction(new GuiFunction()); - FunctionManager.get().addFunction(new BackFunction()); - FunctionManager.get().addFunction(new HasBackFunction()); - FunctionManager.get().addFunction(new SetBackFunction()); - - FunctionManager.get().addFunction(new RefreshGuiFunction()); - FunctionManager.get().addFunction(new RefreshSlotFunction()); - - FunctionManager.get().addFunction(new MoneyWithdrawFunction()); - FunctionManager.get().addFunction(new MoneyDepositFunction()); - FunctionManager.get().addFunction(new MoneyBalanceFunction()); - - FunctionManager.get().addFunction(new NoPermissionFunction()); - FunctionManager.get().addFunction(new PermissionFunction()); - FunctionManager.get().addFunction(new AddPermissionFunction()); - FunctionManager.get().addFunction(new RemovePermissionFunction()); - FunctionManager.get().addFunction(new PlayerMessageFunction()); - FunctionManager.get().addFunction(new RandomFunction()); - FunctionManager.get().addFunction(new SendFunction()); - FunctionManager.get().addFunction(new ServerBroadcastFunction()); - FunctionManager.get().addFunction(new ServerBroadcastJsonFunction()); - FunctionManager.get().addFunction(new ParticleFunction()); - FunctionManager.get().addFunction(new SoundFunction()); - FunctionManager.get().addFunction(new SetNameFunction()); - FunctionManager.get().addFunction(new SetLoreFunction()); - FunctionManager.get().addFunction(new SetTypeFunction()); - FunctionManager.get().addFunction(new SetDurabilityFunction()); - FunctionManager.get().addFunction(new SetAmountFunction()); - FunctionManager.get().addFunction(new SetNBTFunction()); - FunctionManager.get().addFunction(new SetGlowFunction()); - FunctionManager.get().addFunction(new CheckMovableFunction()); - FunctionManager.get().addFunction(new SetMovableFunction()); - FunctionManager.get().addFunction(new SetEnchantsFunction()); - FunctionManager.get().addFunction(new SetCloseFunction()); - FunctionManager.get().addFunction(new RemoveSlotFunction()); - FunctionManager.get().addFunction(new CheckLevelFunction()); - FunctionManager.get().addFunction(new LogFunction()); - - FunctionManager.get().addFunction(new CheckItemTypeInHandFunction()); - - FunctionManager.get().addFunction(new SetGameRuleFunction()); - FunctionManager.get().addFunction(new GetGameRuleFunction()); - - FunctionManager.get().addFunction(new CheckPlayerWorldFunction()); - - FunctionManager.get().addFunction(new PlayerMiniMessageFunction()); - FunctionManager.get().addFunction(new ServerMiniBroadcastFunction()); - - FunctionManager.get().addFunction(new PlayerMsgJsonFunction()); - - FunctionManager.get().addFunction(new HasMetadataFunction()); - FunctionManager.get().addFunction(new SetMetadataFunction()); - FunctionManager.get().addFunction(new IsGuiMetadataSet()); - FunctionManager.get().addFunction(new CopyBackMetadataFunction()); - - FunctionManager.get().addFunction(new IsBedrockPlayerFunction()); - - //Async related - FunctionManager.get().addFunction(new DelayFunction()); - FunctionManager.get().addFunction(new LoggedInFunction()); - FunctionManager.get().addFunction(new AsyncRunningFunction()); - - //Test functions - FunctionManager.get().addFunction(new FalseAsyncFunction()); - FunctionManager.get().addFunction(new MainThreadFunction()); - FunctionManager.get().addFunction(new AsyncThreadFunction()); + ClassScanner scanner = new JarClassScanner(); + scanner.collect(Function.class.getPackageName(), Function.class, Function.class).stream().forEach( + clazz -> { + try { + FunctionManager.get().addFunction(clazz.getDeclaredConstructor().newInstance()); + } catch (InstantiationException | IllegalAccessException | + InvocationTargetException | NoSuchMethodException e) { + e.printStackTrace(); + } + } + ); } private void startPlayerCountTimer() { From 4a2bb9dc598eb1f941ef5b6cf5948271f221e118 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 16 Apr 2022 17:52:58 -0700 Subject: [PATCH 240/261] Cleanup function imports --- .../dynamicgui/core/DynamicGui.java | 61 ------------------- 1 file changed, 61 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 4e7d5ff28..77ad46fd2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -23,67 +23,6 @@ import com.clubobsidian.dynamicgui.core.config.Message; import com.clubobsidian.dynamicgui.core.entity.PlayerWrapper; import com.clubobsidian.dynamicgui.core.function.Function; -import com.clubobsidian.dynamicgui.core.function.impl.AsyncRunningFunction; -import com.clubobsidian.dynamicgui.core.function.impl.AddPermissionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.CheckItemTypeInHandFunction; -import com.clubobsidian.dynamicgui.core.function.impl.CheckLevelFunction; -import com.clubobsidian.dynamicgui.core.function.impl.CheckMovableFunction; -import com.clubobsidian.dynamicgui.core.function.impl.CheckPlayerWorldFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ConsoleCommandFunction; -import com.clubobsidian.dynamicgui.core.function.impl.DelayFunction; -import com.clubobsidian.dynamicgui.core.function.impl.LoggedInFunction; -import com.clubobsidian.dynamicgui.core.function.impl.test.AsyncThreadFunction; -import com.clubobsidian.dynamicgui.core.function.impl.test.FalseAsyncFunction; -import com.clubobsidian.dynamicgui.core.function.impl.GetGameRuleFunction; -import com.clubobsidian.dynamicgui.core.function.impl.IsBedrockPlayerFunction; -import com.clubobsidian.dynamicgui.core.function.impl.LogFunction; -import com.clubobsidian.dynamicgui.core.function.impl.MoneyBalanceFunction; -import com.clubobsidian.dynamicgui.core.function.impl.MoneyDepositFunction; -import com.clubobsidian.dynamicgui.core.function.impl.MoneyWithdrawFunction; -import com.clubobsidian.dynamicgui.core.function.impl.NoPermissionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ParticleFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PermissionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerCommandFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerMessageFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerMiniMessageFunction; -import com.clubobsidian.dynamicgui.core.function.impl.PlayerMsgJsonFunction; -import com.clubobsidian.dynamicgui.core.function.impl.RandomFunction; -import com.clubobsidian.dynamicgui.core.function.impl.RemovePermissionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.RemoveSlotFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ResetFrameFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ResetTickFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SendFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ServerBroadcastJsonFunction; -import com.clubobsidian.dynamicgui.core.function.impl.ServerMiniBroadcastFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetAmountFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetCloseFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetDurabilityFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetEnchantsFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetGameRuleFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetGlowFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetLoreFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetMovableFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetNBTFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetNameFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SetTypeFunction; -import com.clubobsidian.dynamicgui.core.function.impl.SoundFunction; -import com.clubobsidian.dynamicgui.core.function.impl.condition.CheckTickFunction; -import com.clubobsidian.dynamicgui.core.function.impl.condition.ConditionFunction; -import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsNotOnCooldownFunction; -import com.clubobsidian.dynamicgui.core.function.impl.cooldown.IsOnCooldownFunction; -import com.clubobsidian.dynamicgui.core.function.impl.cooldown.SetCooldownFunction; -import com.clubobsidian.dynamicgui.core.function.impl.gui.BackFunction; -import com.clubobsidian.dynamicgui.core.function.impl.gui.GuiFunction; -import com.clubobsidian.dynamicgui.core.function.impl.gui.HasBackFunction; -import com.clubobsidian.dynamicgui.core.function.impl.gui.RefreshGuiFunction; -import com.clubobsidian.dynamicgui.core.function.impl.gui.RefreshSlotFunction; -import com.clubobsidian.dynamicgui.core.function.impl.gui.SetBackFunction; -import com.clubobsidian.dynamicgui.core.function.impl.meta.CopyBackMetadataFunction; -import com.clubobsidian.dynamicgui.core.function.impl.meta.HasMetadataFunction; -import com.clubobsidian.dynamicgui.core.function.impl.meta.IsGuiMetadataSet; -import com.clubobsidian.dynamicgui.core.function.impl.meta.SetMetadataFunction; -import com.clubobsidian.dynamicgui.core.function.impl.test.MainThreadFunction; import com.clubobsidian.dynamicgui.core.listener.EntityClickListener; import com.clubobsidian.dynamicgui.core.listener.GuiListener; import com.clubobsidian.dynamicgui.core.listener.InventoryCloseListener; From dcbe8da1d42530c64221e43e58a977db431c7794 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 16 Apr 2022 18:05:24 -0700 Subject: [PATCH 241/261] Use class graph instead of our class scanner --- build.gradle | 2 +- .../dynamicgui/core/DynamicGui.java | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 4808138f6..1e92c3e0f 100644 --- a/build.gradle +++ b/build.gradle @@ -100,6 +100,6 @@ subprojects { compileOnly "cloud.commandframework:cloud-core:$cloudVersion" testImplementation "cloud.commandframework:cloud-core:$cloudVersion" api "cloud.commandframework:cloud-annotations:$cloudVersion" - api "com.github.ravenlab:class-scanner:1.0.2" + api "io.github.classgraph:classgraph:4.8.138" } } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java index 77ad46fd2..a336b98d9 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/DynamicGui.java @@ -49,13 +49,14 @@ import com.clubobsidian.wrappy.Configuration; import com.clubobsidian.wrappy.ConfigurationSection; import com.clubobsidian.wrappy.transformer.NodeTransformer; -import com.github.ravenlab.classscanner.ClassScanner; -import com.github.ravenlab.classscanner.JarClassScanner; import com.google.common.collect.Iterables; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import com.google.inject.Injector; +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ClassInfo; +import io.github.classgraph.ScanResult; import org.apache.commons.io.FileUtils; import javax.inject.Inject; @@ -255,17 +256,22 @@ private void registerCommands() { } private void loadFunctions() { - ClassScanner scanner = new JarClassScanner(); - scanner.collect(Function.class.getPackageName(), Function.class, Function.class).stream().forEach( - clazz -> { - try { - FunctionManager.get().addFunction(clazz.getDeclaredConstructor().newInstance()); - } catch (InstantiationException | IllegalAccessException | - InvocationTargetException | NoSuchMethodException e) { - e.printStackTrace(); - } + try (ScanResult scanResult = new ClassGraph() + .enableAllInfo() + .acceptPackages(Function.class.getPackageName()) + .scan()) { + for (ClassInfo classInfo : scanResult.getSubclasses(Function.class)) { + try { + FunctionManager.get().addFunction((Function) classInfo + .loadClass() + .getDeclaredConstructor() + .newInstance()); + } catch (InstantiationException | IllegalAccessException | + InvocationTargetException | NoSuchMethodException e) { + e.printStackTrace(); } - ); + } + } } private void startPlayerCountTimer() { From 98841222408ad3b6ca8122ba46085fd185bd30d4 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 16 Apr 2022 18:10:59 -0700 Subject: [PATCH 242/261] Relocate more dependencies --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 1e92c3e0f..3e486f73b 100644 --- a/build.gradle +++ b/build.gradle @@ -79,6 +79,11 @@ subprojects { relocate 'com.fasterxml.jackson', 'com.clubobsidian.dynamicgui.shaded.jackson' relocate 'com.github.benmanes.caffeine', 'com.clubobsidian.dynamicgui.shaded.caffeine' relocate 'cloud', 'com.clubobsidian.dynamicgui.shaded.cloud' + relocate 'com.google.thirdparty', 'com.clubobsidian.dynamicgui.shaded.google.thirdparty' + relocate 'io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.classgraph' + relocate 'noapi.io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.classgraph' + relocate 'noapi.io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.noapi.io.github.classgraph' + relocate 'javassist', 'com.clubobsidian.dynamicgui.shaded.javassist' } repositories { From b5f6bd8c0a48a1a342caa5d4ca7d4e23ec725963 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 16 Apr 2022 18:16:52 -0700 Subject: [PATCH 243/261] Fix nonapi relocate --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3e486f73b..a3ce5c9f7 100644 --- a/build.gradle +++ b/build.gradle @@ -81,8 +81,7 @@ subprojects { relocate 'cloud', 'com.clubobsidian.dynamicgui.shaded.cloud' relocate 'com.google.thirdparty', 'com.clubobsidian.dynamicgui.shaded.google.thirdparty' relocate 'io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.classgraph' - relocate 'noapi.io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.classgraph' - relocate 'noapi.io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.noapi.io.github.classgraph' + relocate 'nonapi.io.github.classgraph', 'com.clubobsidian.dynamicgui.shaded.nonapi.io.github.classgraph' relocate 'javassist', 'com.clubobsidian.dynamicgui.shaded.javassist' } From 6b798c550bbfb7a29f066b0e2104f123cd2d8804 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 16 Apr 2022 18:21:52 -0700 Subject: [PATCH 244/261] Remove deprecated "canceled" methods --- .../bukkit/listener/InventoryInteractListener.java | 4 ++-- .../bukkit/listener/PlayerInteractListener.java | 2 +- .../core/event/block/PlayerInteractEvent.java | 10 ---------- .../dynamicgui/core/event/inventory/GuiLoadEvent.java | 10 ---------- .../core/event/inventory/InventoryClickEvent.java | 10 ---------- .../core/event/inventory/InventoryDragEvent.java | 10 ---------- 6 files changed, 3 insertions(+), 43 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java index 9e2663d29..8ad9b9939 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/InventoryInteractListener.java @@ -80,7 +80,7 @@ public void onInventoryClick(InventoryClickEvent e) { com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent clickEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryClickEvent(playerWrapper, inventoryWrapper, itemStackWrapper, slot, clickType, view); DynamicGui.get().getEventBus().callEvent(clickEvent); - if (clickEvent.isCanceled()) { + if (clickEvent.isCancelled()) { e.setCancelled(true); } } @@ -100,7 +100,7 @@ public void onInventoryDrag(InventoryDragEvent e) { Map> slotItems = this.wrapItemStacks(e.getNewItems()); com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent dragEvent = new com.clubobsidian.dynamicgui.core.event.inventory.InventoryDragEvent(playerWrapper, inventoryWrapper, slotItems); DynamicGui.get().getEventBus().callEvent(dragEvent); - if (dragEvent.isCanceled()) { + if (dragEvent.isCancelled()) { e.setCancelled(true); } } diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java index c7565ce50..20544974a 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/listener/PlayerInteractListener.java @@ -37,7 +37,7 @@ public void interact(final PlayerInteractEvent e) { LocationWrapper locationWrapper = LocationManager.get().toLocationWrapper(e.getClickedBlock().getLocation()); com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent interactEvent = new com.clubobsidian.dynamicgui.core.event.block.PlayerInteractEvent(playerWrapper, locationWrapper, action); DynamicGui.get().getEventBus().callEvent(interactEvent); - if (interactEvent.isCanceled()) { + if (interactEvent.isCancelled()) { e.setCancelled(true); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java index 8491f3e55..7d3d15493 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/block/PlayerInteractEvent.java @@ -38,16 +38,6 @@ public PlayerAction getAction() { return this.action; } - @Deprecated - public boolean isCanceled() { - return this.canceled; - } - - @Deprecated - public void setCanceled(boolean cancel) { - this.canceled = cancel; - } - @Override public boolean isCancelled() { return this.canceled; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java index 5bfe06631..6bfe545ba 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/GuiLoadEvent.java @@ -42,16 +42,6 @@ public PlayerWrapper getPlayerWrapper() { return this.playerWrapper; } - @Deprecated - public boolean isCanceled() { - return this.cancelled; - } - - @Deprecated - public void setCanceled(boolean cancelled) { - this.cancelled = cancelled; - } - @Override public boolean isCancelled() { return this.cancelled; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java index 2056ae8d6..b0a377f53 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryClickEvent.java @@ -56,16 +56,6 @@ public Click getClick() { return this.click; } - @Deprecated - public boolean isCanceled() { - return this.cancelled; - } - - @Deprecated - public void setCanceled(boolean cancelled) { - this.cancelled = cancelled; - } - @Override public boolean isCancelled() { return this.cancelled; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java index d68ae4ee5..368cc31b7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/event/inventory/InventoryDragEvent.java @@ -39,16 +39,6 @@ public Map> getSlotItems() { return this.slotItems; } - @Deprecated - public boolean isCanceled() { - return this.cancelled; - } - - @Deprecated - public void setCanceled(boolean cancel) { - this.cancelled = cancel; - } - @Override public boolean isCancelled() { return this.cancelled; From 876b07e1d2dc7d0cbb74e0194a5a7da2b4936177 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 20 Apr 2022 16:55:11 -0700 Subject: [PATCH 245/261] Do null check on future player --- .../com/clubobsidian/dynamicgui/core/command/GuiCommand.java | 2 +- .../dynamicgui/core/listener/InventoryInteractListener.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java index 1173fca59..ddde342f6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/command/GuiCommand.java @@ -32,7 +32,7 @@ private void gui(GuiCommandSender sender, @Argument("guiName") String guiName) { PlayerWrapper player = sender.getPlayer().orElse(null); if(player != null) { boolean hasPermission = player.hasPermission(Constant.GUI_PERMISSION.apply(guiName)); - if (hasPermission){ + if (hasPermission) { GuiManager.get().openGui(player, guiName); } else { sender.sendMessage(DynamicGui.get().getMessage().getNoGuiPermission()); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java index 2e76eebe0..9ede24472 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/listener/InventoryInteractListener.java @@ -90,7 +90,9 @@ private void cancelClick(InventoryClickEvent e) { Platform platform = DynamicGui.get().getPlatform(); platform.getScheduler().runSyncDelayedTask(() -> { PlayerWrapper futurePlayer = platform.getPlayer(e.getPlayerWrapper().getUniqueId()); - futurePlayer.updateCursor(); + if (futurePlayer != null) { + futurePlayer.updateCursor(); + } }, 1); } From 92547d8600d5d5d66c4855824b9d05ee8312184b Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 25 Apr 2022 00:21:16 -0700 Subject: [PATCH 246/261] Check if oraxen class exists using ReflectionUtil --- .../bukkit/registry/model/OraxenModelProvider.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java index d04a98d30..4e36859fe 100644 --- a/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java +++ b/bukkit/src/main/java/com/clubobsidian/dynamicgui/bukkit/registry/model/OraxenModelProvider.java @@ -19,24 +19,18 @@ import com.clubobsidian.dynamicgui.core.inventory.ItemStackWrapper; import com.clubobsidian.dynamicgui.core.manager.inventory.ItemStackManager; import com.clubobsidian.dynamicgui.core.registry.model.ModelProvider; +import com.clubobsidian.dynamicgui.core.util.ReflectionUtil; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class OraxenModelProvider implements ModelProvider { - private static final boolean ORAXEN_EXISTS = exists(); + private static final boolean ORAXEN_EXISTS = ReflectionUtil + .classExists("io.th0rgal.oraxen.items.OraxenItems"); private static final Method GET_ITEM_BY_ID = getItemById(); private static final Method BUILD = getBuild(); - private static boolean exists() { - try { - Class.forName("io.th0rgal.oraxen.items.OraxenItems"); - return true; - } catch (ClassNotFoundException ex) { - return false; - } - } private static Method getItemById() { if (ORAXEN_EXISTS) { From 19c6eee80705d5eeb585c922b4b4fc723a3149f3 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 25 Apr 2022 00:48:52 -0700 Subject: [PATCH 247/261] Make function throw exception --- .../dynamicgui/core/function/Function.java | 2 +- .../core/manager/dynamicgui/FunctionManager.java | 8 +++++++- .../test/function/AddPermissionFunctionTest.java | 6 +++--- .../core/test/function/AsyncRunningFunctionTest.java | 4 ++-- .../function/CheckItemInTypeHandFunctionTest.java | 6 +++--- .../core/test/function/CheckLevelFunctionTest.java | 10 +++++----- .../core/test/function/CheckMovableFunctionTest.java | 6 +++--- .../test/function/CheckPlayerWorldFunctionTest.java | 4 ++-- .../test/function/ConsoleCommandFunctionTest.java | 4 ++-- .../core/test/function/DelayFunctionTest.java | 12 ++++++++---- .../core/test/function/GetGameRuleFunctionTest.java | 10 +++++----- .../test/function/IsBedrockPlayerFunctionTest.java | 2 +- .../test/function/IsNotOnCooldownFunctionTest.java | 4 ++-- .../core/test/function/IsOnCooldownFunctionTest.java | 4 ++-- .../core/test/function/LogFunctionTest.java | 4 ++-- .../core/test/function/LoggedInFunctionTest.java | 8 ++++---- .../core/test/function/MoneyBalanceFunctionTest.java | 10 +++++----- .../core/test/function/MoneyDepositFunctionTest.java | 6 +++--- .../test/function/MoneyWithdrawFunctionTest.java | 10 +++++----- .../core/test/function/NoPermissionFunctionTest.java | 6 +++--- .../core/test/function/ParticleFunctionTest.java | 4 ++-- .../core/test/function/PermissionFunctionTest.java | 6 +++--- .../test/function/PlayerCommandFunctionTest.java | 4 ++-- .../test/function/PlayerMessageFunctionTest.java | 4 ++-- .../test/function/PlayerMiniMessageFunctionTest.java | 4 ++-- .../test/function/PlayerMsgJsonFunctionTest.java | 4 ++-- .../core/test/function/RandomFunctionTest.java | 6 +++--- .../test/function/RemovePermissionFunctionTest.java | 6 +++--- .../core/test/function/RemoveSlotFunctionTest.java | 6 +++--- .../core/test/function/ResetFrameFunctionTest.java | 4 ++-- .../core/test/function/ResetTickFunctionTest.java | 4 ++-- .../core/test/function/SendFunctionTest.java | 8 ++++---- .../test/function/ServerBroadcastFunctionTest.java | 4 ++-- .../function/ServerBroadcastJsonFunctionTest.java | 4 ++-- .../function/ServerMiniBroadcastFunctionTest.java | 4 ++-- .../core/test/function/SetAmountFunctionTest.java | 8 ++++---- .../core/test/function/SetCloseFunctionTest.java | 8 ++++---- .../core/test/function/SetCooldownFunctionTest.java | 10 +++++----- .../test/function/SetDurabilityFunctionTest.java | 8 ++++---- .../core/test/function/SetEnchantsFunctionTest.java | 10 +++++----- .../core/test/function/SetGameRuleFunctionTest.java | 10 +++++----- .../core/test/function/SetGlowFunctionTest.java | 6 +++--- .../core/test/function/SetLoreFunctionTest.java | 8 ++++---- .../core/test/function/SetMovableFunctionTest.java | 8 ++++---- .../core/test/function/SetNBTFunctionTest.java | 6 +++--- .../core/test/function/SetNameFunctionTest.java | 6 +++--- .../core/test/function/SetTypeFunctionTest.java | 6 +++--- .../core/test/function/SoundFunctionTest.java | 4 ++-- 48 files changed, 153 insertions(+), 143 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java index 6b1d5a23f..c0176a0fc 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/Function.java @@ -70,7 +70,7 @@ public Function(String... aliases) { this(aliases[0], aliases, false); } - public abstract boolean function(PlayerWrapper playerWrapper); + public abstract boolean function(PlayerWrapper playerWrapper) throws Exception; public boolean isAsync() { return this.async; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 9582fa6b4..1838e43a2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -242,7 +242,13 @@ private CompletableFuture runFunctionData(FunctionOwner owner, return value; }); } - boolean ran = function.function(playerWrapper); + boolean ran = false; + try { + ran = function.function(playerWrapper); + } catch (Exception e) { + e.printStackTrace(); + response.complete(new FunctionResponse(false, functionName, functionData)); + } if (data.getModifier() == FunctionModifier.NOT) { ran = !ran; } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java index 39baaf93b..4811de4f5 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AddPermissionFunctionTest.java @@ -28,13 +28,13 @@ public class AddPermissionFunctionTest extends FactoryTest { @Test - public void testNullPermission() { + public void testNullPermission() throws Exception { Function function = new AddPermissionFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void testPermissionAdded() { + public void testPermissionAdded() throws Exception { String permission = "test"; Function function = new AddPermissionFunction(); function.setData(permission); @@ -43,7 +43,7 @@ public void testPermissionAdded() { } @Test - public void testPermissionNotAdded() { + public void testPermissionNotAdded() throws Exception { String permission = "test"; Function function = new AddPermissionFunction(); function.setData(permission); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java index e0acd024b..2ce92cbab 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/AsyncRunningFunctionTest.java @@ -28,13 +28,13 @@ public class AsyncRunningFunctionTest extends FactoryTest { //TODO - implement the passing test @Test - public void failingTest() { + public void failingTest() throws Exception { Function function = new AsyncRunningFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void failingWithoutDataTest() { + public void failingWithoutDataTest() throws Exception { Function function = new AsyncRunningFunction(); function.setData("delay"); assertFalse(function.function(this.getFactory().createPlayer())); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java index 1495f9182..249fde076 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckItemInTypeHandFunctionTest.java @@ -29,7 +29,7 @@ public class CheckItemInTypeHandFunctionTest extends FactoryTest { @Test - public void testNull() { + public void testNull() throws Exception { String material = "stone"; Function function = new CheckItemTypeInHandFunction(); ItemStackWrapper hand = this.getFactory().createItemStack(material); @@ -39,7 +39,7 @@ public void testNull() { } @Test - public void testOneType() { + public void testOneType() throws Exception { String material = "stone"; Function function = new CheckItemTypeInHandFunction(); function.setData(material); @@ -50,7 +50,7 @@ public void testOneType() { } @Test - public void testTwoTypes() { + public void testTwoTypes() throws Exception { String handMaterial = "stone"; String functionMaterials = "dirt,stone"; Function function = new CheckItemTypeInHandFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java index c7a7351a2..30bb5506c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckLevelFunctionTest.java @@ -28,14 +28,14 @@ public class CheckLevelFunctionTest extends FactoryTest { @Test - public void testNull() { + public void testNull() throws Exception { MockPlayerWrapper wrapper = this.getFactory().createPlayer(); Function function = new CheckLevelFunction(); assertFalse(function.function(wrapper)); } @Test - public void testLevelGreater() { + public void testLevelGreater() throws Exception { MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(10); Function function = new CheckLevelFunction(); @@ -44,7 +44,7 @@ public void testLevelGreater() { } @Test - public void testLevelEqual() { + public void testLevelEqual() throws Exception { MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(10); Function function = new CheckLevelFunction(); @@ -53,7 +53,7 @@ public void testLevelEqual() { } @Test - public void testLevelLessThan() { + public void testLevelLessThan() throws Exception { MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(1); Function function = new CheckLevelFunction(); @@ -62,7 +62,7 @@ public void testLevelLessThan() { } @Test - public void testInvalidFormat() { + public void testInvalidFormat() throws Exception { MockPlayerWrapper wrapper = this.getFactory().createPlayer(); wrapper.setLevel(1); Function function = new CheckLevelFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java index 42a2c216a..fd258c3c6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckMovableFunctionTest.java @@ -28,14 +28,14 @@ public class CheckMovableFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new CheckMovableFunction(); MockPlayerWrapper wrapper = this.getFactory().createPlayer(); assertFalse(function.function(wrapper)); } @Test - public void ownerNotSlotTest() { + public void ownerNotSlotTest() throws Exception { Function function = new CheckMovableFunction(); function.setData("true"); function.setOwner(this.getFactory().createGui("test")); @@ -44,7 +44,7 @@ public void ownerNotSlotTest() { } @Test - public void isMovableTest() { + public void isMovableTest() throws Exception { Function function = new CheckMovableFunction(); function.setData("true"); function.setOwner(this.getFactory().createSlot("STONE", true)); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java index 319a99bb7..10c114dce 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/CheckPlayerWorldFunctionTest.java @@ -28,14 +28,14 @@ public class CheckPlayerWorldFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new CheckPlayerWorldFunction(); MockPlayerWrapper player = this.getFactory().createPlayer(); assertFalse(function.function(player)); } @Test - public void worldEqualsTest() { + public void worldEqualsTest() throws Exception { String worldName = "test"; Function function = new CheckPlayerWorldFunction(); function.setData(worldName); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java index 924e99b5e..346bacb4f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ConsoleCommandFunctionTest.java @@ -29,13 +29,13 @@ public class ConsoleCommandFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new ConsoleCommandFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void withDataTest() { + public void withDataTest() throws Exception { String data = "test"; MockPlatform platform = this.getFactory().inject().getPlatform(); Function function = new ConsoleCommandFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java index 17992b2e9..963000b44 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/DelayFunctionTest.java @@ -29,13 +29,13 @@ public class DelayFunctionTest extends FactoryTest { @Test - public void testNull() { + public void testNull() throws Exception { Function function = new DelayFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void testNonNumber() { + public void testNonNumber() throws Exception { Function function = new DelayFunction(); function.setData("a"); assertFalse(function.function(this.getFactory().createPlayer())); @@ -47,7 +47,11 @@ public void testInterrupt() { Thread thread = new Thread(() -> { Function function = new DelayFunction(); function.setData("5000"); - value.set(function.function(this.getFactory().createPlayer())); + try { + value.set(function.function(this.getFactory().createPlayer())); + } catch (Exception e) { + e.printStackTrace(); + } }); thread.start(); thread.interrupt(); @@ -67,7 +71,7 @@ public void testInterrupt() { } @Test - public void testValidData() { + public void testValidData() throws Exception { Function function = new DelayFunction(); function.setData("1"); assertTrue(function.function(this.getFactory().createPlayer())); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java index d00425e58..a722b3935 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/GetGameRuleFunctionTest.java @@ -29,27 +29,27 @@ public class GetGameRuleFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new GetGameRuleFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void noCommaTest() { + public void noCommaTest() throws Exception { Function function = new GetGameRuleFunction(); function.setData(""); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void lengthNotThreeTest() { + public void lengthNotThreeTest() throws Exception { Function function = new GetGameRuleFunction(); function.setData("a,b"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void worldNullTest() { + public void worldNullTest() throws Exception { this.getFactory().inject().getPlatform(); Function function = new GetGameRuleFunction(); function.setData("test,key,value"); @@ -57,7 +57,7 @@ public void worldNullTest() { } @Test - public void hasGameRuleTest() { + public void hasGameRuleTest() throws Exception { String worldName = "test"; MockPlatform platform = this.getFactory().inject().getPlatform(); WorldWrapper world = this.getFactory().createWorld(worldName); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java index 6125a8577..feb871219 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsBedrockPlayerFunctionTest.java @@ -29,7 +29,7 @@ public class IsBedrockPlayerFunctionTest extends FactoryTest { @Test - public void functionTest() { + public void functionTest() throws Exception { String name = "test"; UUID uuid = new UUID(0, 1); MockPlayerWrapper player = this.getFactory().createPlayer(name, uuid); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java index 910d93fa2..d05a8d24b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsNotOnCooldownFunctionTest.java @@ -29,13 +29,13 @@ public class IsNotOnCooldownFunctionTest extends FactoryTest { @Test - public void nullDataTest() { + public void nullDataTest() throws Exception { Function function = new IsNotOnCooldownFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void notOnCooldownTest() { + public void notOnCooldownTest() throws Exception { this.getFactory().inject(); Function function = new IsNotOnCooldownFunction(); function.setData(UUID.randomUUID().toString()); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java index 8593c296f..49de3f2d3 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/IsOnCooldownFunctionTest.java @@ -31,13 +31,13 @@ public class IsOnCooldownFunctionTest extends FactoryTest { @Test - public void nullDataTest() { + public void nullDataTest() throws Exception { Function function = new IsOnCooldownFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void onCooldownTest() { + public void onCooldownTest() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); String cooldownName = UUID.randomUUID().toString(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java index d9471cc85..60ec30b2e 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LogFunctionTest.java @@ -31,14 +31,14 @@ public class LogFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new LogFunction(); PlayerWrapper player = this.getFactory().createPlayer(); assertFalse(function.function(player)); } @Test - public void withDataTest() { + public void withDataTest() throws Exception { String data = "test"; Function function = new LogFunction(); function.setData(data); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java index cc4dd40b2..485f8ea70 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/LoggedInFunctionTest.java @@ -28,7 +28,7 @@ public class LoggedInFunctionTest extends FactoryTest { @Test - public void testLoggedOff() { + public void testLoggedOff() throws Exception { Function function = new LoggedInFunction(); MockPlayerWrapper player = this.getFactory().createPlayer(); this.getFactory().getPlatform().getOnlinePlayers().add(player); @@ -37,20 +37,20 @@ public void testLoggedOff() { } @Test - public void testLoggedOffNullRetrieval() { + public void testLoggedOffNullRetrieval() throws Exception { Function function = new LoggedInFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void testLoggedOffAndBackOn() { + public void testLoggedOffAndBackOn() throws Exception { Function function = new LoggedInFunction(); this.getFactory().getPlatform().getOnlinePlayers().add(this.getFactory().createPlayer()); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void testOnline() { + public void testOnline() throws Exception { Function function = new LoggedInFunction(); MockPlayerWrapper player = this.getFactory().createPlayer(); this.getFactory().getPlatform().getOnlinePlayers().add(player); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java index 4a3dfec9f..b7a7706cf 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyBalanceFunctionTest.java @@ -31,7 +31,7 @@ public class MoneyBalanceFunctionTest extends FactoryTest { @Test - public void testBelowBalance() { + public void testBelowBalance() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyBalanceFunction(); @@ -40,7 +40,7 @@ public void testBelowBalance() { } @Test - public void testInvalidData() { + public void testInvalidData() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyBalanceFunction(); @@ -49,7 +49,7 @@ public void testInvalidData() { } @Test - public void testNullEconomy() { + public void testNullEconomy() throws Exception { this.getFactory().inject().getPlugin().economy = null; PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyBalanceFunction(); @@ -58,7 +58,7 @@ public void testNullEconomy() { } @Test - public void testEqualBalance() { + public void testEqualBalance() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); MockEconomy economy = this.getFactory().inject().getEconomy(); BigDecimal amount = new BigDecimal(1); @@ -69,7 +69,7 @@ public void testEqualBalance() { } @Test - public void testAboveBalance() { + public void testAboveBalance() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); MockEconomy economy = this.getFactory().inject().getEconomy(); int checkAmount = 9; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java index 972fed49c..ce14bdd21 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyDepositFunctionTest.java @@ -28,7 +28,7 @@ public class MoneyDepositFunctionTest extends FactoryTest { @Test - public void testInvalidData() { + public void testInvalidData() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyDepositFunction(); @@ -37,7 +37,7 @@ public void testInvalidData() { } @Test - public void testNullEconomy() { + public void testNullEconomy() throws Exception { this.getFactory().inject().getPlugin().economy = null; PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyDepositFunction(); @@ -46,7 +46,7 @@ public void testNullEconomy() { } @Test - public void testValidDeposit() { + public void testValidDeposit() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); this.getFactory().inject(); Function function = new MoneyDepositFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java index 65daa6d8f..c9254043f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/MoneyWithdrawFunctionTest.java @@ -31,7 +31,7 @@ public class MoneyWithdrawFunctionTest extends FactoryTest { @Test - public void testBelowBalance() { + public void testBelowBalance() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyWithdrawFunction(); @@ -40,7 +40,7 @@ public void testBelowBalance() { } @Test - public void testInvalidData() { + public void testInvalidData() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyWithdrawFunction(); @@ -49,7 +49,7 @@ public void testInvalidData() { } @Test - public void testNullEconomy() { + public void testNullEconomy() throws Exception { this.getFactory().inject().getPlugin().economy = null; PlayerWrapper player = this.getFactory().createPlayer(); Function function = new MoneyWithdrawFunction(); @@ -58,7 +58,7 @@ public void testNullEconomy() { } @Test - public void testEqualBalance() { + public void testEqualBalance() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); MockEconomy economy = this.getFactory().inject().getEconomy(); BigDecimal amount = new BigDecimal(1); @@ -69,7 +69,7 @@ public void testEqualBalance() { } @Test - public void testAboveBalance() { + public void testAboveBalance() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); MockEconomy economy = this.getFactory().inject().getEconomy(); int withdrawAmount = 9; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java index 6b3d966ff..93f04b05b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/NoPermissionFunctionTest.java @@ -28,13 +28,13 @@ public class NoPermissionFunctionTest extends FactoryTest { @Test - public void testNullData() { + public void testNullData() throws Exception { Function function = new NoPermissionFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void testHasNoPermission() { + public void testHasNoPermission() throws Exception { this.getFactory().inject(); Function function = new NoPermissionFunction(); function.setData("test"); @@ -42,7 +42,7 @@ public void testHasNoPermission() { } @Test - public void testHasPermission() { + public void testHasPermission() throws Exception { String permission = "test"; this.getFactory().inject(); Function function = new NoPermissionFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java index ac847b7ca..b17db7b8a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ParticleFunctionTest.java @@ -28,13 +28,13 @@ public class ParticleFunctionTest extends FactoryTest { @Test - public void testNullData() { + public void testNullData() throws Exception { Function function = new ParticleFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void testValid() { + public void testValid() throws Exception { Function function = new ParticleFunction(); function.setData("test,0"); MockPlayerWrapper player = this.getFactory().createPlayer(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java index a27f841b0..e6c45fb8c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PermissionFunctionTest.java @@ -28,21 +28,21 @@ public class PermissionFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new PermissionFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void doesNotHavePermissionTest() { + public void doesNotHavePermissionTest() throws Exception { Function function = new PermissionFunction(); function.setData("test"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void hasPermissionTest() { + public void hasPermissionTest() throws Exception { String permission = "test"; Function function = new PermissionFunction(); function.setData(permission); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java index b85cb1d51..36a53c48c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerCommandFunctionTest.java @@ -29,13 +29,13 @@ public class PlayerCommandFunctionTest extends FactoryTest { @Test - public void nullDataTest() { + public void nullDataTest() throws Exception { Function function = new PlayerCommandFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void validTest() { + public void validTest() throws Exception { String cmd = "test"; String slashCmd = "/" + cmd; Function function = new PlayerCommandFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java index 9cbbb4a3d..ceae82039 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMessageFunctionTest.java @@ -29,13 +29,13 @@ public class PlayerMessageFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new PlayerMessageFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void withDataTest() { + public void withDataTest() throws Exception { String data = "test"; MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); Function function = new PlayerMessageFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java index ef031d525..3826849ce 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMiniMessageFunctionTest.java @@ -29,13 +29,13 @@ public class PlayerMiniMessageFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new PlayerMiniMessageFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void dataTest() { + public void dataTest() throws Exception { this.getFactory().inject(); String data = "test"; Function function = new PlayerMiniMessageFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java index 64cd5d8a6..1d938e46f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/PlayerMsgJsonFunctionTest.java @@ -29,13 +29,13 @@ public class PlayerMsgJsonFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new PlayerMsgJsonFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void dataTest() { + public void dataTest() throws Exception { String data = "{\"text\":\"test\"}"; Function function = new PlayerMsgJsonFunction(); function.setData(data); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java index 531d708b9..083c429d4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RandomFunctionTest.java @@ -27,20 +27,20 @@ public class RandomFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new RandomFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void incorrectLengthTest() { + public void incorrectLengthTest() throws Exception { Function function = new RandomFunction(); function.setData("1-1-1"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void correctLengthTest() { + public void correctLengthTest() throws Exception { Function function = new RandomFunction(); function.setData("1-1"); assertTrue(function.function(this.getFactory().createPlayer())); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java index 8c2671a7e..8b30838f4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemovePermissionFunctionTest.java @@ -28,13 +28,13 @@ public class RemovePermissionFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new RemovePermissionFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void permissionNotRemovedTest() { + public void permissionNotRemovedTest() throws Exception { String permission = "data"; Function function = new RemovePermissionFunction(); function.setData(permission); @@ -43,7 +43,7 @@ public void permissionNotRemovedTest() { } @Test - public void permissionRemoveTest() { + public void permissionRemoveTest() throws Exception { String permission = "data"; Function function = new RemovePermissionFunction(); function.setData(permission); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java index 8acbe2004..5fc15dc24 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/RemoveSlotFunctionTest.java @@ -34,14 +34,14 @@ public class RemoveSlotFunctionTest extends FactoryTest { @Test - public void randomDataTest() { + public void randomDataTest() throws Exception { Function function = new RemoveSlotFunction(); function.setData(UUID.randomUUID().toString()); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void noDataTest() { + public void noDataTest() throws Exception { this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(0, Slot.TEST_MATERIAL, false); @@ -56,7 +56,7 @@ public void noDataTest() { } @Test - public void thisDataTest() { + public void thisDataTest() throws Exception { this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(0, Slot.TEST_MATERIAL, false); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java index 15a294339..2098097e6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetFrameFunctionTest.java @@ -29,7 +29,7 @@ public class ResetFrameFunctionTest extends FactoryTest { @Test - public void ownerNotSlotTest() { + public void ownerNotSlotTest() throws Exception { Gui gui = this.getFactory().createGui("test"); Function function = new ResetFrameFunction(); function.setOwner(gui); @@ -37,7 +37,7 @@ public void ownerNotSlotTest() { } @Test - public void slotOwnerTest() { + public void slotOwnerTest() throws Exception { Slot slot = this.getFactory().createSlot(); Function function = new ResetFrameFunction(); function.setOwner(slot); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java index db8202500..4adce9805 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ResetTickFunctionTest.java @@ -29,7 +29,7 @@ public class ResetTickFunctionTest extends FactoryTest { @Test - public void ownerNotSlotTest() { + public void ownerNotSlotTest() throws Exception { Gui gui = this.getFactory().createGui("test"); Function function = new ResetTickFunction(); function.setOwner(gui); @@ -37,7 +37,7 @@ public void ownerNotSlotTest() { } @Test - public void slotOwnerTest() { + public void slotOwnerTest() throws Exception { Slot slot = this.getFactory().createSlot(); Function function = new ResetTickFunction(); function.setOwner(slot); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java index 801914565..665a93a3b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SendFunctionTest.java @@ -31,13 +31,13 @@ public class SendFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SendFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void noProxyTest() { + public void noProxyTest() throws Exception { this.getFactory().inject(); Function function = new SendFunction(); function.setData("test"); @@ -46,7 +46,7 @@ public void noProxyTest() { } @Test - public void bungeeCordTest() { + public void bungeeCordTest() throws Exception { this.getFactory().inject(); Function function = new SendFunction(); function.setData("test"); @@ -55,7 +55,7 @@ public void bungeeCordTest() { } @Test - public void redisBungeeTest() { + public void redisBungeeTest() throws Exception { this.getFactory().inject(); Function function = new SendFunction(); function.setData("test"); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java index 1740c0ab6..d152f470a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastFunctionTest.java @@ -31,13 +31,13 @@ public class ServerBroadcastFunctionTest extends FactoryTest { @Test - public void noDataTest() { + public void noDataTest() throws Exception { Function function = new ServerBroadcastFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void dataTest() { + public void dataTest() throws Exception { this.getFactory().inject(); String data = "&4test"; String colorized = ChatColor.translateAlternateColorCodes(data); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java index ee91ab91b..adf9e768a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerBroadcastJsonFunctionTest.java @@ -32,13 +32,13 @@ public class ServerBroadcastJsonFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new ServerBroadcastJsonFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void dataTest() { + public void dataTest() throws Exception { MockPlatform platform = this.getFactory().inject().getPlatform(); String json = MiniMessageManager.get().toJson("test"); Function function = new ServerBroadcastJsonFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java index 5cd3a135d..90d131835 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/ServerMiniBroadcastFunctionTest.java @@ -32,13 +32,13 @@ public class ServerMiniBroadcastFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new ServerMiniBroadcastFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void dataTest() { + public void dataTest() throws Exception { MockPlatform platform = this.getFactory().inject().getPlatform(); String data = "test"; String json = MiniMessageManager.get().toJson(data); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java index 8056e31e5..cc5cab419 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetAmountFunctionTest.java @@ -35,13 +35,13 @@ public class SetAmountFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetAmountFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void nonSlotOwnerTest() { + public void nonSlotOwnerTest() throws Exception { Function function = new SetAmountFunction(); function.setOwner(this.getFactory().createGui("test")); function.setData("1"); @@ -49,7 +49,7 @@ public void nonSlotOwnerTest() { } @Test - public void invalidDataTest() { + public void invalidDataTest() throws Exception { this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(); @@ -66,7 +66,7 @@ public void invalidDataTest() { } @Test - public void dataTest() { + public void dataTest() throws Exception { this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); int newAmount = 2; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java index 1c82268be..ec629c081 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCloseFunctionTest.java @@ -32,13 +32,13 @@ public class SetCloseFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetCloseFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void nonCloseableComponentTest() { + public void nonCloseableComponentTest() throws Exception { Function function = new SetCloseFunction(); function.setOwner(new MockNonCloseableFunctionOwner()); function.setData("true"); @@ -46,7 +46,7 @@ public void nonCloseableComponentTest() { } @Test - public void invalidDataTest() { + public void invalidDataTest() throws Exception { Function function = new SetCloseFunction(); CloseableComponent component = new MockCloseableFunctionOwner(); function.setOwner((FunctionOwner) component); @@ -56,7 +56,7 @@ public void invalidDataTest() { } @Test - public void validDataTest() { + public void validDataTest() throws Exception { Function function = new SetCloseFunction(); CloseableComponent component = new MockCloseableFunctionOwner(); function.setOwner((FunctionOwner) component); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java index d13cf35f1..54343d8d4 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetCooldownFunctionTest.java @@ -30,34 +30,34 @@ public class SetCooldownFunctionTest extends FactoryTest { @Test - public void nullDataTest() { + public void nullDataTest() throws Exception { Function function = new SetCooldownFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void noCommaTest() { + public void noCommaTest() throws Exception { Function function = new SetCooldownFunction(); function.setData("a"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void invalidNumberTest() { + public void invalidNumberTest() throws Exception { Function function = new SetCooldownFunction(); function.setData("a,a"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void lengthNotTwoTest() { + public void lengthNotTwoTest() throws Exception { Function function = new SetCooldownFunction(); function.setData("a,a,a"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void onCooldownTest() { + public void onCooldownTest() throws Exception { this.getFactory().inject(); PlayerWrapper player = this.getFactory().createPlayer(); String cooldownName = UUID.randomUUID().toString(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java index e178a08bf..6431d9040 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetDurabilityFunctionTest.java @@ -35,13 +35,13 @@ public class SetDurabilityFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetDurabilityFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void nonSlotOwnerTest() { + public void nonSlotOwnerTest() throws Exception { Function function = new SetDurabilityFunction(); function.setOwner(this.getFactory().createGui("test")); function.setData("1"); @@ -49,7 +49,7 @@ public void nonSlotOwnerTest() { } @Test - public void invalidDataTest() { + public void invalidDataTest() throws Exception { this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(); @@ -66,7 +66,7 @@ public void invalidDataTest() { } @Test - public void dataTest() { + public void dataTest() throws Exception { this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); int newDurability = 2; diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java index 5680db308..670c2e32a 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetEnchantsFunctionTest.java @@ -37,20 +37,20 @@ public class SetEnchantsFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetEnchantsFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void noOwnerTest() { + public void noOwnerTest() throws Exception { Function function = new SetEnchantsFunction(); function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void ownerNotSlotTest() { + public void ownerNotSlotTest() throws Exception { Function function = new SetEnchantsFunction(); function.setData(EnchantmentWrapper.TEST_ENCHANT_2 + ",1"); function.setOwner(new MockNonCloseableFunctionOwner()); @@ -58,7 +58,7 @@ public void ownerNotSlotTest() { } @Test - public void testOneEnchant() { + public void testOneEnchant() throws Exception { int index = 0; this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); @@ -80,7 +80,7 @@ public void testOneEnchant() { } @Test - public void testMultipleEnchants() { + public void testMultipleEnchants() throws Exception { int index = 0; this.getFactory().inject(); MockPlayerWrapper player = this.getFactory().createPlayer(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java index 7bfb52f1a..d26cf3248 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGameRuleFunctionTest.java @@ -30,27 +30,27 @@ public class SetGameRuleFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetGameRuleFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void dataDoesNotHaveCommaTest() { + public void dataDoesNotHaveCommaTest() throws Exception { Function function = new SetGameRuleFunction(); function.setData("a"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void sizeNotThreeTest() { + public void sizeNotThreeTest() throws Exception { Function function = new SetGameRuleFunction(); function.setData("a,a"); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void worldNullTest() { + public void worldNullTest() throws Exception { this.getFactory().inject(); Function function = new SetGameRuleFunction(); function.setData("test,key,value"); @@ -58,7 +58,7 @@ public void worldNullTest() { } @Test - public void validTest() { + public void validTest() throws Exception { MockWorldWrapper world = this.getFactory().inject().createWorld("test"); this.getFactory().getPlatform().addWorld(world); Function function = new SetGameRuleFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java index 6e006a1b5..fdc0f238f 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetGlowFunctionTest.java @@ -30,13 +30,13 @@ public class SetGlowFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetGlowFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void notSlotTest() { + public void notSlotTest() throws Exception { Function function = new SetGlowFunction(); function.setData("true"); function.setOwner(new MockNonCloseableFunctionOwner()); @@ -44,7 +44,7 @@ public void notSlotTest() { } @Test - public void slotTest() { + public void slotTest() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); Function function = new SetGlowFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java index 4b26c74f4..380dc7257 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetLoreFunctionTest.java @@ -35,7 +35,7 @@ public class SetLoreFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); String line = "test"; List lore = new ArrayList<>(); @@ -49,14 +49,14 @@ public void nullTest() { } @Test - public void nonSlotTest() { + public void nonSlotTest() throws Exception { Function function = new SetLoreFunction(); function.setOwner(new MockNonCloseableFunctionOwner()); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void oneLineTest() { + public void oneLineTest() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); Function function = new SetLoreFunction(); @@ -70,7 +70,7 @@ public void oneLineTest() { } @Test - public void multiLineTest() { + public void multiLineTest() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); Function function = new SetLoreFunction(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java index a1cc4c5c1..9dba65e9b 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetMovableFunctionTest.java @@ -30,13 +30,13 @@ public class SetMovableFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetMovableFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void notSlotTest() { + public void notSlotTest() throws Exception { Function function = new SetMovableFunction(); function.setData("a"); function.setOwner(new MockNonCloseableFunctionOwner()); @@ -44,7 +44,7 @@ public void notSlotTest() { } @Test - public void setMovableFalseTest() { + public void setMovableFalseTest() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); Function function = new SetMovableFunction(); function.setData("false"); @@ -55,7 +55,7 @@ public void setMovableFalseTest() { } @Test - public void setMovableTrueTest() { + public void setMovableTrueTest() throws Exception { PlayerWrapper player = this.getFactory().createPlayer(); Function function = new SetMovableFunction(); function.setData("true"); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java index c5f8ed1a1..8a72b7fa7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNBTFunctionTest.java @@ -33,13 +33,13 @@ public class SetNBTFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetNBTFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void notSlotTest() { + public void notSlotTest() throws Exception { Function function = new SetNBTFunction(); function.setData("asdf"); function.setOwner(new MockNonCloseableFunctionOwner()); @@ -47,7 +47,7 @@ public void notSlotTest() { } @Test - public void nbtTest() { + public void nbtTest() throws Exception { String nbt = "asdf"; MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java index d0531a37a..3a94642b9 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetNameFunctionTest.java @@ -33,13 +33,13 @@ public class SetNameFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetNameFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void notSlotTest() { + public void notSlotTest() throws Exception { Function function = new SetNameFunction(); function.setData("asdf"); function.setOwner(new MockNonCloseableFunctionOwner()); @@ -47,7 +47,7 @@ public void notSlotTest() { } @Test - public void nameTest() { + public void nameTest() throws Exception { String name = "asdf"; MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java index f2c15be8f..a85010552 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SetTypeFunctionTest.java @@ -33,13 +33,13 @@ public class SetTypeFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SetTypeFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void notSlotTest() { + public void notSlotTest() throws Exception { Function function = new SetTypeFunction(); function.setData(Slot.TEST_MATERIAL); function.setOwner(new MockNonCloseableFunctionOwner()); @@ -47,7 +47,7 @@ public void notSlotTest() { } @Test - public void typeTest() { + public void typeTest() throws Exception { String type = Slot.TEST_MATERIAL; MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java index 5ac6758cf..043e6f7b1 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/function/SoundFunctionTest.java @@ -33,13 +33,13 @@ public class SoundFunctionTest extends FactoryTest { @Test - public void nullTest() { + public void nullTest() throws Exception { Function function = new SoundFunction(); assertFalse(function.function(this.getFactory().createPlayer())); } @Test - public void soundTest() { + public void soundTest() throws Exception { String type = SoundWrapper.TEST_SOUND_STRING; MockPlayerWrapper player = this.getFactory().createPlayer(); Slot slot = this.getFactory().createSlot(player); From 83ee2dc7474a21e8eaa0fc14aa6dfe8186d50841 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 25 Apr 2022 15:57:02 -0700 Subject: [PATCH 248/261] Start to debug slot loading When there are multiple types of functions I.E: click etc on the a slot the slot will not load and only seems to run one function tree, this seems like it is due to the future not getting completed somewhere down the function tree. --- .../manager/dynamicgui/FunctionManager.java | 79 +++++++++++++------ .../core/manager/dynamicgui/GuiManager.java | 6 +- 2 files changed, 57 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 1838e43a2..cd4b827bb 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -30,7 +30,6 @@ import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -129,6 +128,7 @@ playerWrapper, null, new AtomicBoolean(true)) returnValue.set(false); } int inc = currentCount.incrementAndGet(); + System.out.println("inc: " + inc + " " + rootSize); if (inc == rootSize) { future.complete(returnValue.get()); } @@ -156,30 +156,51 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); if (types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { + System.out.println("type: " + type); if (type != FunctionType.FAIL) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { - if (!dataResponse.result) { - if (dataResponse.failedFunction == null) { - future.complete(false); - } else { - returnValue.set(false); - recurFunctionNodes(dataResponse, owner, - node.getChildren(), FunctionType.FAIL, - playerWrapper, future, returnValue); - } - } else { - recurFunctionNodes(dataResponse, owner, - node.getChildren(), type, - playerWrapper, future, returnValue); - } - }); + runFunctionData(owner, functionToken.getFunctions(), playerWrapper) + .whenComplete((dataResponse, ex) -> { + System.out.println("data complete"); + if (ex != null) { + ex.printStackTrace(); + future.complete(false); + } else { + if (!dataResponse.result) { + if (dataResponse.failedFunction == null) { + future.complete(false); + recurFunctionNodes(null, owner, + nodeQueue, type, + playerWrapper, future, returnValue); + } else { + returnValue.set(false); + recurFunctionNodes(dataResponse, owner, + node.getChildren(), FunctionType.FAIL, + playerWrapper, future, returnValue); + } + } else { + recurFunctionNodes(dataResponse, owner, + node.getChildren(), type, + playerWrapper, future, returnValue); + } + } + }); } else if (type == FunctionType.FAIL) { if (isFail(response, functionToken)) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { - recurFunctionNodes(dataResponse, owner, - node.getChildren(), FunctionType.FAIL, - playerWrapper, future, returnValue); - }); + runFunctionData(owner, functionToken.getFunctions(), playerWrapper) + .whenComplete((dataResponse, ex) -> { + if (ex != null) { + ex.printStackTrace(); + future.complete(false); + } else { + recurFunctionNodes(dataResponse, owner, + node.getChildren(), FunctionType.FAIL, + playerWrapper, future, returnValue); + } + }); + } else { + recurFunctionNodes(null, owner, + nodeQueue, type, + playerWrapper, future, returnValue); } } } else { @@ -256,10 +277,16 @@ private CompletableFuture runFunctionData(FunctionOwner owner, cleanupAsync(uuid, function); response.complete(new FunctionResponse(false, functionName, functionData)); } else if (async) { - runFunctionData(owner, futureData, playerWrapper).thenAccept((value) -> { - cleanupAsync(uuid, function); - response.complete(value); - }); + runFunctionData(owner, futureData, playerWrapper) + .whenComplete((value, ex) -> { + if (ex != null) { + ex.printStackTrace(); + response.complete(new FunctionResponse(false, value.failedFunction, value.data)); + } else { + cleanupAsync(uuid, function); + response.complete(value); + } + }); } }, async); //Return if function is async since the async caller will hand diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index a74e1ac2e..f46a2b247 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -240,10 +240,12 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu if(slotFuture.isDone()) { return; } + System.out.println("i: " + i + " slot size: " + slotSize); Slot slot = slots.get(i); FunctionManager.get() .tryFunctions(slot, FunctionType.LOAD, playerWrapper) .whenComplete((slotResult, ex) -> { + System.out.println("Complete"); if(slotFuture.isDone()) { return; } @@ -252,6 +254,7 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu slotFuture.complete(false); } else { int count = slotCount.incrementAndGet(); + System.out.println("slot size: " + slotSize + " count: " + count); if(slotSize == count) { slotFuture.complete(true); } @@ -259,11 +262,10 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu }); } slotFuture.whenComplete((completed, ex) -> { + System.out.println("Slot future complete: " + (ex != null)); if (ex != null) { ex.printStackTrace(); future.complete(false); - } else if (!completed) { - future.complete(false); } else { ThreadUtil.run(() -> { Platform platform = DynamicGui.get().getPlatform(); From 7ffd6dc8ff743ea995e614535a0a56482011d42e Mon Sep 17 00:00:00 2001 From: virustotalop Date: Mon, 25 Apr 2022 16:04:52 -0700 Subject: [PATCH 249/261] Disable handling slot loading in async manner There is an issue with the function parser, this way at least the gui should load --- .../manager/dynamicgui/FunctionManager.java | 76 ++++++++++++------- .../core/manager/dynamicgui/GuiManager.java | 56 ++++---------- 2 files changed, 64 insertions(+), 68 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 1838e43a2..476e4df1a 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -30,7 +30,6 @@ import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -157,29 +156,48 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, List types = functionToken.getTypes(); if (types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { if (type != FunctionType.FAIL) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { - if (!dataResponse.result) { - if (dataResponse.failedFunction == null) { - future.complete(false); - } else { - returnValue.set(false); - recurFunctionNodes(dataResponse, owner, - node.getChildren(), FunctionType.FAIL, - playerWrapper, future, returnValue); - } - } else { - recurFunctionNodes(dataResponse, owner, - node.getChildren(), type, - playerWrapper, future, returnValue); - } - }); + runFunctionData(owner, functionToken.getFunctions(), playerWrapper) + .whenComplete((dataResponse, ex) -> { + if (ex != null) { + ex.printStackTrace(); + future.complete(false); + } else { + if (!dataResponse.result) { + if (dataResponse.failedFunction == null) { + future.complete(false); + recurFunctionNodes(null, owner, + nodeQueue, type, + playerWrapper, future, returnValue); + } else { + returnValue.set(false); + recurFunctionNodes(dataResponse, owner, + node.getChildren(), FunctionType.FAIL, + playerWrapper, future, returnValue); + } + } else { + recurFunctionNodes(dataResponse, owner, + node.getChildren(), type, + playerWrapper, future, returnValue); + } + } + }); } else if (type == FunctionType.FAIL) { if (isFail(response, functionToken)) { - runFunctionData(owner, functionToken.getFunctions(), playerWrapper).thenAccept(dataResponse -> { - recurFunctionNodes(dataResponse, owner, - node.getChildren(), FunctionType.FAIL, - playerWrapper, future, returnValue); - }); + runFunctionData(owner, functionToken.getFunctions(), playerWrapper) + .whenComplete((dataResponse, ex) -> { + if (ex != null) { + ex.printStackTrace(); + future.complete(false); + } else { + recurFunctionNodes(dataResponse, owner, + node.getChildren(), FunctionType.FAIL, + playerWrapper, future, returnValue); + } + }); + } else { + recurFunctionNodes(null, owner, + nodeQueue, type, + playerWrapper, future, returnValue); } } } else { @@ -256,10 +274,16 @@ private CompletableFuture runFunctionData(FunctionOwner owner, cleanupAsync(uuid, function); response.complete(new FunctionResponse(false, functionName, functionData)); } else if (async) { - runFunctionData(owner, futureData, playerWrapper).thenAccept((value) -> { - cleanupAsync(uuid, function); - response.complete(value); - }); + runFunctionData(owner, futureData, playerWrapper) + .whenComplete((value, ex) -> { + if (ex != null) { + ex.printStackTrace(); + response.complete(new FunctionResponse(false, value.failedFunction, value.data)); + } else { + cleanupAsync(uuid, function); + response.complete(value); + } + }); } }, async); //Return if function is async since the async caller will hand diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index a74e1ac2e..56c532094 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -232,56 +232,28 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu } //Run slot load functions - CompletableFuture slotFuture = new CompletableFuture<>(); List slots = clonedGui.getSlots(); int slotSize = slots.size(); - AtomicInteger slotCount = new AtomicInteger(0); for (int i = 0; i < slotSize; i++) { - if(slotFuture.isDone()) { - return; - } Slot slot = slots.get(i); FunctionManager.get() - .tryFunctions(slot, FunctionType.LOAD, playerWrapper) - .whenComplete((slotResult, ex) -> { - if(slotFuture.isDone()) { - return; - } - if(ex != null) { - ex.printStackTrace(); - slotFuture.complete(false); - } else { - int count = slotCount.incrementAndGet(); - if(slotSize == count) { - slotFuture.complete(true); - } - } - }); + .tryFunctions(slot, FunctionType.LOAD, playerWrapper); } - slotFuture.whenComplete((completed, ex) -> { - if (ex != null) { - ex.printStackTrace(); - future.complete(false); - } else if (!completed) { - future.complete(false); + ThreadUtil.run(() -> { + Platform platform = DynamicGui.get().getPlatform(); + if (platform.getType() == PlatformType.SPONGE) { + platform.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.openInventory(inventoryWrapper); + }, 1L); } else { - ThreadUtil.run(() -> { - Platform platform = DynamicGui.get().getPlatform(); - if (platform.getType() == PlatformType.SPONGE) { - platform.getScheduler().runSyncDelayedTask(() -> { - playerWrapper.openInventory(inventoryWrapper); - }, 1L); - } else { - playerWrapper.openInventory(inventoryWrapper); - } - this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); - platform.getScheduler().runSyncDelayedTask(() -> { - playerWrapper.updateInventory(); - }, 2L); - future.complete(true); - }, false); + playerWrapper.openInventory(inventoryWrapper); } - }); + this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); + platform.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.updateInventory(); + }, 2L); + future.complete(true); + }, false); } else { future.complete(false); } From 70f743a738b8df1cf4b8c288d87131140155cc46 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 27 Apr 2022 16:00:24 -0700 Subject: [PATCH 250/261] Add rgb color support --- core/build.gradle | 7 +- .../core/config/ChatColorTransformer.java | 2 +- .../impl/ServerBroadcastFunction.java | 2 +- .../core/function/impl/SetLoreFunction.java | 2 +- .../core/function/impl/SetNameFunction.java | 2 +- .../core/manager/dynamicgui/GuiManager.java | 4 +- .../dynamicgui/core/util/ChatColor.java | 102 +----------------- .../test/config/ChatColorTransformerTest.java | 2 +- 8 files changed, 17 insertions(+), 106 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 86005ed18..3b7602aeb 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -2,6 +2,8 @@ plugins { id 'java-library' } +def adventureVersion = "4.10.1" + dependencies { api 'commons-io:commons-io:2.11.0' api 'com.github.clubobsidian:trident:3.0.0' @@ -9,6 +11,7 @@ dependencies { api 'com.udojava:EvalEx:2.1' api 'com.github.ClubObsidian:FuzzUtil:1.1.0' api 'com.google.inject:guice:5.1.0' - api 'net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT' - api 'net.kyori:adventure-text-serializer-gson:4.9.3' + api "net.kyori:adventure-text-minimessage:$adventureVersion" + api "net.kyori:adventure-text-serializer-gson:$adventureVersion" + api "net.kyori:adventure-text-serializer-legacy:$adventureVersion" } \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java index f2358aa6d..5790f8b9b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/config/ChatColorTransformer.java @@ -27,6 +27,6 @@ public ChatColorTransformer() { @Override public String transform(String transform) { - return ChatColor.translateAlternateColorCodes('&', transform); + return ChatColor.translateAlternateColorCodes(transform); } } diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java index 860677be6..d5fd4f822 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/ServerBroadcastFunction.java @@ -39,7 +39,7 @@ public boolean function(PlayerWrapper playerWrapper) { if (this.getData() == null) { return false; } - String colorized = ChatColor.translateAlternateColorCodes('&', + String colorized = ChatColor.translateAlternateColorCodes( ReplacerManager .get() .replace(this.getData(), playerWrapper)); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java index b5632a0a8..bed8fca6b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetLoreFunction.java @@ -58,7 +58,7 @@ public boolean function(PlayerWrapper playerWrapper) { } else { String newData = ReplacerManager.get().replace(this.getData(), playerWrapper); newData = AnimationReplacerManager.get().replace(slot, playerWrapper, newData); - newData = ChatColor.translateAlternateColorCodes('&', newData); + newData = ChatColor.translateAlternateColorCodes(newData); if (newData.contains("\n")) { for (String str : this.getData().split("\n")) { lore.add(str); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java index b44907716..ac04183f6 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/function/impl/SetNameFunction.java @@ -51,7 +51,7 @@ public boolean function(PlayerWrapper playerWrapper) { InventoryWrapper inv = gui.getInventoryWrapper(); if (inv != null) { ItemStackWrapper item = slot.getItemStack(); - String newName = ChatColor.translateAlternateColorCodes('&', this.getData()); + String newName = ChatColor.translateAlternateColorCodes(this.getData()); newName = ReplacerManager.get().replace(newName, playerWrapper); newName = AnimationReplacerManager.get().replace(slot, playerWrapper, newName); item.setName(newName); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 56c532094..8f391537c 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -446,14 +446,14 @@ private List createSlots(GuiToken guiToken) { String name = slotToken.getName(); if (name != null) { - name = ChatColor.translateAlternateColorCodes('&', name); + name = ChatColor.translateAlternateColorCodes(name); } String nbt = slotToken.getNbt(); List lore = new ArrayList<>(); for (String ls : slotToken.getLore()) { - lore.add(ChatColor.translateAlternateColorCodes('&', ls)); + lore.add(ChatColor.translateAlternateColorCodes(ls)); } List enchants = new ArrayList<>(); diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java index a03c12ef9..7c01a6670 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java @@ -16,106 +16,14 @@ package com.clubobsidian.dynamicgui.core.util; -import java.awt.*; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -public enum ChatColor { +public class ChatColor { - AQUA('b', 85, 255, 255), - BLACK('0', 0, 0, 0), - BLUE('9', 85, 85, 255), - DARK_AQUA('3', 0, 170, 170), - DARK_BLUE('1', 0, 0, 170), - DARK_GRAY('8', 85, 85, 85), - DARK_GREEN('2', 0, 170, 0), - DARK_PURPLE('5', 170, 0, 170), - DARK_RED('4', 170, 0, 0), - GOLD('6', 170, 170, 0), - GRAY('7', 170, 170, 170), - GREEN('a', 85, 255, 85), - LIGHT_PURPLE('d', 255, 85, 255), - RED('c', 255, 85, 85), - WHITE('f', 255, 255, 255), - YELLOW('e', 255, 255, 85), - //Formatting - BOLD('l', true), - ITALIC('o', true), - MAGIC('k', true), - RESET('r', true), - STRIKETHROUGH('m', true), - UNDERLINE('n', true); - - public static final char FORMATTING_CODE = '\u00A7'; - - private final char colorCode; - private final boolean formatting; - private int red; - private int green; - private int blue; - private Color color; - - ChatColor(char colorCode, int red, int green, int blue) { - this(colorCode, false); - this.red = red; - this.green = green; - this.blue = blue; - this.color = new Color(red, green, blue); - } - - ChatColor(char colorCode, boolean formatting) { - this.colorCode = colorCode; - this.formatting = formatting; - } - - public char getColorCode() { - return this.colorCode; - } - - public boolean isColor() { - return !this.isFormatting(); - } - - public boolean isFormatting() { - return this.formatting; - } - - public int getRed() { - return this.red; - } - - public int getGreen() { - return this.green; - } - - public int getBlue() { - return this.blue; - } - - public Color getJavaColor() { - return this.color; - } - - public static String translateAlternateColorCodes(char translate, String message) { - char[] chars = message.toCharArray(); - for (int i = 0; i < chars.length; i++) { - if (chars[i] == translate) { - if (i + 1 < chars.length) { - for (ChatColor color : ChatColor.values()) { - if (chars[i + 1] == color.getColorCode()) { - chars[i] = ChatColor.FORMATTING_CODE; - } - } - } - } - } - return String.valueOf(chars); - } + private static final LegacyComponentSerializer AMPERSAND = LegacyComponentSerializer.legacyAmpersand(); + private static final LegacyComponentSerializer SECTION = LegacyComponentSerializer.legacySection(); public static String translateAlternateColorCodes(String message) { - return translateAlternateColorCodes('&', message); - } - - @Override - public String toString() { - return ChatColor.FORMATTING_CODE + "" + this.getColorCode(); + return SECTION.serialize(AMPERSAND.deserialize(message)); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java index bb4a1c82e..cc6bb71b7 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/config/ChatColorTransformerTest.java @@ -28,7 +28,7 @@ public class ChatColorTransformerTest { @Test public void transformTest() { String str = "&ctest"; - String colorized = ChatColor.FORMATTING_CODE + "ctest"; + String colorized = '\u00A7' + "ctest"; NodeTransformer transformer = new ChatColorTransformer(); String transformed = transformer.transform(str); assertEquals(colorized, transformed); From 83b3685f0783d79c78266b649e6ead9633fa8140 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 27 Apr 2022 16:23:50 -0700 Subject: [PATCH 251/261] Fix adventure down sampling color codes --- .../dynamicgui/core/util/ChatColor.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java index 7c01a6670..ede299b74 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/util/ChatColor.java @@ -20,8 +20,18 @@ public class ChatColor { - private static final LegacyComponentSerializer AMPERSAND = LegacyComponentSerializer.legacyAmpersand(); - private static final LegacyComponentSerializer SECTION = LegacyComponentSerializer.legacySection(); + public static final char SECTION_CODE = '\u00A7'; + + private static final LegacyComponentSerializer AMPERSAND = LegacyComponentSerializer.builder() + .hexColors() + .useUnusualXRepeatedCharacterHexFormat() + .character('&') + .build(); + private static final LegacyComponentSerializer SECTION = LegacyComponentSerializer.builder() + .hexColors() + .useUnusualXRepeatedCharacterHexFormat() + .character(SECTION_CODE) + .build(); public static String translateAlternateColorCodes(String message) { return SECTION.serialize(AMPERSAND.deserialize(message)); From 6a2b82c325b37306c6a26314c74856768589a571 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 4 May 2022 19:40:19 -0700 Subject: [PATCH 252/261] Add function node name for debugging --- .../dynamicgui/parser/function/tree/FunctionNode.java | 8 +++++++- .../dynamicgui/parser/function/tree/FunctionTree.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java index 03e346581..5e538e5c9 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionNode.java @@ -29,16 +29,22 @@ public class FunctionNode implements Serializable { */ private static final long serialVersionUID = -8331607544830166913L; + private final String name; private final int depth; private final FunctionToken token; private final List children; - public FunctionNode(int depth, FunctionToken token) { + public FunctionNode(String name, int depth, FunctionToken token) { + this.name = name; this.depth = depth; this.token = token; this.children = new ArrayList<>(); } + public String getName() { + return this.name; + } + public int getDepth() { return this.depth; } diff --git a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java index d60f9c88a..92889d6b0 100644 --- a/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java +++ b/parser/src/main/java/com/clubobsidian/dynamicgui/parser/function/tree/FunctionTree.java @@ -131,7 +131,7 @@ private void walkTree(int depth, ConfigurationSection section, FunctionNode pare List failFunctions = this.parseFunctionData(rootSection.getStringList("fail-on")); FunctionToken data = new FunctionToken(name, types, functionTokens, failFunctions); - FunctionNode childNode = new FunctionNode(depth, data); + FunctionNode childNode = new FunctionNode(name, depth, data); if (depth == 0) { this.rootNodes.add(childNode); From c1b29ffdf98c0291abdcdf88bc2f37864d8f8e58 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Wed, 4 May 2022 20:27:43 -0700 Subject: [PATCH 253/261] Don't loop root nodes This is a bigger underlying issues of not doing proper recursion through multiple depths. Instead we just call recureFunctionNodes(), this currently breaks all the code but should start leading us towards the right direction since this ended up just being a bandaid fix anyways. --- .../manager/dynamicgui/FunctionManager.java | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index cd4b827bb..47a0c530b 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -118,22 +118,9 @@ public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType if (rootSize == 0) { future.complete(true); } else { - AtomicBoolean returnValue = new AtomicBoolean(true); - AtomicInteger currentCount = new AtomicInteger(0); - for (FunctionNode node : rootNodes) { - recurFunctionNodes(null, owner, Collections.singletonList(node), type, - playerWrapper, null, new AtomicBoolean(true)) - .whenComplete((ret, ex) -> { - if (ex != null || !ret) { - returnValue.set(false); - } - int inc = currentCount.incrementAndGet(); - System.out.println("inc: " + inc + " " + rootSize); - if (inc == rootSize) { - future.complete(returnValue.get()); - } - }); - } + recurFunctionNodes(null, owner, rootNodes, type, + playerWrapper, future, + new AtomicBoolean(true)); } return future; } @@ -143,10 +130,9 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, Collection functionNodes, FunctionType type, PlayerWrapper playerWrapper, - CompletableFuture incomingFuture, + CompletableFuture future, AtomicBoolean returnValue) { Queue nodeQueue = new ArrayDeque<>(functionNodes); - CompletableFuture future = incomingFuture == null ? new CompletableFuture<>() : incomingFuture; future.exceptionally((ex) -> { ex.printStackTrace(); return null; From 3624d2177357c664107292274ae206ce706bab1f Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 22:43:14 -0700 Subject: [PATCH 254/261] Drop support for same function type per slot --- core/mock_data/guis/test.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/core/mock_data/guis/test.yml b/core/mock_data/guis/test.yml index 289192ebf..6f189fcea 100644 --- a/core/mock_data/guis/test.yml +++ b/core/mock_data/guis/test.yml @@ -44,15 +44,4 @@ rows: 5 functions: - "delay: 1000" - "pmsg: test" - - "isasyncthread" -'5': - icon: "STONE" - functions: - click1: - type: "click" - functions: - - "pmsg: test1" - click2: - type: "click" - functions: - - "pmsg: test2" \ No newline at end of file + - "isasyncthread" \ No newline at end of file From 77ce892a576fc1a4f4bcd61c77117b1c85dcf24d Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 22:45:54 -0700 Subject: [PATCH 255/261] Fix function recur issue Functions were not properly doing recursion, this should fix it but there may still be other issues. --- core/mock_data/guis/multi-function-test.yml | 25 +++++++ .../manager/dynamicgui/FunctionManager.java | 67 +++++++------------ .../test/manager/FunctionManagerTest.java | 15 +++-- .../core/test/manager/GuiManagerTest.java | 2 +- 4 files changed, 60 insertions(+), 49 deletions(-) create mode 100644 core/mock_data/guis/multi-function-test.yml diff --git a/core/mock_data/guis/multi-function-test.yml b/core/mock_data/guis/multi-function-test.yml new file mode 100644 index 000000000..298ac4303 --- /dev/null +++ b/core/mock_data/guis/multi-function-test.yml @@ -0,0 +1,25 @@ +title: "test" +rows: 5 + +'0': + icon: "STONE" + functions: + load-1: + type: "load" + functions: + - "permission: test" + - "condition: STREQUAL(\"test1\", \"test2\")" + permission-failfunction: + type: fail + functions: + - "pmsg: test-failed" + fail-on: "permission" + condtion-failfunction: + type: fail + functions: + - "pmsg: condition failed" + fail-on: "condition" + click: + type: "click" + functions: + - "pmsg: test" \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 47a0c530b..25f9f6ab2 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -113,37 +113,38 @@ public boolean hasAsyncFunctionRunning(UUID uuid, String functionName) { public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType type, PlayerWrapper playerWrapper) { CompletableFuture future = new CompletableFuture<>(); - List rootNodes = owner.getFunctions().getRootNodes(); - int rootSize = rootNodes.size(); - if (rootSize == 0) { - future.complete(true); - } else { - recurFunctionNodes(null, owner, rootNodes, type, - playerWrapper, future, - new AtomicBoolean(true)); - } - return future; - } - - private CompletableFuture recurFunctionNodes(FunctionResponse response, - FunctionOwner owner, - Collection functionNodes, - FunctionType type, - PlayerWrapper playerWrapper, - CompletableFuture future, - AtomicBoolean returnValue) { - Queue nodeQueue = new ArrayDeque<>(functionNodes); future.exceptionally((ex) -> { ex.printStackTrace(); return null; }); - FunctionNode node = nodeQueue.poll(); - if (node != null) { + List rootNodes = owner.getFunctions().getRootNodes(); + recurFunctionNodes(null, + owner, + rootNodes, + type, + playerWrapper, + future, + new AtomicBoolean(true)); + return future; + } + + private void recurFunctionNodes(FunctionResponse response, + FunctionOwner owner, + Collection functionNodes, + FunctionType type, + PlayerWrapper playerWrapper, + CompletableFuture future, + AtomicBoolean returnValue) { + if (functionNodes.size() == 0) { + future.complete(returnValue.get()); + } + for (FunctionNode node : functionNodes) { FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); if (types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { System.out.println("type: " + type); if (type != FunctionType.FAIL) { + System.out.println("Not fail"); runFunctionData(owner, functionToken.getFunctions(), playerWrapper) .whenComplete((dataResponse, ex) -> { System.out.println("data complete"); @@ -154,9 +155,6 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, if (!dataResponse.result) { if (dataResponse.failedFunction == null) { future.complete(false); - recurFunctionNodes(null, owner, - nodeQueue, type, - playerWrapper, future, returnValue); } else { returnValue.set(false); recurFunctionNodes(dataResponse, owner, @@ -170,7 +168,7 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, } } }); - } else if (type == FunctionType.FAIL) { + } else { if (isFail(response, functionToken)) { runFunctionData(owner, functionToken.getFunctions(), playerWrapper) .whenComplete((dataResponse, ex) -> { @@ -183,22 +181,10 @@ private CompletableFuture recurFunctionNodes(FunctionResponse response, playerWrapper, future, returnValue); } }); - } else { - recurFunctionNodes(null, owner, - nodeQueue, type, - playerWrapper, future, returnValue); } } - } else { - recurFunctionNodes(null, owner, - nodeQueue, type, - playerWrapper, future, returnValue); } } - if (node == null) { - future.complete(returnValue.get()); - } - return future; } private CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { @@ -308,10 +294,9 @@ private void cleanupAsync(UUID uuid, Function function) { private boolean isFail(FunctionResponse response, FunctionToken token) { for (FunctionData data : token.getFailOnFunctions()) { + System.out.println("looking for: \"" + response.failedFunction + "\" found: \"" + data.getName() + "\""); if (data.getName().equals(response.failedFunction)) { - if (data.getData() == null) { - return true; - } else if (data.getData().equals(response.data)) { + if (data.getData() == null || data.getData().equals(response.data)) { return true; } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 13b7ecadb..84b855b22 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -131,14 +131,15 @@ public void testTryFunctionsAsyncThread() throws ExecutionException, Interrupted } @Test - public void testMultipleClickSlots() throws ExecutionException, InterruptedException { + public void testLoadWithClick() throws ExecutionException, InterruptedException { MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); - Gui gui = GuiManager.get().getGui("test"); - Slot slot = gui.getSlots().get(5); - FunctionManager.get().tryFunctions(slot, FunctionType.CLICK, playerWrapper).get(); + playerWrapper.addPermission("test"); + Gui gui = GuiManager.get().getGui("multi-function-test"); + Slot slot = gui.getSlots().get(0); + boolean failed = FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper).get(); + assertFalse(failed); List chat = playerWrapper.getIncomingChat(); - assertEquals(2, chat.size()); - assertEquals("test1", chat.get(0)); - assertEquals("test2", chat.get(1)); + assertEquals(1, chat.size()); + assertEquals("condition failed", chat.get(0)); } } \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java index f0d0d91b7..1c7646b9c 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/GuiManagerTest.java @@ -45,6 +45,6 @@ public void testHasGui() { public void testGetGuis() { List guis = GuiManager.get().getGuis(); assertNotNull(guis); - assertTrue(guis.size() == 1); + assertTrue(guis.size() > 1); } } \ No newline at end of file From cd338eb9b22617b2f1fd10f8f6450f05b0df28c9 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 22:59:56 -0700 Subject: [PATCH 256/261] Test function without fail function --- core/mock_data/guis/no-fail-function.yml | 10 ++++++++++ .../core/test/manager/FunctionManagerTest.java | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 core/mock_data/guis/no-fail-function.yml diff --git a/core/mock_data/guis/no-fail-function.yml b/core/mock_data/guis/no-fail-function.yml new file mode 100644 index 000000000..772d66b92 --- /dev/null +++ b/core/mock_data/guis/no-fail-function.yml @@ -0,0 +1,10 @@ +title: "test" +rows: 5 + +'0': + icon: "STONE" + functions: + load-1: + type: "load" + functions: + - "permission: test" \ No newline at end of file diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index 84b855b22..e067722f6 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -142,4 +142,13 @@ public void testLoadWithClick() throws ExecutionException, InterruptedException assertEquals(1, chat.size()); assertEquals("condition failed", chat.get(0)); } + + @Test + public void testFailNoFailFunction() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("no-fail-function"); + Slot slot = gui.getSlots().get(0); + boolean failed = FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper).get(); + assertFalse(failed); + } } \ No newline at end of file From 2d64007667d395ed72ad9394be59a985110875f6 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 23:12:37 -0700 Subject: [PATCH 257/261] Check if function nodes doesn't have FunctionType --- core/mock_data/guis/test-no-function-type.yml | 10 ++++++++++ .../core/manager/dynamicgui/FunctionManager.java | 11 ++++++++++- .../core/test/manager/FunctionManagerTest.java | 10 ++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 core/mock_data/guis/test-no-function-type.yml diff --git a/core/mock_data/guis/test-no-function-type.yml b/core/mock_data/guis/test-no-function-type.yml new file mode 100644 index 000000000..7b641d8e0 --- /dev/null +++ b/core/mock_data/guis/test-no-function-type.yml @@ -0,0 +1,10 @@ +title: "test" +rows: 5 + +'0': + icon: "DIRT" + functions: + broadcast: + type: "left" + functions: + - 'broadcast: test' \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 25f9f6ab2..e531aca18 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -135,7 +135,7 @@ private void recurFunctionNodes(FunctionResponse response, PlayerWrapper playerWrapper, CompletableFuture future, AtomicBoolean returnValue) { - if (functionNodes.size() == 0) { + if (functionNodes.size() == 0 || !hasFunctionType(functionNodes, type)) { future.complete(returnValue.get()); } for (FunctionNode node : functionNodes) { @@ -187,6 +187,15 @@ private void recurFunctionNodes(FunctionResponse response, } } + private boolean hasFunctionType(Collection nodes, FunctionType type) { + for (FunctionNode node : nodes) { + if (node.getToken().getTypes().contains(type)) { + return true; + } + } + return false; + } + private CompletableFuture runFunctionData(FunctionOwner owner, List functionDataList, PlayerWrapper playerWrapper) { UUID uuid = playerWrapper.getUniqueId(); CompletableFuture response = new CompletableFuture<>(); diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index e067722f6..a5f11e741 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -151,4 +151,14 @@ public void testFailNoFailFunction() throws ExecutionException, InterruptedExcep boolean failed = FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper).get(); assertFalse(failed); } + + @Test + public void testNoFunctionType() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + playerWrapper.addPermission("test"); + Gui gui = GuiManager.get().getGui("test-no-function-type"); + Slot slot = gui.getSlots().get(0); + boolean result = FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper).get(); + assertTrue(result); + } } \ No newline at end of file From 6f0e5646697eba1384700169b2b6aa82615cdfcd Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 23:22:55 -0700 Subject: [PATCH 258/261] Remove debugging code --- .../core/manager/dynamicgui/FunctionManager.java | 7 ------- .../dynamicgui/core/manager/dynamicgui/GuiManager.java | 4 ---- 2 files changed, 11 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index e531aca18..7472f7246 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -28,14 +28,11 @@ import com.clubobsidian.dynamicgui.parser.function.tree.FunctionNode; import com.clubobsidian.fuzzutil.StringFuzz; -import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Queue; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; @@ -142,12 +139,9 @@ private void recurFunctionNodes(FunctionResponse response, FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); if (types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { - System.out.println("type: " + type); if (type != FunctionType.FAIL) { - System.out.println("Not fail"); runFunctionData(owner, functionToken.getFunctions(), playerWrapper) .whenComplete((dataResponse, ex) -> { - System.out.println("data complete"); if (ex != null) { ex.printStackTrace(); future.complete(false); @@ -303,7 +297,6 @@ private void cleanupAsync(UUID uuid, Function function) { private boolean isFail(FunctionResponse response, FunctionToken token) { for (FunctionData data : token.getFailOnFunctions()) { - System.out.println("looking for: \"" + response.failedFunction + "\" found: \"" + data.getName() + "\""); if (data.getName().equals(response.failedFunction)) { if (data.getData() == null || data.getData().equals(response.data)) { return true; diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index f46a2b247..c0dc829f7 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -240,12 +240,10 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu if(slotFuture.isDone()) { return; } - System.out.println("i: " + i + " slot size: " + slotSize); Slot slot = slots.get(i); FunctionManager.get() .tryFunctions(slot, FunctionType.LOAD, playerWrapper) .whenComplete((slotResult, ex) -> { - System.out.println("Complete"); if(slotFuture.isDone()) { return; } @@ -254,7 +252,6 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu slotFuture.complete(false); } else { int count = slotCount.incrementAndGet(); - System.out.println("slot size: " + slotSize + " count: " + count); if(slotSize == count) { slotFuture.complete(true); } @@ -262,7 +259,6 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu }); } slotFuture.whenComplete((completed, ex) -> { - System.out.println("Slot future complete: " + (ex != null)); if (ex != null) { ex.printStackTrace(); future.complete(false); From 6abf313b4df208f51a92bd82d8bb3d5b6cf5ad53 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 23:30:24 -0700 Subject: [PATCH 259/261] Correctly merge slot loading fix branch --- .../core/manager/dynamicgui/GuiManager.java | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java index 06f9f56a9..7d4187dbe 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/GuiManager.java @@ -232,26 +232,54 @@ public CompletableFuture openGui(PlayerWrapper playerWrapper, Gui gu } //Run slot load functions + CompletableFuture slotFuture = new CompletableFuture<>(); List slots = clonedGui.getSlots(); int slotSize = slots.size(); + AtomicInteger slotCount = new AtomicInteger(0); for (int i = 0; i < slotSize; i++) { + if(slotFuture.isDone()) { + return; + } Slot slot = slots.get(i); FunctionManager.get() - .tryFunctions(slot, FunctionType.LOAD, playerWrapper); + .tryFunctions(slot, FunctionType.LOAD, playerWrapper) + .whenComplete((slotResult, ex) -> { + if(slotFuture.isDone()) { + return; + } + if(ex != null) { + ex.printStackTrace(); + slotFuture.complete(false); + } else { + int count = slotCount.incrementAndGet(); + if(slotSize == count) { + slotFuture.complete(true); + } + } + }); } slotFuture.whenComplete((completed, ex) -> { if (ex != null) { ex.printStackTrace(); future.complete(false); } else { - playerWrapper.openInventory(inventoryWrapper); + ThreadUtil.run(() -> { + Platform platform = DynamicGui.get().getPlatform(); + if (platform.getType() == PlatformType.SPONGE) { + platform.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.openInventory(inventoryWrapper); + }, 1L); + } else { + playerWrapper.openInventory(inventoryWrapper); + } + this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); + platform.getScheduler().runSyncDelayedTask(() -> { + playerWrapper.updateInventory(); + }, 2L); + future.complete(true); + }, false); } - this.playerGuis.put(playerWrapper.getUniqueId(), clonedGui); - platform.getScheduler().runSyncDelayedTask(() -> { - playerWrapper.updateInventory(); - }, 2L); - future.complete(true); - }, false); + }); } else { future.complete(false); } From 2f00c1e00f2dce39496070e19cef48946a994f70 Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sat, 7 May 2022 23:38:32 -0700 Subject: [PATCH 260/261] Complete future at end of fail functions --- core/mock_data/guis/test-fail-no-fail-type.yml | 18 ++++++++++++++++++ .../manager/dynamicgui/FunctionManager.java | 9 +++++++-- .../core/test/manager/FunctionManagerTest.java | 9 +++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 core/mock_data/guis/test-fail-no-fail-type.yml diff --git a/core/mock_data/guis/test-fail-no-fail-type.yml b/core/mock_data/guis/test-fail-no-fail-type.yml new file mode 100644 index 000000000..6957eb13a --- /dev/null +++ b/core/mock_data/guis/test-fail-no-fail-type.yml @@ -0,0 +1,18 @@ +title: "&cTest" +rows: 6 +mode: set + +'1': + icon: "DIRT" + amount: 1 + functions: + load: + type: "load" + functions: + - 'permission: test' + check-type: + type: "fail" + fail-on: + - 'checktick' + functions: + - 'pmsg: test' \ No newline at end of file diff --git a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java index 7472f7246..f51276c94 100644 --- a/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java +++ b/core/src/main/java/com/clubobsidian/dynamicgui/core/manager/dynamicgui/FunctionManager.java @@ -127,7 +127,7 @@ public CompletableFuture tryFunctions(FunctionOwner owner, FunctionType private void recurFunctionNodes(FunctionResponse response, FunctionOwner owner, - Collection functionNodes, + List functionNodes, FunctionType type, PlayerWrapper playerWrapper, CompletableFuture future, @@ -135,7 +135,9 @@ private void recurFunctionNodes(FunctionResponse response, if (functionNodes.size() == 0 || !hasFunctionType(functionNodes, type)) { future.complete(returnValue.get()); } - for (FunctionNode node : functionNodes) { + boolean foundFail = false; + for (int i = 0 ; i < functionNodes.size(); i++) { + FunctionNode node = functionNodes.get(i); FunctionToken functionToken = node.getToken(); List types = functionToken.getTypes(); if (types.contains(type) || (type.isClick() && types.contains(FunctionType.CLICK))) { @@ -164,6 +166,7 @@ private void recurFunctionNodes(FunctionResponse response, }); } else { if (isFail(response, functionToken)) { + foundFail = true; runFunctionData(owner, functionToken.getFunctions(), playerWrapper) .whenComplete((dataResponse, ex) -> { if (ex != null) { @@ -175,6 +178,8 @@ private void recurFunctionNodes(FunctionResponse response, playerWrapper, future, returnValue); } }); + } else if(i == functionNodes.size() - 1 && !foundFail) { + future.complete(returnValue.get()); } } } diff --git a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java index a5f11e741..855ed1a03 100644 --- a/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java +++ b/core/src/test/java/com/clubobsidian/dynamicgui/core/test/manager/FunctionManagerTest.java @@ -161,4 +161,13 @@ public void testNoFunctionType() throws ExecutionException, InterruptedException boolean result = FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper).get(); assertTrue(result); } + + @Test + public void testFailNoFailType() throws ExecutionException, InterruptedException { + MockPlayerWrapper playerWrapper = this.getFactory().createPlayer(); + Gui gui = GuiManager.get().getGui("test-fail-no-fail-type"); + Slot slot = gui.getSlots().get(0); + boolean result = FunctionManager.get().tryFunctions(slot, FunctionType.LOAD, playerWrapper).get(); + assertFalse(result); + } } \ No newline at end of file From 5b5ef76e03923fbbb2ea7b310c312c189b45fd4c Mon Sep 17 00:00:00 2001 From: virustotalop Date: Sun, 8 May 2022 00:05:00 -0700 Subject: [PATCH 261/261] Fix slot number --- core/mock_data/guis/test-fail-no-fail-type.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/mock_data/guis/test-fail-no-fail-type.yml b/core/mock_data/guis/test-fail-no-fail-type.yml index 6957eb13a..15bfce11e 100644 --- a/core/mock_data/guis/test-fail-no-fail-type.yml +++ b/core/mock_data/guis/test-fail-no-fail-type.yml @@ -2,7 +2,7 @@ title: "&cTest" rows: 6 mode: set -'1': +'0': icon: "DIRT" amount: 1 functions: