Browse Source

Fix array out of bounds

nossr50 5 years ago
parent
commit
039eb0ee9e
3 changed files with 13 additions and 2 deletions
  1. 6 0
      Changelog.txt
  2. 1 1
      pom.xml
  3. 6 1
      src/main/java/com/gmail/nossr50/listeners/InventoryListener.java

+ 6 - 0
Changelog.txt

@@ -1,3 +1,9 @@
+Version 2.1.133
+    A fix for an 'array out of bounds' error related to players clicking outside the inventory windows has been fixed
+    French locale has been updated (thanks Elikill58)
+    Another fix has been deployed to prevent mobs from having hearts in player death messages (thanks FrankHeijden)
+    Players no longer ready their tool if they don't have access to the skill (thanks Draycia)
+
 Version 2.1.132
     A fix is in place to prevent an exploit from working that is due to a yet to be patched Spigot server software bug
     Fixed a NPE that could happen when players swapped items from their hotbar

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
-    <version>2.1.132</version>
+    <version>2.1.133-SNAPSHOT</version>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>

+ 6 - 1
src/main/java/com/gmail/nossr50/listeners/InventoryListener.java

@@ -436,7 +436,12 @@ public class InventoryListener implements Listener {
     public void onInventoryClickEvent(InventoryClickEvent event) {
         SkillUtils.removeAbilityBuff(event.getCurrentItem());
         if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
-            if(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) != null)
+            if(event.getHotbarButton() == -1)
+                return;
+
+            PlayerInventory playerInventory = event.getWhoClicked().getInventory();
+
+            if(playerInventory.getItem(event.getHotbarButton()) != null)
                 SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
         }
     }