This commit is contained in:
mfnalex 2022-02-05 10:02:48 +01:00
parent 33283a3360
commit c4f6f37c3d
5 changed files with 39 additions and 3 deletions

View File

@ -21,7 +21,7 @@ You can use maven to add ChestSort as a dependency to your Spigot-/Bukkit-Plugin
<dependency> <dependency>
<groupId>de.jeff_media</groupId> <groupId>de.jeff_media</groupId>
<artifactId>ChestSortAPI</artifactId> <artifactId>ChestSortAPI</artifactId>
<version>12.0.0</version> <version>13.0.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -130,7 +130,7 @@ ChestSortAPI.setUnsortable(myInventory);
## Javadocs, Source code, Example plugin & Discord ## Javadocs, Source code, Example plugin & Discord
There are more methods you can use, just have a look at the Javadocs. 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). - [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) Here is a complete example plugin that shows to add and use the ChestSort API: [LINK](https://github.com/JEFF-Media-GbR/ChestSortAPIExample)

View File

@ -9,7 +9,7 @@
<name>ChestSort</name> <name>ChestSort</name>
<url>https://www.chestsort.de</url> <url>https://www.chestsort.de</url>
<description>Allows automatic chest sorting!</description> <description>Allows automatic chest sorting!</description>
<version>12.1.4</version> <version>13.0.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

View File

@ -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;
}
}

View File

@ -2,6 +2,7 @@ package de.jeff_media.chestsort.handlers;
import de.jeff_media.chestsort.api.ChestSortEvent; import de.jeff_media.chestsort.api.ChestSortEvent;
import de.jeff_media.chestsort.ChestSortPlugin; 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.data.Category;
import de.jeff_media.chestsort.hooks.CrackShotHook; import de.jeff_media.chestsort.hooks.CrackShotHook;
import de.jeff_media.chestsort.hooks.InventoryPagesHook; import de.jeff_media.chestsort.hooks.InventoryPagesHook;
@ -623,6 +624,9 @@ public class ChestSortOrganizer {
currentSlot++; currentSlot++;
} }
plugin.debug("Sorting successful. I'll go back to bed now."); plugin.debug("Sorting successful. I'll go back to bed now.");
Bukkit.getPluginManager().callEvent(new ChestSortPostSortEvent(chestSortEvent));
} }
public void updateInventoryView(InventoryClickEvent event) { public void updateInventoryView(InventoryClickEvent event) {

View File

@ -749,6 +749,8 @@ public class Listener implements org.bukkit.event.Listener {
//plugin.organizer.sortInventory(e.getInventory()); //plugin.organizer.sortInventory(e.getInventory());
plugin.getOrganizer().updateInventoryView(e.getInventory()); plugin.getOrganizer().updateInventoryView(e.getInventory());
plugin.getOrganizer().updateInventoryView(p.getInventory()); plugin.getOrganizer().updateInventoryView(p.getInventory());
Bukkit.getPluginManager().callEvent(new ChestSortPostSortEvent(chestSortEvent));
} }