Fix burnTime debug prints on mmodebug players

This commit is contained in:
nossr50 2022-07-23 14:24:31 -07:00
parent e1a54b72a9
commit eb1393c02c

View File

@ -54,14 +54,12 @@ public class InventoryListener implements Listener {
} }
Furnace furnace = (Furnace) furnaceState; Furnace furnace = (Furnace) furnaceState;
OfflinePlayer offlinePlayer = mcMMO.getSmeltingTracker().getFurnaceOwner(furnace); OfflinePlayer offlinePlayer = mcMMO.getSmeltingTracker().getFurnaceOwner(furnace);
Player player;
if(offlinePlayer != null && offlinePlayer.isOnline()) { if(offlinePlayer != null && offlinePlayer.isOnline() && offlinePlayer instanceof Player) {
player = (Player) offlinePlayer;
Player player = Bukkit.getPlayer(offlinePlayer.getUniqueId());
if(player != null) {
if (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) { if (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
return; return;
} }
@ -69,12 +67,12 @@ public class InventoryListener implements Listener {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) { if(mmoPlayer != null) {
boolean debugMode = player.isOnline() && mmoPlayer.isDebugMode(); boolean debugMode = mmoPlayer.isDebugMode();
if(debugMode) { if(debugMode) {
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT"); player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
player.sendMessage("Furnace - "+furnace.hashCode()); player.sendMessage("Furnace - "+furnace.hashCode());
player.sendMessage("Furnace Type: "+furnaceBlock.getType().toString()); player.sendMessage("Furnace Type: "+furnaceBlock.getType());
player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime()); player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime());
} }
@ -87,7 +85,6 @@ public class InventoryListener implements Listener {
} }
} }
} }
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) { public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {