Part 2 of removing bad design patterns

This commit is contained in:
nossr50
2019-06-27 03:04:34 -07:00
parent 5ee862effd
commit 87af2419a3
234 changed files with 2303 additions and 2746 deletions

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.util;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.util.random.RandomChanceSkill;
@@ -30,9 +29,9 @@ public final class BlockUtils {
*/
public static void markDropsAsBonus(BlockState blockState, boolean triple) {
if (triple)
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(2, mcMMO.p));
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(2, pluginRef));
else
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(1, mcMMO.p));
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(1, pluginRef));
}
/**
@@ -42,7 +41,7 @@ public final class BlockUtils {
* @param amount amount of extra items to drop
*/
public static void markDropsAsBonus(BlockState blockState, int amount) {
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(amount, mcMMO.p));
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(amount, pluginRef));
}
/**
@@ -52,7 +51,7 @@ public final class BlockUtils {
* @return true if the player succeeded in the check
*/
public static boolean checkDoubleDrops(Player player, BlockState blockState, SubSkillType subSkillType) {
if (mcMMO.getDynamicSettingsManager().isBonusDropsEnabled(blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
if (pluginRef.getDynamicSettingsManager().isBonusDropsEnabled(blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
}
@@ -97,7 +96,7 @@ public final class BlockUtils {
* otherwise
*/
public static boolean canActivateAbilities(BlockState blockState) {
return !mcMMO.getMaterialMapStore().isAbilityActivationBlackListed(blockState.getType());
return !pluginRef.getMaterialMapStore().isAbilityActivationBlackListed(blockState.getType());
}
/**
@@ -109,7 +108,7 @@ public final class BlockUtils {
* otherwise
*/
public static boolean canActivateTools(BlockState blockState) {
return !mcMMO.getMaterialMapStore().isToolActivationBlackListed(blockState.getType());
return !pluginRef.getMaterialMapStore().isToolActivationBlackListed(blockState.getType());
}
/**
@@ -129,7 +128,7 @@ public final class BlockUtils {
* @return true if the block can be made mossy, false otherwise
*/
public static boolean canMakeMossy(BlockState blockState) {
return mcMMO.getMaterialMapStore().isMossyWhiteListed(blockState.getType());
return pluginRef.getMaterialMapStore().isMossyWhiteListed(blockState.getType());
}
/**
@@ -139,7 +138,7 @@ public final class BlockUtils {
* @return true if the block should affected by Green Terra, false otherwise
*/
public static boolean affectedByGreenTerra(BlockState blockState) {
return mcMMO.getDynamicSettingsManager().getExperienceManager().hasHerbalismXp(blockState.getType());
return pluginRef.getDynamicSettingsManager().getExperienceManager().hasHerbalismXp(blockState.getType());
}
/**
@@ -149,7 +148,7 @@ public final class BlockUtils {
* @return true if the block should affected by Green Terra, false otherwise
*/
public static boolean affectedByGreenTerra(Material material) {
return mcMMO.getDynamicSettingsManager().getExperienceManager().hasHerbalismXp(material);
return pluginRef.getDynamicSettingsManager().getExperienceManager().hasHerbalismXp(material);
}
/**
@@ -160,7 +159,7 @@ public final class BlockUtils {
* otherwise
*/
public static Boolean affectedBySuperBreaker(BlockState blockState) {
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasMiningXp(blockState.getType()))
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasMiningXp(blockState.getType()))
return true;
return isMineable(blockState);
@@ -174,7 +173,7 @@ public final class BlockUtils {
* otherwise
*/
public static Boolean affectedBySuperBreaker(Material material) {
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasMiningXp(material))
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasMiningXp(material))
return true;
return isMineable(material);
@@ -225,7 +224,7 @@ public final class BlockUtils {
* otherwise
*/
public static boolean affectedByGigaDrillBreaker(Material material) {
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasExcavationXp(material))
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasExcavationXp(material))
return true;
return isDiggable(material);
@@ -239,7 +238,7 @@ public final class BlockUtils {
* otherwise
*/
public static boolean affectedByGigaDrillBreaker(BlockState blockState) {
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasExcavationXp(blockState.getType()))
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasExcavationXp(blockState.getType()))
return true;
return isDiggable(blockState);
@@ -291,7 +290,7 @@ public final class BlockUtils {
* @return true if the block is a log, false otherwise
*/
public static boolean isLog(BlockState blockState) {
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasWoodcuttingXp(blockState.getType()))
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasWoodcuttingXp(blockState.getType()))
return true;
return isLoggingRelated(blockState);
@@ -305,7 +304,7 @@ public final class BlockUtils {
* @return true if the block is a log, false otherwise
*/
public static boolean isLog(Material material) {
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasWoodcuttingXp(material))
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasWoodcuttingXp(material))
return true;
return isLoggingRelated(material);
@@ -367,7 +366,7 @@ public final class BlockUtils {
* @return true if the block is a leaf, false otherwise
*/
public static boolean isLeaves(BlockState blockState) {
return mcMMO.getMaterialMapStore().isLeavesWhiteListed(blockState.getType());
return pluginRef.getMaterialMapStore().isLeavesWhiteListed(blockState.getType());
}
/**
@@ -396,7 +395,7 @@ public final class BlockUtils {
* otherwise
*/
public static boolean canActivateHerbalism(BlockState blockState) {
return mcMMO.getMaterialMapStore().isHerbalismAbilityWhiteListed(blockState.getType());
return pluginRef.getMaterialMapStore().isHerbalismAbilityWhiteListed(blockState.getType());
}
/**
@@ -407,7 +406,7 @@ public final class BlockUtils {
* otherwise
*/
public static boolean affectedByBlockCracker(BlockState blockState) {
return mcMMO.getMaterialMapStore().isBlockCrackerWhiteListed(blockState.getType());
return pluginRef.getMaterialMapStore().isBlockCrackerWhiteListed(blockState.getType());
}
/**
@@ -417,7 +416,7 @@ public final class BlockUtils {
* @return true if the block can be made into Mycelium, false otherwise
*/
public static boolean canMakeShroomy(BlockState blockState) {
return mcMMO.getMaterialMapStore().isShroomyWhiteListed(blockState.getType());
return pluginRef.getMaterialMapStore().isShroomyWhiteListed(blockState.getType());
}
/**

View File

@@ -2,8 +2,6 @@ package com.gmail.nossr50.util;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
@@ -36,7 +34,7 @@ public final class ChimaeraWing {
* @param player Player whose item usage to check
*/
public static void activationCheck(Player player) {
if (!mcMMO.getConfigManager().getConfigItems().isChimaeraWingEnabled()) {
if (!pluginRef.getConfigManager().getConfigItems().isChimaeraWingEnabled()) {
return;
}
@@ -47,7 +45,7 @@ public final class ChimaeraWing {
}
if (!Permissions.chimaeraWing(player)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return;
}
@@ -63,42 +61,42 @@ public final class ChimaeraWing {
int amount = inHand.getAmount();
if (amount < mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough",
String.valueOf(mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost() - amount), "Item.ChimaeraWing.Name");
if (amount < pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost()) {
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough",
String.valueOf(pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost() - amount), "Item.ChimaeraWing.Name");
return;
}
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
int cooldown = mcMMO.getConfigManager().getConfigItems().getCooldown();
int cooldown = pluginRef.getConfigManager().getConfigItems().getCooldown();
if (cooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, cooldown, player);
if (timeRemaining > 0) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Item.Generic.Wait", String.valueOf(timeRemaining));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Item.Generic.Wait", String.valueOf(timeRemaining));
return;
}
}
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
int hurtCooldown = mcMMO.getConfigManager().getConfigItems().getRecentlyHurtCooldown();
int hurtCooldown = pluginRef.getConfigManager().getConfigItems().getRecentlyHurtCooldown();
if (hurtCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
if (timeRemaining > 0) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.Injured.Wait", String.valueOf(timeRemaining));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.Injured.Wait", String.valueOf(timeRemaining));
return;
}
}
location = player.getLocation();
if (mcMMO.getConfigManager().getConfigItems().isPreventUndergroundUse()) {
if (pluginRef.getConfigManager().getConfigItems().isPreventUndergroundUse()) {
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(amount - mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost())));
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(amount - pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost())));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
player.updateInventory();
player.setVelocity(new Vector(0, 0.5D, 0));
CombatUtils.dealDamage(player, Misc.getRandom().nextInt((int) (player.getHealth() - 10)));
@@ -109,11 +107,11 @@ public final class ChimaeraWing {
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
long warmup = mcMMO.getConfigManager().getConfigItems().getChimaeraWingWarmup();
long warmup = pluginRef.getConfigManager().getConfigItems().getChimaeraWingWarmup();
if (warmup > 0) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
new ChimaeraWingWarmup(mcMMOPlayer).runTaskLater(mcMMO.p, 20 * warmup);
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
new ChimaeraWingWarmup(mcMMOPlayer).runTaskLater(pluginRef, 20 * warmup);
} else {
chimaeraExecuteTeleport();
}
@@ -122,7 +120,7 @@ public final class ChimaeraWing {
public static void chimaeraExecuteTeleport() {
Player player = mcMMOPlayer.getPlayer();
if (mcMMO.getConfigManager().getConfigItems().doesChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
if (pluginRef.getConfigManager().getConfigItems().doesChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
player.teleport(player.getBedSpawnLocation());
} else {
Location spawnLocation = player.getWorld().getSpawnLocation();
@@ -133,20 +131,20 @@ public final class ChimaeraWing {
}
}
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(player.getInventory().getItemInMainHand().getAmount() - mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost())));
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(player.getInventory().getItemInMainHand().getAmount() - pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost())));
player.updateInventory();
mcMMOPlayer.actualizeChimeraWingLastUse();
mcMMOPlayer.setTeleportCommenceLocation(null);
if (mcMMO.getConfigManager().getConfigItems().isChimaeraWingSoundEnabled()) {
if (pluginRef.getConfigManager().getConfigItems().isChimaeraWingSoundEnabled()) {
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
}
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
}
public static ItemStack getChimaeraWing(int amount) {
Material ingredient = Material.matchMaterial(mcMMO.getConfigManager().getConfigItems().getChimaeraWingRecipeMats());
Material ingredient = Material.matchMaterial(pluginRef.getConfigManager().getConfigItems().getChimaeraWingRecipeMats());
if(ingredient == null)
ingredient = Material.FEATHER;
@@ -154,11 +152,11 @@ public final class ChimaeraWing {
ItemStack itemStack = new ItemStack(ingredient, amount);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
itemMeta.setDisplayName(ChatColor.GOLD + pluginRef.getLocaleManager().getString("Item.ChimaeraWing.Name"));
List<String> itemLore = new ArrayList<>();
itemLore.add("mcMMO Item");
itemLore.add(LocaleLoader.getString("Item.ChimaeraWing.Lore"));
itemLore.add(pluginRef.getLocaleManager().getString("Item.ChimaeraWing.Lore"));
itemMeta.setLore(itemLore);
itemStack.setItemMeta(itemMeta);
@@ -166,14 +164,14 @@ public final class ChimaeraWing {
}
public static ShapelessRecipe getChimaeraWingRecipe() {
Material ingredient = Material.matchMaterial(mcMMO.getConfigManager().getConfigItems().getChimaeraWingRecipeMats());
Material ingredient = Material.matchMaterial(pluginRef.getConfigManager().getConfigItems().getChimaeraWingRecipeMats());
if(ingredient == null)
ingredient = Material.FEATHER;
int amount = mcMMO.getConfigManager().getConfigItems().getChimaeraWingUseCost();
int amount = pluginRef.getConfigManager().getConfigItems().getChimaeraWingUseCost();
ShapelessRecipe chimaeraWing = new ShapelessRecipe(new NamespacedKey(mcMMO.p, "Chimaera"), getChimaeraWing(1));
ShapelessRecipe chimaeraWing = new ShapelessRecipe(new NamespacedKey(pluginRef, "Chimaera"), getChimaeraWing(1));
chimaeraWing.addIngredient(amount, ingredient);
return chimaeraWing;
}

View File

@@ -1,7 +1,5 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.mcMMO;
import java.lang.reflect.Method;
public class CompatibilityCheck {
@@ -15,7 +13,7 @@ public class CompatibilityCheck {
Class<?> checkForClassBaseComponent = Class.forName("net.md_5.bungee.api.chat.BaseComponent");
} catch (ClassNotFoundException | NoSuchMethodException e) {
serverAPIOutdated = true;
mcMMO.p.getLogger().severe("You are running an older version of " + software + " that is not compatible with mcMMO, update your server software!");
pluginRef.getLogger().severe("You are running an older version of " + software + " that is not compatible with mcMMO, update your server software!");
}
}
}

View File

@@ -30,8 +30,6 @@ import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
import com.gmail.nossr50.events.skills.salvage.McMMOPlayerSalvageCheckEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import net.md_5.bungee.api.chat.TextComponent;
@@ -167,7 +165,7 @@ public class EventUtils {
public static McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) {
McMMOPlayerAbilityActivateEvent event = new McMMOPlayerAbilityActivateEvent(player, skill);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
@@ -182,7 +180,7 @@ public class EventUtils {
@Deprecated
public static SubSkillEvent callSubSkillEvent(Player player, SubSkillType subSkillType) {
SubSkillEvent event = new SubSkillEvent(player, subSkillType);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
@@ -196,20 +194,20 @@ public class EventUtils {
*/
public static SubSkillEvent callSubSkillEvent(Player player, AbstractSubSkill abstractSubSkill) {
SubSkillEvent event = new SubSkillEvent(player, abstractSubSkill);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
public static void callFakeArmSwingEvent(Player player) {
FakePlayerAnimationEvent event = new FakePlayerAnimationEvent(player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
}
public static boolean tryLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) {
McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
boolean isCancelled = event.isCancelled();
@@ -225,7 +223,7 @@ public class EventUtils {
public static boolean tryLevelEditEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) {
McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged - oldLevel, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
boolean isCancelled = event.isCancelled();
@@ -248,7 +246,7 @@ public class EventUtils {
* @return true if the event wasn't cancelled, false otherwise
*/
public static boolean simulateBlockBreak(Block block, Player player, boolean shouldArmSwing) {
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
PluginManager pluginManager = pluginRef.getServer().getPluginManager();
// Support for NoCheat
if (shouldArmSwing) {
@@ -271,7 +269,7 @@ public class EventUtils {
return;
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName());
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
@@ -279,15 +277,15 @@ public class EventUtils {
teleportingPlayer.teleport(targetPlayer);
teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));
targetPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Target", teleportingPlayer.getName()));
teleportingPlayer.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Player", targetPlayer.getName()));
targetPlayer.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Target", teleportingPlayer.getName()));
mcMMOPlayer.getPartyTeleportRecord().actualizeLastUse();
}
public static boolean handlePartyXpGainEvent(Party party, double xpGained) {
McMMOPartyXpGainEvent event = new McMMOPartyXpGainEvent(party, xpGained);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
boolean isCancelled = event.isCancelled();
@@ -300,7 +298,7 @@ public class EventUtils {
public static boolean handlePartyLevelChangeEvent(Party party, int levelsChanged, double xpRemoved) {
McMMOPartyLevelUpEvent event = new McMMOPartyLevelUpEvent(party, levelsChanged);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
boolean isCancelled = event.isCancelled();
@@ -315,7 +313,7 @@ public class EventUtils {
public static boolean handleXpGainEvent(Player player, PrimarySkillType skill, double xpGained, XPGainReason xpGainReason) {
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skill, xpGained, xpGainReason);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
boolean isCancelled = event.isCancelled();
@@ -332,7 +330,7 @@ public class EventUtils {
return true;
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
boolean isCancelled = event.isCancelled();
@@ -364,8 +362,8 @@ public class EventUtils {
public static boolean handleVampirismEvent(Player killer, Player victim, HashMap<String, Integer> levelChanged, HashMap<String, Double> experienceChanged) {
McMMOPlayerVampirismEvent eventKiller = new McMMOPlayerVampirismEvent(killer, false, levelChanged, experienceChanged);
McMMOPlayerVampirismEvent eventVictim = new McMMOPlayerVampirismEvent(victim, true, levelChanged, experienceChanged);
mcMMO.p.getServer().getPluginManager().callEvent(eventKiller);
mcMMO.p.getServer().getPluginManager().callEvent(eventVictim);
pluginRef.getServer().getPluginManager().callEvent(eventKiller);
pluginRef.getServer().getPluginManager().callEvent(eventVictim);
boolean isCancelled = eventKiller.isCancelled() || eventVictim.isCancelled();
@@ -413,47 +411,47 @@ public class EventUtils {
public static void callAbilityDeactivateEvent(Player player, SuperAbilityType ability) {
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, PrimarySkillType.byAbility(ability));
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
}
public static McMMOPlayerFishingTreasureEvent callFishingTreasureEvent(Player player, ItemStack treasureDrop, int treasureXp, Map<Enchantment, Integer> enchants) {
McMMOPlayerFishingTreasureEvent event = enchants.isEmpty() ? new McMMOPlayerFishingTreasureEvent(player, treasureDrop, treasureXp) : new McMMOPlayerMagicHunterEvent(player, treasureDrop, treasureXp, enchants);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
public static void callFakeFishEvent(Player player, FishHook hook) {
FakePlayerFishEvent event = new FakePlayerFishEvent(player, null, hook, PlayerFishEvent.State.FISHING);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
}
public static McMMOPlayerRepairCheckEvent callRepairCheckEvent(Player player, short durability, ItemStack repairMaterial, ItemStack repairedObject) {
McMMOPlayerRepairCheckEvent event = new McMMOPlayerRepairCheckEvent(player, durability, repairMaterial, repairedObject);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
public static McMMOPlayerPreDeathPenaltyEvent callPreDeathPenaltyEvent(Player player) {
McMMOPlayerPreDeathPenaltyEvent event = new McMMOPlayerPreDeathPenaltyEvent(player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
public static McMMOPlayerDisarmEvent callDisarmEvent(Player defender) {
McMMOPlayerDisarmEvent event = new McMMOPlayerDisarmEvent(defender);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
public static McMMOPlayerSalvageCheckEvent callSalvageCheckEvent(Player player, ItemStack salvageMaterial, ItemStack salvageResults, ItemStack enchantedBook) {
McMMOPlayerSalvageCheckEvent event = new McMMOPlayerSalvageCheckEvent(player, salvageMaterial, salvageResults, enchantedBook);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
return event;
}
@@ -467,7 +465,7 @@ public class EventUtils {
*/
public static McMMOPlayerNotificationEvent createAndCallNotificationEvent(Player player, NotificationType notificationType, TextComponent textComponent) {
//Init event
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(notificationType, player, mcMMO.getNotificationManager().getPlayerNotificationSettings(notificationType), textComponent);
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(notificationType, player, pluginRef.getNotificationManager().getPlayerNotificationSettings(notificationType), textComponent);
//Call event
Bukkit.getServer().getPluginManager().callEvent(customEvent);
@@ -483,7 +481,7 @@ public class EventUtils {
*/
public static McMMOPlayerNotificationEvent createAndCallNotificationEvent(Player player, NotificationType notificationType, String message) {
//Init event
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(notificationType, player, mcMMO.getNotificationManager().getPlayerNotificationSettings(notificationType), message);
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(notificationType, player, pluginRef.getNotificationManager().getPlayerNotificationSettings(notificationType), message);
//Call event
Bukkit.getServer().getPluginManager().callEvent(customEvent);

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.util;
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.UserManager;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils;
@@ -23,8 +22,8 @@ public final class HardcoreManager {
}
}
double statLossPercentage = mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage();
int levelThreshold = mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getLevelThreshold();
double statLossPercentage = pluginRef.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage();
int levelThreshold = pluginRef.getConfigManager().getConfigHardcore().getDeathPenalty().getLevelThreshold();
if (UserManager.getPlayer(player) == null)
return;
@@ -64,7 +63,7 @@ public final class HardcoreManager {
return;
}
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.HARDCORE_MODE, "Hardcore.DeathStatLoss.PlayerDeath", String.valueOf(totalLevelsLost));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.HARDCORE_MODE, "Hardcore.DeathStatLoss.PlayerDeath", String.valueOf(totalLevelsLost));
}
public static void invokeVampirism(Player killer, Player victim) {
@@ -75,8 +74,8 @@ public final class HardcoreManager {
}
}
double vampirismStatLeechPercentage = mcMMO.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage();
int levelThreshold = mcMMO.getConfigManager().getConfigHardcore().getVampirism().getLevelThreshold();
double vampirismStatLeechPercentage = pluginRef.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage();
int levelThreshold = pluginRef.getConfigManager().getConfigHardcore().getVampirism().getLevelThreshold();
if (UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
return;
@@ -120,11 +119,11 @@ public final class HardcoreManager {
}
if (totalLevelsStolen > 0) {
mcMMO.getNotificationManager().sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
mcMMO.getNotificationManager().sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
pluginRef.getNotificationManager().sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
pluginRef.getNotificationManager().sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
} else {
mcMMO.getNotificationManager().sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
mcMMO.getNotificationManager().sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
pluginRef.getNotificationManager().sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
pluginRef.getNotificationManager().sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
}
}

View File

@@ -2,8 +2,6 @@ package com.gmail.nossr50.util;
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
import com.gmail.nossr50.datatypes.skills.ItemType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.FurnaceRecipe;
@@ -234,7 +232,7 @@ public final class ItemUtils {
* @return true if the item counts as unarmed, false otherwise
*/
public static boolean isUnarmed(ItemStack item) {
if (mcMMO.getConfigManager().getConfigUnarmed().doItemsCountAsUnarmed()) {
if (pluginRef.getConfigManager().getConfigUnarmed().doItemsCountAsUnarmed()) {
return !isMinecraftTool(item);
}
@@ -629,7 +627,7 @@ public final class ItemUtils {
return false;
}
for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) {
for (Recipe recipe : pluginRef.getServer().getRecipesFor(item)) {
if (recipe instanceof FurnaceRecipe
&& ((FurnaceRecipe) recipe).getInput().getType().isBlock()
&& MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getType())) {
@@ -829,7 +827,7 @@ public final class ItemUtils {
* @return true if the item is a miscellaneous drop, false otherwise
*/
public static boolean isMiscDrop(ItemStack item) {
return mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(item.getType()) != null;
return pluginRef.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(item.getType()) != null;
}
public static boolean isMcMMOItem(ItemStack item) {
@@ -847,6 +845,6 @@ public final class ItemUtils {
}
ItemMeta itemMeta = item.getItemMeta();
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + pluginRef.getLocaleManager().getString("Item.ChimaeraWing.Name"));
}
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableSet;
@@ -107,7 +106,7 @@ public final class Misc {
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return null;
@@ -152,7 +151,7 @@ public final class Misc {
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(spawnLocation, clonedItem);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
//Something cancelled the event so back out
if (event.isCancelled() || event.getItemStack() == null) {
@@ -174,17 +173,17 @@ public final class Misc {
}
public static void profileCleanup(String playerName) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player != null) {
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(pluginRef, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
}
public static void printProgress(int convertedUsers, int progressInterval, long startMillis) {
if ((convertedUsers % progressInterval) == 0) {
mcMMO.p.getLogger().info(String.format("Conversion progress: %d users at %.2f users/second", convertedUsers, convertedUsers / (double) ((System.currentTimeMillis() - startMillis) / TIME_CONVERSION_FACTOR)));
pluginRef.getLogger().info(String.format("Conversion progress: %d users at %.2f users/second", convertedUsers, convertedUsers / (double) ((System.currentTimeMillis() - startMillis) / TIME_CONVERSION_FACTOR)));
}
}

View File

@@ -37,7 +37,7 @@ public final class MobHealthbarUtils {
* @param damage damage done by the attack triggering this
*/
public static void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
if (mcMMO.isHealthBarPluginEnabled() || !mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
if (pluginRef.isHealthBarPluginEnabled() || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
return;
}
@@ -59,25 +59,25 @@ public final class MobHealthbarUtils {
}
boolean oldNameVisible = target.isCustomNameVisible();
String newName = createHealthDisplay(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(), target, damage);
String newName = createHealthDisplay(pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(), target, damage);
target.setCustomName(newName);
target.setCustomNameVisible(true);
int displayTime = Math.max(mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayTimeSeconds(), 1);
int displayTime = Math.max(pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayTimeSeconds(), 1);
if (displayTime != -1) {
boolean updateName = !ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName));
if (updateName) {
target.setMetadata(MetadataConstants.CUSTOM_NAME_METAKEY, new FixedMetadataValue(mcMMO.p, oldName));
target.setMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY, new FixedMetadataValue(mcMMO.p, oldNameVisible));
target.setMetadata(MetadataConstants.CUSTOM_NAME_METAKEY, new FixedMetadataValue(pluginRef, oldName));
target.setMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY, new FixedMetadataValue(pluginRef, oldNameVisible));
} else if (!target.hasMetadata(MetadataConstants.CUSTOM_NAME_METAKEY)) {
target.setMetadata(MetadataConstants.CUSTOM_NAME_METAKEY, new FixedMetadataValue(mcMMO.p, ""));
target.setMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY, new FixedMetadataValue(mcMMO.p, false));
target.setMetadata(MetadataConstants.CUSTOM_NAME_METAKEY, new FixedMetadataValue(pluginRef, ""));
target.setMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY, new FixedMetadataValue(pluginRef, false));
}
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
new MobHealthDisplayUpdaterTask(target).runTaskLater(pluginRef, displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
}
}

View File

@@ -1,8 +1,6 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.entity.Player;
@@ -11,8 +9,8 @@ import org.bukkit.plugin.PluginDescriptionFile;
import java.text.DecimalFormat;
public final class Motd {
public static final String PERK_PREFIX = LocaleLoader.getString("MOTD.PerksPrefix") + " ";
private static final PluginDescriptionFile pluginDescription = mcMMO.p.getDescription();
public static final String PERK_PREFIX = pluginRef.getLocaleManager().getString("MOTD.PerksPrefix") + " ";
private static final PluginDescriptionFile pluginDescription = pluginRef.getDescription();
private Motd() {
}
@@ -35,7 +33,7 @@ public final class Motd {
*/
public static void displayVersion(Player player, String version) {
if (Permissions.showversion(player)) {
player.sendMessage(LocaleLoader.getString("MOTD.Version.Overhaul", version));
player.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Version.Overhaul", version));
}
}
@@ -57,25 +55,25 @@ public final class Motd {
String seperator = "";
if (deathStatLossEnabled) {
statLossInfo = LocaleLoader.getString("Hardcore.DeathStatLoss.Name");
statLossInfo = pluginRef.getLocaleManager().getString("Hardcore.DeathStatLoss.Name");
}
if (vampirismEnabled) {
vampirismInfo = LocaleLoader.getString("Hardcore.Vampirism.Name");
vampirismInfo = pluginRef.getLocaleManager().getString("Hardcore.Vampirism.Name");
}
if (deathStatLossEnabled && vampirismEnabled) {
seperator = " & ";
}
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo));
player.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo));
if (deathStatLossEnabled) {
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.DeathStatLoss.Stats", mcMMO.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage()));
player.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Hardcore.DeathStatLoss.Stats", pluginRef.getConfigManager().getConfigHardcore().getDeathPenalty().getPenaltyPercentage()));
}
if (vampirismEnabled) {
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Vampirism.Stats", mcMMO.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage()));
player.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Hardcore.Vampirism.Stats", pluginRef.getConfigManager().getConfigHardcore().getVampirism().getPenaltyPercentage()));
}
}
@@ -87,7 +85,7 @@ public final class Motd {
public static void displayXpPerks(Player player) {
for (PrimarySkillType skill : PrimarySkillType.values()) {
// if (PerksUtils.handleXpPerks(player, 1, skill) > 1) {
// player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.XP.Name"), LocaleLoader.getString("Perks.XP.Desc")));
// player.sendMessage(PERK_PREFIX + pluginRef.getLocaleManager().getString("Effects.Template", pluginRef.getLocaleManager().getString("Perks.XP.Name"), pluginRef.getLocaleManager().getString("Perks.XP.Desc")));
// return;
// }
}
@@ -103,7 +101,7 @@ public final class Motd {
if (cooldownReduction > 0.0) {
DecimalFormat percent = new DecimalFormat("##0.00%");
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Cooldowns.Name"), LocaleLoader.getString("Perks.Cooldowns.Desc", percent.format(cooldownReduction))));
player.sendMessage(PERK_PREFIX + pluginRef.getLocaleManager().getString("Effects.Template", pluginRef.getLocaleManager().getString("Perks.Cooldowns.Name"), pluginRef.getLocaleManager().getString("Perks.Cooldowns.Desc", percent.format(cooldownReduction))));
}
}
@@ -116,7 +114,7 @@ public final class Motd {
int perkAmount = SkillUtils.getEnduranceLength(player);
if (perkAmount > 0) {
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.ActivationTime.Name"), LocaleLoader.getString("Perks.ActivationTime.Desc", perkAmount)));
player.sendMessage(PERK_PREFIX + pluginRef.getLocaleManager().getString("Effects.Template", pluginRef.getLocaleManager().getString("Perks.ActivationTime.Name"), pluginRef.getLocaleManager().getString("Perks.ActivationTime.Desc", perkAmount)));
}
}
@@ -128,7 +126,7 @@ public final class Motd {
public static void displayLuckyPerks(Player player) {
for (PrimarySkillType skill : PrimarySkillType.values()) {
if (Permissions.lucky(player, skill)) {
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc.Login")));
player.sendMessage(PERK_PREFIX + pluginRef.getLocaleManager().getString("Effects.Template", pluginRef.getLocaleManager().getString("Perks.Lucky.Name"), pluginRef.getLocaleManager().getString("Perks.Lucky.Desc.Login")));
return;
}
}
@@ -141,6 +139,6 @@ public final class Motd {
* @param website Plugin website
*/
public static void displayWebsite(Player player, String website) {
player.sendMessage(LocaleLoader.getString("MOTD.Website", website));
player.sendMessage(pluginRef.getLocaleManager().getString("MOTD.Website", website));
}
}

View File

@@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.skills.ItemType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
@@ -511,7 +510,7 @@ public final class Permissions {
}
public static void generateWorldTeleportPermissions() {
Server server = mcMMO.p.getServer();
Server server = pluginRef.getServer();
PluginManager pluginManager = server.getPluginManager();
for (World world : server.getWorlds()) {
@@ -524,10 +523,10 @@ public final class Permissions {
* This method registers Permissions with the server software as needed
*/
public static void addCustomXPPerks() {
mcMMO.p.getLogger().info("Registering custom XP perks with server software...");
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
pluginRef.getLogger().info("Registering custom XP perks with server software...");
PluginManager pluginManager = pluginRef.getServer().getPluginManager();
for (CustomXPPerk customXPPerk : mcMMO.getConfigManager().getConfigExperience().getCustomXPBoosts()) {
for (CustomXPPerk customXPPerk : pluginRef.getConfigManager().getConfigExperience().getCustomXPBoosts()) {
Permission permission = new Permission(customXPPerk.getPerkPermissionAddress());
permission.setDefault(PermissionDefault.FALSE);

View File

@@ -6,8 +6,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.skills.RankUtils;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ChatMessageType;
@@ -23,7 +21,7 @@ import java.util.List;
public class TextComponentFactory {
/**
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleLoader
* Makes a text component using strings from a locale and supports passing an undefined number of variables to the LocaleManager
*
* @param localeKey target locale string address
* @param values vars to be passed to the locale loader
@@ -31,18 +29,18 @@ public class TextComponentFactory {
*/
public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
{
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
String preColoredString = pluginRef.getLocaleManager().getString(localeKey, (Object[]) values);
TextComponent msg = new TextComponent(preColoredString);
return new TextComponent(msg);
}
public static TextComponent getNotificationTextComponentFromLocale(String localeKey)
{
return getNotificationTextComponent(LocaleLoader.getString(localeKey));
return getNotificationTextComponent(pluginRef.getLocaleManager().getString(localeKey));
}
public static TextComponent getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel) {
TextComponent textComponent = new TextComponent(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name." + StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
TextComponent textComponent = new TextComponent(pluginRef.getLocaleManager().getString("Overhaul.Levelup", pluginRef.getLocaleManager().getString("Overhaul.Name." + StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
return textComponent;
}
@@ -52,12 +50,12 @@ public class TextComponentFactory {
}
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted) {
if (!mcMMO.getConfigManager().getConfigAds().isShowWebsiteLinks())
if (!pluginRef.getConfigManager().getConfigAds().isShowWebsiteLinks())
return;
Player.Spigot spigotPlayer = player.spigot();
TextComponent wikiLinkComponent = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
TextComponent wikiLinkComponent = new TextComponent(pluginRef.getLocaleManager().getString("Overhaul.mcMMO.MmoInfo.Wiki"));
wikiLinkComponent.setUnderlined(true);
String wikiUrl = "https://mcmmo.org/wiki/" + subskillformatted;
@@ -74,14 +72,14 @@ public class TextComponentFactory {
public static void sendPlayerUrlHeader(Player player) {
Player.Spigot spigotPlayer = player.spigot();
TextComponent prefix = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
TextComponent prefix = new TextComponent(pluginRef.getLocaleManager().getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
/*prefix.setColor(ChatColor.DARK_AQUA);*/
TextComponent suffix = new TextComponent(" " + LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
TextComponent suffix = new TextComponent(" " + pluginRef.getLocaleManager().getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
/*suffix.setColor(ChatColor.DARK_AQUA);*/
TextComponent emptySpace = new TextComponent(" ");
if (mcMMO.getConfigManager().getConfigAds().isShowPatreonInfo()) {
if (pluginRef.getConfigManager().getConfigAds().isShowPatreonInfo()) {
BaseComponent[] baseComponents = {new TextComponent(prefix),
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
emptySpace,
@@ -133,7 +131,7 @@ public class TextComponentFactory {
//Style the skills into @links
final String originalTxt = textComponent.getText();
TextComponent stylizedText = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolSkills"));
TextComponent stylizedText = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolSkills"));
addChild(stylizedText, originalTxt);
if (textComponent.getHoverEvent() != null)
@@ -162,32 +160,32 @@ public class TextComponentFactory {
switch (webLinks) {
case WEBSITE:
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
webTextComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolURL"));
addChild(webTextComponent, "Web");
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWebsite));
break;
case SPIGOT:
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
webTextComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolURL"));
addChild(webTextComponent, "Spigot");
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlSpigot));
break;
case DISCORD:
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
webTextComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolURL"));
addChild(webTextComponent, "Discord");
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlDiscord));
break;
case PATREON:
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
webTextComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolURL"));
addChild(webTextComponent, "Patreon");
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlPatreon));
break;
case WIKI:
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
webTextComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolURL"));
addChild(webTextComponent, "Wiki");
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWiki));
break;
case HELP_TRANSLATE:
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
webTextComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.AtSymbolURL"));
addChild(webTextComponent, "Lang");
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlTranslate));
break;
@@ -308,14 +306,14 @@ public class TextComponentFactory {
TextComponent textComponent;
if (skillUnlocked) {
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
textComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.MaxRankSkillName", skillName));
else
textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.SkillName", skillName));
textComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.SkillName", skillName));
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo " + subSkillType.getNiceNameNoSpaces(subSkillType)));
} else {
textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.Mystery",
textComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.Mystery",
String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
@@ -376,7 +374,7 @@ public class TextComponentFactory {
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.DescriptionHeader"));
componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n");
//Empty line
@@ -394,11 +392,11 @@ public class TextComponentFactory {
ComponentBuilder componentBuilder;
if (skillUnlocked) {
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
componentBuilder = getNewComponentBuilder(pluginRef.getLocaleManager().getString("JSON.Hover.MaxRankSkillName", skillName));
else
componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.SkillName", skillName));
componentBuilder = getNewComponentBuilder(pluginRef.getLocaleManager().getString("JSON.Hover.SkillName", skillName));
} else
componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.Mystery",
componentBuilder = getNewComponentBuilder(pluginRef.getLocaleManager().getString("JSON.Hover.Mystery",
String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
return componentBuilder;
}
@@ -412,15 +410,15 @@ public class TextComponentFactory {
private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank, int nextRank) {
if (numRanks > 0) {
//Rank: x
componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n")
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n")
.bold(false).italic(false).strikethrough(false).underlined(false);
//Next Rank: x
if (nextRank > rank)
componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n")
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n")
.bold(false).italic(false).strikethrough(false).underlined(false);
/*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
/*componentBuilder.append(" " + pluginRef.getLocaleManager().getString("JSON.RankPossesive") + " ").color(ccPossessive);
componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/
}
}
@@ -438,9 +436,9 @@ public class TextComponentFactory {
}
private static void addLocked(ChatColor ccLocked, ChatColor ccLevelRequirement, ComponentBuilder componentBuilder) {
componentBuilder.append(LocaleLoader.getString("JSON.Locked")).color(ccLocked).bold(true);
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.Locked")).color(ccLocked).bold(true);
componentBuilder.append("\n").append("\n").bold(false);
componentBuilder.append(LocaleLoader.getString("JSON.LevelRequirement") + ": ").color(ccLevelRequirement);
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.LevelRequirement") + ": ").color(ccLevelRequirement);
}
@Deprecated
@@ -484,7 +482,7 @@ public class TextComponentFactory {
}
componentBuilder.append("\n").bold(false);
componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.DescriptionHeader"));
componentBuilder.color(ccDescriptionHeader);
componentBuilder.append("\n");
componentBuilder.append(subSkillType.getLocaleDescription());
@@ -496,13 +494,13 @@ public class TextComponentFactory {
private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill, ComponentBuilder componentBuilder) {
if (abstractSubSkill.isSuperAbility()) {
componentBuilder.append(LocaleLoader.getString("JSON.Type.SuperAbility")).color(ChatColor.LIGHT_PURPLE);
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.Type.SuperAbility")).color(ChatColor.LIGHT_PURPLE);
componentBuilder.bold(true);
} else if (abstractSubSkill.isActiveUse()) {
componentBuilder.append(LocaleLoader.getString("JSON.Type.Active")).color(ChatColor.DARK_RED);
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.Type.Active")).color(ChatColor.DARK_RED);
componentBuilder.bold(true);
} else {
componentBuilder.append(LocaleLoader.getString("JSON.Type.Passive")).color(ChatColor.GREEN);
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.Type.Passive")).color(ChatColor.GREEN);
componentBuilder.bold(true);
}
@@ -530,7 +528,7 @@ public class TextComponentFactory {
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType) {
TextComponent unlockMessage = new TextComponent("");
unlockMessage.setText(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + subSkillType.getParentSkill().toString().toLowerCase()));
return unlockMessage;

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.util.blockmeta;
import com.gmail.nossr50.mcMMO;
import org.bukkit.World;
import org.bukkit.block.Block;
@@ -160,7 +159,7 @@ public class HashChunkletManager implements ChunkletManager {
@Override
public void saveAll() {
for (World world : mcMMO.p.getServer().getWorlds()) {
for (World world : pluginRef.getServer().getWorlds()) {
saveWorld(world);
}
}
@@ -168,7 +167,7 @@ public class HashChunkletManager implements ChunkletManager {
@Override
public void unloadAll() {
saveAll();
for (World world : mcMMO.p.getServer().getWorlds()) {
for (World world : pluginRef.getServer().getWorlds()) {
unloadWorld(world);
}
}
@@ -269,7 +268,7 @@ public class HashChunkletManager implements ChunkletManager {
for (String key : store.keySet()) {
if (store.get(key).isEmpty()) {
String[] info = key.split(",");
File dataDir = new File(mcMMO.p.getServer().getWorld(info[0]).getWorldFolder(), "mcmmo_data");
File dataDir = new File(pluginRef.getServer().getWorld(info[0]).getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + info[1]);
if (!cxDir.exists()) {

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.util.blockmeta.chunkmeta;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.conversion.BlockStoreConversionZDirectory;
import org.bukkit.World;
import org.bukkit.block.Block;
@@ -250,7 +249,7 @@ public class HashChunkManager implements ChunkManager {
public synchronized void saveAll() {
closeAll();
for (World world : mcMMO.p.getServer().getWorlds()) {
for (World world : pluginRef.getServer().getWorlds()) {
saveWorld(world);
}
}
@@ -259,7 +258,7 @@ public class HashChunkManager implements ChunkManager {
public synchronized void unloadAll() {
closeAll();
for (World world : mcMMO.p.getServer().getWorlds()) {
for (World world : pluginRef.getServer().getWorlds()) {
unloadWorld(world);
}
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.util.blockmeta.conversion;
import com.gmail.nossr50.core.ChunkConversionOptions;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitScheduler;
import java.io.File;
@@ -17,7 +16,7 @@ public class BlockStoreConversionMain implements Runnable {
public BlockStoreConversionMain(org.bukkit.World world) {
this.taskID = -1;
this.world = world;
this.scheduler = mcMMO.p.getServer().getScheduler();
this.scheduler = pluginRef.getServer().getScheduler();
this.dataDir = new File(this.world.getWorldFolder(), "mcmmo_data");
this.converters = new BlockStoreConversionXDirectory[ChunkConversionOptions.getConversionRate()];
}
@@ -27,7 +26,7 @@ public class BlockStoreConversionMain implements Runnable {
return;
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
this.taskID = this.scheduler.runTaskLater(pluginRef, this, 1).getTaskId();
}
@Override
@@ -79,7 +78,7 @@ public class BlockStoreConversionMain implements Runnable {
return;
}
mcMMO.p.getLogger().info("Finished converting the storage for " + world.getName() + ".");
pluginRef.getLogger().info("Finished converting the storage for " + world.getName() + ".");
this.dataDir = null;
this.xDirs = null;

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.util.blockmeta.conversion;
import com.gmail.nossr50.core.ChunkConversionOptions;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitScheduler;
import java.io.File;
@@ -20,7 +19,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
public void start(org.bukkit.World world, File dataDir) {
this.world = world;
this.scheduler = mcMMO.p.getServer().getScheduler();
this.scheduler = pluginRef.getServer().getScheduler();
this.converters = new BlockStoreConversionZDirectory[ChunkConversionOptions.getConversionRate()];
this.dataDir = dataDir;
@@ -28,7 +27,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
return;
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
this.taskID = this.scheduler.runTaskLater(pluginRef, this, 1).getTaskId();
}
@Override

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.util.blockmeta.conversion;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.ChunkletStore;
import com.gmail.nossr50.util.blockmeta.HashChunkletManager;
import com.gmail.nossr50.util.blockmeta.PrimitiveChunkletStore;
@@ -30,9 +29,9 @@ public class BlockStoreConversionZDirectory implements Runnable {
public void start(org.bukkit.World world, File xDir, File dataDir) {
this.world = world;
this.scheduler = mcMMO.p.getServer().getScheduler();
this.scheduler = pluginRef.getServer().getScheduler();
this.manager = new HashChunkletManager();
this.newManager = (HashChunkManager) mcMMO.getPlaceStore();
this.newManager = (HashChunkManager) pluginRef.getPlaceStore();
this.dataDir = dataDir;
this.xDir = xDir;
@@ -40,7 +39,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
return;
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
this.taskID = this.scheduler.runTaskLater(pluginRef, this, 1).getTaskId();
}
@Override

View File

@@ -18,7 +18,6 @@ import com.gmail.nossr50.commands.player.*;
import com.gmail.nossr50.commands.server.ReloadCommand;
import com.gmail.nossr50.commands.skills.*;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils;
import org.bukkit.command.PluginCommand;
@@ -28,7 +27,7 @@ import java.util.List;
public final class CommandRegistrationManager {
private mcMMO pluginRef;
private String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
private String permissionsMessage = pluginRef.getLocaleManager().getString("mcMMO.NoPermission");
public CommandRegistrationManager(mcMMO pluginRef) {
this.pluginRef = pluginRef;
@@ -41,12 +40,12 @@ public final class CommandRegistrationManager {
PluginCommand command;
command = mcMMO.p.getCommand(commandName);
command.setDescription(LocaleLoader.getString("Commands.Description.Skill", StringUtils.getCapitalized(localizedName)));
command = pluginRef.getCommand(commandName);
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.Skill", StringUtils.getCapitalized(localizedName)));
command.setPermission("mcmmo.commands." + commandName);
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", localizedName));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", localizedName, "?", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", localizedName));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", localizedName, "?", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Page") + "]"));
switch (skill) {
case ACROBATICS:
@@ -116,83 +115,83 @@ public final class CommandRegistrationManager {
}
private void registerAddlevelsCommand() {
PluginCommand command = mcMMO.p.getCommand("addlevels");
command.setDescription(LocaleLoader.getString("Commands.Description.addlevels"));
PluginCommand command = pluginRef.getCommand("addlevels");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.addlevels"));
command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addlevels", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "addlevels", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Level") + ">"));
command.setExecutor(new AddlevelsCommand());
}
private void registerAddxpCommand() {
PluginCommand command = mcMMO.p.getCommand("addxp");
command.setDescription(LocaleLoader.getString("Commands.Description.addxp"));
PluginCommand command = pluginRef.getCommand("addxp");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.addxp"));
command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "addxp", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.XP") + ">"));
command.setExecutor(new AddxpCommand());
}
private void registerMcgodCommand() {
PluginCommand command = mcMMO.p.getCommand("mcgod");
command.setDescription(LocaleLoader.getString("Commands.Description.mcgod"));
PluginCommand command = pluginRef.getCommand("mcgod");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcgod"));
command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcgod", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McgodCommand());
}
private void registerMmoInfoCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoinfo");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoinfo"));
PluginCommand command = pluginRef.getCommand("mmoinfo");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mmoinfo"));
command.setPermission("mcmmo.commands.mmoinfo");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mmoinfo", "[" + LocaleLoader.getString("Commands.Usage.SubSkill") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mmoinfo", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.SubSkill") + "]"));
command.setExecutor(new MmoInfoCommand());
}
private void registerMcChatSpyCommand() {
PluginCommand command = mcMMO.p.getCommand("mcchatspy");
command.setDescription(LocaleLoader.getString("Commands.Description.mcchatspy"));
PluginCommand command = pluginRef.getCommand("mcchatspy");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcchatspy"));
command.setPermission("mcmmo.commands.mcchatspy;mcmmo.commands.mcchatspy.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcchatspy", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcchatspy", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McChatSpy());
}
private void registerMcrefreshCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrefresh");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh"));
PluginCommand command = pluginRef.getCommand("mcrefresh");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcrefresh"));
command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrefresh", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcrefresh", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McrefreshCommand());
}
private void registerMmoeditCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoedit");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit"));
PluginCommand command = pluginRef.getCommand("mmoedit");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mmoedit"));
command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.3", "mmoedit", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.Level") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "mmoedit", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Level") + ">"));
command.setExecutor(new MmoeditCommand());
}
private void registerMcmmoReloadCommand() {
PluginCommand command = mcMMO.p.getCommand("mcmmoreload");
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmoreload"));
PluginCommand command = pluginRef.getCommand("mcmmoreload");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcmmoreload"));
command.setPermission("mcmmo.commands.reload");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmoreload"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcmmoreload"));
command.setExecutor(new ReloadCommand(pluginRef));
}
private void registerSkillresetCommand() {
PluginCommand command = mcMMO.p.getCommand("skillreset");
command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
PluginCommand command = pluginRef.getCommand("skillreset");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.skillreset"));
command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "skillreset", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "skillreset", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">"));
command.setExecutor(new SkillresetCommand());
}
@@ -200,142 +199,142 @@ public final class CommandRegistrationManager {
List<String> aliasList = new ArrayList<>();
aliasList.add("mcxprate");
PluginCommand command = mcMMO.p.getCommand("xprate");
command.setDescription(LocaleLoader.getString("Commands.Description.xprate"));
PluginCommand command = pluginRef.getCommand("xprate");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.xprate"));
command.setPermission("mcmmo.commands.xprate;mcmmo.commands.xprate.reset;mcmmo.commands.xprate.set");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "xprate", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">", "<true|false>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xprate", "reset"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "xprate", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Rate") + ">", "<true|false>"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "xprate", "reset"));
command.setAliases(aliasList);
command.setExecutor(new XprateCommand());
}
private void registerInspectCommand() {
PluginCommand command = mcMMO.p.getCommand("inspect");
command.setDescription(LocaleLoader.getString("Commands.Description.inspect"));
PluginCommand command = pluginRef.getCommand("inspect");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.inspect"));
command.setPermission("mcmmo.commands.inspect;mcmmo.commands.inspect.far;mcmmo.commands.inspect.offline");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "inspect", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "inspect", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
command.setExecutor(new InspectCommand());
}
private void registerMccooldownCommand() {
PluginCommand command = mcMMO.p.getCommand("mccooldown");
command.setDescription(LocaleLoader.getString("Commands.Description.mccooldown"));
PluginCommand command = pluginRef.getCommand("mccooldown");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mccooldown"));
command.setPermission("mcmmo.commands.mccooldown");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mccooldowns"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mccooldowns"));
command.setExecutor(new MccooldownCommand());
}
private void registerMcabilityCommand() {
PluginCommand command = mcMMO.p.getCommand("mcability");
command.setDescription(LocaleLoader.getString("Commands.Description.mcability"));
PluginCommand command = pluginRef.getCommand("mcability");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcability"));
command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcability", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcability", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McabilityCommand());
}
private void registerMcmmoCommand() {
PluginCommand command = mcMMO.p.getCommand("mcmmo");
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
PluginCommand command = pluginRef.getCommand("mcmmo");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcmmo"));
command.setPermission("mcmmo.commands.mcmmo.description;mcmmo.commands.mcmmo.help");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmo"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "mcmmo", "help"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcmmo"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcmmo", "help"));
command.setExecutor(new McmmoCommand());
}
private void registerMcrankCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrank");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrank"));
PluginCommand command = pluginRef.getCommand("mcrank");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcrank"));
command.setPermission("mcmmo.commands.mcrank;mcmmo.commands.mcrank.others;mcmmo.commands.mcrank.others.far;mcmmo.commands.mcrank.others.offline");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcrank", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcrank", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]"));
command.setExecutor(new McrankCommand());
}
private void registerMcstatsCommand() {
PluginCommand command = mcMMO.p.getCommand("mcstats");
command.setDescription(LocaleLoader.getString("Commands.Description.mcstats"));
PluginCommand command = pluginRef.getCommand("mcstats");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcstats"));
command.setPermission("mcmmo.commands.mcstats");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcstats"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcstats"));
command.setExecutor(new McstatsCommand());
}
private void registerMctopCommand() {
PluginCommand command = mcMMO.p.getCommand("mctop");
command.setDescription(LocaleLoader.getString("Commands.Description.mctop"));
PluginCommand command = pluginRef.getCommand("mctop");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mctop"));
command.setPermission("mcmmo.commands.mctop"); // Only need the main one, not the individual skill ones
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "mctop", "[" + LocaleLoader.getString("Commands.Usage.Skill") + "]", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "mctop", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + "]", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Page") + "]"));
command.setExecutor(new MctopCommand());
}
private void registerMcpurgeCommand() {
PluginCommand command = mcMMO.p.getCommand("mcpurge");
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", mcMMO.getDatabaseCleaningSettings().getOldUserCutoffMonths()));
PluginCommand command = pluginRef.getCommand("mcpurge");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcpurge", pluginRef.getDatabaseCleaningSettings().getOldUserCutoffMonths()));
command.setPermission("mcmmo.commands.mcpurge");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcpurge"));
command.setExecutor(new McpurgeCommand());
}
private void registerMcremoveCommand() {
PluginCommand command = mcMMO.p.getCommand("mcremove");
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
PluginCommand command = pluginRef.getCommand("mcremove");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcremove"));
command.setPermission("mcmmo.commands.mcremove");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcremove", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
command.setExecutor(new McremoveCommand());
}
private void registerMmoshowdbCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoshowdb");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoshowdb"));
PluginCommand command = pluginRef.getCommand("mmoshowdb");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mmoshowdb"));
command.setPermission("mcmmo.commands.mmoshowdb");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoshowdb"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mmoshowdb"));
command.setExecutor(new MmoshowdbCommand());
}
private void registerMcconvertCommand() {
PluginCommand command = mcMMO.p.getCommand("mcconvert");
command.setDescription(LocaleLoader.getString("Commands.Description.mcconvert"));
PluginCommand command = pluginRef.getCommand("mcconvert");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcconvert"));
command.setPermission("mcmmo.commands.mcconvert;mcmmo.commands.mcconvert.experience;mcmmo.commands.mcconvert.database");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "mcconvert", "database", "<flatfile|sql>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", "mcconvert", "experience", "<linear|exponential>"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "mcconvert", "database", "<flatfile|sql>"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", "mcconvert", "experience", "<linear|exponential>"));
command.setExecutor(new McconvertCommand());
}
private void registerAdminChatCommand() {
PluginCommand command = mcMMO.p.getCommand("adminchat");
command.setDescription(LocaleLoader.getString("Commands.Description.adminchat"));
PluginCommand command = pluginRef.getCommand("adminchat");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.adminchat"));
command.setPermission("mcmmo.chat.adminchat");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "adminchat"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "adminchat"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "adminchat", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "adminchat", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Message") + ">"));
command.setExecutor(new AdminChatCommand());
}
private void registerPartyChatCommand() {
PluginCommand command = mcMMO.p.getCommand("partychat");
command.setDescription(LocaleLoader.getString("Commands.Description.partychat"));
PluginCommand command = pluginRef.getCommand("partychat");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.partychat"));
command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "partychat"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "partychat"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "partychat", "<on|off>"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "partychat", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Message") + ">"));
command.setExecutor(new PartyChatCommand());
}
private void registerPartyCommand() {
PluginCommand command = mcMMO.p.getCommand("party");
command.setDescription(LocaleLoader.getString("Commands.Description.party"));
PluginCommand command = pluginRef.getCommand("party");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.party"));
command.setPermission("mcmmo.commands.party;mcmmo.commands.party.accept;mcmmo.commands.party.create;mcmmo.commands.party.disband;" +
"mcmmo.commands.party.xpshare;mcmmo.commands.party.invite;mcmmo.commands.party.itemshare;mcmmo.commands.party.join;" +
"mcmmo.commands.party.kick;mcmmo.commands.party.lock;mcmmo.commands.party.owner;mcmmo.commands.party.password;" +
@@ -345,78 +344,78 @@ public final class CommandRegistrationManager {
}
private void registerPtpCommand() {
PluginCommand command = mcMMO.p.getCommand("ptp");
command.setDescription(LocaleLoader.getString("Commands.Description.ptp"));
PluginCommand command = pluginRef.getCommand("ptp");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.ptp"));
command.setPermission("mcmmo.commands.ptp"); // Only need the main one, not the individual ones for toggle/accept/acceptall
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "ptp", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "ptp", "<toggle|accept|acceptall>"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "ptp", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + ">"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "ptp", "<toggle|accept|acceptall>"));
command.setExecutor(new PtpCommand());
}
/*private void registerHardcoreCommand() {
PluginCommand command = mcMMO.p.getCommand("hardcore");
command.setDescription(LocaleLoader.getString("Commands.Description.hardcore"));
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.hardcore"));
command.setPermission("mcmmo.commands.hardcore;mcmmo.commands.hardcore.toggle;mcmmo.commands.hardcore.modify");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "hardcore", "[on|off]"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "hardcore", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "hardcore", "[on|off]"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "hardcore", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Rate") + ">"));
command.setExecutor(new HardcoreCommand());
}
private void registerVampirismCommand() {
PluginCommand command = mcMMO.p.getCommand("vampirism");
command.setDescription(LocaleLoader.getString("Commands.Description.vampirism"));
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.vampirism"));
command.setPermission("mcmmo.commands.vampirism;mcmmo.commands.vampirism.toggle;mcmmo.commands.vampirism.modify");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "vampirism", "[on|off]"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "vampirism", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "vampirism", "[on|off]"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "vampirism", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Rate") + ">"));
command.setExecutor(new VampirismCommand());
}*/
private void registerMcnotifyCommand() {
PluginCommand command = mcMMO.p.getCommand("mcnotify");
command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify"));
PluginCommand command = pluginRef.getCommand("mcnotify");
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.mcnotify"));
command.setPermission("mcmmo.commands.mcnotify");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcnotify"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcnotify"));
command.setExecutor(new McnotifyCommand());
}
private void registerMHDCommand() {
PluginCommand command = mcMMO.p.getCommand("mhd");
PluginCommand command = pluginRef.getCommand("mhd");
command.setDescription("Resets all mob health bar settings for all players to the default"); //TODO: Localize
command.setPermission("mcmmo.commands.mhd");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mhd"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mhd"));
command.setExecutor(new MHDCommand());
}
private void registerMcscoreboardCommand() {
PluginCommand command = mcMMO.p.getCommand("mcscoreboard");
PluginCommand command = pluginRef.getCommand("mcscoreboard");
command.setDescription("Change the current mcMMO scoreboard being displayed"); //TODO: Localize
command.setPermission("mcmmo.commands.mcscoreboard");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcscoreboard", "<CLEAR | KEEP>"));
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.2", "mcscoreboard", "time", "<seconds>"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcscoreboard", "<CLEAR | KEEP>"));
command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", "mcscoreboard", "time", "<seconds>"));
command.setExecutor(new McscoreboardCommand());
}
private void registerMcImportCommand() {
PluginCommand command = mcMMO.p.getCommand("mcimport");
PluginCommand command = pluginRef.getCommand("mcimport");
command.setDescription("Import mod config files"); //TODO: Localize
command.setPermission("mcmmo.commands.mcimport");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcimport"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcimport"));
command.setExecutor(new McImportCommand());
}
private void registerReloadLocaleCommand() {
PluginCommand command = mcMMO.p.getCommand("mcmmoreloadlocale");
PluginCommand command = pluginRef.getCommand("mcmmoreloadlocale");
command.setDescription("Reloads locale"); // TODO: Localize
command.setPermission("mcmmo.commands.reloadlocale");
command.setPermissionMessage(permissionsMessage);
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmoreloadlocale"));
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcmmoreloadlocale"));
command.setExecutor(new McmmoReloadLocaleCommand());
}

View File

@@ -4,8 +4,6 @@ import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.player.UserManager;
@@ -36,14 +34,14 @@ public final class CommandUtils {
public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
if(!target.isOnline() && !hasPermission) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));
return true;
} else if (mcMMO.getConfigManager().getConfigCommands().isLimitInspectRange()
} else if (pluginRef.getConfigManager().getConfigCommands().isLimitInspectRange()
&& sender instanceof Player
&& !Misc.isNear(((Player) sender).getLocation(), target.getLocation(),
mcMMO.getConfigManager().getConfigCommands().getInspectCommandMaxDistance())
pluginRef.getConfigManager().getConfigCommands().getInspectCommandMaxDistance())
&& !hasPermission) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.TooFar"));
return true;
}
@@ -59,7 +57,7 @@ public final class CommandUtils {
return false;
}
sender.sendMessage(LocaleLoader.getString("Commands.NoConsole"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.NoConsole"));
return true;
}
@@ -68,7 +66,7 @@ public final class CommandUtils {
return false;
}
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
return true;
}
@@ -83,7 +81,7 @@ public final class CommandUtils {
public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) {
if (mcMMOPlayer != null) {
if (CommandUtils.hidden(sender, mcMMOPlayer.getPlayer(), false)) {
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
return false;
}
return true;
@@ -95,7 +93,7 @@ public final class CommandUtils {
return false;
}
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.DoesNotExist"));
return false;
}
@@ -104,7 +102,7 @@ public final class CommandUtils {
return false;
}
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
return true;
}
@@ -116,7 +114,7 @@ public final class CommandUtils {
boolean hasPlayerDataKey = ((Player) sender).hasMetadata(MetadataConstants.PLAYER_DATA_METAKEY);
if (!hasPlayerDataKey) {
sender.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.NotLoaded"));
}
return hasPlayerDataKey;
@@ -127,7 +125,7 @@ public final class CommandUtils {
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.NotLoaded"));
return false;
}
@@ -154,7 +152,7 @@ public final class CommandUtils {
return false;
}
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Skill.Invalid"));
return true;
}
@@ -173,7 +171,7 @@ public final class CommandUtils {
* @param display The sender to display stats to
*/
public static void printGatheringSkills(Player inspect, CommandSender display) {
printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Gathering"), PrimarySkillType.GATHERING_SKILLS);
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Gathering"), PrimarySkillType.GATHERING_SKILLS);
}
public static void printGatheringSkills(Player player) {
@@ -187,7 +185,7 @@ public final class CommandUtils {
* @param display The sender to display stats to
*/
public static void printCombatSkills(Player inspect, CommandSender display) {
printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Combat"), PrimarySkillType.COMBAT_SKILLS);
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Combat"), PrimarySkillType.COMBAT_SKILLS);
}
public static void printCombatSkills(Player player) {
@@ -201,7 +199,7 @@ public final class CommandUtils {
* @param display The sender to display stats to
*/
public static void printMiscSkills(Player inspect, CommandSender display) {
printGroupedSkillData(inspect, display, LocaleLoader.getString("Stats.Header.Misc"), PrimarySkillType.MISC_SKILLS);
printGroupedSkillData(inspect, display, pluginRef.getLocaleManager().getString("Stats.Header.Misc"), PrimarySkillType.MISC_SKILLS);
}
public static void printMiscSkills(Player player) {
@@ -210,10 +208,10 @@ public final class CommandUtils {
public static String displaySkill(PlayerProfile profile, PrimarySkillType skill) {
if (skill.isChildSkill()) {
return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill));
return pluginRef.getLocaleManager().getString("Skills.ChildStats", pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill));
}
return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
return pluginRef.getLocaleManager().getString("Skills.Stats", pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".Listener") + " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
}
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) {
@@ -242,7 +240,7 @@ public final class CommandUtils {
Player player = sender instanceof Player ? (Player) sender : null;
List<String> onlinePlayerNames = new ArrayList<>();
for (Player onlinePlayer : mcMMO.p.getServer().getOnlinePlayers()) {
for (Player onlinePlayer : pluginRef.getServer().getOnlinePlayers()) {
if (player != null && player.canSee(onlinePlayer)) {
onlinePlayerNames.add(onlinePlayer.getName());
}
@@ -258,14 +256,14 @@ public final class CommandUtils {
* @return Matched name or {@code partialName} if no match was found
*/
public static String getMatchedPlayerName(String partialName) {
if (mcMMO.getConfigManager().getConfigCommands().getMisc().isMatchOfflinePlayers()) {
if (pluginRef.getConfigManager().getConfigCommands().getMisc().isMatchOfflinePlayers()) {
List<String> matches = matchPlayer(partialName);
if (matches.size() == 1) {
partialName = matches.get(0);
}
} else {
Player player = mcMMO.p.getServer().getPlayer(partialName);
Player player = pluginRef.getServer().getPlayer(partialName);
if (player != null) {
partialName = player.getName();
@@ -287,7 +285,7 @@ public final class CommandUtils {
private static List<String> matchPlayer(String partialName) {
List<String> matchedPlayers = new ArrayList<>();
for (OfflinePlayer offlinePlayer : mcMMO.p.getServer().getOfflinePlayers()) {
for (OfflinePlayer offlinePlayer : pluginRef.getServer().getOfflinePlayers()) {
String playerName = offlinePlayer.getName();
if (playerName == null) { //Do null checking here to detect corrupted data before sending it throuogh .equals

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.util.experience;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
import org.bukkit.plugin.Plugin;
@@ -26,7 +25,7 @@ public class ExperienceBarManager {
}
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin) {
if (!mcMMO.getConfigManager().getConfigLeveling().isEnableXPBars() || !mcMMO.getConfigManager().getConfigLeveling().getXPBarToggle(primarySkillType))
if (!pluginRef.getConfigManager().getConfigLeveling().isEnableXPBars() || !pluginRef.getConfigManager().getConfigLeveling().getXPBarToggle(primarySkillType))
return;
//Init Bar

View File

@@ -2,8 +2,6 @@ package com.gmail.nossr50.util.experience;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.player.PlayerLevelUtils;
import org.bukkit.boss.BarColor;
@@ -54,12 +52,12 @@ public class ExperienceBarWrapper {
private String getTitleTemplate() {
//If they are using extra details
if(mcMMO.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
return LocaleLoader.getString("XPBar.Template.EarlyGameBoost");
} else if(mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceBars().isMoreDetailedXPBars())
return LocaleLoader.getString("XPBar.Complex.Template", LocaleLoader.getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
if(pluginRef.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
return pluginRef.getLocaleManager().getString("XPBar.Template.EarlyGameBoost");
} else if(pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceBars().isMoreDetailedXPBars())
return pluginRef.getLocaleManager().getString("XPBar.Complex.Template", pluginRef.getLocaleManager().getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
return LocaleLoader.getString("XPBar." + niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
return pluginRef.getLocaleManager().getString("XPBar." + niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
}
private int getLevel() {
@@ -121,14 +119,14 @@ public class ExperienceBarWrapper {
bossBar.setProgress(v);
//Check player level
if(mcMMO.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
if(pluginRef.getConfigManager().getConfigLeveling().getEarlyGameBoost().isEnableEarlyGameBoost() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
setColor(BarColor.YELLOW);
} else {
setColor(mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceBars().getXPBarColor(primarySkillType));
setColor(pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceBars().getXPBarColor(primarySkillType));
}
//Every time progress updates we need to check for a title update
if (getLevel() != lastLevelUpdated || mcMMO.getConfigManager().getConfigLeveling().isMoreDetailedXPBars()) {
if (getLevel() != lastLevelUpdated || pluginRef.getConfigManager().getConfigLeveling().isMoreDetailedXPBars()) {
updateTitle();
lastLevelUpdated = getLevel();
}
@@ -157,8 +155,8 @@ public class ExperienceBarWrapper {
private void createBossBar() {
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(title,
mcMMO.getConfigManager().getConfigLeveling().getXPBarColor(primarySkillType),
mcMMO.getConfigManager().getConfigLeveling().getXPBarStyle(primarySkillType));
pluginRef.getConfigManager().getConfigLeveling().getXPBarColor(primarySkillType),
pluginRef.getConfigManager().getConfigLeveling().getXPBarStyle(primarySkillType));
bossBar.addPlayer(mcMMOPlayer.getPlayer());
}
}

View File

@@ -13,6 +13,8 @@ import java.util.HashMap;
* This class handles the XP maps for various skills
*/
public class ExperienceManager {
private mcMMO pluginRef;
private HashMap<PrimarySkillType, HashMap<Material, String>> skillMaterialXPMap;
private HashMap<String, Integer> miningFullyQualifiedBlockXpMap;
private HashMap<String, Integer> herbalismFullyQualifiedBlockXpMap;
@@ -25,7 +27,8 @@ public class ExperienceManager {
private double globalXpMult;
public ExperienceManager() {
public ExperienceManager(mcMMO pluginRef) {
this.pluginRef = pluginRef;
initExperienceMaps();
registerDefaultValues();
@@ -44,8 +47,8 @@ public class ExperienceManager {
}
private void registerDefaultValues() {
fillCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getCombatExperienceMap());
registerSpecialCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getSpecialCombatExperienceMap());
fillCombatXPMultiplierMap(pluginRef.getConfigManager().getConfigExperience().getCombatExperienceMap());
registerSpecialCombatXPMultiplierMap(pluginRef.getConfigManager().getConfigExperience().getSpecialCombatExperienceMap());
buildBlockXPMaps();
buildFurnaceXPMap();
}
@@ -58,7 +61,7 @@ public class ExperienceManager {
* @param platformSafeMap the platform safe map
*/
public void fillCombatXPMultiplierMap(HashMap<String, Double> platformSafeMap) {
mcMMO.p.getLogger().info("Registering combat XP values...");
pluginRef.getLogger().info("Registering combat XP values...");
for (String entityString : platformSafeMap.keySet()) {
//Iterate over all EntityType(s)
boolean foundMatch = false;
@@ -68,7 +71,7 @@ public class ExperienceManager {
if (entityString.equalsIgnoreCase(type.name())) {
//Check for duplicates and warn the admin
if (combatXPMultiplierMap.containsKey(entityString)) {
mcMMO.p.getLogger().severe("Entity named " + entityString + " has multiple values in the combat experience config!");
pluginRef.getLogger().severe("Entity named " + entityString + " has multiple values in the combat experience config!");
}
//Match found
combatXPMultiplierMap.put(type, platformSafeMap.get(entityString));
@@ -77,7 +80,7 @@ public class ExperienceManager {
}
if(!foundMatch) {
mcMMO.p.getLogger().severe("No entity could be matched for the combat experience config value named - " + entityString);
pluginRef.getLogger().severe("No entity could be matched for the combat experience config value named - " + entityString);
}
}
}
@@ -88,13 +91,13 @@ public class ExperienceManager {
* @param map target map
*/
public void registerSpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Double> map) {
mcMMO.p.getLogger().info("Registering special combat XP values...");
pluginRef.getLogger().info("Registering special combat XP values...");
specialCombatXPMultiplierMap = map;
}
private void buildFurnaceXPMap() {
mcMMO.p.getLogger().info("Mapping xp values for furnaces...");
fillBlockXPMap(mcMMO.getConfigManager().getConfigExperience().getSmeltingExperienceMap(), furnaceFullyQualifiedItemXpMap);
pluginRef.getLogger().info("Mapping xp values for furnaces...");
fillBlockXPMap(pluginRef.getConfigManager().getConfigExperience().getSmeltingExperienceMap(), furnaceFullyQualifiedItemXpMap);
}
/**
@@ -117,8 +120,8 @@ public class ExperienceManager {
* Taming entries in the config are case insensitive, but for faster lookups we convert them to ENUMs
*/
private void buildTamingXPMap() {
mcMMO.p.getLogger().info("Building Taming XP list...");
HashMap<String, Integer> userTamingConfigMap = mcMMO.getConfigManager().getConfigExperience().getTamingExperienceMap();
pluginRef.getLogger().info("Building Taming XP list...");
HashMap<String, Integer> userTamingConfigMap = pluginRef.getConfigManager().getConfigExperience().getTamingExperienceMap();
for (String s : userTamingConfigMap.keySet()) {
boolean matchFound = false;
@@ -130,7 +133,7 @@ public class ExperienceManager {
}
}
if (!matchFound) {
mcMMO.p.getLogger().info("Unable to find entity with matching name - " + s);
pluginRef.getLogger().info("Unable to find entity with matching name - " + s);
}
}
}
@@ -144,30 +147,30 @@ public class ExperienceManager {
//Map the fully qualified name
fullyQualifiedBlockXPMap.put(matchingMaterial.getKey().toString(), userConfigMap.get(string));
} else {
mcMMO.p.getLogger().info("Could not find a match for the block named '" + string + "' among vanilla block registers");
pluginRef.getLogger().info("Could not find a match for the block named '" + string + "' among vanilla block registers");
}
}
}
private void buildMiningBlockXPMap() {
mcMMO.p.getLogger().info("Mapping block break XP values for Mining...");
fillBlockXPMap(mcMMO.getConfigManager().getConfigExperience().getMiningExperienceMap(), miningFullyQualifiedBlockXpMap);
pluginRef.getLogger().info("Mapping block break XP values for Mining...");
fillBlockXPMap(pluginRef.getConfigManager().getConfigExperience().getMiningExperienceMap(), miningFullyQualifiedBlockXpMap);
}
private void buildHerbalismBlockXPMap() {
mcMMO.p.getLogger().info("Mapping block break XP values for Herbalism...");
fillBlockXPMap(mcMMO.getConfigManager().getConfigExperience().getHerbalismXPMap(), herbalismFullyQualifiedBlockXpMap);
pluginRef.getLogger().info("Mapping block break XP values for Herbalism...");
fillBlockXPMap(pluginRef.getConfigManager().getConfigExperience().getHerbalismXPMap(), herbalismFullyQualifiedBlockXpMap);
}
private void buildWoodcuttingBlockXPMap() {
mcMMO.p.getLogger().info("Mapping block break XP values for Woodcutting...");
fillBlockXPMap(mcMMO.getConfigManager().getConfigExperience().getWoodcuttingExperienceMap(), woodcuttingFullyQualifiedBlockXpMap);
pluginRef.getLogger().info("Mapping block break XP values for Woodcutting...");
fillBlockXPMap(pluginRef.getConfigManager().getConfigExperience().getWoodcuttingExperienceMap(), woodcuttingFullyQualifiedBlockXpMap);
}
private void buildExcavationBlockXPMap() {
mcMMO.p.getLogger().info("Mapping block break XP values for Excavation...");
fillBlockXPMap(mcMMO.getConfigManager().getConfigExperience().getExcavationExperienceMap(), excavationFullyQualifiedBlockXpMap);
pluginRef.getLogger().info("Mapping block break XP values for Excavation...");
fillBlockXPMap(pluginRef.getConfigManager().getConfigExperience().getExcavationExperienceMap(), excavationFullyQualifiedBlockXpMap);
}
/**
@@ -176,7 +179,7 @@ public class ExperienceManager {
* @param newGlobalXpMult new global xp multiplier value
*/
public void setGlobalXpMult(double newGlobalXpMult) {
mcMMO.p.getLogger().info("Setting the global XP multiplier -> " + newGlobalXpMult);
pluginRef.getLogger().info("Setting the global XP multiplier -> " + newGlobalXpMult);
globalXpMult = newGlobalXpMult;
}
@@ -184,7 +187,7 @@ public class ExperienceManager {
* Reset the Global XP multiplier to its original value
*/
public void resetGlobalXpMult() {
mcMMO.p.getLogger().info("Resetting the global XP multiplier " + globalXpMult + " -> " + getOriginalGlobalXpMult());
pluginRef.getLogger().info("Resetting the global XP multiplier " + globalXpMult + " -> " + getOriginalGlobalXpMult());
globalXpMult = getOriginalGlobalXpMult();
}
@@ -194,7 +197,7 @@ public class ExperienceManager {
* @param miningFullyQualifiedBlockXpMap the XP map to change to
*/
public void setMiningFullyQualifiedBlockXpMap(HashMap<String, Integer> miningFullyQualifiedBlockXpMap) {
mcMMO.p.getLogger().info("Changing Mining XP Values...");
pluginRef.getLogger().info("Changing Mining XP Values...");
this.miningFullyQualifiedBlockXpMap = miningFullyQualifiedBlockXpMap;
}
@@ -204,7 +207,7 @@ public class ExperienceManager {
* @param herbalismFullyQualifiedBlockXpMap the XP map to change to
*/
public void setHerbalismFullyQualifiedBlockXpMap(HashMap<String, Integer> herbalismFullyQualifiedBlockXpMap) {
mcMMO.p.getLogger().info("Changing Herbalism XP Values...");
pluginRef.getLogger().info("Changing Herbalism XP Values...");
this.herbalismFullyQualifiedBlockXpMap = herbalismFullyQualifiedBlockXpMap;
}
@@ -214,7 +217,7 @@ public class ExperienceManager {
* @param woodcuttingFullyQualifiedBlockXpMap the XP map to change to
*/
public void setWoodcuttingFullyQualifiedBlockXpMap(HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap) {
mcMMO.p.getLogger().info("Changin Woodcutting XP Values...");
pluginRef.getLogger().info("Changin Woodcutting XP Values...");
this.woodcuttingFullyQualifiedBlockXpMap = woodcuttingFullyQualifiedBlockXpMap;
}
@@ -224,7 +227,7 @@ public class ExperienceManager {
* @param excavationFullyQualifiedBlockXpMap the XP map to change to
*/
public void setExcavationFullyQualifiedBlockXpMap(HashMap<String, Integer> excavationFullyQualifiedBlockXpMap) {
mcMMO.p.getLogger().info("Changing Excavation XP Values...");
pluginRef.getLogger().info("Changing Excavation XP Values...");
this.excavationFullyQualifiedBlockXpMap = excavationFullyQualifiedBlockXpMap;
}
@@ -281,7 +284,7 @@ public class ExperienceManager {
* @return the original global xp multiplier value from the user config file
*/
public double getOriginalGlobalXpMult() {
return mcMMO.getConfigManager().getConfigExperience().getGlobalXPMultiplier();
return pluginRef.getConfigManager().getConfigExperience().getGlobalXPMultiplier();
}
/**

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.util.experience;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import java.util.HashMap;
import java.util.Map;
@@ -17,7 +16,7 @@ public class FormulaManager {
private FormulaType currentFormula;
public FormulaManager() {
currentFormula = mcMMO.getConfigManager().getConfigLeveling().getFormulaType();
currentFormula = pluginRef.getConfigManager().getConfigLeveling().getFormulaType();
initExperienceNeededMaps();
}
@@ -64,7 +63,7 @@ public class FormulaManager {
public int[] calculateNewLevel(PrimarySkillType primarySkillType, int experience) {
int newLevel = 0;
int remainder = 0;
int maxLevel = mcMMO.getConfigManager().getConfigLeveling().getSkillLevelCap(primarySkillType);
int maxLevel = pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(primarySkillType);
while (experience > 0 && newLevel < maxLevel) {
int experienceToNextLevel = getXPtoNextLevel(newLevel, currentFormula);
@@ -124,7 +123,7 @@ public class FormulaManager {
* @param formulaType target formulaType
*/
private int processXPToNextLevel(int level, FormulaType formulaType) {
if(mcMMO.isRetroModeEnabled())
if(pluginRef.isRetroModeEnabled())
{
return processXPRetroToNextLevel(level, formulaType);
} else {
@@ -182,18 +181,18 @@ public class FormulaManager {
* @return the raw XP needed for the next level based on formula type
*/
private int calculateXPNeeded(int level, FormulaType formulaType) {
int base = mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getBase(formulaType);
double multiplier = mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getMultiplier(formulaType);
int base = pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getBase(formulaType);
double multiplier = pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getMultiplier(formulaType);
switch(formulaType) {
case LINEAR:
return (int) Math.floor(base + level * multiplier);
case EXPONENTIAL:
double exponent = mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getExponentialExponent();
double exponent = pluginRef.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getExponentialExponent();
return (int) Math.floor(multiplier * Math.pow(level, exponent) + base);
default:
//TODO: Should never be called
mcMMO.p.getLogger().severe("Invalid formula specified for calculation, defaulting to Linear");
pluginRef.getLogger().severe("Invalid formula specified for calculation, defaulting to Linear");
return calculateXPNeeded(level, FormulaType.LINEAR);
}
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.util.nbt;
import com.gmail.nossr50.mcMMO;
import net.minecraft.server.v1_13_R2.NBTBase;
import net.minecraft.server.v1_13_R2.NBTList;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
@@ -39,7 +38,7 @@ public class NBTManager {
return CraftNBTTagConfigSerializer.deserialize(nbtString);
} catch (Exception e) {
e.printStackTrace();
mcMMO.p.getLogger().severe("mcMMO was unable parse the NBT string from your config! Double check that it is proper NBT!");
pluginRef.getLogger().severe("mcMMO was unable parse the NBT string from your config! Double check that it is proper NBT!");
return null;
}
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.util.nbt;
import com.gmail.nossr50.mcMMO;
import net.minecraft.server.v1_13_R2.NBTBase;
/**
@@ -29,6 +28,6 @@ public class RawNBT {
}
public NBTBase getNbtData() {
return mcMMO.getNbtManager().constructNBT(nbtContents);
return pluginRef.getNbtManager().constructNBT(nbtContents);
}
}

View File

@@ -7,8 +7,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory;
@@ -40,7 +38,7 @@ public class NotificationManager {
private void initMaps() {
//Copy the map
playerNotificationHashMap = new HashMap<>(mcMMO.getConfigManager().getConfigNotifications().getNotificationSettingHashMap());
playerNotificationHashMap = new HashMap<>(pluginRef.getConfigManager().getConfigNotifications().getNotificationSettingHashMap());
}
@@ -99,7 +97,7 @@ public class NotificationManager {
* This event in particular is provided with a source player, and players near the source player are sent the information
* @param targetPlayer the recipient player for this message
* @param notificationType type of notification
* @param key Locale Key for the string to use with this event
* @param key LocaleManager Key for the string to use with this event
* @param values values to be injected into the locale string
*/
public void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
@@ -112,7 +110,7 @@ public class NotificationManager {
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return;
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
String preColoredString = pluginRef.getLocaleManager().getString(key, (Object[]) values);
player.sendMessage(preColoredString);
}
@@ -198,7 +196,7 @@ public class NotificationManager {
/*
* Determine the 'identity' of the one who executed the command to pass as a parameters
*/
String senderName = LocaleLoader.getString("Server.ConsoleName");
String senderName = pluginRef.getLocaleManager().getString("Server.ConsoleName");
if (commandSender instanceof Player) {
senderName = ((Player) commandSender).getDisplayName() + ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
@@ -207,12 +205,12 @@ public class NotificationManager {
//Send the notification
switch (sensitiveCommandType) {
case XPRATE_MODIFY:
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args));
sendAdminNotification(pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender, pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.Start.Self", args));
break;
case XPRATE_END:
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.End.Others", addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.End.Self", args));
sendAdminNotification(pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.End.Others", addItemToFirstPositionOfArray(senderName, args)));
sendAdminCommandConfirmation(commandSender, pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.End.Self", args));
break;
}
}
@@ -225,17 +223,17 @@ public class NotificationManager {
*/
private void sendAdminNotification(String msg) {
//If its not enabled exit
if (!mcMMO.getConfigManager().getConfigAdmin().isSendAdminNotifications())
if (!pluginRef.getConfigManager().getConfigAdmin().isSendAdminNotifications())
return;
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (player.isOp() || Permissions.adminChat(player)) {
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
player.sendMessage(pluginRef.getLocaleManager().getString("Notifications.Admin.Format.Others", msg));
}
}
//Copy it out to Console too
mcMMO.p.getLogger().info(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
pluginRef.getLogger().info(pluginRef.getLocaleManager().getString("Notifications.Admin.Format.Others", msg));
}
/**
@@ -245,7 +243,7 @@ public class NotificationManager {
* @param msg message fetched from locale
*/
private void sendAdminCommandConfirmation(CommandSender commandSender, String msg) {
commandSender.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Self", msg));
commandSender.sendMessage(pluginRef.getLocaleManager().getString("Notifications.Admin.Format.Self", msg));
}
/**

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.util.player;
import com.gmail.nossr50.datatypes.experience.CustomXPPerk;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import org.bukkit.entity.Player;
@@ -30,7 +29,7 @@ public class PlayerLevelUtils {
*/
private void applyConfigPerks() {
//Make a copy
customXpPerkNodes = new HashSet<>(mcMMO.getConfigManager().getConfigExperience().getCustomXPBoosts());
customXpPerkNodes = new HashSet<>(pluginRef.getConfigManager().getConfigExperience().getCustomXPBoosts());
}
/**

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.util.player;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Entity;
@@ -26,7 +25,7 @@ public final class UserManager {
* @param mcMMOPlayer the player profile to start tracking
*/
public static void track(McMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().setMetadata(MetadataConstants.PLAYER_DATA_METAKEY, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
mcMMOPlayer.getPlayer().setMetadata(MetadataConstants.PLAYER_DATA_METAKEY, new FixedMetadataValue(pluginRef, mcMMOPlayer));
if(playerDataSet == null)
playerDataSet = new HashSet<>();
@@ -46,7 +45,7 @@ public final class UserManager {
*/
public static void remove(Player player) {
McMMOPlayer mcMMOPlayer = getPlayer(player);
player.removeMetadata(MetadataConstants.PLAYER_DATA_METAKEY, mcMMO.p);
player.removeMetadata(MetadataConstants.PLAYER_DATA_METAKEY, pluginRef);
if(playerDataSet != null && playerDataSet.contains(mcMMOPlayer))
playerDataSet.remove(mcMMOPlayer); //Clear sync save tracking
@@ -56,7 +55,7 @@ public final class UserManager {
* Clear all users.
*/
public static void clearAll() {
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
for (Player player : pluginRef.getServer().getOnlinePlayers()) {
remove(player);
}
@@ -73,27 +72,27 @@ public final class UserManager {
ImmutableList<McMMOPlayer> trackedSyncData = ImmutableList.copyOf(playerDataSet);
mcMMO.p.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");
pluginRef.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");
for (McMMOPlayer playerData : trackedSyncData) {
try
{
mcMMO.p.getLogger().info("Saving data for player: "+playerData.getPlayerName());
pluginRef.getLogger().info("Saving data for player: "+playerData.getPlayerName());
playerData.getProfile().save(true);
}
catch (Exception e)
{
mcMMO.p.getLogger().warning("Could not save mcMMO player data for player: " + playerData.getPlayerName());
pluginRef.getLogger().warning("Could not save mcMMO player data for player: " + playerData.getPlayerName());
}
}
mcMMO.p.getLogger().info("Finished save operation for "+trackedSyncData.size()+" players!");
pluginRef.getLogger().info("Finished save operation for "+trackedSyncData.size()+" players!");
}
public static Collection<McMMOPlayer> getPlayers() {
Collection<McMMOPlayer> playerCollection = new ArrayList<>();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
for (Player player : pluginRef.getServer().getOnlinePlayers()) {
if (hasPlayerDataKey(player)) {
playerCollection.add(getPlayer(player));
}
@@ -139,11 +138,11 @@ public final class UserManager {
}
private static McMMOPlayer retrieveMcMMOPlayer(String playerName, boolean offlineValid) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
if (!offlineValid) {
mcMMO.p.getLogger().warning("A valid mcMMOPlayer object could not be found for " + playerName + ".");
pluginRef.getLogger().warning("A valid mcMMOPlayer object could not be found for " + playerName + ".");
}
return null;

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.util.random;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player;
@@ -33,7 +32,7 @@ public class RandomChanceSkill implements RandomChanceExecution {
public RandomChanceSkill(Player player, SubSkillType subSkillType, boolean hasCap) {
if (hasCap)
this.probabilityCap = mcMMO.getDynamicSettingsManager().getSkillMaxChance(subSkillType);
this.probabilityCap = pluginRef.getDynamicSettingsManager().getSkillMaxChance(subSkillType);
else
this.probabilityCap = RandomChanceUtil.LINEAR_CURVE_VAR;
@@ -86,7 +85,7 @@ public class RandomChanceSkill implements RandomChanceExecution {
* @return the maximum bonus from skill level for this skill
*/
public double getMaximumBonusLevelCap() {
return mcMMO.getDynamicSettingsManager().getSkillMaxBonusLevel(subSkillType);
return pluginRef.getDynamicSettingsManager().getSkillMaxBonusLevel(subSkillType);
}
/**

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillActivationType;
@@ -219,7 +218,7 @@ public class RandomChanceUtil {
* @throws InvalidStaticChance if the skill has no defined static chance this exception will be thrown and you should know you're a naughty boy
*/
public static double getStaticRandomChance(SubSkillType subSkillType) throws InvalidStaticChance {
return mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getStaticChanceProperty(subSkillType);
return pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getStaticChanceProperty(subSkillType);
}
public static boolean sendSkillEvent(Player player, SubSkillType subSkillType, double activationChance) {

View File

@@ -5,8 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
@@ -29,19 +27,19 @@ public class ScoreboardManager {
static final String SIDEBAR_OBJECTIVE = "mcmmo_sidebar";
static final String POWER_OBJECTIVE = "mcmmo_pwrlvl";
static final String HEADER_STATS = LocaleLoader.getString("Scoreboard.Header.PlayerStats");
static final String HEADER_COOLDOWNS = LocaleLoader.getString("Scoreboard.Header.PlayerCooldowns");
static final String HEADER_RANK = LocaleLoader.getString("Scoreboard.Header.PlayerRank");
static final String TAG_POWER_LEVEL = LocaleLoader.getString("Scoreboard.Header.PowerLevel");
static final String HEADER_STATS = pluginRef.getLocaleManager().getString("Scoreboard.Header.PlayerStats");
static final String HEADER_COOLDOWNS = pluginRef.getLocaleManager().getString("Scoreboard.Header.PlayerCooldowns");
static final String HEADER_RANK = pluginRef.getLocaleManager().getString("Scoreboard.Header.PlayerRank");
static final String TAG_POWER_LEVEL = pluginRef.getLocaleManager().getString("Scoreboard.Header.PowerLevel");
static final String POWER_LEVEL = LocaleLoader.getString("Scoreboard.Misc.PowerLevel");
static final String POWER_LEVEL = pluginRef.getLocaleManager().getString("Scoreboard.Misc.PowerLevel");
static final String LABEL_POWER_LEVEL = POWER_LEVEL;
static final String LABEL_LEVEL = LocaleLoader.getString("Scoreboard.Misc.Level");
static final String LABEL_CURRENT_XP = LocaleLoader.getString("Scoreboard.Misc.CurrentXP");
static final String LABEL_REMAINING_XP = LocaleLoader.getString("Scoreboard.Misc.RemainingXP");
static final String LABEL_ABILITY_COOLDOWN = LocaleLoader.getString("Scoreboard.Misc.Cooldown");
static final String LABEL_OVERALL = LocaleLoader.getString("Scoreboard.Misc.Overall");
static final String LABEL_LEVEL = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Level");
static final String LABEL_CURRENT_XP = pluginRef.getLocaleManager().getString("Scoreboard.Misc.CurrentXP");
static final String LABEL_REMAINING_XP = pluginRef.getLocaleManager().getString("Scoreboard.Misc.RemainingXP");
static final String LABEL_ABILITY_COOLDOWN = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Cooldown");
static final String LABEL_OVERALL = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Overall");
static final Map<PrimarySkillType, String> skillLabels;
static final Map<SuperAbilityType, String> abilityLabelsColored;
@@ -64,7 +62,7 @@ public class ScoreboardManager {
* Stylizes the targetBoard in a Rainbow Pattern
* This is off by default
*/
if (mcMMO.getScoreboardSettings().getUseRainbowSkillStyling()) {
if (pluginRef.getScoreboardSettings().getUseRainbowSkillStyling()) {
// Everything but black, gray, gold
List<ChatColor> colors = Lists.newArrayList(
ChatColor.WHITE,
@@ -134,10 +132,10 @@ public class ScoreboardManager {
}
private static String formatAbility(ChatColor color, String abilityName) {
if (mcMMO.getScoreboardSettings().getUseAbilityNamesOverGenerics()) {
if (pluginRef.getScoreboardSettings().getUseAbilityNamesOverGenerics()) {
return getShortenedName(color + abilityName);
} else {
return color + LocaleLoader.getString("Scoreboard.Misc.Ability");
return color + pluginRef.getLocaleManager().getString("Scoreboard.Misc.Ability");
}
}
@@ -172,8 +170,8 @@ public class ScoreboardManager {
// Called in onDisable()
public static void teardownAll() {
ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers());
mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")");
ImmutableList<Player> onlinePlayers = ImmutableList.copyOf(pluginRef.getServer().getOnlinePlayers());
pluginRef.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")");
for (Player player : onlinePlayers) {
teardownPlayer(player);
}
@@ -206,11 +204,11 @@ public class ScoreboardManager {
}
}
if (mcMMO.getScoreboardSettings().getPowerLevelTagsEnabled() && !dirtyPowerLevels.contains(playerName)) {
if (pluginRef.getScoreboardSettings().getPowerLevelTagsEnabled() && !dirtyPowerLevels.contains(playerName)) {
dirtyPowerLevels.add(playerName);
}
if (mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().isUseThisBoard()) {
if (pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().isUseThisBoard()) {
enablePlayerSkillLevelUpScoreboard(player, skill);
}
}
@@ -241,7 +239,7 @@ public class ScoreboardManager {
wrapper.setOldScoreboard();
wrapper.setTypeSkill(skill);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.SKILL_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.SKILL_BOARD));
}
// **** Setup methods **** //
@@ -257,7 +255,7 @@ public class ScoreboardManager {
wrapper.setOldScoreboard();
wrapper.setTypeSkill(skill);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().getShowBoardOnPlayerLevelUpTime());
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().getShowBoardOnPlayerLevelUpTime());
}
public static void enablePlayerStatsScoreboard(Player player) {
@@ -266,7 +264,7 @@ public class ScoreboardManager {
wrapper.setOldScoreboard();
wrapper.setTypeSelfStats();
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.STATS_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.STATS_BOARD));
}
public static void enablePlayerInspectScoreboard(Player player, PlayerProfile targetProfile) {
@@ -275,7 +273,7 @@ public class ScoreboardManager {
wrapper.setOldScoreboard();
wrapper.setTypeInspectStats(targetProfile);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().getDisplayTimeInSeconds());
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().getDisplayTimeInSeconds());
}
public static void enablePlayerCooldownScoreboard(Player player) {
@@ -284,7 +282,7 @@ public class ScoreboardManager {
wrapper.setOldScoreboard();
wrapper.setTypeCooldowns();
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.COOLDOWNS_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.COOLDOWNS_BOARD));
}
public static void showPlayerRankScoreboard(Player player, Map<PrimarySkillType, Integer> rank) {
@@ -294,7 +292,7 @@ public class ScoreboardManager {
wrapper.setTypeSelfRank();
wrapper.acceptRankData(rank);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.RANK_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.RANK_BOARD));
}
public static void showPlayerRankScoreboardOthers(Player player, String targetName, Map<PrimarySkillType, Integer> rank) {
@@ -304,7 +302,7 @@ public class ScoreboardManager {
wrapper.setTypeInspectRank(targetName);
wrapper.acceptRankData(rank);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.RANK_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.RANK_BOARD));
}
public static void showTopScoreboard(Player player, PrimarySkillType skill, int pageNumber, List<PlayerStat> stats) {
@@ -314,7 +312,7 @@ public class ScoreboardManager {
wrapper.setTypeTop(skill, pageNumber);
wrapper.acceptLeaderboardData(stats);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.TOP_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.TOP_BOARD));
}
public static void showTopPowerScoreboard(Player player, int pageNumber, List<PlayerStat> stats) {
@@ -324,7 +322,7 @@ public class ScoreboardManager {
wrapper.setTypeTopPower(pageNumber);
wrapper.acceptLeaderboardData(stats);
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.TOP_BOARD));
changeScoreboard(wrapper, pluginRef.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.TOP_BOARD));
}
/**
@@ -369,21 +367,21 @@ public class ScoreboardManager {
* @return the main targetBoard objective, or null if disabled
*/
public static Objective getPowerLevelObjective() {
if (!mcMMO.getScoreboardSettings().getPowerLevelTagsEnabled()) {
Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
if (!pluginRef.getScoreboardSettings().getPowerLevelTagsEnabled()) {
Objective objective = pluginRef.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
if (objective != null) {
objective.unregister();
mcMMO.p.debug("Removed leftover targetBoard objects from Power Level Tags.");
pluginRef.debug("Removed leftover targetBoard objects from Power Level Tags.");
}
return null;
}
Objective powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
Objective powerObjective = pluginRef.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
if (powerObjective == null) {
powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
powerObjective = pluginRef.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
powerObjective.setDisplayName(TAG_POWER_LEVEL);
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
}

View File

@@ -6,8 +6,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.events.scoreboard.*;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
@@ -54,7 +52,7 @@ public class ScoreboardWrapper {
sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy");
powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy");
if (mcMMO.getScoreboardSettings().getPowerLevelTagsEnabled()) {
if (pluginRef.getScoreboardSettings().getPowerLevelTagsEnabled()) {
powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL);
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
@@ -66,7 +64,7 @@ public class ScoreboardWrapper {
public static ScoreboardWrapper create(Player player) {
//Call our custom event
McMMOScoreboardMakeboardEvent event = new McMMOScoreboardMakeboardEvent(mcMMO.p.getServer().getScoreboardManager().getNewScoreboard(), player.getScoreboard(), player, ScoreboardEventReason.CREATING_NEW_SCOREBOARD);
McMMOScoreboardMakeboardEvent event = new McMMOScoreboardMakeboardEvent(pluginRef.getServer().getScoreboardManager().getNewScoreboard(), player.getScoreboard(), player, ScoreboardEventReason.CREATING_NEW_SCOREBOARD);
player.getServer().getPluginManager().callEvent(event);
//Use the values from the event
return new ScoreboardWrapper(event.getTargetPlayer(), event.getTargetBoard());
@@ -75,7 +73,7 @@ public class ScoreboardWrapper {
public void doSidebarUpdateSoon() {
if (updateTask == null) {
// To avoid spamming the scheduler, store the instance and run 2 ticks later
updateTask = new ScoreboardQuickUpdate().runTaskLater(mcMMO.p, 2L);
updateTask = new ScoreboardQuickUpdate().runTaskLater(pluginRef, 2L);
}
}
@@ -83,7 +81,7 @@ public class ScoreboardWrapper {
if (cooldownTask == null) {
// Repeat every 5 seconds.
// Cancels once all cooldowns are done, using stopCooldownUpdating().
cooldownTask = new ScoreboardCooldownTask().runTaskTimer(mcMMO.p, 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
cooldownTask = new ScoreboardCooldownTask().runTaskTimer(pluginRef, 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
}
}
@@ -114,7 +112,7 @@ public class ScoreboardWrapper {
* Set the old targetBoard, for use in reverting.
*/
public void setOldScoreboard() {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
ScoreboardManager.cleanup(this);
@@ -126,7 +124,7 @@ public class ScoreboardWrapper {
if (oldBoard == scoreboard) { // Already displaying it
if (this.oldBoard == null) {
// (Shouldn't happen) Use failsafe value - we're already displaying our board, but we don't have the one we should revert to
this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
this.oldBoard = pluginRef.getServer().getScoreboardManager().getMainScoreboard();
}
} else {
this.oldBoard = oldBoard;
@@ -134,7 +132,7 @@ public class ScoreboardWrapper {
}
public void showBoardWithNoRevert() {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
ScoreboardManager.cleanup(this);
@@ -150,7 +148,7 @@ public class ScoreboardWrapper {
}
public void showBoardAndScheduleRevert(int ticks) {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
ScoreboardManager.cleanup(this);
@@ -162,32 +160,32 @@ public class ScoreboardWrapper {
}
player.setScoreboard(scoreboard);
revertTask = new ScoreboardChangeTask().runTaskLater(mcMMO.p, ticks);
revertTask = new ScoreboardChangeTask().runTaskLater(pluginRef, ticks);
// TODO is there any way to do the time that looks acceptable?
// player.sendMessage(LocaleLoader.getString("Commands.ConfigScoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F));
// player.sendMessage(pluginRef.getLocaleManager().getString("Commands.ConfigScoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F));
if (UserManager.getPlayer(playerName) == null)
return;
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
if (profile.getScoreboardTipsShown() >= mcMMO.getScoreboardSettings().getTipsAmount()) {
if (profile.getScoreboardTipsShown() >= pluginRef.getScoreboardSettings().getTipsAmount()) {
return;
}
if (!tippedKeep) {
tippedKeep = true;
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Keep"));
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Tip.Keep"));
} else if (!tippedClear) {
tippedClear = true;
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Clear"));
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Scoreboard.Tip.Clear"));
profile.increaseTipsShown();
}
}
public void tryRevertBoard() {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
ScoreboardManager.cleanup(this);
@@ -205,7 +203,7 @@ public class ScoreboardWrapper {
event.getTargetPlayer().setScoreboard(event.getTargetBoard());
oldBoard = null;
} else {
mcMMO.p.debug("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
pluginRef.debug("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
}
}
@@ -219,7 +217,7 @@ public class ScoreboardWrapper {
}
public boolean isBoardShown() {
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
ScoreboardManager.cleanup(this);
@@ -281,7 +279,7 @@ public class ScoreboardWrapper {
targetSkill = null;
leaderboardPage = -1;
loadObjective(LocaleLoader.getString("Scoreboard.Header.PlayerInspect", targetPlayer));
loadObjective(pluginRef.getLocaleManager().getString("Scoreboard.Header.PlayerInspect", targetPlayer));
}
public void setTypeCooldowns() {
@@ -388,7 +386,7 @@ public class ScoreboardWrapper {
return;
}
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
if (player == null) {
ScoreboardManager.cleanup(this);
@@ -515,7 +513,7 @@ public class ScoreboardWrapper {
public void acceptRankData(Map<PrimarySkillType, Integer> rankData) {
Integer rank;
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
Player player = pluginRef.getServer().getPlayerExact(playerName);
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
if (!skill.getPermissions(player)) {

View File

@@ -11,7 +11,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
@@ -493,7 +492,7 @@ public final class CombatUtils {
switch (type) {
case SWORDS:
if (entity instanceof Player) {
mcMMO.getNotificationManager().sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
pluginRef.getNotificationManager().sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
}
UserManager.getPlayer(attacker).getSwordsManager().ruptureCheck(target);
@@ -501,7 +500,7 @@ public final class CombatUtils {
case AXES:
if (entity instanceof Player) {
mcMMO.getNotificationManager().sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.SS.Struck");
pluginRef.getNotificationManager().sendPlayerInformation((Player) entity, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.SS.Struck");
}
break;
@@ -531,7 +530,7 @@ public final class CombatUtils {
XPGainReason xpGainReason;
if (target instanceof Player) {
if (!mcMMO.getConfigManager().getConfigExperience().isPvpXPEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
if (!pluginRef.getConfigManager().getConfigExperience().isPvpXPEnabled() || pluginRef.getPartyManager().inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
return;
}
@@ -539,7 +538,7 @@ public final class CombatUtils {
Player defender = (Player) target;
if (defender.isOnline() && SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
baseXPMultiplier = 20 * mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.PVP);
baseXPMultiplier = 20 * pluginRef.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.PVP);
}
} else {
/*if (mcMMO.getModManager().isCustomEntity(target)) {
@@ -547,21 +546,21 @@ public final class CombatUtils {
}*/
//else if (target instanceof Animals) {
if (target instanceof Animals) {
baseXPMultiplier = mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.ANIMALS);
baseXPMultiplier = pluginRef.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.ANIMALS);
} else if (target instanceof Monster) {
EntityType type = target.getType();
baseXPMultiplier = mcMMO.getDynamicSettingsManager().getExperienceManager().getCombatXPMultiplier(type);
baseXPMultiplier = pluginRef.getDynamicSettingsManager().getExperienceManager().getCombatXPMultiplier(type);
} else {
EntityType type = target.getType();
if (mcMMO.getDynamicSettingsManager().getExperienceManager().hasCombatXP(type)) {
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasCombatXP(type)) {
//Exploit stuff
if (type == EntityType.IRON_GOLEM) {
if (!((IronGolem) target).isPlayerCreated()) {
baseXPMultiplier = mcMMO.getDynamicSettingsManager().getExperienceManager().getCombatXPMultiplier(type);
baseXPMultiplier = pluginRef.getDynamicSettingsManager().getExperienceManager().getCombatXPMultiplier(type);
}
} else {
baseXPMultiplier = mcMMO.getDynamicSettingsManager().getExperienceManager().getCombatXPMultiplier(type);
baseXPMultiplier = pluginRef.getDynamicSettingsManager().getExperienceManager().getCombatXPMultiplier(type);
}
} else {
baseXPMultiplier = 1.0f;
@@ -569,11 +568,11 @@ public final class CombatUtils {
}
if (target.hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY) || target.hasMetadata("ES")) {
baseXPMultiplier *= mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.SPAWNED);
baseXPMultiplier *= pluginRef.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.SPAWNED);
}
if (target.hasMetadata(MetadataConstants.PETS_ANIMAL_TRACKING_METAKEY)) {
baseXPMultiplier *= mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.PETS);
baseXPMultiplier *= pluginRef.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.PETS);
}
xpGainReason = XPGainReason.PVE;
@@ -584,7 +583,7 @@ public final class CombatUtils {
baseXPMultiplier *= multiplier;
if (baseXPMultiplier != 0) {
new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXPMultiplier, target, xpGainReason).runTaskLater(mcMMO.p, 0);
new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXPMultiplier, target, xpGainReason).runTaskLater(pluginRef, 0);
}
}
@@ -607,7 +606,7 @@ public final class CombatUtils {
return false;
}
if ((PartyManager.inSameParty(player, defender) || PartyManager.areAllies(player, defender)) && !(Permissions.friendlyFire(player) && Permissions.friendlyFire(defender))) {
if ((pluginRef.getPartyManager().inSameParty(player, defender) || pluginRef.getPartyManager().areAllies(player, defender)) && !(Permissions.friendlyFire(player) && Permissions.friendlyFire(defender))) {
return false;
}
@@ -668,7 +667,7 @@ public final class CombatUtils {
if (tamer instanceof Player) {
Player owner = (Player) tamer;
return (owner == attacker || PartyManager.inSameParty(attacker, owner) || PartyManager.areAllies(attacker, owner));
return (owner == attacker || pluginRef.getPartyManager().inSameParty(attacker, owner) || pluginRef.getPartyManager().areAllies(attacker, owner));
}
}
@@ -703,7 +702,7 @@ public final class CombatUtils {
public static EntityDamageEvent sendEntityDamageEvent(Entity attacker, Entity target, DamageCause damageCause, double damage) {
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, damageCause, damage) : new FakeEntityDamageByEntityEvent(attacker, target, damageCause, damage);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
pluginRef.getServer().getPluginManager().callEvent(damageEvent);
return damageEvent;
}
@@ -717,7 +716,7 @@ public final class CombatUtils {
public static double getFakeDamageFinalResult(Entity attacker, Entity target, DamageCause cause, Map<DamageModifier, Double> modifiers) {
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers);
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
pluginRef.getServer().getPluginManager().callEvent(damageEvent);
if (damageEvent.isCancelled()) {
return 0;

View File

@@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.SkillUnlockNotificationTask;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
@@ -381,7 +380,7 @@ public class RankUtils {
*/
private static int findRankByRootAddress(int rank, SubSkillType subSkillType) {
CommentedConfigurationNode rankConfigRoot = mcMMO.getConfigManager().getConfigRanksRootNode();
CommentedConfigurationNode rankConfigRoot = pluginRef.getConfigManager().getConfigRanksRootNode();
try {
SkillRankProperty skillRankProperty
@@ -389,17 +388,17 @@ public class RankUtils {
.getNode(subSkillType.getHoconFriendlyConfigName())
.getValue(TypeToken.of(SkillRankProperty.class));
int unlockLevel = skillRankProperty.getUnlockLevel(mcMMO.isRetroModeEnabled(), rank);
int unlockLevel = skillRankProperty.getUnlockLevel(pluginRef.isRetroModeEnabled(), rank);
return unlockLevel;
} catch (ObjectMappingException | MissingSkillPropertyDefinition | NullPointerException e) {
mcMMO.p.getLogger().severe("Error traversing nodes to SkillRankProperty for "+subSkillType.toString());
mcMMO.p.getLogger().severe("This indicates a problem with your rank config file, edit the file and correct the issue or delete it to generate a new default one with correct values.");
pluginRef.getLogger().severe("Error traversing nodes to SkillRankProperty for "+subSkillType.toString());
pluginRef.getLogger().severe("This indicates a problem with your rank config file, edit the file and correct the issue or delete it to generate a new default one with correct values.");
e.printStackTrace();
}
//Default to the max level for the skill if any errors were encountered incorrect
return mcMMO.getConfigManager().getConfigLeveling().getSkillLevelCap(subSkillType.getParentSkill());
return pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(subSkillType.getParentSkill());
}
public static boolean isPlayerMaxRankInSubSkill(Player player, SubSkillType subSkillType) {

View File

@@ -7,8 +7,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@@ -50,9 +48,9 @@ public class SkillUtils {
*/
public static int calculateAbilityLength(McMMOPlayer mcMMOPlayer, PrimarySkillType skill, SuperAbilityType superAbilityType) {
//These values change depending on whether or not the server is in retro mode
int abilityLengthVar = mcMMO.getConfigManager().getConfigSuperAbilities().getSuperAbilityStartingSeconds();
int abilityLengthVar = pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityStartingSeconds();
int maxLength = mcMMO.getConfigManager().getConfigSuperAbilities().getMaxLengthForSuper(superAbilityType);
int maxLength = pluginRef.getConfigManager().getConfigSuperAbilities().getMaxLengthForSuper(superAbilityType);
int skillLevel = mcMMOPlayer.getSkillLevel(skill);
@@ -134,7 +132,7 @@ public class SkillUtils {
* @return true if this is a valid skill, false otherwise
*/
public static boolean isSkill(String skillName) {
return mcMMO.getConfigManager().getConfigLanguage().getTargetLanguage().equalsIgnoreCase("en_US") ? PrimarySkillType.getSkill(skillName) != null : isLocalizedSkill(skillName);
return pluginRef.getConfigManager().getConfigLanguage().getTargetLanguage().equalsIgnoreCase("en_US") ? PrimarySkillType.getSkill(skillName) != null : isLocalizedSkill(skillName);
}
public static void sendSkillMessage(Player player, NotificationType notificationType, String key) {
@@ -142,7 +140,7 @@ public class SkillUtils {
for (Player otherPlayer : player.getWorld().getPlayers()) {
if (otherPlayer != player && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
mcMMO.getNotificationManager().sendNearbyPlayersInformation(otherPlayer, notificationType, key, player.getName());
pluginRef.getNotificationManager().sendNearbyPlayersInformation(otherPlayer, notificationType, key, player.getName());
}
}
}
@@ -258,7 +256,7 @@ public class SkillUtils {
}
Material type = itemStack.getType();
short maxDurability = mcMMO.getRepairableManager().isRepairable(type) ? mcMMO.getRepairableManager().getRepairable(type).getMaximumDurability() : type.getMaxDurability();
short maxDurability = pluginRef.getRepairableManager().isRepairable(type) ? pluginRef.getRepairableManager().getRepairable(type).getMaximumDurability() : type.getMaxDurability();
durabilityModifier = (int) Math.min(durabilityModifier / (itemStack.getEnchantmentLevel(Enchantment.DURABILITY) + 1), maxDurability * maxDamageModifier);
itemStack.setDurability((short) Math.min(itemStack.getDurability() + durabilityModifier, maxDurability));
@@ -266,7 +264,7 @@ public class SkillUtils {
private static boolean isLocalizedSkill(String skillName) {
for (PrimarySkillType skill : PrimarySkillType.values()) {
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"))) {
if (skillName.equalsIgnoreCase(pluginRef.getLocaleManager().getString(StringUtils.getCapitalized(skill.toString()) + ".SkillName"))) {
return true;
}
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.util.sounds;
import com.gmail.nossr50.config.hocon.sound.SoundSetting;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import org.bukkit.Location;
import org.bukkit.Sound;
@@ -16,24 +15,24 @@ public class SoundManager {
* @param soundType the type of sound
*/
public static void sendSound(Player player, Location location, SoundType soundType) {
if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
}
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) {
if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
}
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) {
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
}
public static void worldSendSound(World world, Location location, SoundType soundType) {
if (mcMMO.getConfigManager().getConfigSound().isSoundEnabled(soundType))
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
}
@@ -44,8 +43,8 @@ public class SoundManager {
* @return the volume for this soundtype
*/
private static float getVolume(SoundType soundType) {
SoundSetting soundSetting = mcMMO.getConfigManager().getConfigSound().getSoundSetting(soundType);
return soundSetting.getVolume() * (float) mcMMO.getConfigManager().getConfigSound().getMasterVolume();
SoundSetting soundSetting = pluginRef.getConfigManager().getConfigSound().getSoundSetting(soundType);
return soundSetting.getVolume() * (float) pluginRef.getConfigManager().getConfigSound().getMasterVolume();
}
private static float getPitch(SoundType soundType) {
@@ -54,7 +53,7 @@ public class SoundManager {
else if (soundType == SoundType.POP)
return getPopPitch();
else {
SoundSetting soundSetting = mcMMO.getConfigManager().getConfigSound().getSoundSetting(soundType);
SoundSetting soundSetting = pluginRef.getConfigManager().getConfigSound().getSoundSetting(soundType);
return soundSetting.getPitch();
}
}