From d33c21426672efcc2b2f6234fae1547b529d1785 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 19 Mar 2021 12:44:03 -0700 Subject: [PATCH] Rollback UserManager to being static again --- .../nossr50/chat/SamePartyPredicate.java | 3 +- .../nossr50/database/DatabaseManager.java | 1 - .../database/FlatFileDatabaseManager.java | 1 - .../nossr50/database/SQLDatabaseManager.java | 2 +- .../skills/subskills/acrobatics/Roll.java | 8 ++-- .../McMMOPlayerExperienceEvent.java | 6 ++- .../events/skills/McMMOPlayerSkillEvent.java | 2 +- .../nossr50/listeners/BlockListener.java | 36 +++++++-------- .../nossr50/listeners/CommandListener.java | 2 +- .../nossr50/listeners/EntityListener.java | 44 +++++++++--------- .../nossr50/listeners/InventoryListener.java | 18 ++++---- .../nossr50/listeners/PlayerListener.java | 46 +++++++++---------- .../gmail/nossr50/listeners/SelfListener.java | 6 +-- src/main/java/com/gmail/nossr50/mcMMO.java | 10 ++-- .../com/gmail/nossr50/party/ShareHandler.java | 2 +- .../nossr50/runnables/SaveTimerTask.java | 4 +- .../commands/NotifySquelchReminderTask.java | 4 +- .../player/ClearRegisteredXPGainTask.java | 2 +- .../runnables/skills/AlchemyBrewTask.java | 2 +- .../skills/alchemy/AlchemyPotionBrewer.java | 8 ++-- .../nossr50/skills/mining/BlastMining.java | 6 +-- .../skills/unarmed/UnarmedManager.java | 4 +- .../com/gmail/nossr50/util/ChimaeraWing.java | 2 +- .../com/gmail/nossr50/util/EventUtils.java | 26 +++++------ .../gmail/nossr50/util/HardcoreManager.java | 11 ++--- .../gmail/nossr50/util/HolidayManager.java | 2 +- .../java/com/gmail/nossr50/util/Misc.java | 2 +- .../nossr50/util/commands/CommandUtils.java | 4 +- .../util/player/NotificationManager.java | 10 ++-- .../util/scoreboards/ScoreboardManager.java | 2 +- .../util/scoreboards/ScoreboardWrapper.java | 10 ++-- .../nossr50/util/skills/CombatUtils.java | 32 ++++++------- .../gmail/nossr50/util/skills/PerksUtils.java | 5 +- .../gmail/nossr50/util/skills/SkillUtils.java | 2 +- .../nossr50/util/skills/SmeltingTracker.java | 4 +- 35 files changed, 161 insertions(+), 168 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/chat/SamePartyPredicate.java b/src/main/java/com/gmail/nossr50/chat/SamePartyPredicate.java index 640dffb9e..3cf96600c 100644 --- a/src/main/java/com/gmail/nossr50/chat/SamePartyPredicate.java +++ b/src/main/java/com/gmail/nossr50/chat/SamePartyPredicate.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.chat; -import com.gmail.nossr50.mcMMO; import com.neetgames.mcmmo.party.Party; import com.neetgames.mcmmo.player.OnlineMMOPlayer; import org.bukkit.command.CommandSender; @@ -25,7 +24,7 @@ public class SamePartyPredicate implements Predicate } else { if(t instanceof Player) { Player player = (Player) t; - OnlineMMOPlayer mcMMOPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mcMMOPlayer = UserManager.queryPlayer(player); if(mcMMOPlayer != null) { return mcMMOPlayer.getParty() == party; } diff --git a/src/main/java/com/gmail/nossr50/database/DatabaseManager.java b/src/main/java/com/gmail/nossr50/database/DatabaseManager.java index 3a430a0a0..6fc76bd9a 100644 --- a/src/main/java/com/gmail/nossr50/database/DatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/DatabaseManager.java @@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.database.PlayerStat; import com.gmail.nossr50.datatypes.player.PlayerData; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.neetgames.mcmmo.player.MMOPlayer; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java index 56adf23b0..136972312 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java @@ -19,7 +19,6 @@ import com.gmail.nossr50.util.skills.SkillUtils; import com.google.common.collect.ImmutableMap; import com.neetgames.mcmmo.UniqueDataType; import com.neetgames.mcmmo.exceptions.InvalidSkillException; -import com.neetgames.mcmmo.player.MMOPlayer; import com.neetgames.mcmmo.skill.SkillBossBarState; import org.apache.commons.lang.NullArgumentException; import org.bukkit.OfflinePlayer; diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index cf8f550f8..316f98659 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -739,7 +739,7 @@ public final class SQLDatabaseManager implements DatabaseManager { resultSet.next(); //TODO: Optimize, probably needless to make a snapshot here, brain tired PlayerData mmoPlayerData = loadFromResult(playerName, resultSet); - MMODataSnapshot mmoDataSnapshot = mcMMO.getUserManager().createPlayerDataSnapshot(mmoPlayerData); + MMODataSnapshot mmoDataSnapshot = UserManager.createPlayerDataSnapshot(mmoPlayerData); destination.saveUser(mmoDataSnapshot); resultSet.close(); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index 1b892fc2b..ff6ceb615 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -118,7 +118,7 @@ public class Roll extends AcrobaticsSubSkill { String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky; /* Values related to the player */ - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); float skillValue = mmoPlayer.getExperienceHandler().getSkillLevel(getPrimarySkill()); boolean isLucky = Permissions.lucky(player, getPrimarySkill()); @@ -268,7 +268,7 @@ public class Roll extends AcrobaticsSubSkill { return false; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if (ItemUtils.hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) { if(mmoPlayer.isDebugMode()) { @@ -277,7 +277,7 @@ public class Roll extends AcrobaticsSubSkill { return true; } - if(mcMMO.getUserManager().queryPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player))) + if(UserManager.queryPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player))) { if(mmoPlayer.isDebugMode()) { Misc.adaptPlayer(mmoPlayer).sendMessage("Acrobatics XP Prevented: Fallen in location before"); @@ -419,7 +419,7 @@ public class Roll extends AcrobaticsSubSkill { public void addFallLocation(Player player) { - mcMMO.getUserManager().queryPlayer(player).getAcrobaticsManager().addLocationToFallMap(getBlockLocation(player)); + UserManager.queryPlayer(player).getAcrobaticsManager().addLocationToFallMap(getBlockLocation(player)); } public Location getBlockLocation(Player player) diff --git a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java index 7620b09c4..e38316387 100644 --- a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java +++ b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java @@ -1,6 +1,8 @@ package com.gmail.nossr50.events.experience; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.util.player.UserManager; +import com.neetgames.mcmmo.experience.XPGainReason; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -20,7 +22,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill) { super(player); this.skill = skill; - this.skillLevel = mcMMO.getUserManager().getPlayer(player).getSkillLevel(skill); + this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill); this.xpGainReason = XPGainReason.UNKNOWN; } @@ -29,7 +31,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements this.skill = skill; if(UserManager.getPlayer(player) != null) { - this.skillLevel = mcMMO.getUserManager().getPlayer(player).getSkillLevel(skill); + this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill); } else { this.skillLevel = 0; } diff --git a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java index 31fa75d47..b645b8823 100644 --- a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java +++ b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerSkillEvent.java @@ -16,7 +16,7 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent { protected McMMOPlayerSkillEvent(Player player, PrimarySkillType skill) { super(player); this.skill = skill; - this.skillLevel = mcMMO.getUserManager().getPlayer(player).getSkillLevel(skill); + this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill); } /** diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index c52b6b523..ec8302822 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -219,11 +219,11 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null) return; @@ -305,11 +305,11 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { + if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Check if profile is loaded if(mmoPlayer == null) { @@ -402,12 +402,12 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { + if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } @@ -416,7 +416,7 @@ public class BlockListener implements Listener { ItemStack heldItem = player.getInventory().getItemInMainHand(); if (ItemUtils.isSword(heldItem)) { - HerbalismManager herbalismManager = mcMMO.getUserManager().queryPlayer(player).getHerbalismManager(); + HerbalismManager herbalismManager = UserManager.queryPlayer(player).getHerbalismManager(); if (herbalismManager.canUseHylianLuck()) { if (herbalismManager.processHylianLuck(blockState)) { @@ -431,7 +431,7 @@ public class BlockListener implements Listener { } } /*else if (!heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) { - SmeltingManager smeltingManager = mcMMO.getUserManager().getPlayer(player).getSmeltingManager(); + SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager(); if (smeltingManager.canUseFluxMining(blockState)) { if (smeltingManager.processFluxMining(blockState)) { @@ -466,11 +466,11 @@ public class BlockListener implements Listener { if (event instanceof FakeBlockDamageEvent) { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Profile not loaded if(mmoPlayer == null) @@ -552,14 +552,14 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } @@ -603,10 +603,10 @@ public class BlockListener implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onBlockDamageCleanup(BlockDamageEvent event) { Player player = event.getPlayer(); - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } @@ -624,19 +624,19 @@ public class BlockListener implements Listener { //TODO: Convert into locale strings private void debugStickDump(Player player, BlockState blockState) { //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - if(mcMMO.getUserManager().queryPlayer(player).isDebugMode()) + if(UserManager.queryPlayer(player).isDebugMode()) { if(mcMMO.getPlaceStore().isTrue(blockState)) player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP"); else { player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO"); - mcMMO.getUserManager().queryPlayer(player).getExcavationManager().printExcavationDebug(player, blockState); + UserManager.queryPlayer(player).getExcavationManager().printExcavationDebug(player, blockState); } if(WorldGuardUtils.isWorldGuardLoaded()) diff --git a/src/main/java/com/gmail/nossr50/listeners/CommandListener.java b/src/main/java/com/gmail/nossr50/listeners/CommandListener.java index 608ba1fe2..d19f05a88 100644 --- a/src/main/java/com/gmail/nossr50/listeners/CommandListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/CommandListener.java @@ -26,7 +26,7 @@ // // SkillUtils.removeAbilityBoostsFromInventory(player); // -// OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); +// OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); // // if(mmoPlayer == null) // return; diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 9853e72d4..9c3ae708e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -197,7 +197,7 @@ public class EntityListener implements Listener { //Crossbow only if (isCrossbow) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Process launch event if (Permissions.skillEnabled(player, PrimarySkillType.CROSSBOWS)) { @@ -409,7 +409,7 @@ public class EntityListener implements Listener { } //Deflect checks - final OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(defendingPlayer); + final OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(defendingPlayer); if (mmoPlayer != null) { UnarmedManager unarmedManager = ((McMMOPlayer) (mmoPlayer)).getUnarmedManager(); @@ -473,7 +473,7 @@ public class EntityListener implements Listener { } public boolean checkParties(Cancellable event, Player defendingPlayer, Player attackingPlayer) { - if (!mcMMO.getUserManager().hasPlayerDataKey(defendingPlayer) || !mcMMO.getUserManager().hasPlayerDataKey(attackingPlayer)) { + if (!UserManager.hasPlayerDataKey(defendingPlayer) || !UserManager.hasPlayerDataKey(attackingPlayer)) { return true; } @@ -563,11 +563,11 @@ public class EntityListener implements Listener { if (livingEntity instanceof Player) { Player player = (Player) entity; - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } - McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); + McMMOPlayer mmoPlayer = (McMMOPlayer) UserManager.queryPlayer(player); //Profile not loaded if(mmoPlayer == null) @@ -605,12 +605,12 @@ public class EntityListener implements Listener { Wolf wolf = (Wolf) pet; //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - TamingManager tamingManager = mcMMO.getUserManager().queryPlayer(player).getTamingManager(); + TamingManager tamingManager = UserManager.queryPlayer(player).getTamingManager(); switch (cause) { case CONTACT: @@ -794,12 +794,12 @@ public class EntityListener implements Listener { // using this exact metadata Player player = pluginRef.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } @@ -811,7 +811,7 @@ public class EntityListener implements Listener { return; } - MiningManager miningManager = mcMMO.getUserManager().queryPlayer(player).getMiningManager(); + MiningManager miningManager = UserManager.queryPlayer(player).getMiningManager(); if (miningManager.canUseBiggerBombs()) { event.setRadius(miningManager.biggerBombs(event.getRadius())); @@ -840,7 +840,7 @@ public class EntityListener implements Listener { // using this exact metadata Player player = pluginRef.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } @@ -852,12 +852,12 @@ public class EntityListener implements Listener { } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - MiningManager miningManager = mcMMO.getUserManager().queryPlayer(player).getMiningManager(); + MiningManager miningManager = UserManager.queryPlayer(player).getMiningManager(); if (miningManager.canUseBlastMining()) { miningManager.blastMiningDropProcessing(event.getYield(), event); @@ -886,7 +886,7 @@ public class EntityListener implements Listener { Player player = (Player) entity; //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } @@ -898,7 +898,7 @@ public class EntityListener implements Listener { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } @@ -951,7 +951,7 @@ public class EntityListener implements Listener { * 1000 */ if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) { - event.setFoodLevel(mcMMO.getUserManager().queryPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel)); + event.setFoodLevel(UserManager.queryPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel)); } return; @@ -963,7 +963,7 @@ public class EntityListener implements Listener { */ case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) { - event.setFoodLevel(mcMMO.getUserManager().queryPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel)); + event.setFoodLevel(UserManager.queryPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel)); } return; case COD: @@ -973,7 +973,7 @@ public class EntityListener implements Listener { case COOKED_SALMON: if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET)) { - event.setFoodLevel(mcMMO.getUserManager().queryPlayer(player).getFishingManager().handleFishermanDiet(newFoodLevel)); + event.setFoodLevel(UserManager.queryPlayer(player).getFishingManager().handleFishermanDiet(newFoodLevel)); } return; @@ -1008,7 +1008,7 @@ public class EntityListener implements Listener { LivingEntity livingEntity = event.getEntity(); - if (mcMMO.getUserManager().queryPlayer(player) == null + if (UserManager.queryPlayer(player) == null || (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(livingEntity)) || persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity) || persistentDataLayer.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, livingEntity)) { @@ -1018,12 +1018,12 @@ public class EntityListener implements Listener { persistentDataLayer.flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity); //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - mcMMO.getUserManager().queryPlayer(player).getTamingManager().awardTamingXP(livingEntity); + UserManager.queryPlayer(player).getTamingManager().awardTamingXP(livingEntity); } /** @@ -1056,7 +1056,7 @@ public class EntityListener implements Listener { Tameable tameable = (Tameable) entity; - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) { + if (!UserManager.hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) { return; } diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index bfb4e1e4e..3540dc14f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -66,13 +66,13 @@ public class InventoryListener implements Listener { } //Profile doesn't exist - if(mcMMO.getUserManager().queryOfflineMcMMOPlayer(offlinePlayer) == null) + if(UserManager.queryOfflineMcMMOPlayer(offlinePlayer) == null) { return; } - boolean debugMode = player.isOnline() && mcMMO.getUserManager().queryPlayer(player).isDebugMode(); + boolean debugMode = player.isOnline() && UserManager.queryPlayer(player).isDebugMode(); if(debugMode) { player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT"); @@ -81,7 +81,7 @@ public class InventoryListener implements Listener { player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime()); } - event.setBurnTime(mcMMO.getUserManager().queryPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime())); + event.setBurnTime(UserManager.queryPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime())); if(debugMode) { player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime()); @@ -111,7 +111,7 @@ public class InventoryListener implements Listener { if(offlinePlayer != null) { - OnlineMMOPlayer offlineProfile = mcMMO.getUserManager().queryOfflineMcMMOPlayer(offlinePlayer); + OnlineMMOPlayer offlineProfile = UserManager.queryOfflineMcMMOPlayer(offlinePlayer); //Profile doesn't exist if(offlineProfile != null) { @@ -144,18 +144,18 @@ public class InventoryListener implements Listener { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkillType.SMELTING)) { + if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkillType.SMELTING)) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } int xpToDrop = event.getExpToDrop(); - int exp = mcMMO.getUserManager().queryPlayer(player).getSmeltingManager().vanillaXPBoost(xpToDrop); + int exp = UserManager.queryPlayer(player).getSmeltingManager().vanillaXPBoost(xpToDrop); event.setExpToDrop(exp); } } @@ -197,7 +197,7 @@ public class InventoryListener implements Listener { HumanEntity whoClicked = event.getWhoClicked(); - if (!mcMMO.getUserManager().hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkillType.ALCHEMY_CONCOCTIONS)) { + if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkillType.ALCHEMY_CONCOCTIONS)) { return; } @@ -310,7 +310,7 @@ public class InventoryListener implements Listener { HumanEntity whoClicked = event.getWhoClicked(); - if (!mcMMO.getUserManager().hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkillType.ALCHEMY_CONCOCTIONS)) { + if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkillType.ALCHEMY_CONCOCTIONS)) { return; } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 004bb2469..6b1ae3efd 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -88,12 +88,12 @@ public class PlayerListener implements Listener { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || Config.getInstance().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) { + if (!UserManager.hasPlayerDataKey(player) || Config.getInstance().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) { return; } //Profile not loaded - McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); + McMMOPlayer mmoPlayer = (McMMOPlayer) UserManager.queryPlayer(player); if(mmoPlayer == null) { return; @@ -199,17 +199,17 @@ public class PlayerListener implements Listener { public void onPlayerWorldChange(PlayerChangedWorldEvent event) { Player player = event.getPlayer(); - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null) { return; @@ -274,12 +274,12 @@ public class PlayerListener implements Listener { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { + if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { return; } //Profile not loaded - McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); + McMMOPlayer mmoPlayer = (McMMOPlayer) UserManager.queryPlayer(player); if(mmoPlayer == null) { return; @@ -361,18 +361,18 @@ public class PlayerListener implements Listener { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { + if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } Entity caught = event.getCaught(); - FishingManager fishingManager = mcMMO.getUserManager().queryPlayer(player).getFishingManager(); + FishingManager fishingManager = UserManager.queryPlayer(player).getFishingManager(); //Track the hook if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) @@ -474,11 +474,11 @@ public class PlayerListener implements Listener { return; } - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Profile not loaded if(mmoPlayer == null) { @@ -589,17 +589,17 @@ public class PlayerListener implements Listener { public void onPlayerRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - mcMMO.getUserManager().queryPlayer(player).actualizeRespawnATS(); + UserManager.queryPlayer(player).actualizeRespawnATS(); } /** @@ -636,17 +636,17 @@ public class PlayerListener implements Listener { } } - if (event.getHand() != EquipmentSlot.HAND || !mcMMO.getUserManager().hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { + if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); MiningManager miningManager = ((McMMOPlayer) (mmoPlayer)).getMiningManager(); ItemStack heldItem = player.getInventory().getItemInMainHand(); @@ -675,7 +675,7 @@ public class PlayerListener implements Listener { && RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR) && mcMMO.getSalvageableManager().isSalvageable(heldItem) && heldItem.getAmount() <= 1) { - SalvageManager salvageManager = mcMMO.getUserManager().queryPlayer(player).getSalvageManager(); + SalvageManager salvageManager = UserManager.queryPlayer(player).getSalvageManager(); event.setCancelled(true); // Make sure the player knows what he's doing when trying to salvage an enchanted item @@ -752,17 +752,17 @@ public class PlayerListener implements Listener { return; } - if (playerInteractEvent.getHand() != EquipmentSlot.HAND || !mcMMO.getUserManager().hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { + if (playerInteractEvent.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { return; } //Profile not loaded - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); ItemStack heldItem = player.getInventory().getItemInMainHand(); //Spam Fishing Detection @@ -797,7 +797,7 @@ public class PlayerListener implements Listener { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if (mmoPlayer == null) { mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server."); diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 761877b18..cab7bba9a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -37,14 +37,14 @@ public class SelfListener implements Listener { { int previousLevelGained = event.getSkillLevel() - i; //Send player skill unlock notifications - RankUtils.executeSkillUnlockNotifications(plugin, mcMMO.getUserManager().queryPlayer(player), event.getSkill(), previousLevelGained); + RankUtils.executeSkillUnlockNotifications(plugin, UserManager.queryPlayer(player), event.getSkill(), previousLevelGained); } for(int i = 0; i < event.getLevelsGained(); i++) { int previousLevelGained = event.getSkillLevel() - i; //Send player skill unlock notifications - RankUtils.executeSkillUnlockNotifications(plugin, mcMMO.getUserManager().queryPlayer(player), event.getSkill(), previousLevelGained); + RankUtils.executeSkillUnlockNotifications(plugin, UserManager.queryPlayer(player), event.getSkill(), previousLevelGained); } //Reset the delay timer @@ -80,7 +80,7 @@ public class SelfListener implements Listener { @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { Player player = event.getPlayer(); - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); PrimarySkillType primarySkillType = event.getSkill(); if(mmoPlayer.isDebugMode()) { diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 682656c3c..206ae2cc1 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -84,8 +84,7 @@ public class mcMMO extends JavaPlugin { private static PlayerLevelUtils playerLevelUtils; private static SmeltingTracker smeltingTracker; private static SpawnedProjectileTracker spawnedProjectileTracker; - private static UserManager userManager; - private static PartyManager partyManager; + private static PartyManager partyManager; //TODO: T&C wire this up private static TransientMetadataTools transientMetadataTools; private static ChatManager chatManager; private static CommandManager commandManager; //ACF @@ -315,9 +314,6 @@ public class mcMMO extends JavaPlugin { //Init spawned projectile tracker spawnedProjectileTracker = new SpawnedProjectileTracker(); - //Init Player Data Manager - userManager = new UserManager(); - //Set up Adventure's audiences audiences = BukkitAudiences.create(this); @@ -369,8 +365,8 @@ public class mcMMO extends JavaPlugin { mcMMO.p.getLogger().info("Server shutdown has been executed, saving and cleaning up data..."); try { - userManager.saveAllSync(); // Make sure to save player information if the server shuts down - userManager.clearAll(); + UserManager.saveAll(); // Make sure to save player information if the server shuts down + UserManager.clearAll(); Alchemy.finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla brewing continuation on restart mcMMO.getPartyManager().saveParties(); // Save our parties diff --git a/src/main/java/com/gmail/nossr50/party/ShareHandler.java b/src/main/java/com/gmail/nossr50/party/ShareHandler.java index 50a4e1336..426e0814c 100644 --- a/src/main/java/com/gmail/nossr50/party/ShareHandler.java +++ b/src/main/java/com/gmail/nossr50/party/ShareHandler.java @@ -42,7 +42,7 @@ public final class ShareHandler { float splitXp = (float) (xp / partySize * shareBonus); for (Player otherMember : nearMembers) { - OnlineMMOPlayer partyMember = mcMMO.getUserManager().queryPlayer(otherMember); + OnlineMMOPlayer partyMember = UserManager.queryPlayer(otherMember); //Profile not loaded if(partyMember == null) { diff --git a/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java b/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java index 063122cc2..33a2c9d46 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java @@ -12,8 +12,8 @@ public class SaveTimerTask extends BukkitRunnable { int count = 1; //TODO: write a more efficient bulk save - for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) { - mcMMO.getUserManager().saveUserWithDelay(mmoPlayer.getPersistentPlayerData(), false, count); + for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) { + UserManager.saveUserWithDelay(mmoPlayer.getPersistentPlayerData(), false, count); count++; } diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java index 9cb6a3be9..97adbf2a2 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java @@ -10,9 +10,9 @@ public class NotifySquelchReminderTask extends BukkitRunnable { @Override public void run() { for (Player player : Bukkit.getOnlinePlayers()) { - if(mcMMO.getUserManager().getPlayer(player) != null) + if(UserManager.getPlayer(player) != null) { - if(!mcMMO.getUserManager().getPlayer(player).useChatNotifications()) + if(!UserManager.getPlayer(player).useChatNotifications()) { player.sendMessage(LocaleLoader.getString("Reminder.Squelched")); } diff --git a/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java b/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java index ad3860324..15c232e09 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java @@ -6,7 +6,7 @@ import org.bukkit.scheduler.BukkitRunnable; public class ClearRegisteredXPGainTask extends BukkitRunnable { @Override public void run() { - for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) { + for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) { mmoPlayer.purgeExpiredXpGains(); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java index 6023ac743..364729aed 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java @@ -38,7 +38,7 @@ public class AlchemyBrewTask extends BukkitRunnable { brewSpeed = DEFAULT_BREW_SPEED; brewTimer = DEFAULT_BREW_TICKS; - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if (player != null && !Misc.isNPCEntityExcludingVillagers(player) && Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS) diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java index adc66999f..b35129cdb 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java @@ -92,12 +92,12 @@ public final class AlchemyPotionBrewer { } private static List getValidIngredients(Player player) { - if(player == null || mcMMO.getUserManager().queryPlayer(player) == null) + if(player == null || UserManager.queryPlayer(player) == null) { return PotionConfig.getInstance().getIngredients(1); } - return PotionConfig.getInstance().getIngredients(!Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS) ? 1 : mcMMO.getUserManager().queryPlayer(player).getAlchemyManager().getTier()); + return PotionConfig.getInstance().getIngredients(!Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS) ? 1 : UserManager.queryPlayer(player).getAlchemyManager().getTier()); } public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) { @@ -154,8 +154,8 @@ public final class AlchemyPotionBrewer { PotionStage potionStage = PotionStage.getPotionStage(input, output); //TODO: hmm - if (mcMMO.getUserManager().hasPlayerDataKey(player)) { - mcMMO.getUserManager().queryPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1); + if (UserManager.hasPlayerDataKey(player)) { + UserManager.queryPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1); } } } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java index b63b7186a..5c14999a1 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java @@ -91,7 +91,7 @@ public class BlastMining { } public static boolean processBlastMiningExplosion(EntityDamageByEntityEvent event, TNTPrimed tnt, Player defender) { - if (!tnt.hasMetadata(mcMMO.tntMetadataKey) || !mcMMO.getUserManager().hasPlayerDataKey(defender)) { + if (!tnt.hasMetadata(mcMMO.tntMetadataKey) || !UserManager.hasPlayerDataKey(defender)) { return false; } @@ -102,12 +102,12 @@ public class BlastMining { return false; } - if(mcMMO.getUserManager().queryPlayer(defender) == null) + if(UserManager.queryPlayer(defender) == null) { return false; } - MiningManager miningManager = mcMMO.getUserManager().queryPlayer(defender).getMiningManager(); + MiningManager miningManager = UserManager.queryPlayer(defender).getMiningManager(); if (!miningManager.canUseDemolitionsExpertise()) { return false; diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index 52a67fe72..35863772b 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -107,13 +107,13 @@ public class UnarmedManager extends SkillManager { return; } - if(mcMMO.getUserManager().queryPlayer(defender) == null) + if(UserManager.queryPlayer(defender) == null) return; Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM); if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) { - item.setMetadata(mcMMO.disarmedItemKey, mcMMO.getUserManager().queryPlayer(defender).getPlayerMetadata()); + item.setMetadata(mcMMO.disarmedItemKey, UserManager.queryPlayer(defender).getPlayerMetadata()); } defender.getInventory().setItemInMainHand(new ItemStack(Material.AIR)); diff --git a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java index 836c6af26..a5d4aeb9d 100644 --- a/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java +++ b/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java @@ -52,7 +52,7 @@ public final class ChimaeraWing { return; } - mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + mmoPlayer = UserManager.queryPlayer(player); //Not loaded if(mmoPlayer == null) diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index d674f7b2f..ecc77c753 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -96,7 +96,7 @@ public final class EventUtils { */ public static OnlineMMOPlayer getMcMMOPlayer(@NotNull Entity entity) { - return mcMMO.getUserManager().queryPlayer((Player)entity); + return UserManager.queryPlayer((Player)entity); } /** @@ -140,11 +140,11 @@ public final class EventUtils { if (livingEntity instanceof Player) { Player player = (Player) entity; - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return true; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null) { @@ -237,7 +237,7 @@ public final class EventUtils { boolean isCancelled = event.isCancelled(); if (isCancelled) { - PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player); + PlayerProfile profile = UserManager.queryPlayer(player); profile.getExperienceHandler().setSkillLevel(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged)); profile.addXp(skill, xpRemoved); @@ -273,7 +273,7 @@ public final class EventUtils { boolean isCancelled = event.isCancelled(); if (isCancelled) { - PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player); + PlayerProfile profile = UserManager.queryPlayer(player); profile.modifySkill(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged)); profile.addXp(skill, xpRemoved); @@ -327,7 +327,7 @@ public final class EventUtils { } public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(teleportingPlayer); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(teleportingPlayer); if(mmoPlayer == null) return; @@ -382,15 +382,15 @@ public final class EventUtils { boolean isCancelled = event.isCancelled(); if (!isCancelled) { - mcMMO.getUserManager().queryPlayer(player).addXp(skill, event.getRawXpGained()); - mcMMO.getUserManager().queryPlayer(player).registerXpGain(skill, event.getRawXpGained()); + UserManager.queryPlayer(player).addXp(skill, event.getRawXpGained()); + UserManager.queryPlayer(player).registerXpGain(skill, event.getRawXpGained()); } return !isCancelled; } public static boolean handleStatsLossEvent(Player player, HashMap levelChanged, HashMap experienceChanged) { - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) return true; McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged); @@ -401,7 +401,7 @@ public final class EventUtils { if (!isCancelled) { levelChanged = event.getLevelChanged(); experienceChanged = event.getExperienceChanged(); - PlayerProfile playerProfile = mcMMO.getUserManager().queryPlayer(player); + PlayerProfile playerProfile = UserManager.queryPlayer(player); for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { String skillName = primarySkillType.toString(); @@ -440,17 +440,17 @@ public final class EventUtils { HashMap levelChangedVictim = eventVictim.getLevelChanged(); HashMap experienceChangedVictim = eventVictim.getExperienceChanged(); - OnlineMMOPlayer killerPlayer = mcMMO.getUserManager().queryPlayer(killer); + OnlineMMOPlayer killerPlayer = UserManager.queryPlayer(killer); //Not loaded if(killerPlayer == null) return true; //Not loaded - if(mcMMO.getUserManager().queryPlayer(victim) == null) + if(UserManager.queryPlayer(victim) == null) return true; - PlayerProfile victimProfile = mcMMO.getUserManager().queryPlayer(victim); + PlayerProfile victimProfile = UserManager.queryPlayer(victim); for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { String skillName = primarySkillType.toString(); diff --git a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java index eb0bef172..6290a962a 100644 --- a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java +++ b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java @@ -4,7 +4,6 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; @@ -25,10 +24,10 @@ public final class HardcoreManager { double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage(); int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(); - if(mcMMO.getUserManager().queryPlayer(player) == null) + if(UserManager.queryPlayer(player) == null) return; - PlayerProfile playerProfile = mcMMO.getUserManager().queryPlayer(player); + PlayerProfile playerProfile = UserManager.queryPlayer(player); int totalLevelsLost = 0; HashMap levelChanged = new HashMap<>(); @@ -76,11 +75,11 @@ public final class HardcoreManager { double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage(); int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold(); - if(mcMMO.getUserManager().queryPlayer(killer) == null || mcMMO.getUserManager().queryPlayer(victim) == null) + if(UserManager.queryPlayer(killer) == null || UserManager.queryPlayer(victim) == null) return; - PlayerProfile killerProfile = mcMMO.getUserManager().queryPlayer(killer); - PlayerProfile victimProfile = mcMMO.getUserManager().queryPlayer(victim); + PlayerProfile killerProfile = UserManager.queryPlayer(killer); + PlayerProfile victimProfile = UserManager.queryPlayer(victim); int totalLevelsStolen = 0; HashMap levelChanged = new HashMap<>(); diff --git a/src/main/java/com/gmail/nossr50/util/HolidayManager.java b/src/main/java/com/gmail/nossr50/util/HolidayManager.java index a1c988cf1..2bd5305bc 100644 --- a/src/main/java/com/gmail/nossr50/util/HolidayManager.java +++ b/src/main/java/com/gmail/nossr50/util/HolidayManager.java @@ -368,7 +368,7 @@ public final class HolidayManager { if(!Config.getInstance().isAprilFoolsAllowed()) return; - final OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + final OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if (mmoPlayer == null) return; int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.getSkillLevel(PrimarySkillType.MINING)) + 1; diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index 0a8a3e622..8a83887f2 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -254,7 +254,7 @@ public final class Misc { Player player = mcMMO.p.getServer().getPlayerExact(playerName); if (player != null) { - mcMMO.getUserManager().remove(player); + UserManager.remove(player); new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading } } diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java index 29070f0f4..8571246f5 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java @@ -207,10 +207,10 @@ public final class CommandUtils { } private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List skillGroup) { - if(mcMMO.getUserManager().queryPlayer(inspect) == null) + if(UserManager.queryPlayer(inspect) == null) return; - PlayerProfile profile = mcMMO.getUserManager().queryPlayer(inspect); + PlayerProfile profile = UserManager.queryPlayer(inspect); List displayData = new ArrayList<>(); displayData.add(header); diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index ea08171ab..c582c6c3d 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -47,7 +47,7 @@ public class NotificationManager { */ public static void sendPlayerInformation(@NotNull Player player, @NotNull NotificationType notificationType, @NotNull String key) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null || !mmoPlayer.hasSkillChatNotifications()) return; @@ -63,7 +63,7 @@ public class NotificationManager { public static boolean doesPlayerUseNotifications(@NotNull Player player) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null) return false; @@ -86,7 +86,7 @@ public class NotificationManager { } public static void sendPlayerInformationChatOnly(@NotNull Player player, @NotNull String key, String... values) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Don't send chat notifications if they are disabled if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications()) @@ -98,7 +98,7 @@ public class NotificationManager { public static void sendPlayerInformationChatOnlyPrefixed(@NotNull Player player, @NotNull String key, String... values) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Don't send chat notifications if they are disabled if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications()) @@ -110,7 +110,7 @@ public class NotificationManager { } public static void sendPlayerInformation(@NotNull Player player, @NotNull NotificationType notificationType, @NotNull String key, String... values) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Don't send chat notifications if they are disabled if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications()) diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index ff1ad6723..3a0350983 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -465,7 +465,7 @@ public class ScoreboardManager { } for (String playerName : dirtyPowerLevels) { - MMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerName); + MMOPlayer mmoPlayer = UserManager.queryPlayer(playerName); if (mmoPlayer == null) { continue; diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index 06e5029c6..046ad610c 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -63,7 +63,7 @@ public class ScoreboardWrapper { powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL); powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME); - for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) { + for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) { powerObjective.getScore(mmoPlayer.getPlayerName()).setScore(mmoPlayer.getExperienceHandler().getPowerLevel()); } } @@ -204,10 +204,10 @@ public class ScoreboardWrapper { // TODO is there any way to do the time that looks acceptable? // player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase(Locale.ENGLISH)), ticks / 20F)); - if(mcMMO.getUserManager().getPlayer(playerName) == null) + if(UserManager.getPlayer(playerName) == null) return; - PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player); + PlayerProfile profile = UserManager.queryPlayer(player); if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) { return; @@ -447,7 +447,7 @@ public class ScoreboardWrapper { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null) return; @@ -539,7 +539,7 @@ public class ScoreboardWrapper { newProfile = mmoPlayer; // self } else { - newProfile = mcMMO.getUserManager().getPlayer(targetPlayer); // online + newProfile = UserManager.getPlayer(targetPlayer); // online } // Calculate power level here diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index fbb61564e..f3e0eb6a6 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -75,7 +75,7 @@ public final class CombatUtils { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -125,7 +125,7 @@ public final class CombatUtils { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -161,7 +161,7 @@ public final class CombatUtils { double finalDamage = initialDamage; Map modifiers = getModifiers(event); - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -212,7 +212,7 @@ public final class CombatUtils { double initialDamage = event.getDamage(); double finalDamage = initialDamage; - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -253,7 +253,7 @@ public final class CombatUtils { double finalDamage = initialDamage; if(master != null && master.isOnline() && master.isValid()) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(master); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(master); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -285,7 +285,7 @@ public final class CombatUtils { private static void processArcheryCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull Projectile arrow) { double initialDamage = event.getDamage(); - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -337,7 +337,7 @@ public final class CombatUtils { private static void processCrossbowCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Projectile arrow) { double initialDamage = event.getDamage(); - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Make sure the profiles been loaded if(mmoPlayer == null) { @@ -349,7 +349,7 @@ public final class CombatUtils { double finalDamage = event.getDamage(); if (target instanceof Player && PrimarySkillType.UNARMED.getPVPEnabled()) { - UnarmedManager unarmedManager = mcMMO.getUserManager().queryPlayer((Player) target).getUnarmedManager(); + UnarmedManager unarmedManager = UserManager.queryPlayer((Player) target).getUnarmedManager(); if (unarmedManager.canDeflect()) { event.setCancelled(unarmedManager.deflectCheck()); @@ -394,11 +394,11 @@ public final class CombatUtils { } Player player = (Player) target; - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); AcrobaticsManager acrobaticsManager = ((McMMOPlayer) (mmoPlayer)).getAcrobaticsManager(); if (acrobaticsManager.canDodge(target)) { @@ -421,7 +421,7 @@ public final class CombatUtils { if (painSourceRoot instanceof Player && entityType == EntityType.PLAYER) { Player player = (Player) painSourceRoot; - if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { + if (!UserManager.hasPlayerDataKey(player)) { return; } @@ -429,7 +429,7 @@ public final class CombatUtils { if (target instanceof Tameable) { if (heldItem.getType() == Material.BONE) { - TamingManager tamingManager = mcMMO.getUserManager().queryPlayer(player).getTamingManager(); + TamingManager tamingManager = UserManager.queryPlayer(player).getTamingManager(); if (tamingManager.canUseBeastLore()) { tamingManager.beastLore(target); @@ -522,7 +522,7 @@ public final class CombatUtils { } if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntityExcludingVillagers(player) && PrimarySkillType.TAMING.getPermissions(player)) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); if(mmoPlayer == null) { return; @@ -777,7 +777,7 @@ public final class CombatUtils { NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck"); } - mcMMO.getUserManager().queryPlayer(attacker).getSwordsManager().ruptureCheck(target); + UserManager.queryPlayer(attacker).getSwordsManager().ruptureCheck(target); break; case AXES: @@ -903,10 +903,10 @@ public final class CombatUtils { Player defender = (Player) entity; //TODO: NPC Interaction? - if(mcMMO.getUserManager().queryPlayer(defender) == null) + if(UserManager.queryPlayer(defender) == null) return true; - if (!defender.getWorld().getPVP() || defender == player || mcMMO.getUserManager().queryPlayer(defender).getGodMode()) { + if (!defender.getWorld().getPVP() || defender == player || UserManager.queryPlayer(defender).getGodMode()) { return false; } diff --git a/src/main/java/com/gmail/nossr50/util/skills/PerksUtils.java b/src/main/java/com/gmail/nossr50/util/skills/PerksUtils.java index b78856c62..8dd44fecc 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/PerksUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/PerksUtils.java @@ -3,7 +3,6 @@ package com.gmail.nossr50.util.skills; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.events.skills.SkillActivationPerkEvent; -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -54,7 +53,7 @@ public final class PerksUtils { double modifier = 1.0F; if (Permissions.customXpBoost(player, skill)) { - if(mcMMO.getUserManager().queryPlayer(player) != null && mcMMO.getUserManager().queryPlayer(player).isDebugMode()) { + if(UserManager.queryPlayer(player) != null && UserManager.queryPlayer(player).isDebugMode()) { player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.DARK_GRAY + "XP Perk Multiplier IS CUSTOM! "); } @@ -81,7 +80,7 @@ public final class PerksUtils { float modifiedXP = (float) (xp * modifier); - if(mcMMO.getUserManager().queryPlayer(player) != null && mcMMO.getUserManager().queryPlayer(player).isDebugMode()) { + if(UserManager.queryPlayer(player) != null && UserManager.queryPlayer(player).isDebugMode()) { player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP Perk Multiplier - " + ChatColor.GOLD + modifier); player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "Original XP before perk boosts " + ChatColor.RED + (double) xp); player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP); diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 4249f8b46..dcdd446c0 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -185,7 +185,7 @@ public final class SkillUtils { } } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); //Not Loaded if(mmoPlayer == null) 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 4b91a430c..234377269 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SmeltingTracker.java @@ -21,7 +21,7 @@ public class SmeltingTracker { private void changeFurnaceOwnership(Furnace furnace, Player player) { - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player); /* Debug output @@ -52,7 +52,7 @@ public class SmeltingTracker { OfflinePlayer furnaceOwner = getFurnaceOwner(furnace); if(furnaceOwner != null && furnaceOwner.isOnline()) { - OnlineMMOPlayer furnaceOwnerProfile = mcMMO.getUserManager().queryPlayer(furnaceOwner.getPlayer()); + OnlineMMOPlayer furnaceOwnerProfile = UserManager.queryPlayer(furnaceOwner.getPlayer()); if(furnaceOwnerProfile != null) { if(furnaceOwnerProfile.isDebugMode()) {