Rollback UserManager to being static again

This commit is contained in:
nossr50 2021-03-19 12:44:03 -07:00
parent 3bda73de2e
commit d33c214266
35 changed files with 161 additions and 168 deletions

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.chat; package com.gmail.nossr50.chat;
import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -25,7 +24,7 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
} else { } else {
if(t instanceof Player) { if(t instanceof Player) {
Player player = (Player) t; Player player = (Player) t;
OnlineMMOPlayer mcMMOPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mcMMOPlayer = UserManager.queryPlayer(player);
if(mcMMOPlayer != null) { if(mcMMOPlayer != null) {
return mcMMOPlayer.getParty() == party; return mcMMOPlayer.getParty() == party;
} }

View File

@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.player.PlayerData; import com.gmail.nossr50.datatypes.player.PlayerData;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.neetgames.mcmmo.player.MMOPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View File

@ -19,7 +19,6 @@ import com.gmail.nossr50.util.skills.SkillUtils;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.neetgames.mcmmo.UniqueDataType; import com.neetgames.mcmmo.UniqueDataType;
import com.neetgames.mcmmo.exceptions.InvalidSkillException; import com.neetgames.mcmmo.exceptions.InvalidSkillException;
import com.neetgames.mcmmo.player.MMOPlayer;
import com.neetgames.mcmmo.skill.SkillBossBarState; import com.neetgames.mcmmo.skill.SkillBossBarState;
import org.apache.commons.lang.NullArgumentException; import org.apache.commons.lang.NullArgumentException;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;

View File

@ -739,7 +739,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
resultSet.next(); resultSet.next();
//TODO: Optimize, probably needless to make a snapshot here, brain tired //TODO: Optimize, probably needless to make a snapshot here, brain tired
PlayerData mmoPlayerData = loadFromResult(playerName, resultSet); PlayerData mmoPlayerData = loadFromResult(playerName, resultSet);
MMODataSnapshot mmoDataSnapshot = mcMMO.getUserManager().createPlayerDataSnapshot(mmoPlayerData); MMODataSnapshot mmoDataSnapshot = UserManager.createPlayerDataSnapshot(mmoPlayerData);
destination.saveUser(mmoDataSnapshot); destination.saveUser(mmoDataSnapshot);
resultSet.close(); resultSet.close();
} }

View File

@ -118,7 +118,7 @@ public class Roll extends AcrobaticsSubSkill {
String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky; String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky;
/* Values related to the player */ /* Values related to the player */
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
float skillValue = mmoPlayer.getExperienceHandler().getSkillLevel(getPrimarySkill()); float skillValue = mmoPlayer.getExperienceHandler().getSkillLevel(getPrimarySkill());
boolean isLucky = Permissions.lucky(player, getPrimarySkill()); boolean isLucky = Permissions.lucky(player, getPrimarySkill());
@ -268,7 +268,7 @@ public class Roll extends AcrobaticsSubSkill {
return false; return false;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if (ItemUtils.hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) { if (ItemUtils.hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
if(mmoPlayer.isDebugMode()) { if(mmoPlayer.isDebugMode()) {
@ -277,7 +277,7 @@ public class Roll extends AcrobaticsSubSkill {
return true; return true;
} }
if(mcMMO.getUserManager().queryPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player))) if(UserManager.queryPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
{ {
if(mmoPlayer.isDebugMode()) { if(mmoPlayer.isDebugMode()) {
Misc.adaptPlayer(mmoPlayer).sendMessage("Acrobatics XP Prevented: Fallen in location before"); 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) 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) public Location getBlockLocation(Player player)

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.events.experience; package com.gmail.nossr50.events.experience;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 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.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -20,7 +22,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill) { protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill) {
super(player); super(player);
this.skill = skill; this.skill = skill;
this.skillLevel = mcMMO.getUserManager().getPlayer(player).getSkillLevel(skill); this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
this.xpGainReason = XPGainReason.UNKNOWN; this.xpGainReason = XPGainReason.UNKNOWN;
} }
@ -29,7 +31,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
this.skill = skill; this.skill = skill;
if(UserManager.getPlayer(player) != null) { if(UserManager.getPlayer(player) != null) {
this.skillLevel = mcMMO.getUserManager().getPlayer(player).getSkillLevel(skill); this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
} else { } else {
this.skillLevel = 0; this.skillLevel = 0;
} }

View File

@ -16,7 +16,7 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
protected McMMOPlayerSkillEvent(Player player, PrimarySkillType skill) { protected McMMOPlayerSkillEvent(Player player, PrimarySkillType skill) {
super(player); super(player);
this.skill = skill; this.skill = skill;
this.skillLevel = mcMMO.getUserManager().getPlayer(player).getSkillLevel(skill); this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
} }
/** /**

View File

@ -219,11 +219,11 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if(mmoPlayer == null) if(mmoPlayer == null)
return; return;
@ -305,11 +305,11 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!mcMMO.getUserManager().hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Check if profile is loaded //Check if profile is loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -402,12 +402,12 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!mcMMO.getUserManager().hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
@ -416,7 +416,7 @@ public class BlockListener implements Listener {
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
if (ItemUtils.isSword(heldItem)) { if (ItemUtils.isSword(heldItem)) {
HerbalismManager herbalismManager = mcMMO.getUserManager().queryPlayer(player).getHerbalismManager(); HerbalismManager herbalismManager = UserManager.queryPlayer(player).getHerbalismManager();
if (herbalismManager.canUseHylianLuck()) { if (herbalismManager.canUseHylianLuck()) {
if (herbalismManager.processHylianLuck(blockState)) { if (herbalismManager.processHylianLuck(blockState)) {
@ -431,7 +431,7 @@ public class BlockListener implements Listener {
} }
} }
/*else if (!heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) { /*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.canUseFluxMining(blockState)) {
if (smeltingManager.processFluxMining(blockState)) { if (smeltingManager.processFluxMining(blockState)) {
@ -466,11 +466,11 @@ public class BlockListener implements Listener {
if (event instanceof FakeBlockDamageEvent) { if (event instanceof FakeBlockDamageEvent) {
return; return;
} }
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Profile not loaded //Profile not loaded
if(mmoPlayer == null) if(mmoPlayer == null)
@ -552,14 +552,14 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
@ -603,10 +603,10 @@ public class BlockListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onBlockDamageCleanup(BlockDamageEvent event) { public void onBlockDamageCleanup(BlockDamageEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
@ -624,19 +624,19 @@ public class BlockListener implements Listener {
//TODO: Convert into locale strings //TODO: Convert into locale strings
private void debugStickDump(Player player, BlockState blockState) { private void debugStickDump(Player player, BlockState blockState) {
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
if(mcMMO.getUserManager().queryPlayer(player).isDebugMode()) if(UserManager.queryPlayer(player).isDebugMode())
{ {
if(mcMMO.getPlaceStore().isTrue(blockState)) if(mcMMO.getPlaceStore().isTrue(blockState))
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP"); player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
else else
{ {
player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO"); 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()) if(WorldGuardUtils.isWorldGuardLoaded())

View File

@ -26,7 +26,7 @@
// //
// SkillUtils.removeAbilityBoostsFromInventory(player); // SkillUtils.removeAbilityBoostsFromInventory(player);
// //
// OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); // OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
// //
// if(mmoPlayer == null) // if(mmoPlayer == null)
// return; // return;

View File

@ -197,7 +197,7 @@ public class EntityListener implements Listener {
//Crossbow only //Crossbow only
if (isCrossbow) { if (isCrossbow) {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Process launch event //Process launch event
if (Permissions.skillEnabled(player, PrimarySkillType.CROSSBOWS)) { if (Permissions.skillEnabled(player, PrimarySkillType.CROSSBOWS)) {
@ -409,7 +409,7 @@ public class EntityListener implements Listener {
} }
//Deflect checks //Deflect checks
final OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(defendingPlayer); final OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(defendingPlayer);
if (mmoPlayer != null) { if (mmoPlayer != null) {
UnarmedManager unarmedManager = ((McMMOPlayer) (mmoPlayer)).getUnarmedManager(); UnarmedManager unarmedManager = ((McMMOPlayer) (mmoPlayer)).getUnarmedManager();
@ -473,7 +473,7 @@ public class EntityListener implements Listener {
} }
public boolean checkParties(Cancellable event, Player defendingPlayer, Player attackingPlayer) { 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; return true;
} }
@ -563,11 +563,11 @@ public class EntityListener implements Listener {
if (livingEntity instanceof Player) { if (livingEntity instanceof Player) {
Player player = (Player) entity; Player player = (Player) entity;
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); McMMOPlayer mmoPlayer = (McMMOPlayer) UserManager.queryPlayer(player);
//Profile not loaded //Profile not loaded
if(mmoPlayer == null) if(mmoPlayer == null)
@ -605,12 +605,12 @@ public class EntityListener implements Listener {
Wolf wolf = (Wolf) pet; Wolf wolf = (Wolf) pet;
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
TamingManager tamingManager = mcMMO.getUserManager().queryPlayer(player).getTamingManager(); TamingManager tamingManager = UserManager.queryPlayer(player).getTamingManager();
switch (cause) { switch (cause) {
case CONTACT: case CONTACT:
@ -794,12 +794,12 @@ public class EntityListener implements Listener {
// using this exact metadata // using this exact metadata
Player player = pluginRef.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); Player player = pluginRef.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
@ -811,7 +811,7 @@ public class EntityListener implements Listener {
return; return;
} }
MiningManager miningManager = mcMMO.getUserManager().queryPlayer(player).getMiningManager(); MiningManager miningManager = UserManager.queryPlayer(player).getMiningManager();
if (miningManager.canUseBiggerBombs()) { if (miningManager.canUseBiggerBombs()) {
event.setRadius(miningManager.biggerBombs(event.getRadius())); event.setRadius(miningManager.biggerBombs(event.getRadius()));
@ -840,7 +840,7 @@ public class EntityListener implements Listener {
// using this exact metadata // using this exact metadata
Player player = pluginRef.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); Player player = pluginRef.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
@ -852,12 +852,12 @@ public class EntityListener implements Listener {
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
MiningManager miningManager = mcMMO.getUserManager().queryPlayer(player).getMiningManager(); MiningManager miningManager = UserManager.queryPlayer(player).getMiningManager();
if (miningManager.canUseBlastMining()) { if (miningManager.canUseBlastMining()) {
miningManager.blastMiningDropProcessing(event.getYield(), event); miningManager.blastMiningDropProcessing(event.getYield(), event);
@ -886,7 +886,7 @@ public class EntityListener implements Listener {
Player player = (Player) entity; Player player = (Player) entity;
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
@ -898,7 +898,7 @@ public class EntityListener implements Listener {
return; return;
} }
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
@ -951,7 +951,7 @@ public class EntityListener implements Listener {
* 1000 * 1000
*/ */
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) { 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; return;
@ -963,7 +963,7 @@ public class EntityListener implements Listener {
*/ */
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) { 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; return;
case COD: case COD:
@ -973,7 +973,7 @@ public class EntityListener implements Listener {
case COOKED_SALMON: case COOKED_SALMON:
if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET)) { 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; return;
@ -1008,7 +1008,7 @@ public class EntityListener implements Listener {
LivingEntity livingEntity = event.getEntity(); LivingEntity livingEntity = event.getEntity();
if (mcMMO.getUserManager().queryPlayer(player) == null if (UserManager.queryPlayer(player) == null
|| (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(livingEntity)) || (ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(livingEntity))
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity) || persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity)
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_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); persistentDataLayer.flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; 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; Tameable tameable = (Tameable) entity;
if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) { if (!UserManager.hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) {
return; return;
} }

View File

@ -66,13 +66,13 @@ public class InventoryListener implements Listener {
} }
//Profile doesn't exist //Profile doesn't exist
if(mcMMO.getUserManager().queryOfflineMcMMOPlayer(offlinePlayer) == null) if(UserManager.queryOfflineMcMMOPlayer(offlinePlayer) == null)
{ {
return; return;
} }
boolean debugMode = player.isOnline() && mcMMO.getUserManager().queryPlayer(player).isDebugMode(); boolean debugMode = player.isOnline() && UserManager.queryPlayer(player).isDebugMode();
if(debugMode) { if(debugMode) {
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT"); 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()); 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) { if(debugMode) {
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime()); player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
@ -111,7 +111,7 @@ public class InventoryListener implements Listener {
if(offlinePlayer != null) { if(offlinePlayer != null) {
OnlineMMOPlayer offlineProfile = mcMMO.getUserManager().queryOfflineMcMMOPlayer(offlinePlayer); OnlineMMOPlayer offlineProfile = UserManager.queryOfflineMcMMOPlayer(offlinePlayer);
//Profile doesn't exist //Profile doesn't exist
if(offlineProfile != null) { if(offlineProfile != null) {
@ -144,18 +144,18 @@ public class InventoryListener implements Listener {
return; return;
} }
if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkillType.SMELTING)) { if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkillType.SMELTING)) {
return; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
int xpToDrop = event.getExpToDrop(); int xpToDrop = event.getExpToDrop();
int exp = mcMMO.getUserManager().queryPlayer(player).getSmeltingManager().vanillaXPBoost(xpToDrop); int exp = UserManager.queryPlayer(player).getSmeltingManager().vanillaXPBoost(xpToDrop);
event.setExpToDrop(exp); event.setExpToDrop(exp);
} }
} }
@ -197,7 +197,7 @@ public class InventoryListener implements Listener {
HumanEntity whoClicked = event.getWhoClicked(); 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; return;
} }
@ -310,7 +310,7 @@ public class InventoryListener implements Listener {
HumanEntity whoClicked = event.getWhoClicked(); 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; return;
} }

View File

@ -88,12 +88,12 @@ public class PlayerListener implements Listener {
return; 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; return;
} }
//Profile not loaded //Profile not loaded
McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); McMMOPlayer mmoPlayer = (McMMOPlayer) UserManager.queryPlayer(player);
if(mmoPlayer == null) { if(mmoPlayer == null) {
return; return;
@ -199,17 +199,17 @@ public class PlayerListener implements Listener {
public void onPlayerWorldChange(PlayerChangedWorldEvent event) { public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if(mmoPlayer == null) { if(mmoPlayer == null) {
return; return;
@ -274,12 +274,12 @@ public class PlayerListener implements Listener {
return; return;
} }
if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) {
return; return;
} }
//Profile not loaded //Profile not loaded
McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); McMMOPlayer mmoPlayer = (McMMOPlayer) UserManager.queryPlayer(player);
if(mmoPlayer == null) { if(mmoPlayer == null) {
return; return;
@ -361,18 +361,18 @@ public class PlayerListener implements Listener {
return; return;
} }
if (!mcMMO.getUserManager().hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) { if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.FISHING.getPermissions(player)) {
return; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
Entity caught = event.getCaught(); Entity caught = event.getCaught();
FishingManager fishingManager = mcMMO.getUserManager().queryPlayer(player).getFishingManager(); FishingManager fishingManager = UserManager.queryPlayer(player).getFishingManager();
//Track the hook //Track the hook
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) if(ExperienceConfig.getInstance().isFishingExploitingPrevented())
@ -474,11 +474,11 @@ public class PlayerListener implements Listener {
return; return;
} }
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Profile not loaded //Profile not loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -589,17 +589,17 @@ public class PlayerListener implements Listener {
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; 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; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
MiningManager miningManager = ((McMMOPlayer) (mmoPlayer)).getMiningManager(); MiningManager miningManager = ((McMMOPlayer) (mmoPlayer)).getMiningManager();
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
@ -675,7 +675,7 @@ public class PlayerListener implements Listener {
&& RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)
&& mcMMO.getSalvageableManager().isSalvageable(heldItem) && mcMMO.getSalvageableManager().isSalvageable(heldItem)
&& heldItem.getAmount() <= 1) { && heldItem.getAmount() <= 1) {
SalvageManager salvageManager = mcMMO.getUserManager().queryPlayer(player).getSalvageManager(); SalvageManager salvageManager = UserManager.queryPlayer(player).getSalvageManager();
event.setCancelled(true); event.setCancelled(true);
// Make sure the player knows what he's doing when trying to salvage an enchanted item // 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; 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; return;
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
{ {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
//Spam Fishing Detection //Spam Fishing Detection
@ -797,7 +797,7 @@ public class PlayerListener implements Listener {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if (mmoPlayer == null) { if (mmoPlayer == null) {
mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server."); mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server.");

View File

@ -37,14 +37,14 @@ public class SelfListener implements Listener {
{ {
int previousLevelGained = event.getSkillLevel() - i; int previousLevelGained = event.getSkillLevel() - i;
//Send player skill unlock notifications //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++) for(int i = 0; i < event.getLevelsGained(); i++)
{ {
int previousLevelGained = event.getSkillLevel() - i; int previousLevelGained = event.getSkillLevel() - i;
//Send player skill unlock notifications //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 //Reset the delay timer
@ -80,7 +80,7 @@ public class SelfListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
PrimarySkillType primarySkillType = event.getSkill(); PrimarySkillType primarySkillType = event.getSkill();
if(mmoPlayer.isDebugMode()) { if(mmoPlayer.isDebugMode()) {

View File

@ -84,8 +84,7 @@ public class mcMMO extends JavaPlugin {
private static PlayerLevelUtils playerLevelUtils; private static PlayerLevelUtils playerLevelUtils;
private static SmeltingTracker smeltingTracker; private static SmeltingTracker smeltingTracker;
private static SpawnedProjectileTracker spawnedProjectileTracker; private static SpawnedProjectileTracker spawnedProjectileTracker;
private static UserManager userManager; private static PartyManager partyManager; //TODO: T&C wire this up
private static PartyManager partyManager;
private static TransientMetadataTools transientMetadataTools; private static TransientMetadataTools transientMetadataTools;
private static ChatManager chatManager; private static ChatManager chatManager;
private static CommandManager commandManager; //ACF private static CommandManager commandManager; //ACF
@ -315,9 +314,6 @@ public class mcMMO extends JavaPlugin {
//Init spawned projectile tracker //Init spawned projectile tracker
spawnedProjectileTracker = new SpawnedProjectileTracker(); spawnedProjectileTracker = new SpawnedProjectileTracker();
//Init Player Data Manager
userManager = new UserManager();
//Set up Adventure's audiences //Set up Adventure's audiences
audiences = BukkitAudiences.create(this); 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..."); mcMMO.p.getLogger().info("Server shutdown has been executed, saving and cleaning up data...");
try { try {
userManager.saveAllSync(); // Make sure to save player information if the server shuts down UserManager.saveAll(); // Make sure to save player information if the server shuts down
userManager.clearAll(); UserManager.clearAll();
Alchemy.finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla brewing continuation on restart Alchemy.finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla brewing continuation on restart
mcMMO.getPartyManager().saveParties(); // Save our parties mcMMO.getPartyManager().saveParties(); // Save our parties

View File

@ -42,7 +42,7 @@ public final class ShareHandler {
float splitXp = (float) (xp / partySize * shareBonus); float splitXp = (float) (xp / partySize * shareBonus);
for (Player otherMember : nearMembers) { for (Player otherMember : nearMembers) {
OnlineMMOPlayer partyMember = mcMMO.getUserManager().queryPlayer(otherMember); OnlineMMOPlayer partyMember = UserManager.queryPlayer(otherMember);
//Profile not loaded //Profile not loaded
if(partyMember == null) { if(partyMember == null) {

View File

@ -12,8 +12,8 @@ public class SaveTimerTask extends BukkitRunnable {
int count = 1; int count = 1;
//TODO: write a more efficient bulk save //TODO: write a more efficient bulk save
for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) { for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) {
mcMMO.getUserManager().saveUserWithDelay(mmoPlayer.getPersistentPlayerData(), false, count); UserManager.saveUserWithDelay(mmoPlayer.getPersistentPlayerData(), false, count);
count++; count++;
} }

View File

@ -10,9 +10,9 @@ public class NotifySquelchReminderTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
for (Player player : Bukkit.getOnlinePlayers()) { 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")); player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
} }

View File

@ -6,7 +6,7 @@ import org.bukkit.scheduler.BukkitRunnable;
public class ClearRegisteredXPGainTask extends BukkitRunnable { public class ClearRegisteredXPGainTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) { for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) {
mmoPlayer.purgeExpiredXpGains(); mmoPlayer.purgeExpiredXpGains();
} }
} }

View File

@ -38,7 +38,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
brewSpeed = DEFAULT_BREW_SPEED; brewSpeed = DEFAULT_BREW_SPEED;
brewTimer = DEFAULT_BREW_TICKS; brewTimer = DEFAULT_BREW_TICKS;
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if (player != null if (player != null
&& !Misc.isNPCEntityExcludingVillagers(player) && !Misc.isNPCEntityExcludingVillagers(player)
&& Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS) && Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)

View File

@ -92,12 +92,12 @@ public final class AlchemyPotionBrewer {
} }
private static List<ItemStack> getValidIngredients(Player player) { private static List<ItemStack> 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(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) { public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
@ -154,8 +154,8 @@ public final class AlchemyPotionBrewer {
PotionStage potionStage = PotionStage.getPotionStage(input, output); PotionStage potionStage = PotionStage.getPotionStage(input, output);
//TODO: hmm //TODO: hmm
if (mcMMO.getUserManager().hasPlayerDataKey(player)) { if (UserManager.hasPlayerDataKey(player)) {
mcMMO.getUserManager().queryPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1); UserManager.queryPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
} }
} }
} }

View File

@ -91,7 +91,7 @@ public class BlastMining {
} }
public static boolean processBlastMiningExplosion(EntityDamageByEntityEvent event, TNTPrimed tnt, Player defender) { 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; return false;
} }
@ -102,12 +102,12 @@ public class BlastMining {
return false; return false;
} }
if(mcMMO.getUserManager().queryPlayer(defender) == null) if(UserManager.queryPlayer(defender) == null)
{ {
return false; return false;
} }
MiningManager miningManager = mcMMO.getUserManager().queryPlayer(defender).getMiningManager(); MiningManager miningManager = UserManager.queryPlayer(defender).getMiningManager();
if (!miningManager.canUseDemolitionsExpertise()) { if (!miningManager.canUseDemolitionsExpertise()) {
return false; return false;

View File

@ -107,13 +107,13 @@ public class UnarmedManager extends SkillManager {
return; return;
} }
if(mcMMO.getUserManager().queryPlayer(defender) == null) if(UserManager.queryPlayer(defender) == null)
return; return;
Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM); Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM);
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) { 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)); defender.getInventory().setItemInMainHand(new ItemStack(Material.AIR));

View File

@ -52,7 +52,7 @@ public final class ChimaeraWing {
return; return;
} }
mmoPlayer = mcMMO.getUserManager().queryPlayer(player); mmoPlayer = UserManager.queryPlayer(player);
//Not loaded //Not loaded
if(mmoPlayer == null) if(mmoPlayer == null)

View File

@ -96,7 +96,7 @@ public final class EventUtils {
*/ */
public static OnlineMMOPlayer getMcMMOPlayer(@NotNull Entity entity) 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) { if (livingEntity instanceof Player) {
Player player = (Player) entity; Player player = (Player) entity;
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return true; return true;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if(mmoPlayer == null) if(mmoPlayer == null)
{ {
@ -237,7 +237,7 @@ public final class EventUtils {
boolean isCancelled = event.isCancelled(); boolean isCancelled = event.isCancelled();
if (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.getExperienceHandler().setSkillLevel(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
profile.addXp(skill, xpRemoved); profile.addXp(skill, xpRemoved);
@ -273,7 +273,7 @@ public final class EventUtils {
boolean isCancelled = event.isCancelled(); boolean isCancelled = event.isCancelled();
if (isCancelled) { if (isCancelled) {
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player); PlayerProfile profile = UserManager.queryPlayer(player);
profile.modifySkill(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged)); profile.modifySkill(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
profile.addXp(skill, xpRemoved); profile.addXp(skill, xpRemoved);
@ -327,7 +327,7 @@ public final class EventUtils {
} }
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) { public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(teleportingPlayer); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(teleportingPlayer);
if(mmoPlayer == null) if(mmoPlayer == null)
return; return;
@ -382,15 +382,15 @@ public final class EventUtils {
boolean isCancelled = event.isCancelled(); boolean isCancelled = event.isCancelled();
if (!isCancelled) { if (!isCancelled) {
mcMMO.getUserManager().queryPlayer(player).addXp(skill, event.getRawXpGained()); UserManager.queryPlayer(player).addXp(skill, event.getRawXpGained());
mcMMO.getUserManager().queryPlayer(player).registerXpGain(skill, event.getRawXpGained()); UserManager.queryPlayer(player).registerXpGain(skill, event.getRawXpGained());
} }
return !isCancelled; return !isCancelled;
} }
public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
return true; return true;
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged); McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
@ -401,7 +401,7 @@ public final class EventUtils {
if (!isCancelled) { if (!isCancelled) {
levelChanged = event.getLevelChanged(); levelChanged = event.getLevelChanged();
experienceChanged = event.getExperienceChanged(); experienceChanged = event.getExperienceChanged();
PlayerProfile playerProfile = mcMMO.getUserManager().queryPlayer(player); PlayerProfile playerProfile = UserManager.queryPlayer(player);
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
String skillName = primarySkillType.toString(); String skillName = primarySkillType.toString();
@ -440,17 +440,17 @@ public final class EventUtils {
HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged(); HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged();
HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged(); HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged();
OnlineMMOPlayer killerPlayer = mcMMO.getUserManager().queryPlayer(killer); OnlineMMOPlayer killerPlayer = UserManager.queryPlayer(killer);
//Not loaded //Not loaded
if(killerPlayer == null) if(killerPlayer == null)
return true; return true;
//Not loaded //Not loaded
if(mcMMO.getUserManager().queryPlayer(victim) == null) if(UserManager.queryPlayer(victim) == null)
return true; return true;
PlayerProfile victimProfile = mcMMO.getUserManager().queryPlayer(victim); PlayerProfile victimProfile = UserManager.queryPlayer(victim);
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
String skillName = primarySkillType.toString(); String skillName = primarySkillType.toString();

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils; import com.gmail.nossr50.worldguard.WorldGuardUtils;
@ -25,10 +24,10 @@ public final class HardcoreManager {
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage(); double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(); int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
if(mcMMO.getUserManager().queryPlayer(player) == null) if(UserManager.queryPlayer(player) == null)
return; return;
PlayerProfile playerProfile = mcMMO.getUserManager().queryPlayer(player); PlayerProfile playerProfile = UserManager.queryPlayer(player);
int totalLevelsLost = 0; int totalLevelsLost = 0;
HashMap<String, Integer> levelChanged = new HashMap<>(); HashMap<String, Integer> levelChanged = new HashMap<>();
@ -76,11 +75,11 @@ public final class HardcoreManager {
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage(); double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold(); 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; return;
PlayerProfile killerProfile = mcMMO.getUserManager().queryPlayer(killer); PlayerProfile killerProfile = UserManager.queryPlayer(killer);
PlayerProfile victimProfile = mcMMO.getUserManager().queryPlayer(victim); PlayerProfile victimProfile = UserManager.queryPlayer(victim);
int totalLevelsStolen = 0; int totalLevelsStolen = 0;
HashMap<String, Integer> levelChanged = new HashMap<>(); HashMap<String, Integer> levelChanged = new HashMap<>();

View File

@ -368,7 +368,7 @@ public final class HolidayManager {
if(!Config.getInstance().isAprilFoolsAllowed()) if(!Config.getInstance().isAprilFoolsAllowed())
return; return;
final OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); final OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if (mmoPlayer == null) return; if (mmoPlayer == null) return;
int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.getSkillLevel(PrimarySkillType.MINING)) + 1; int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.getSkillLevel(PrimarySkillType.MINING)) + 1;

View File

@ -254,7 +254,7 @@ public final class Misc {
Player player = mcMMO.p.getServer().getPlayerExact(playerName); Player player = mcMMO.p.getServer().getPlayerExact(playerName);
if (player != null) { 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 new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
} }
} }

View File

@ -207,10 +207,10 @@ public final class CommandUtils {
} }
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) { private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) {
if(mcMMO.getUserManager().queryPlayer(inspect) == null) if(UserManager.queryPlayer(inspect) == null)
return; return;
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(inspect); PlayerProfile profile = UserManager.queryPlayer(inspect);
List<String> displayData = new ArrayList<>(); List<String> displayData = new ArrayList<>();
displayData.add(header); displayData.add(header);

View File

@ -47,7 +47,7 @@ public class NotificationManager {
*/ */
public static void sendPlayerInformation(@NotNull Player player, @NotNull NotificationType notificationType, @NotNull String key) 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()) if(mmoPlayer == null || !mmoPlayer.hasSkillChatNotifications())
return; return;
@ -63,7 +63,7 @@ public class NotificationManager {
public static boolean doesPlayerUseNotifications(@NotNull Player player) public static boolean doesPlayerUseNotifications(@NotNull Player player)
{ {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if(mmoPlayer == null) if(mmoPlayer == null)
return false; return false;
@ -86,7 +86,7 @@ public class NotificationManager {
} }
public static void sendPlayerInformationChatOnly(@NotNull Player player, @NotNull String key, String... values) { 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 //Don't send chat notifications if they are disabled
if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications()) if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications())
@ -98,7 +98,7 @@ public class NotificationManager {
public static void sendPlayerInformationChatOnlyPrefixed(@NotNull Player player, @NotNull String key, String... values) 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 //Don't send chat notifications if they are disabled
if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications()) 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) { 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 //Don't send chat notifications if they are disabled
if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications()) if(mmoPlayer != null && !mmoPlayer.hasSkillChatNotifications())

View File

@ -465,7 +465,7 @@ public class ScoreboardManager {
} }
for (String playerName : dirtyPowerLevels) { for (String playerName : dirtyPowerLevels) {
MMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerName); MMOPlayer mmoPlayer = UserManager.queryPlayer(playerName);
if (mmoPlayer == null) { if (mmoPlayer == null) {
continue; continue;

View File

@ -63,7 +63,7 @@ public class ScoreboardWrapper {
powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL); powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL);
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME); powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
for (OnlineMMOPlayer mmoPlayer : mcMMO.getUserManager().getPlayers()) { for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) {
powerObjective.getScore(mmoPlayer.getPlayerName()).setScore(mmoPlayer.getExperienceHandler().getPowerLevel()); 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? // 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)); // 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; return;
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player); PlayerProfile profile = UserManager.queryPlayer(player);
if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) { if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) {
return; return;
@ -447,7 +447,7 @@ public class ScoreboardWrapper {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
if(mmoPlayer == null) if(mmoPlayer == null)
return; return;
@ -539,7 +539,7 @@ public class ScoreboardWrapper {
newProfile = mmoPlayer; // self newProfile = mmoPlayer; // self
} }
else { else {
newProfile = mcMMO.getUserManager().getPlayer(targetPlayer); // online newProfile = UserManager.getPlayer(targetPlayer); // online
} }
// Calculate power level here // Calculate power level here

View File

@ -75,7 +75,7 @@ public final class CombatUtils {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -125,7 +125,7 @@ public final class CombatUtils {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -161,7 +161,7 @@ public final class CombatUtils {
double finalDamage = initialDamage; double finalDamage = initialDamage;
Map<DamageModifier, Double> modifiers = getModifiers(event); Map<DamageModifier, Double> modifiers = getModifiers(event);
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -212,7 +212,7 @@ public final class CombatUtils {
double initialDamage = event.getDamage(); double initialDamage = event.getDamage();
double finalDamage = initialDamage; double finalDamage = initialDamage;
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -253,7 +253,7 @@ public final class CombatUtils {
double finalDamage = initialDamage; double finalDamage = initialDamage;
if(master != null && master.isOnline() && master.isValid()) { if(master != null && master.isOnline() && master.isValid()) {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(master); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(master);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { 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) { private static void processArcheryCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull Projectile arrow) {
double initialDamage = event.getDamage(); double initialDamage = event.getDamage();
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -337,7 +337,7 @@ public final class CombatUtils {
private static void processCrossbowCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Projectile arrow) { private static void processCrossbowCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Projectile arrow) {
double initialDamage = event.getDamage(); double initialDamage = event.getDamage();
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Make sure the profiles been loaded //Make sure the profiles been loaded
if(mmoPlayer == null) { if(mmoPlayer == null) {
@ -349,7 +349,7 @@ public final class CombatUtils {
double finalDamage = event.getDamage(); double finalDamage = event.getDamage();
if (target instanceof Player && PrimarySkillType.UNARMED.getPVPEnabled()) { 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()) { if (unarmedManager.canDeflect()) {
event.setCancelled(unarmedManager.deflectCheck()); event.setCancelled(unarmedManager.deflectCheck());
@ -394,11 +394,11 @@ public final class CombatUtils {
} }
Player player = (Player) target; Player player = (Player) target;
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
AcrobaticsManager acrobaticsManager = ((McMMOPlayer) (mmoPlayer)).getAcrobaticsManager(); AcrobaticsManager acrobaticsManager = ((McMMOPlayer) (mmoPlayer)).getAcrobaticsManager();
if (acrobaticsManager.canDodge(target)) { if (acrobaticsManager.canDodge(target)) {
@ -421,7 +421,7 @@ public final class CombatUtils {
if (painSourceRoot instanceof Player && entityType == EntityType.PLAYER) { if (painSourceRoot instanceof Player && entityType == EntityType.PLAYER) {
Player player = (Player) painSourceRoot; Player player = (Player) painSourceRoot;
if (!mcMMO.getUserManager().hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return; return;
} }
@ -429,7 +429,7 @@ public final class CombatUtils {
if (target instanceof Tameable) { if (target instanceof Tameable) {
if (heldItem.getType() == Material.BONE) { if (heldItem.getType() == Material.BONE) {
TamingManager tamingManager = mcMMO.getUserManager().queryPlayer(player).getTamingManager(); TamingManager tamingManager = UserManager.queryPlayer(player).getTamingManager();
if (tamingManager.canUseBeastLore()) { if (tamingManager.canUseBeastLore()) {
tamingManager.beastLore(target); tamingManager.beastLore(target);
@ -522,7 +522,7 @@ public final class CombatUtils {
} }
if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntityExcludingVillagers(player) && PrimarySkillType.TAMING.getPermissions(player)) { 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) { if(mmoPlayer == null) {
return; return;
@ -777,7 +777,7 @@ public final class CombatUtils {
NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck"); 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; break;
case AXES: case AXES:
@ -903,10 +903,10 @@ public final class CombatUtils {
Player defender = (Player) entity; Player defender = (Player) entity;
//TODO: NPC Interaction? //TODO: NPC Interaction?
if(mcMMO.getUserManager().queryPlayer(defender) == null) if(UserManager.queryPlayer(defender) == null)
return true; 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; return false;
} }

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.events.skills.SkillActivationPerkEvent; import com.gmail.nossr50.events.skills.SkillActivationPerkEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -54,7 +53,7 @@ public final class PerksUtils {
double modifier = 1.0F; double modifier = 1.0F;
if (Permissions.customXpBoost(player, skill)) { 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! "); 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); 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 + "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 + "Original XP before perk boosts " + ChatColor.RED + (double) xp);
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP); player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP);

View File

@ -185,7 +185,7 @@ public final class SkillUtils {
} }
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
//Not Loaded //Not Loaded
if(mmoPlayer == null) if(mmoPlayer == null)

View File

@ -21,7 +21,7 @@ public class SmeltingTracker {
private void changeFurnaceOwnership(Furnace furnace, Player player) { private void changeFurnaceOwnership(Furnace furnace, Player player) {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
/* /*
Debug output Debug output
@ -52,7 +52,7 @@ public class SmeltingTracker {
OfflinePlayer furnaceOwner = getFurnaceOwner(furnace); OfflinePlayer furnaceOwner = getFurnaceOwner(furnace);
if(furnaceOwner != null && furnaceOwner.isOnline()) { if(furnaceOwner != null && furnaceOwner.isOnline()) {
OnlineMMOPlayer furnaceOwnerProfile = mcMMO.getUserManager().queryPlayer(furnaceOwner.getPlayer()); OnlineMMOPlayer furnaceOwnerProfile = UserManager.queryPlayer(furnaceOwner.getPlayer());
if(furnaceOwnerProfile != null) { if(furnaceOwnerProfile != null) {
if(furnaceOwnerProfile.isDebugMode()) { if(furnaceOwnerProfile.isDebugMode()) {