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;
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<T extends CommandSender> implements Predicate<T>
} 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;
}

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.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;

View File

@ -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;

View File

@ -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();
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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);
}
/**

View File

@ -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())

View File

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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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.");

View File

@ -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()) {

View File

@ -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

View File

@ -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) {

View File

@ -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++;
}

View File

@ -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"));
}

View File

@ -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();
}
}

View File

@ -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)

View File

@ -92,12 +92,12 @@ public final class AlchemyPotionBrewer {
}
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(!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);
}
}
}

View File

@ -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;

View File

@ -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));

View File

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

View File

@ -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<String, Integer> levelChanged, HashMap<String, Float> 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<String, Integer> levelChangedVictim = eventVictim.getLevelChanged();
HashMap<String, Float> 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();

View File

@ -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<String, Integer> 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<String, Integer> levelChanged = new HashMap<>();

View File

@ -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;

View File

@ -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
}
}

View File

@ -207,10 +207,10 @@ public final class CommandUtils {
}
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;
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(inspect);
PlayerProfile profile = UserManager.queryPlayer(inspect);
List<String> displayData = new ArrayList<>();
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)
{
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())

View File

@ -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;

View File

@ -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

View File

@ -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<DamageModifier, Double> 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;
}

View File

@ -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);

View File

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

View File

@ -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()) {