From fda2597976348de532d2023a567d3796d086a5eb Mon Sep 17 00:00:00 2001
From: mfnalex <1122571+mfnalex@users.noreply.github.com>
Date: Fri, 26 Jun 2020 01:56:14 +0200
Subject: [PATCH] 8.12.2 release
---
CHANGELOG.md | 3 +++
pom.xml | 2 +-
.../java/de/jeff_media/ChestSort/ChestSortOrganizer.java | 8 ++++++--
src/main/resources/plugin.yml | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 166890f..62bb751 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,7 @@
# Changelog
+## 8.12.2
+- Fixes NullPointerException when using EssentialsX' /ec command in Minecraft 1.12
+
## 8.12.0
- Changed name of command /chestsort to /sort. You can still use /chestsort though.
- Fixed weird config updater problem on systems that don't properly support UTF-8 (like Windows)
diff --git a/pom.xml b/pom.xml
index 903cb99..d6cdc65 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
JeffChestSort
https://www.chestsort.de
Automatically sorts your chests!
- 8.12.1
+ 8.12.2
jar
diff --git a/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java b/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java
index 0c98faa..6e44f75 100644
--- a/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java
+++ b/src/main/java/de/jeff_media/ChestSort/ChestSortOrganizer.java
@@ -18,6 +18,7 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
+import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileNotFoundException;
@@ -399,7 +400,7 @@ public class ChestSortOrganizer {
}
// Sort an inventory only between startSlot and endSlot
- void sortInventory(Inventory inv, int startSlot, int endSlot) {
+ void sortInventory(@NotNull Inventory inv, int startSlot, int endSlot) {
if(inv==null) return;
Class extends Inventory> invClass = inv.getClass();
try {
@@ -414,7 +415,10 @@ public class ChestSortOrganizer {
return;
}
}
- } catch (NoSuchMethodException | SecurityException | IllegalStateException e) {
+ } catch (Throwable throwable) {
+ //System.out.println("Exception cought");
+ // I dont know, but this inv.getLocation() causes a NullPointerException when using EssentialsX's /ec command in 1.12
+ // Don't ask me why, but everything still works as expected if we catch that Exception.
// TODO Auto-generated catch block
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 62f5317..f21426d 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
main: de.jeff_media.ChestSort.ChestSortPlugin
name: ChestSort
-version: 8.12.1
+version: 8.12.2
api-version: "1.13"
description: Allows automatic chest sorting
author: mfnalex