mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 08:39:49 +01:00
Fix NPE when a furnace belonging to a player that has logged out keeps
burning.
This commit is contained in:
parent
76a987e1e0
commit
8736aae2ef
@ -2,6 +2,7 @@ package com.gmail.nossr50.listeners;
|
|||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -72,8 +73,12 @@ public class InventoryListener implements Listener{
|
|||||||
ItemStack smelting = inventory.getSmelting();
|
ItemStack smelting = inventory.getSmelting();
|
||||||
|
|
||||||
if (plugin.furnaceIsTracked(furnaceBlock) && smelting != null && ItemChecks.isSmeltable(smelting)) {
|
if (plugin.furnaceIsTracked(furnaceBlock) && smelting != null && ItemChecks.isSmeltable(smelting)) {
|
||||||
SmeltingManager smeltingManager = new SmeltingManager(plugin.getFurnacePlayer(furnaceBlock));
|
Player player = plugin.getFurnacePlayer(furnaceBlock);
|
||||||
smeltingManager.fuelEfficiency(event);
|
|
||||||
|
if (player != null) {
|
||||||
|
SmeltingManager smeltingManager = new SmeltingManager(player);
|
||||||
|
smeltingManager.fuelEfficiency(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +89,12 @@ public class InventoryListener implements Listener{
|
|||||||
ItemStack smelting = inventory.getSmelting();
|
ItemStack smelting = inventory.getSmelting();
|
||||||
|
|
||||||
if (plugin.furnaceIsTracked(furnaceBlock) && smelting != null && ItemChecks.isSmeltable(smelting)) {
|
if (plugin.furnaceIsTracked(furnaceBlock) && smelting != null && ItemChecks.isSmeltable(smelting)) {
|
||||||
SmeltingManager smeltingManager = new SmeltingManager(plugin.getFurnacePlayer(furnaceBlock));
|
Player player = plugin.getFurnacePlayer(furnaceBlock);
|
||||||
smeltingManager.smeltProcessing(event);
|
|
||||||
|
if (player != null) {
|
||||||
|
SmeltingManager smeltingManager = new SmeltingManager(player);
|
||||||
|
smeltingManager.smeltProcessing(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user