diff --git a/labyrinth-common/pom.xml b/labyrinth-common/pom.xml index 68a6a4d2..d94cc7ee 100644 --- a/labyrinth-common/pom.xml +++ b/labyrinth-common/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/FileManager.java b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/FileManager.java index f1fb304d..a1308ed6 100644 --- a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/FileManager.java +++ b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/FileManager.java @@ -84,6 +84,17 @@ public void write(Consumer table) { write(t); } + /** + * Set/Replace & save multiple keyed value spaces within this file. + * + * @see FileManager#write(DataTable, boolean) + * @param table The data table to use when setting values. + */ + @Note("You can create a fresh DataTable really easily see DataTable#newTable()") + public void write(@Note("Provided table gets cleared upon finalization.") DataTable table) { + write(table, true); + } + /** * Set & save multiple keyed value spaces within this file. * @@ -95,19 +106,11 @@ public void write(Consumer table) { *

By default this method is set to override any already existing nodes store * within the configurable

* - * @param table The data table to use when setting values. - */ - @Note("You can create a fresh DataTable really easily see DataTable#newTable()") - public void write(@Note("Custom implementations will work here!") DataTable table) { - write(table, true); - } - - /** * @param replace Whether to replace already set values from file with ones from the table * @see FileManager#write(DataTable) */ @Note("You can create a fresh DataTable really easily see DataTable#newTable()") - public void write(@Note("Custom implementations will work here!") DataTable table, boolean replace) { + public void write(@Note("Provided table gets cleared upon finalization.") DataTable table, boolean replace) { for (Map.Entry entry : table.values().entrySet()) { if (replace) { if (entry.getValue().equals("NULL")) { @@ -123,67 +126,91 @@ public void write(@Note("Custom implementations will work here!") DataTable tabl } } } - // instantly clear up space (help GC) + // instantly clear up space (help GC, we don't need these elements anymore.) table.clear(); configuration.save(); } - public @NotNull FileManager toJSON(String name, String dir) { + /** + * Copy all values from this yml file to a json file of similar stature. + * + * @param name The new name of the file. + * @param dir The optional new directory, null places in base folder. + * @return a new json file containing all values from this yml file. + */ + public @NotNull FileManager toJSON(@NotNull String name, String dir) { FileManager n = FileList.search(plugin).get(name, dir, FileType.JSON); Configurable c = getRoot(); if (c instanceof YamlConfiguration) { - DataTable inquiry = DataTable.newTable(); - for (String entry : c.getKeys(true)) { - if (c.isNode(entry)) { - ConfigurationSection s = c.getNode(entry).get(ConfigurationSection.class); - for (String e : s.getKeys(true)) { - if (s.isConfigurationSection(e)) { - ConfigurationSection a = s.getConfigurationSection(e); - inquiry.set(e, a.get(e)); - } - } - } else { - inquiry.set(entry, c.getNode(entry).get()); - } - } - n.write(inquiry, false); + n.write(copy(), false); return n; } return this; } - public @NotNull FileManager toYaml(String name, String dir) { + /** + * Copy all values from this json file to a yml file of similar stature. + * + * @param name The new name of the file. + * @param dir The optional new directory, null places in base folder. + * @return a new yml file containing all values from this json file. + */ + public @NotNull FileManager toYaml(@NotNull String name, String dir) { FileManager n = FileList.search(plugin).get(name, dir, FileType.JSON); Configurable c = getRoot(); if (c instanceof JsonConfiguration) { - DataTable inquiry = DataTable.newTable(); - for (String entry : c.getKeys(true)) { - if (c.isNode(entry)) { - Node s = c.getNode(entry); - for (String e : s.getKeys(true)) { - if (s.isNode(e)) { - Node a = s.getNode(e); - inquiry.set(e, a.get()); - } - } - } else { - inquiry.set(entry, c.getNode(entry).get()); - } - } - n.write(inquiry, false); + n.write(copy(), false); return n; } return this; } + /** + * Copy all values from this yml file to a json file of similar stature. + * + * @return a new json file containing all values from this yml file. + */ public @NotNull FileManager toJSON() { return toJSON(getRoot().getName(), getRoot().getDirectory()); } + /** + * Copy all values from this json file to a yml file of similar stature. + * + * @return a new yml file containing all values from this json file. + */ public @NotNull FileManager toYaml() { return toYaml(getRoot().getName(), getRoot().getDirectory()); } + /** + * Move this file to another location. Retains all values but doesn't retain comments, only headers. + * *Automatically deletes old file when moved* + * + * @param dir The optional new directory to move to, null places in base folder. + * @return a new file containing all the values from this file. + */ + public @NotNull FileManager toMoved(String dir) { + // gotta love our api sometimes, just look at how clean it is to copy ALL values from a config to another location. + final FileManager n = FileList.search(plugin).get(getRoot().getName(), dir, getRoot().getType()); + Configurable c = getRoot(); + n.write(copy(), false); + c.delete(); + return n; + } + + /** + * Copy all contents to a datatable. + * + * @return a fresh datatable containing all values from this file. + */ + public @NotNull DataTable copy() { + Configurable c = getRoot(); + DataTable inquiry = DataTable.newTable(); + c.getValues(true).forEach(inquiry::set); + return inquiry; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/JsonConfiguration.java b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/JsonConfiguration.java index f812619f..80b5eff0 100644 --- a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/JsonConfiguration.java +++ b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/data/JsonConfiguration.java @@ -301,38 +301,11 @@ public Node getNode(String key) { @SuppressWarnings("unchecked") @Override public Set getKeys(boolean deep) { - Set keys = new HashSet<>(); - for (Object o : json.entrySet()) { - Map.Entry entry = (Map.Entry) o; - if (deep) { - if (entry.getValue() instanceof JSONObject) { - JSONObject obj = (JSONObject) entry.getValue(); - for (Object ob : obj.entrySet()) { - Map.Entry en = (Map.Entry) ob; - if (en.getValue() instanceof JSONObject) { - JSONObject j = (JSONObject) entry.getValue(); - for (Object e : j.entrySet()) { - Map.Entry ent = (Map.Entry) e; - if (ent.getValue() instanceof JSONObject) { - JSONObject ja = (JSONObject) ent.getValue(); - for (Object ex : ja.entrySet()) { - Map.Entry entr = (Map.Entry) ex; - keys.add(entry.getKey() + "." + en.getKey() + "." + ent.getKey() + "." + entr.getKey()); - } - } else { - keys.add(entry.getKey() + "." + en.getKey() + "." + ent.getKey()); - } - } - } else { - keys.add(entry.getKey() + "." + en.getKey()); - } - } - } else { - keys.add(entry.getKey()); - } - } else { - keys.add(entry.getKey()); - } + Set keys; + if (deep) { + return MapDecompressionUtils.getInstance().decompress((Set>)json.entrySet(), '.', null).toSet(); + } else { + keys = new HashSet<>((Set) json.keySet()); } return keys; } @@ -341,37 +314,13 @@ public Set getKeys(boolean deep) { @Override public Map getValues(boolean deep) { Map map = new HashMap<>(); - for (Object o : json.entrySet()) { - Map.Entry entry = (Map.Entry) o; - if (deep) { - if (entry.getValue() instanceof JSONObject) { - JSONObject obj = (JSONObject) entry.getValue(); - for (Object ob : obj.entrySet()) { - Map.Entry en = (Map.Entry) ob; - if (en.getValue() instanceof JSONObject) { - JSONObject j = (JSONObject) entry.getValue(); - for (Object e : j.entrySet()) { - Map.Entry ent = (Map.Entry) e; - if (ent.getValue() instanceof JSONObject) { - JSONObject ja = (JSONObject) ent.getValue(); - for (Object ex : ja.entrySet()) { - Map.Entry entr = (Map.Entry) ex; - map.put(entry.getKey() + "." + en.getKey() + "." + ent.getKey() + "." + entr.getKey(), entr.getValue()); - } - } else { - map.put(entry.getKey() + "." + en.getKey() + "." + ent.getKey(), ent.getValue()); - } - } - } else { - map.put(entry.getKey() + "." + en.getKey(), en.getValue()); - } - } - } else { - map.put(entry.getKey(), entry.getValue()); - } - } else { + if (deep) { + return MapDecompressionUtils.getInstance().decompress((Set>)json.entrySet(), '.', null).toMap(); + } else { + json.entrySet().forEach(e -> { + Map.Entry entry = (Map.Entry)e; map.put(entry.getKey(), entry.getValue()); - } + }); } return map; } diff --git a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/Disabled.java b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/Disabled.java index 1fff4ec1..7f65897e 100644 --- a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/Disabled.java +++ b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/Disabled.java @@ -9,6 +9,14 @@ /** * An annotation marking a {@link VentListener} subscription not valid for runtime usage. + * + * Example: + *
{@code
+ *    @Disabled
+ *    @Subscribe
+ *    public void onMyEvent(Vent e) {
+ *
+ *    }}
*/ @Documented @Retention(RetentionPolicy.RUNTIME) @@ -17,4 +25,6 @@ String until() default "N/A"; + + } diff --git a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/LabeledAs.java b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/LabeledAs.java index 3e72d013..7a2bae6d 100644 --- a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/LabeledAs.java +++ b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/LabeledAs.java @@ -7,6 +7,9 @@ import java.lang.annotation.Target; import org.jetbrains.annotations.NotNull; +/** + * An annotation that's capable of keying a class. Giving it a unique identifier. + */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) diff --git a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/VentListener.java b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/VentListener.java index 2e7c80f6..4f2c5fad 100644 --- a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/VentListener.java +++ b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/event/custom/VentListener.java @@ -27,8 +27,9 @@ * Wraps around any objects, detects methods annotated with {@link Subscribe} and creates SubscriberCalls with it. * Also, it recognises methods annotated with {@link Extend} and adds them to the method linking pool * Always has s string as key, which may be "null", when not specified by {@link LabeledAs}; + * + * @author Rigo */ - public class VentListener { /** diff --git a/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/formatting/pagination/AdvancedPagination.java b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/formatting/pagination/AdvancedPagination.java new file mode 100644 index 00000000..826ce083 --- /dev/null +++ b/labyrinth-common/src/main/java/com/github/sanctum/labyrinth/formatting/pagination/AdvancedPagination.java @@ -0,0 +1,168 @@ +package com.github.sanctum.labyrinth.formatting.pagination; + +import com.github.sanctum.labyrinth.data.ReplaceableKeyedValue; +import com.github.sanctum.labyrinth.data.TripleWideConsumer; +import com.github.sanctum.labyrinth.data.WideConsumer; +import com.github.sanctum.labyrinth.formatting.FancyMessage; +import com.github.sanctum.labyrinth.formatting.FancyMessageChain; +import java.util.Collection; +import java.util.Comparator; +import java.util.Map; +import java.util.function.Predicate; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +/** + * A predefined paginated template. + * + * @param The type of element + */ +public final class AdvancedPagination { + + private final AbstractPaginatedCollection collection; + private TripleWideConsumer, FancyMessage> format; + private WideConsumer header; + private WideConsumer footer; + private final Player player; + + public AdvancedPagination(Player target, Collection collection) { + this.collection = AbstractPaginatedCollection.of(collection); + this.player = target; + } + + public AdvancedPagination(Player target, Collection collection, Comparator comparator) { + this.collection = AbstractPaginatedCollection.of(collection).sort(comparator); + this.player = target; + } + + public AdvancedPagination(Player target, Collection collection, Comparator comparator, Predicate predicate) { + this.collection = AbstractPaginatedCollection.of(collection).sort(comparator).filter(predicate); + this.player = target; + } + + @SafeVarargs + public AdvancedPagination(Player target, T... collection) { + this.collection = AbstractPaginatedCollection.of(collection); + this.player = target; + } + + @SafeVarargs + public AdvancedPagination(Player target, Comparator comparator, T... collection) { + this.collection = AbstractPaginatedCollection.of(collection).sort(comparator); + this.player = target; + } + + @SafeVarargs + public AdvancedPagination(Player target, Comparator comparator, Predicate predicate, T... collection) { + this.collection = AbstractPaginatedCollection.of(collection).sort(comparator).filter(predicate); + this.player = target; + } + + public void setHeader(WideConsumer consumer) { + this.header = consumer; + } + + public void setFooter(WideConsumer consumer) { + this.footer = consumer; + } + + public void setFormat(TripleWideConsumer, FancyMessage> messageConsumer) { + this.format = messageConsumer; + } + + public void limit(int elements) { + this.collection.limit(elements); + } + + public int size() { + return collection.size(); + } + + private String calc(int i) { + String val = String.valueOf(i); + int size = String.valueOf(i).length(); + if (val.contains("-")) { + if (size == 2) { + val = "-0" + i; + } + } else { + if (size == 1) { + val = "0" + i; + } + } + return val; + } + + public void send(int page) { + Page p = collection.get(page); + int totalPages = collection.size(); + // Header here + FancyMessageChain chain = new FancyMessageChain(); + chain.append(header -> this.header.accept(player, header)); + int testing = 0; + if (page > 0) { + for (int i = page; i > 0; i--) { + if (i == page) continue; + testing += collection.get(i).size(); + } + } + for (int i = 0; i < p.size(); i++) { + T t = p.get(i); + // send each clan here. + FancyMessage message = new FancyMessage(); + format.accept(t, ReplaceableKeyedValue.of(page, testing + i + 1), message); + chain.append(message); + } + chain.append(footer -> this.footer.accept(player, footer)); + chain.append(footer -> { + FancyMessage pages = new FancyMessage(); + for (int i = page - 2; i < totalPages; i++) { + int finalI = i + 1; + if (pages.length() < 17) { + if (finalI == page) { + if (i == totalPages - 1) { + pages.then("&a&l" + calc(finalI)).hover("&cYou're already on this page."); + } else { + pages.then("&a&l" + calc(finalI)).hover("&cYou're already on this page.").then("&8..."); + } + } else { + if (i == totalPages - 1) { + if (String.valueOf(i).contains("-")) { + pages.then("&7" + calc(finalI)); + } else { + pages.then("&7" + calc(finalI)).action(() -> send(finalI)).hover("&6Click to goto this page."); + } + } else { + if (String.valueOf(i).contains("-")) { + pages.then("&7" + calc(finalI)).then("&8..."); + } else { + pages.then("&7" + calc(finalI)).action(() -> send(finalI)).hover("&6Click to goto this page.").then("&8..."); + } + } + } + } + } + if (page == 1 || page == 0) { + if (totalPages == 1) { + FancyMessage t = footer.then("«").color(ChatColor.DARK_GRAY).then(" ").append(pages); + t.then(" ").then("»").color(ChatColor.DARK_GRAY); + return; + } + FancyMessage t = footer.then("«").color(ChatColor.DARK_GRAY).then(" ").append(pages); + t.then(" ").then("»").action(() -> send(page + 1)).color(ChatColor.DARK_AQUA); + return; + } + if (page == totalPages) { + FancyMessage t = footer.then("«").action(() -> send(page - 1)).color(ChatColor.DARK_AQUA).then(" ").append(pages); + t.then(" ").then("»").color(ChatColor.DARK_GRAY); + return; + } + FancyMessage t = footer.then("«").action(() -> send(page - 1)).color(ChatColor.DARK_AQUA).then(" ").append(pages); + t.then(" ").then("»").action(() -> send(page + 1)).color(ChatColor.DARK_AQUA); + }); + chain.send(player).deploy(); + // Footer here + } + + +} diff --git a/labyrinth-gui/pom.xml b/labyrinth-gui/pom.xml index becc009e..4a949caa 100644 --- a/labyrinth-gui/pom.xml +++ b/labyrinth-gui/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/construct/Menu.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/construct/Menu.java index f1a39dee..174b4600 100644 --- a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/construct/Menu.java +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/construct/Menu.java @@ -4,7 +4,10 @@ import com.github.sanctum.labyrinth.api.Service; import com.github.sanctum.labyrinth.api.TaskService; import com.github.sanctum.labyrinth.data.container.PersistentContainer; +import com.github.sanctum.labyrinth.event.custom.Vent; import com.github.sanctum.labyrinth.formatting.UniformedComponents; +import com.github.sanctum.labyrinth.gui.unity.event.MenuClickEvent; +import com.github.sanctum.labyrinth.gui.unity.event.MenuDragItemEvent; import com.github.sanctum.labyrinth.gui.unity.impl.ClickElement; import com.github.sanctum.labyrinth.gui.unity.impl.ClosingElement; import com.github.sanctum.labyrinth.gui.unity.impl.InventoryElement; @@ -891,6 +894,13 @@ public void onDrag(InventoryDragEvent e) { if (e.getInventory().equals(target)) { e.setResult(Event.Result.DENY); } + + ItemStack attempt = e.getCursor() != null ? e.getCursor() : e.getOldCursor(); + ItemElement element = getInventory().getItem(attempt); + if (element == null) element = new ItemElement<>().setPlayerAdded(true).setParent(getInventory()).setElement(attempt); + MenuDragItemEvent event = new Vent.Call<>(new MenuDragItemEvent(Menu.this, (Player) e.getWhoClicked(), element)).run(); + if (event.isCancelled()) e.setCancelled(true); + } @EventHandler(priority = EventPriority.NORMAL) @@ -915,10 +925,15 @@ public void onClick(InventoryClickEvent e) { Player p = (Player) e.getWhoClicked(); if (e.getCurrentItem() != null) { ItemStack item = e.getCurrentItem(); - ItemElement element = getInventory().getItem(i -> i.getSlot().isPresent() && e.getRawSlot() == i.getSlot().get() && item.getType() == i.getElement().getType() && i.getType() != ItemElement.ControlType.ITEM_FILLER && i.getType() != ItemElement.ControlType.ITEM_BORDER); - if (element != null) { - Click click = element.getAttachment(); - ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), element, e.getCursor(), e.getView()); + ItemElement fixedSlotElement = getInventory().getItem(i -> i.getSlot().isPresent() && e.getRawSlot() == i.getSlot().get() && item.getType() == i.getElement().getType() && i.getType() != ItemElement.ControlType.ITEM_FILLER && i.getType() != ItemElement.ControlType.ITEM_BORDER); + if (fixedSlotElement != null) { + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, Menu.this, fixedSlotElement)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } + Click click = fixedSlotElement.getAttachment(); + ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), fixedSlotElement, e.getCursor(), e.getView()); if (click != null) { click.apply(clickElement); } @@ -931,11 +946,11 @@ public void onClick(InventoryClickEvent e) { } } - if (element.getType() != null) { + if (fixedSlotElement.getType() != null) { ClickElement.Consumer consumer = clickElement.getConsumer(); - switch (element.getType()) { + switch (fixedSlotElement.getType()) { case TAKEAWAY: - element.remove(false); + fixedSlotElement.remove(false); break; case BUTTON_EXIT: if (consumer != null) { @@ -1054,10 +1069,15 @@ public void onClick(InventoryClickEvent e) { } } else { - ItemElement el = getInventory().getItem(e.getRawSlot()); - if (el != null) { - Click click = el.getAttachment(); - ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), el, e.getCursor(), e.getView()); + ItemElement hotKeyElement = getInventory().getItem(e.getRawSlot()); + if (hotKeyElement != null) { + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, Menu.this, hotKeyElement)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } + Click click = hotKeyElement.getAttachment(); + ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), hotKeyElement, e.getCursor(), e.getView()); if (click != null) { click.apply(clickElement); } @@ -1071,11 +1091,11 @@ public void onClick(InventoryClickEvent e) { } } - if (el.getType() != null) { + if (hotKeyElement.getType() != null) { ClickElement.Consumer consumer = clickElement.getConsumer(); - switch (el.getType()) { + switch (hotKeyElement.getType()) { case TAKEAWAY: - el.remove(false); + hotKeyElement.remove(false); break; case BUTTON_EXIT: if (consumer != null) { @@ -1194,10 +1214,15 @@ public void onClick(InventoryClickEvent e) { } } - ItemElement element2 = getInventory().getItem(item); - if (element2 != null) { - Click click = element2.getAttachment(); - ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), element2, e.getCursor(), e.getView()); + ItemElement otherElement = getInventory().getItem(item); + if (otherElement != null) { + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, Menu.this, otherElement)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } + Click click = otherElement.getAttachment(); + ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), otherElement, e.getCursor(), e.getView()); if (click == null) { if (Menu.this.click != null) { Menu.this.click.apply(clickElement); @@ -1216,11 +1241,11 @@ public void onClick(InventoryClickEvent e) { } } - if (element2.getType() != null) { + if (otherElement.getType() != null) { ClickElement.Consumer consumer = clickElement.getConsumer(); - switch (element2.getType()) { + switch (otherElement.getType()) { case TAKEAWAY: - element2.remove(false); + otherElement.remove(false); break; case BUTTON_EXIT: if (consumer != null) { @@ -1342,6 +1367,11 @@ public void onClick(InventoryClickEvent e) { if (!e.isCancelled()) { ItemElement element1 = new ItemElement<>().setPlayerAdded(true).setParent(getInventory()).setElement(e.getCurrentItem()); + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, Menu.this, element1)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } if (getProperties().contains(Property.SHAREABLE)) { if (getInventory().isPaginated()) { InventoryElement.Paginated inv = (InventoryElement.Paginated) getInventory(); @@ -1380,6 +1410,11 @@ public void onClick(InventoryClickEvent e) { if (!e.isCancelled()) { ItemElement el = new ItemElement<>().setPlayerAdded(true).setParent(getInventory()).setElement(e.getCursor()); + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, Menu.this, el)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } if (getProperties().contains(Property.SHAREABLE)) { if (getInventory().isPaginated()) { InventoryElement.Paginated inv = (InventoryElement.Paginated) getInventory(); @@ -1476,6 +1511,18 @@ public void onOpen(InventoryOpenEvent e) { } } + @EventHandler(priority = EventPriority.NORMAL) + public void onDrag(InventoryDragEvent e) { + if (!(e.getInventory().getHolder() instanceof Instance)) return; + if (!(e.getWhoClicked() instanceof Player)) return; + Menu menu = ((Instance)e.getInventory().getHolder()).getMenu(); + ItemStack attempt = e.getCursor() != null ? e.getCursor() : e.getOldCursor(); + ItemElement element = menu.getInventory().getItem(attempt); + if (element == null) element = new ItemElement<>().setPlayerAdded(true).setParent(menu.getInventory()).setElement(attempt); + MenuDragItemEvent event = new Vent.Call<>(new MenuDragItemEvent(menu, (Player) e.getWhoClicked(), element)).run(); + if (event.isCancelled()) e.setCancelled(true); + } + @EventHandler(priority = EventPriority.NORMAL) public void onClick(InventoryClickEvent e) { if (!(e.getInventory().getHolder() instanceof Instance)) return; @@ -1489,10 +1536,15 @@ public void onClick(InventoryClickEvent e) { Player p = (Player) e.getWhoClicked(); if (e.getCurrentItem() != null) { ItemStack item = e.getCurrentItem(); - ItemElement element = menu.getInventory().getItem(i -> i.getSlot().isPresent() && e.getRawSlot() == i.getSlot().get() && item.getType() == i.getElement().getType() && i.getType() != ItemElement.ControlType.ITEM_FILLER && i.getType() != ItemElement.ControlType.ITEM_BORDER); - if (element != null) { - Click click = element.getAttachment(); - ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), element, e.getCursor(), e.getView()); + ItemElement fixedSlotElement = menu.getInventory().getItem(i -> i.getSlot().isPresent() && e.getRawSlot() == i.getSlot().get() && item.getType() == i.getElement().getType() && i.getType() != ItemElement.ControlType.ITEM_FILLER && i.getType() != ItemElement.ControlType.ITEM_BORDER); + if (fixedSlotElement != null) { + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, menu, fixedSlotElement)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } + Click click = fixedSlotElement.getAttachment(); + ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), fixedSlotElement, e.getCursor(), e.getView()); if (click != null) { click.apply(clickElement); } @@ -1505,11 +1557,11 @@ public void onClick(InventoryClickEvent e) { } } - if (element.getType() != null) { + if (fixedSlotElement.getType() != null) { ClickElement.Consumer consumer = clickElement.getConsumer(); - switch (element.getType()) { + switch (fixedSlotElement.getType()) { case TAKEAWAY: - element.remove(false); + fixedSlotElement.remove(false); break; case BUTTON_EXIT: if (consumer != null) { @@ -1628,10 +1680,15 @@ public void onClick(InventoryClickEvent e) { } } else { - ItemElement el = menu.getInventory().getItem(e.getRawSlot()); - if (el != null) { - Click click = el.getAttachment(); - ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), el, e.getCursor(), e.getView()); + ItemElement hotKeyElement = menu.getInventory().getItem(e.getRawSlot()); + if (hotKeyElement != null) { + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, menu, hotKeyElement)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } + Click click = hotKeyElement.getAttachment(); + ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), hotKeyElement, e.getCursor(), e.getView()); if (click != null) { click.apply(clickElement); } @@ -1645,11 +1702,11 @@ public void onClick(InventoryClickEvent e) { } } - if (el.getType() != null) { + if (hotKeyElement.getType() != null) { ClickElement.Consumer consumer = clickElement.getConsumer(); - switch (el.getType()) { + switch (hotKeyElement.getType()) { case TAKEAWAY: - el.remove(false); + hotKeyElement.remove(false); break; case BUTTON_EXIT: if (consumer != null) { @@ -1768,10 +1825,15 @@ public void onClick(InventoryClickEvent e) { } } - ItemElement element2 = menu.getInventory().getItem(item); - if (element2 != null) { - Click click = element2.getAttachment(); - ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), element2, e.getCursor(), e.getView()); + ItemElement otherElement = menu.getInventory().getItem(item); + if (otherElement != null) { + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, menu, otherElement)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } + Click click = otherElement.getAttachment(); + ClickElement clickElement = new ClickElement(p, e.getRawSlot(), e.getAction(), e.getClick(), otherElement, e.getCursor(), e.getView()); if (click == null) { if (menu.click != null) { menu.click.apply(clickElement); @@ -1790,11 +1852,11 @@ public void onClick(InventoryClickEvent e) { } } - if (element2.getType() != null) { + if (otherElement.getType() != null) { ClickElement.Consumer consumer = clickElement.getConsumer(); - switch (element2.getType()) { + switch (otherElement.getType()) { case TAKEAWAY: - element2.remove(false); + otherElement.remove(false); break; case BUTTON_EXIT: if (consumer != null) { @@ -1916,6 +1978,11 @@ public void onClick(InventoryClickEvent e) { if (!e.isCancelled()) { ItemElement element1 = new ItemElement<>().setPlayerAdded(true).setParent(menu.getInventory()).setElement(e.getCurrentItem()); + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, menu, element1)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } if (menu.getProperties().contains(Property.SHAREABLE)) { if (menu.getInventory().isPaginated()) { InventoryElement.Paginated inv = (InventoryElement.Paginated) menu.getInventory(); @@ -1954,6 +2021,11 @@ public void onClick(InventoryClickEvent e) { if (!e.isCancelled()) { ItemElement el = new ItemElement<>().setPlayerAdded(true).setParent(menu.getInventory()).setElement(e.getCursor()); + MenuClickEvent event = new Vent.Call<>(new MenuClickEvent(p, menu, el)).run(); + if (event.isCancelled()) { + e.setCancelled(true); + return; + } if (menu.getProperties().contains(Property.SHAREABLE)) { if (menu.getInventory().isPaginated()) { InventoryElement.Paginated inv = (InventoryElement.Paginated) menu.getInventory(); diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuClickEvent.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuClickEvent.java new file mode 100644 index 00000000..e971d6a5 --- /dev/null +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuClickEvent.java @@ -0,0 +1,26 @@ +package com.github.sanctum.labyrinth.gui.unity.event; + +import com.github.sanctum.labyrinth.gui.unity.construct.Menu; +import com.github.sanctum.labyrinth.gui.unity.impl.ItemElement; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +public class MenuClickEvent extends MenuInteractEvent { + final ItemElement itemElement; + final ItemStack item; + + public MenuClickEvent(@NotNull Player player, @NotNull Menu menu, @NotNull ItemElement itemElement) { + super(Type.CLICK, player, menu); + this.itemElement = itemElement; + this.item = itemElement.getElement(); + } + + public @NotNull ItemStack getItem() { + return item; + } + + public @NotNull ItemElement getItemElement() { + return itemElement; + } +} diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuDragItemEvent.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuDragItemEvent.java new file mode 100644 index 00000000..61de3462 --- /dev/null +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuDragItemEvent.java @@ -0,0 +1,26 @@ +package com.github.sanctum.labyrinth.gui.unity.event; + +import com.github.sanctum.labyrinth.gui.unity.construct.Menu; +import com.github.sanctum.labyrinth.gui.unity.impl.ItemElement; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +public class MenuDragItemEvent extends MenuInteractEvent { + final ItemElement itemElement; + final ItemStack item; + + public MenuDragItemEvent(@NotNull Menu menu, @NotNull Player player, @NotNull ItemElement itemElement) { + super(Type.DRAG, player, menu); + this.item = itemElement.getElement(); + this.itemElement = itemElement; + } + + public @NotNull ItemStack getItem() { + return item; + } + + public @NotNull ItemElement getItemElement() { + return itemElement; + } +} diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuEvent.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuEvent.java new file mode 100644 index 00000000..19790ebf --- /dev/null +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuEvent.java @@ -0,0 +1,22 @@ +package com.github.sanctum.labyrinth.gui.unity.event; + +import com.github.sanctum.labyrinth.event.custom.Vent; +import com.github.sanctum.labyrinth.gui.unity.construct.Menu; +import org.jetbrains.annotations.NotNull; + +public abstract class MenuEvent extends Vent { + final Menu menu; + + public MenuEvent(@NotNull Menu menu, boolean isAsync) { + super(isAsync); + this.menu = menu; + } + + public MenuEvent(@NotNull Menu menu) { + this(menu, false); + } + + public Menu getMenu() { + return menu; + } +} diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuInteractEvent.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuInteractEvent.java new file mode 100644 index 00000000..ab3be55f --- /dev/null +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/event/MenuInteractEvent.java @@ -0,0 +1,29 @@ +package com.github.sanctum.labyrinth.gui.unity.event; + +import com.github.sanctum.labyrinth.gui.unity.construct.Menu; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public abstract class MenuInteractEvent extends MenuEvent { + final Type type; + final Player player; + + public MenuInteractEvent(@NotNull Type type, @NotNull Player player, @NotNull Menu menu) { + super(menu); + this.player = player; + this.type = type; + } + + public @NotNull Player getPlayer() { + return player; + } + + public @NotNull Type getType() { + return type; + } + + public enum Type { + CLICK, DRAG + } + +} diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/AnvilDocket.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/AnvilDocket.java new file mode 100644 index 00000000..4258b8ae --- /dev/null +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/AnvilDocket.java @@ -0,0 +1,99 @@ +package com.github.sanctum.labyrinth.gui.unity.simple; + +import com.github.sanctum.labyrinth.LabyrinthProvider; +import com.github.sanctum.labyrinth.data.MemorySpace; +import com.github.sanctum.labyrinth.data.WideFunction; +import com.github.sanctum.labyrinth.data.service.Check; +import com.github.sanctum.labyrinth.gui.unity.construct.Menu; +import com.github.sanctum.labyrinth.gui.unity.construct.MenuRegistration; +import com.github.sanctum.labyrinth.gui.unity.impl.MenuType; +import com.github.sanctum.labyrinth.interfacing.UnknownGeneric; +import com.github.sanctum.labyrinth.library.Mailer; +import org.jetbrains.annotations.NotNull; + +public class AnvilDocket implements Docket, UniqueHolder { + + final MemorySpace memory; + String title; + MemoryItem item; + Object uniqueData; + WideFunction uniqueDataConverter; + Menu menu; + + public AnvilDocket(@NotNull MemorySpace memorySpace) { + this.memory = memorySpace; + } + + @Override + public AnvilDocket setUniqueDataConverter(@NotNull V data, @NotNull WideFunction function) { + this.uniqueData = data; + this.uniqueDataConverter = (WideFunction) function; + return this; + } + + @Override + public @NotNull Menu toMenu() { + return menu; + } + + @Override + public @NotNull AnvilDocket load() { + this.title = Check.forNull(memory.getNode("title").toPrimitive().getString(), "Configured menus cannot have null titles please correct under path '" + memory.getPath() + "'"); + if (uniqueData != null) { + this.title = uniqueDataConverter.accept(this.title, uniqueData); + } + this.item = new MemoryItem(memory.getNode("item")); + this.menu = MenuType.PRINTABLE.build() + .setTitle(title) + .setSize(Menu.Rows.ONE) + .setHost(LabyrinthProvider.getInstance().getPluginInstance()) + .setStock(i -> i.addItem(b -> b.setElement(it -> it.setItem(item.toItem()).build()).setSlot(0).setClick(c -> { + c.setCancelled(true); + c.setHotbarAllowed(false); + }))).join() + .addAction(click -> { + if (click.getSlot() == 2) { + if (item.isNotRemovable()) { + handleClickEvent(item, click.getParent().getName()).apply(click); + } + } + + }); + return this; + } + + protected Menu.Click handleClickEvent(MemoryItem item, String text) { + return click -> { + click.setCancelled(true); + if (item.isExitOnClick()) click.getParent().getParent().getParent().close(click.getElement()); + if (item.getMessage() != null) { + String message = item.getMessage().replace(":message:", text); + if (uniqueData != null) { + message = uniqueDataConverter.accept(message, uniqueData); + } + Mailer.empty(click.getElement()).chat(message).deploy(); + } + if (item.getOpenOnClick() != null) { + String open = item.getOpenOnClick(); + MenuRegistration registration = MenuRegistration.getInstance(); + Menu registered = registration.get(open).get(); + if (registered != null) { + registered.open(click.getElement()); + } else { + if (item.getOpenOnClick().startsWith("/")) { + String command = item.getOpenOnClick().replace("/", "").replace(":message:", text); + if (uniqueData != null) { + command = uniqueDataConverter.accept(command, uniqueData); + } + click.getElement().performCommand(command); + } + } + } + }; + } + + @Override + public @NotNull Type getType() { + return Type.MEMORY; + } +} diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/Docket.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/Docket.java index a47bc81c..d4507276 100644 --- a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/Docket.java +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/Docket.java @@ -36,6 +36,15 @@ public interface Docket extends JsonIntermediate { */ @NotNull Type getType(); + /** + * Check if this docket holds unique data. + * + * @return true if this docket handles unique data conversions. + */ + default boolean isUnique() { + return this instanceof UniqueHolder; + } + enum Type { /** * Defines a docket type that requires being built. diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryDocket.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryDocket.java index 9b41ed8d..d999505f 100644 --- a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryDocket.java +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryDocket.java @@ -41,7 +41,7 @@ * * @param The type of docket. */ -public class MemoryDocket implements Docket { +public class MemoryDocket implements Docket, UniqueHolder { protected final LabyrinthCollection> items = new LabyrinthList<>(); protected Plugin plugin = LabyrinthProvider.getInstance().getPluginInstance(); @@ -83,6 +83,7 @@ public MemoryDocket setFilter(Predicate predicate) { return this; } + @Override @Note("This method is used for translating player names for skull items, it is expected to be the placeholder for returning a player username and is used in tandem with a Unique Data Converter") public MemoryDocket setNamePlaceholder(@NotNull String placeholder) { this.nameHolder = placeholder; @@ -95,6 +96,7 @@ public MemoryDocket setDataConverter(@NotNull WideFunction return this; } + @Override @Note("This method is used for setting up unique translations. Example; a singular parent object being attached for extra placeholders.") public MemoryDocket setUniqueDataConverter(@NotNull V t, @NotNull WideFunction function) { this.uniqueData = t; @@ -103,7 +105,7 @@ public MemoryDocket setUniqueDataConverter(@NotNull V t, @NotNull WideFun } @Override - public @NotNull Docket load() { + public @NotNull MemoryDocket load() { this.title = Check.forNull(memory.getNode("title").toPrimitive().getString(), "Configured menus cannot have null titles please correct under path '" + memory.getPath() + "'"); if (this.uniqueData != null) { this.title = uniqueDataConverter.accept(title, uniqueData); diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryItem.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryItem.java index 4342fc51..73f52bd6 100644 --- a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryItem.java +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/MemoryItem.java @@ -4,6 +4,7 @@ import com.github.sanctum.labyrinth.data.Node; import com.github.sanctum.labyrinth.data.container.LabyrinthCollection; import com.github.sanctum.labyrinth.data.container.LabyrinthList; +import com.github.sanctum.labyrinth.data.service.Check; import com.github.sanctum.labyrinth.library.Item; import com.github.sanctum.labyrinth.library.Items; import com.github.sanctum.labyrinth.library.StringUtils; @@ -20,14 +21,14 @@ public class MemoryItem { - private final Node node; - private Map replacements; - private boolean notRemovable; - private boolean exitOnClick; - private String openOnClick; - private String message; - private int slot = -1; - private int limit = 5; + protected final Node node; + protected Map replacements; + protected boolean notRemovable; + protected boolean exitOnClick; + protected String openOnClick; + protected String message; + protected int slot = -1; + protected int limit = 5; public MemoryItem(Node node) { this.node = node; @@ -76,7 +77,9 @@ private ItemStack improvise(String value) { } public @NotNull ItemStack toItem() { - Item.Edit edit = new Item.Edit(improvise(node.getNode("type").toPrimitive().getString())); + String type = node.getNode("type").toPrimitive().getString(); + ItemStack test = improvise(type); + Item.Edit edit = new Item.Edit(Check.forNull(test, "Item '" + type + "' not found. Key:" + node.getPath())); String label = node.getPath(); String[] split = label.split("\\."); String c = split[split.length - 1]; diff --git a/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/UniqueHolder.java b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/UniqueHolder.java new file mode 100644 index 00000000..3aa374ba --- /dev/null +++ b/labyrinth-gui/src/main/java/com/github/sanctum/labyrinth/gui/unity/simple/UniqueHolder.java @@ -0,0 +1,17 @@ +package com.github.sanctum.labyrinth.gui.unity.simple; + +import com.github.sanctum.labyrinth.data.WideFunction; +import org.jetbrains.annotations.NotNull; + +/** + * An extension interface for {@link Docket}, use to signify this as a unique data dependent. + */ +public interface UniqueHolder { + + Docket setUniqueDataConverter(@NotNull V data, @NotNull WideFunction function); + + default Docket setNamePlaceholder(@NotNull String placeholder) { + return null; + } + +} diff --git a/labyrinth-paste/pom.xml b/labyrinth-paste/pom.xml index 1de0d55c..ebf520e6 100644 --- a/labyrinth-paste/pom.xml +++ b/labyrinth-paste/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-perms/pom.xml b/labyrinth-perms/pom.xml index 73755e3f..f771edd1 100644 --- a/labyrinth-perms/pom.xml +++ b/labyrinth-perms/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-placeholders/pom.xml b/labyrinth-placeholders/pom.xml index 17f0d39a..3b05c628 100644 --- a/labyrinth-placeholders/pom.xml +++ b/labyrinth-placeholders/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-placeholders/src/main/java/com/github/sanctum/labyrinth/placeholders/PlaceholderTranslationUtility.java b/labyrinth-placeholders/src/main/java/com/github/sanctum/labyrinth/placeholders/PlaceholderTranslationUtility.java index b8bb35f3..6ead7b6d 100644 --- a/labyrinth-placeholders/src/main/java/com/github/sanctum/labyrinth/placeholders/PlaceholderTranslationUtility.java +++ b/labyrinth-placeholders/src/main/java/com/github/sanctum/labyrinth/placeholders/PlaceholderTranslationUtility.java @@ -264,8 +264,10 @@ public char end() { } else { PlaceholderRegistration.getInstance().runAction(conversion -> { String parameters = matcher.group("parameters"); - String translation = conversion.onTranslation(parameters, receiver != null ? receiver : () -> null); - matcher.appendReplacement(builder, translation != null && !translation.isEmpty() ? translation : (placeholder.start() + parameters + placeholder.end())); + if (parameters != null && !parameters.isEmpty()) { + String translation = conversion.onTranslation(parameters, receiver != null ? receiver : () -> null); + matcher.appendReplacement(builder, translation != null && !translation.isEmpty() ? translation : (placeholder.start() + parameters + placeholder.end())); + } }); } } while (matcher.find()); diff --git a/labyrinth-plugin/pom.xml b/labyrinth-plugin/pom.xml index 3fc0fda2..a4bab342 100644 --- a/labyrinth-plugin/pom.xml +++ b/labyrinth-plugin/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-plugin/src/main/java/com/github/sanctum/labyrinth/Labyrinth.java b/labyrinth-plugin/src/main/java/com/github/sanctum/labyrinth/Labyrinth.java index 1b04702a..42955d39 100644 --- a/labyrinth-plugin/src/main/java/com/github/sanctum/labyrinth/Labyrinth.java +++ b/labyrinth-plugin/src/main/java/com/github/sanctum/labyrinth/Labyrinth.java @@ -27,6 +27,7 @@ import com.github.sanctum.labyrinth.data.service.LabyrinthOption; import com.github.sanctum.labyrinth.data.service.PlayerSearch; import com.github.sanctum.labyrinth.event.custom.DefaultEvent; +import com.github.sanctum.labyrinth.event.custom.Disabled; import com.github.sanctum.labyrinth.event.custom.LabeledAs; import com.github.sanctum.labyrinth.event.custom.Subscribe; import com.github.sanctum.labyrinth.event.custom.Vent; @@ -79,6 +80,7 @@ import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; +import org.bukkit.boss.BossBar; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.serialization.ConfigurationSerialization; diff --git a/labyrinth-regions/pom.xml b/labyrinth-regions/pom.xml index 08518a73..04b753ec 100644 --- a/labyrinth-regions/pom.xml +++ b/labyrinth-regions/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/labyrinth-skulls/pom.xml b/labyrinth-skulls/pom.xml index f698b4cf..60541b67 100644 --- a/labyrinth-skulls/pom.xml +++ b/labyrinth-skulls/pom.xml @@ -5,7 +5,7 @@ labyrinth com.github.the-h-team - 1.7.8 + 1.7.9 4.0.0 diff --git a/pom.xml b/pom.xml index 3d6b8e19..f001e814 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.the-h-team labyrinth - 1.7.8 + 1.7.9 labyrinth-common labyrinth-gui