浏览代码

Fixed Alchemy XP Gain

nossr50 6 年之前
父节点
当前提交
bdfac28b44

+ 1 - 0
Changelog.txt

@@ -8,6 +8,7 @@ Key:
   - Removal
   - Removal
 
 
 Version 2.1.4
 Version 2.1.4
+    Fixed a bug where Alchemy didn't gain XP
     Temporarily disabled Flux Mining
     Temporarily disabled Flux Mining
     Removed XP from entities that target endermite to prevent easy exploitation (Credits to TheBentoBox for the tip!) [Can be turned off in experience.yml]
     Removed XP from entities that target endermite to prevent easy exploitation (Credits to TheBentoBox for the tip!) [Can be turned off in experience.yml]
     Fixed a bug where static chance skills like Arcane Salvage were using incorrect calculations for success
     Fixed a bug where static chance skills like Arcane Salvage were using incorrect calculations for success

+ 8 - 10
src/main/java/com/gmail/nossr50/listeners/InventoryListener.java

@@ -178,20 +178,18 @@ public class InventoryListener implements Listener {
 
 
         Inventory inventory = event.getInventory();
         Inventory inventory = event.getInventory();
 
 
-        Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
-
-        if (furnaceBlock == null) {
-            return;
-        }
-
         if(event.getWhoClicked() instanceof Player)
         if(event.getWhoClicked() instanceof Player)
         {
         {
             Player player = ((Player) event.getWhoClicked()).getPlayer();
             Player player = ((Player) event.getWhoClicked()).getPlayer();
-            
-            if(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
-                furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
+            Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
+
+            if (furnaceBlock != null)
+            {
+                if (furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
+                    furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
 
 
-            furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
+                furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
+            }
         }
         }
 
 
         if (!(inventory instanceof BrewerInventory)) {
         if (!(inventory instanceof BrewerInventory)) {

+ 1 - 0
src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java

@@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 import com.gmail.nossr50.datatypes.skills.SubSkillType;
 import com.gmail.nossr50.datatypes.skills.SubSkillType;
 import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
 import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
+import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.skills.SkillManager;
 import com.gmail.nossr50.skills.SkillManager;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.StringUtils;
 import com.gmail.nossr50.util.skills.RankUtils;
 import com.gmail.nossr50.util.skills.RankUtils;