diff --git a/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java b/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java index 6fa99bed8..761e8714e 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java @@ -1,11 +1,14 @@ package com.gmail.nossr50.util.skills; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.smelting.Smelting; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Permissions; +import com.gmail.nossr50.util.player.UserManager; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; import org.bukkit.block.Furnace; import org.bukkit.entity.Player; @@ -17,13 +20,45 @@ import java.util.HashMap; public class SmeltingTracker { - private HashMap furnaceOwners; + private final HashMap furnaceOwners; public SmeltingTracker() { furnaceOwners = new HashMap<>(); } private void changeFurnaceOwnership(Furnace furnace, Player player) { + + McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); + + /* + Debug output + */ + if(mcMMOPlayer != null) { + if(mcMMOPlayer.isDebugMode()) { + mcMMOPlayer.getPlayer().sendMessage("Furnace ownership " + + ChatColor.GREEN +"gained " + ChatColor.RESET + + "at location: " + furnace.getLocation().toString()); + } + + if(furnaceOwners.get(furnace) != null) { + OfflinePlayer furnaceOwner = furnaceOwners.get(furnace); + + if(furnaceOwner.isOnline()) { + McMMOPlayer furnaceOwnerProfile = UserManager.getPlayer(furnaceOwner.getPlayer()); + + if(furnaceOwnerProfile != null) { + if(furnaceOwnerProfile.isDebugMode()) { + furnaceOwnerProfile.getPlayer().sendMessage("Furnace ownership " + + ChatColor.RED + "lost " + ChatColor.RESET + + "at location: " + furnace.getLocation().toString()); + } + } + } + } + } + + + furnaceOwners.put(furnace, player); }