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,10 +73,14 @@ 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);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
SmeltingManager smeltingManager = new SmeltingManager(player);
|
||||||
smeltingManager.fuelEfficiency(event);
|
smeltingManager.fuelEfficiency(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
||||||
@ -84,10 +89,14 @@ 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);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
SmeltingManager smeltingManager = new SmeltingManager(player);
|
||||||
smeltingManager.smeltProcessing(event);
|
smeltingManager.smeltProcessing(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user