From c4f6f37c3df52b026ba5d5819a23f52459b9c865 Mon Sep 17 00:00:00 2001
From: mfnalex <1122571+mfnalex@users.noreply.github.com>
Date: Sat, 5 Feb 2022 10:02:48 +0100
Subject: [PATCH] 13.0.0
---
HOW_TO_USE_API.md | 4 +--
pom.xml | 2 +-
.../chestsort/api/ChestSortPostSortEvent.java | 30 +++++++++++++++++++
.../handlers/ChestSortOrganizer.java | 4 +++
.../chestsort/listeners/Listener.java | 2 ++
5 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 src/main/java/de/jeff_media/chestsort/api/ChestSortPostSortEvent.java
diff --git a/HOW_TO_USE_API.md b/HOW_TO_USE_API.md
index f01614d..cb8fd13 100644
--- a/HOW_TO_USE_API.md
+++ b/HOW_TO_USE_API.md
@@ -21,7 +21,7 @@ You can use maven to add ChestSort as a dependency to your Spigot-/Bukkit-Plugin
de.jeff_media
ChestSortAPI
- 12.0.0
+ 13.0.0-SNAPSHOT
provided
@@ -130,7 +130,7 @@ ChestSortAPI.setUnsortable(myInventory);
## Javadocs, Source code, Example plugin & Discord
There are more methods you can use, just have a look at the Javadocs.
-- [ChestSortAPI Javadocs](https://repo.jeff-media.de/javadocs/ChestSortAPI).
+- [ChestSortAPI Javadocs](https://hub.jeff-media.de/javadocs/chestsortapi).
- [ChestSortAPI source code](https://github.com/JEFF-Media-GbR/Spigot-ChestSortAPI).
Here is a complete example plugin that shows to add and use the ChestSort API: [LINK](https://github.com/JEFF-Media-GbR/ChestSortAPIExample)
diff --git a/pom.xml b/pom.xml
index 38643f8..52f4fde 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
ChestSort
https://www.chestsort.de
Allows automatic chest sorting!
- 12.1.4
+ 13.0.0
jar
diff --git a/src/main/java/de/jeff_media/chestsort/api/ChestSortPostSortEvent.java b/src/main/java/de/jeff_media/chestsort/api/ChestSortPostSortEvent.java
new file mode 100644
index 0000000..23b738a
--- /dev/null
+++ b/src/main/java/de/jeff_media/chestsort/api/ChestSortPostSortEvent.java
@@ -0,0 +1,30 @@
+package de.jeff_media.chestsort.api;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.Inventory;
+import org.jetbrains.annotations.NotNull;
+
+public class ChestSortPostSortEvent extends Event {
+
+ private static final HandlerList HANDLERS = new HandlerList();
+ private final ChestSortEvent event;
+
+ public ChestSortPostSortEvent(ChestSortEvent event) {
+ this.event = event;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLERS;
+ }
+
+ public static HandlerList getHandlerList() {
+ return HANDLERS;
+ }
+
+ public ChestSortEvent getChestSortEvent() {
+ return event;
+ }
+}
diff --git a/src/main/java/de/jeff_media/chestsort/handlers/ChestSortOrganizer.java b/src/main/java/de/jeff_media/chestsort/handlers/ChestSortOrganizer.java
index f97f828..827b177 100644
--- a/src/main/java/de/jeff_media/chestsort/handlers/ChestSortOrganizer.java
+++ b/src/main/java/de/jeff_media/chestsort/handlers/ChestSortOrganizer.java
@@ -2,6 +2,7 @@ package de.jeff_media.chestsort.handlers;
import de.jeff_media.chestsort.api.ChestSortEvent;
import de.jeff_media.chestsort.ChestSortPlugin;
+import de.jeff_media.chestsort.api.ChestSortPostSortEvent;
import de.jeff_media.chestsort.data.Category;
import de.jeff_media.chestsort.hooks.CrackShotHook;
import de.jeff_media.chestsort.hooks.InventoryPagesHook;
@@ -623,6 +624,9 @@ public class ChestSortOrganizer {
currentSlot++;
}
plugin.debug("Sorting successful. I'll go back to bed now.");
+
+ Bukkit.getPluginManager().callEvent(new ChestSortPostSortEvent(chestSortEvent));
+
}
public void updateInventoryView(InventoryClickEvent event) {
diff --git a/src/main/java/de/jeff_media/chestsort/listeners/Listener.java b/src/main/java/de/jeff_media/chestsort/listeners/Listener.java
index e43a28e..e311aa3 100644
--- a/src/main/java/de/jeff_media/chestsort/listeners/Listener.java
+++ b/src/main/java/de/jeff_media/chestsort/listeners/Listener.java
@@ -749,6 +749,8 @@ public class Listener implements org.bukkit.event.Listener {
//plugin.organizer.sortInventory(e.getInventory());
plugin.getOrganizer().updateInventoryView(e.getInventory());
plugin.getOrganizer().updateInventoryView(p.getInventory());
+
+ Bukkit.getPluginManager().callEvent(new ChestSortPostSortEvent(chestSortEvent));
}