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,36 +54,33 @@ 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 (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
return;
}
if(player != null) { McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
return; if(mmoPlayer != null) {
boolean debugMode = mmoPlayer.isDebugMode();
if(debugMode) {
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
player.sendMessage("Furnace - "+furnace.hashCode());
player.sendMessage("Furnace Type: "+furnaceBlock.getType());
player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime());
} }
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); event.setBurnTime(mmoPlayer.getSmeltingManager().fuelEfficiency(event.getBurnTime()));
if(mmoPlayer != null) { if(debugMode) {
boolean debugMode = player.isOnline() && mmoPlayer.isDebugMode(); player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
player.sendMessage("");
if(debugMode) {
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
player.sendMessage("Furnace - "+furnace.hashCode());
player.sendMessage("Furnace Type: "+furnaceBlock.getType().toString());
player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime());
}
event.setBurnTime(mmoPlayer.getSmeltingManager().fuelEfficiency(event.getBurnTime()));
if(debugMode) {
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
player.sendMessage("");
}
} }
} }
} }