8.10.4 release

This commit is contained in:
mfnalex 2020-06-14 20:02:24 +02:00
parent fa898f66f4
commit 73f361651f
4 changed files with 21 additions and 9 deletions

View File

@ -1,4 +1,7 @@
# Changelog
## 8.10.4
- Fixed exception when sorting inventories in 1.8 because Inventory.getLocation() did not exist yet
## 8.10.3
- Fixed exception when using the left-/right-click hotkey while using PaperMC instead of Spigot

View File

@ -9,7 +9,7 @@
<name>JeffChestSort</name>
<url>https://www.chestsort.de</url>
<description>Automatically sorts your chests!</description>
<version>8.10.3</version>
<version>8.10.4</version>
<packaging>jar</packaging>
<properties>

View File

@ -387,16 +387,25 @@ public class ChestSortOrganizer {
// Sort an inventory only between startSlot and endSlot
void sortInventory(Inventory inv, int startSlot, int endSlot) {
if(inv.getLocation() != null) {
ChestSortEvent chestSortEvent = new ChestSortEvent(inv);
chestSortEvent.loc = inv.getLocation();
Bukkit.getPluginManager().callEvent(chestSortEvent);
if (chestSortEvent.isCancelled()) {
return;
Class<? extends Inventory> invClass = inv.getClass();
try {
if(invClass.getMethod("getLocation", null) != null) {
// This whole try/catch fixes MethodNotFoundException when using inv.getLocation in Spigot 1.8.
}
if(inv.getLocation() != null) {
ChestSortEvent chestSortEvent = new ChestSortEvent(inv);
chestSortEvent.loc = inv.getLocation();
Bukkit.getPluginManager().callEvent(chestSortEvent);
if (chestSortEvent.isCancelled()) {
return;
}
}
} catch (NoSuchMethodException | SecurityException | IllegalStateException e) {
// TODO Auto-generated catch block
}
if (plugin.debug) {
System.out.println(" ");
System.out.println(" ");

View File

@ -1,6 +1,6 @@
main: de.jeff_media.ChestSort.ChestSortPlugin
name: ChestSort
version: 8.10.3
version: 8.10.4
api-version: 1.13
description: Allows automatic chest sorting
author: mfnalex