Fix issue where the vanilla XP boost for smelting would be called

regardless of who took the item out of the furnace. Not only does this
fix the exploit, it also fixes an NPE that could occur if the player who
lit the furnance was offline when someone else extracted the items from
it.
This commit is contained in:
GJ 2013-02-01 08:03:03 -05:00
parent 2762a9d1fd
commit 8c7fd7b1a6

View File

@ -17,6 +17,7 @@ import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.skills.smelting.SmeltingManager; import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.util.ItemChecks; import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -118,9 +119,13 @@ public class InventoryListener implements Listener{
ItemStack result = inventory.getResult(); ItemStack result = inventory.getResult();
if (plugin.furnaceIsTracked(furnaceBlock) && result != null && ItemChecks.isSmelted(result)) { if (plugin.furnaceIsTracked(furnaceBlock) && result != null && ItemChecks.isSmelted(result)) {
SmeltingManager smeltingManager = new SmeltingManager(Users.getPlayer(plugin.getFurnacePlayer(furnaceBlock))); McMMOPlayer mcMMOPlayer = Users.getPlayer(plugin.getFurnacePlayer(furnaceBlock));
if (event.getPlayer().equals(mcMMOPlayer.getPlayer())) {
SmeltingManager smeltingManager = new SmeltingManager(mcMMOPlayer);
smeltingManager.vanillaXPBoost(event); smeltingManager.vanillaXPBoost(event);
} }
} }
} }
} }
}