Selaa lähdekoodia

Properly fixed the NPE in dropItem
It was due to bad logic in Herbalism

bm01 12 vuotta sitten
vanhempi
sitoutus
6d871c9bdb

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java

@@ -196,7 +196,7 @@ public class Herbalism {
             if (chance > Misc.getRandom().nextInt(activationChance)) {
             if (chance > Misc.getRandom().nextInt(activationChance)) {
                 Location location = block.getLocation();
                 Location location = block.getLocation();
 
 
-                if (herbalismBlock != null && herbalismBlock.canDoubleDrop()) {
+                if (dropItem != null && herbalismBlock.canDoubleDrop()) {
                     Misc.dropItems(location, dropItem, dropAmount);
                     Misc.dropItems(location, dropItem, dropAmount);
                 }
                 }
                 else if (customBlock != null){
                 else if (customBlock != null){

+ 1 - 1
src/main/java/com/gmail/nossr50/util/Misc.java

@@ -344,7 +344,7 @@ public final class Misc {
      */
      */
     public static void dropItem(Location location, ItemStack itemStack) {
     public static void dropItem(Location location, ItemStack itemStack) {
 
 
-        if (itemStack == null || itemStack.getType() == Material.AIR) {
+        if (itemStack.getType() == Material.AIR) {
             return;
             return;
         }
         }