mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Add some more mmodebug related to furnaces
This commit is contained in:
parent
70c934fa69
commit
567a5461e1
@ -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<Furnace, OfflinePlayer> furnaceOwners;
|
||||
private final HashMap<Furnace, OfflinePlayer> 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user