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

@@ -1,15 +1,13 @@
package com.gmail.nossr50.skills.acrobatics;
import com.gmail.nossr50.mcMMO;
public final class Acrobatics {
public static double dodgeDamageModifier;
public static int dodgeXpModifier;
// public static boolean dodgeLightningDisabled;
private Acrobatics() {
dodgeDamageModifier = mcMMO.getConfigManager().getConfigAcrobatics().getDamageReductionDivisor();
dodgeXpModifier = mcMMO.getConfigManager().getConfigExperience().getDodgeXP();
dodgeDamageModifier = pluginRef.getConfigManager().getConfigAcrobatics().getDamageReductionDivisor();
dodgeXpModifier = pluginRef.getConfigManager().getConfigExperience().getDodgeXP();
// dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled();
}

View File

@@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@@ -28,11 +27,11 @@ public class AcrobaticsManager extends SkillManager {
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
super(mcMMOPlayer, PrimarySkillType.ACROBATICS);
rollXPInterval = (1000 * mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getRollXPGainCooldownSeconds());
rollXPInterval = (1000 * pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().getRollXPGainCooldownSeconds());
//Save some memory if exploit prevention is off
if (mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
fallLocationMap = new LimitedSizeList(mcMMO.getConfigManager().getConfigExploitPrevention().getAcrobaticLocationLimit());
if (pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
fallLocationMap = new LimitedSizeList(pluginRef.getConfigManager().getConfigExploitPrevention().getAcrobaticLocationLimit());
}
public boolean hasFallenInLocationBefore(Location location) {
@@ -44,7 +43,7 @@ public class AcrobaticsManager extends SkillManager {
}
public boolean canGainRollXP() {
if (!mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
if (!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
return true;
if (System.currentTimeMillis() >= rollXPCooldown) {
@@ -87,11 +86,11 @@ public class AcrobaticsManager extends SkillManager {
ParticleEffectUtils.playDodgeEffect(player);
if (mcMMOPlayer.useChatNotifications()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Combat.Proc");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Combat.Proc");
}
//Check respawn to prevent abuse
if (!mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
if (!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVP);
else if (SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)
&& mcMMOPlayer.getTeleportATS() < System.currentTimeMillis()) {

View File

@@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.archery;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.meta.TrackedArrowMeta;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.Material;
@@ -27,9 +26,9 @@ public class Archery {
public static void incrementArrowCount(LivingEntity livingEntity) {
if(livingEntity.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
int arrowCount = livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).get(0).asInt();
livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).set(0, new FixedMetadataValue(mcMMO.p, arrowCount + 1));
livingEntity.getMetadata(MetadataConstants.ARROW_TRACKER_METAKEY).set(0, new FixedMetadataValue(pluginRef, arrowCount + 1));
} else {
livingEntity.setMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, new TrackedArrowMeta(mcMMO.p, 1));
livingEntity.setMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, new TrackedArrowMeta(pluginRef, 1));
}
}
@@ -40,18 +39,18 @@ public class Archery {
}
public static double getDamageBonusPercent(Player player) {
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * mcMMO.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
}
public static double getSkillShotDamageCap() {
return mcMMO.getConfigManager().getConfigArchery().getSkillShotDamageCeiling();
return pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageCeiling();
}
public static double getDazeBonusDamage() {
return mcMMO.getConfigManager().getConfigArchery().getDaze().getDazeBonusDamage();
return pluginRef.getConfigManager().getConfigArchery().getDaze().getDazeBonusDamage();
}
public static double getDistanceXpMultiplier() {
return mcMMO.getConfigManager().getConfigExperience().getExperienceArchery().getDistanceMultiplier();
return pluginRef.getConfigManager().getConfigExperience().getExperienceArchery().getDistanceMultiplier();
}
}

View File

@@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@@ -75,7 +74,7 @@ public class ArcheryManager extends SkillManager {
public void processArrowRetrievalActivation(LivingEntity target, Projectile projectile) {
if(projectile.hasMetadata(MetadataConstants.ARROW_TRACKER_METAKEY)) {
Archery.incrementArrowCount(target);
projectile.removeMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, mcMMO.p); //Only 1 entity per projectile
projectile.removeMetadata(MetadataConstants.ARROW_TRACKER_METAKEY, pluginRef); //Only 1 entity per projectile
}
}
@@ -96,12 +95,12 @@ public class ArcheryManager extends SkillManager {
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
if (mcMMO.getNotificationManager().doesPlayerUseNotifications(defender)) {
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Combat.TouchedFuzzy");
if (pluginRef.getNotificationManager().doesPlayerUseNotifications(defender)) {
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Combat.TouchedFuzzy");
}
if (mcMMOPlayer.useChatNotifications()) {
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.TargetDazed");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.TargetDazed");
}
return Archery.getDazeBonusDamage();

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.axes;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.entity.LivingEntity;
@@ -27,6 +26,6 @@ public class Axes {
* @return The axe mastery bonus damage which will be added to their attack
*/
public static double getAxeMasteryBonusDamage(Player player) {
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * mcMMO.getConfigManager().getConfigAxes().getAxeMasteryMultiplier();
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * pluginRef.getConfigManager().getConfigAxes().getAxeMasteryMultiplier();
}
}

View File

@@ -6,7 +6,6 @@ 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.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Permissions;
@@ -88,19 +87,19 @@ public class AxesManager extends SkillManager {
Player player = getPlayer();
if (mcMMOPlayer.useChatNotifications()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CriticalHit");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CriticalHit");
}
if (target instanceof Player) {
Player defender = (Player) target;
if (mcMMO.getNotificationManager().doesPlayerUseNotifications(defender)) {
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck");
if (pluginRef.getNotificationManager().doesPlayerUseNotifications(defender)) {
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck");
}
damage = (damage * mcMMO.getConfigManager().getConfigAxes().getConfigAxesCriticalStrikes().getDamageProperty().getPVPModifier()) - damage;
damage = (damage * pluginRef.getConfigManager().getConfigAxes().getConfigAxesCriticalStrikes().getDamageProperty().getPVPModifier()) - damage;
} else {
damage = (damage * mcMMO.getConfigManager().getConfigAxes().getConfigAxesCriticalStrikes().getDamageProperty().getPVEModifier()) - damage;
damage = (damage * pluginRef.getConfigManager().getConfigAxes().getConfigAxesCriticalStrikes().getDamageProperty().getPVEModifier()) - damage;
}
return damage;
@@ -124,7 +123,7 @@ public class AxesManager extends SkillManager {
}
public double getImpactDurabilityDamage() {
return mcMMO.getConfigManager().getConfigAxes().getConfigAxesImpact().getImpactDurabilityDamageModifier() * RankUtils.getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
return pluginRef.getConfigManager().getConfigAxes().getConfigAxesImpact().getImpactDurabilityDamageModifier() * RankUtils.getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
}
/**
@@ -141,21 +140,21 @@ public class AxesManager extends SkillManager {
Player player = getPlayer();
ParticleEffectUtils.playGreaterImpactEffect(target);
target.setVelocity(player.getLocation().getDirection().normalize().multiply(mcMMO.getConfigManager().getConfigAxes().getGreaterImpactKnockBackModifier()));
target.setVelocity(player.getLocation().getDirection().normalize().multiply(pluginRef.getConfigManager().getConfigAxes().getGreaterImpactKnockBackModifier()));
if (mcMMOPlayer.useChatNotifications()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Proc");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Proc");
}
if (target instanceof Player) {
Player defender = (Player) target;
if (mcMMO.getNotificationManager().doesPlayerUseNotifications(defender)) {
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck");
if (pluginRef.getNotificationManager().doesPlayerUseNotifications(defender)) {
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck");
}
}
return mcMMO.getConfigManager().getConfigAxes().getConfigAxesGreaterImpact().getBonusDamage();
return pluginRef.getConfigManager().getConfigAxes().getConfigAxesGreaterImpact().getBonusDamage();
}
/**
@@ -165,6 +164,6 @@ public class AxesManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event
*/
public void skullSplitterCheck(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / mcMMO.getConfigManager().getConfigAxes().getConfigAxesSkullSplitter().getSkullSplitterDamageDivisor(), modifiers, skill);
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / pluginRef.getConfigManager().getConfigAxes().getConfigAxesSkullSplitter().getSkullSplitterDamageDivisor(), modifiers, skill);
}
}

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.excavation;
import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils;
import org.bukkit.block.BlockState;
@@ -24,7 +23,7 @@ public class Excavation {
}
protected static int getBlockXP(BlockState blockState) {
int xp = mcMMO.getDynamicSettingsManager().getExperienceManager().getExcavationXp(blockState.getType());
int xp = pluginRef.getDynamicSettingsManager().getExperienceManager().getExcavationXp(blockState.getType());
return xp;
}

View File

@@ -5,7 +5,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.treasure.ExcavationTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@@ -100,6 +99,6 @@ public class ExcavationManager extends SkillManager {
excavationBlockCheck(blockState);
excavationBlockCheck(blockState);
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), mcMMO.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage());
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage());
}
}

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.fishing;
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.adapter.BiomeAdapter;
import org.bukkit.Material;
@@ -27,9 +26,9 @@ public final class Fishing {
private Set<Biome> iceFishingBiomes = BiomeAdapter.ICE_BIOMES;
public Fishing() {
overfishLimit = mcMMO.getConfigManager().getConfigExploitPrevention().getOverfishingLimit() + 1;
fishingRodCastCdMilliseconds = mcMMO.getConfigManager().getConfigExploitPrevention().getFishingRodSpamMilliseconds();
boundingBoxSize = mcMMO.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize();
overfishLimit = pluginRef.getConfigManager().getConfigExploitPrevention().getOverfishingLimit() + 1;
fishingRodCastCdMilliseconds = pluginRef.getConfigManager().getConfigExploitPrevention().getFishingRodSpamMilliseconds();
boundingBoxSize = pluginRef.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize();
initFishingXPRewardMap();
}
@@ -45,13 +44,13 @@ public final class Fishing {
*/
private void initFishingXPRewardMap() {
fishingXpRewardMap = new HashMap<>();
HashMap<String, Integer> nameRegisterMap = mcMMO.getConfigManager().getConfigExperience().getFishingXPMap();
HashMap<String, Integer> nameRegisterMap = pluginRef.getConfigManager().getConfigExperience().getFishingXPMap();
for (String qualifiedName : nameRegisterMap.keySet()) {
Material material = Material.matchMaterial(qualifiedName);
if (material == null) {
mcMMO.p.getLogger().info("Unable to match qualified name to item for fishing xp map: " + qualifiedName);
pluginRef.getLogger().info("Unable to match qualified name to item for fishing xp map: " + qualifiedName);
continue;
}

View File

@@ -14,8 +14,6 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
@@ -82,7 +80,7 @@ public class FishingManager extends SkillManager {
getPlayer().updateInventory();
if (lastWarnedExhaust + (1000) < currentTime) {
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Fishing.Exhausting"));
lastWarnedExhaust = currentTime;
SoundManager.sendSound(getPlayer(), getPlayer().getLocation(), SoundType.TIRED);
}
@@ -106,7 +104,7 @@ public class FishingManager extends SkillManager {
boolean hasFished = (currentTime < fishHookSpawnCD);
if (hasFished && (lastWarned + (1000) < currentTime)) {
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Fishing.Scared"));
lastWarned = System.currentTimeMillis();
}
@@ -133,7 +131,7 @@ public class FishingManager extends SkillManager {
fishCaughtCounter = 1;
if (fishCaughtCounter + 1 == overfishLimit) {
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", mcMMO.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize() * 2));
getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Fishing.LowResourcesTip", pluginRef.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize() * 2));
}
//If the new bounding box does not intersect with the old one, then update our bounding box reference
@@ -148,7 +146,7 @@ public class FishingManager extends SkillManager {
if (overFishCount == 2) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.isOp() || Permissions.adminChat(player)) {
player.sendMessage(LocaleLoader.getString("Fishing.OverFishingDetected", getPlayer().getDisplayName()));
player.sendMessage(pluginRef.getLocaleManager().getString("Fishing.OverFishingDetected", getPlayer().getDisplayName()));
}
}
}
@@ -202,7 +200,7 @@ public class FishingManager extends SkillManager {
}
public int getInnerPeaceMultiplier() {
return mcMMO.getConfigManager().getConfigFishing().getVanillaXPMultInnerPeace(RankUtils.getRank(getPlayer(), SubSkillType.FISHING_INNER_PEACE));
return pluginRef.getConfigManager().getConfigFishing().getVanillaXPMultInnerPeace(RankUtils.getRank(getPlayer(), SubSkillType.FISHING_INNER_PEACE));
}
/**
@@ -277,7 +275,7 @@ public class FishingManager extends SkillManager {
Player player = getPlayer();
FishingTreasure treasure = null;
if (mcMMO.getConfigManager().getConfigFishing().isAllowCustomDrops()
if (pluginRef.getConfigManager().getConfigFishing().isAllowCustomDrops()
&& Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
treasure = getFishingTreasure();
}
@@ -311,10 +309,10 @@ public class FishingManager extends SkillManager {
}
if (enchanted) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Fishing.Ability.TH.MagicFound");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Fishing.Ability.TH.MagicFound");
}
if (mcMMO.getConfigManager().getConfigFishing().isAlwaysCatchFish()) {
if (pluginRef.getConfigManager().getConfigFishing().isAlwaysCatchFish()) {
/*Misc.dropItem(player.getEyeLocation(), fishingCatch.getItemStack());*/
Misc.dropItem(fishingCatch.getLocation(), fishingCatch.getItemStack()).setVelocity(fishingCatch.getVelocity());
}
@@ -424,7 +422,7 @@ public class FishingManager extends SkillManager {
Misc.dropItem(target.getLocation(), drop);
CombatUtils.dealDamage(target, Math.min(Math.max(target.getMaxHealth() / 4, 1), 10), EntityDamageEvent.DamageCause.CUSTOM, getPlayer()); // Make it so you can shake a mob no more than 4 times.
applyXpGain(mcMMO.getConfigManager().getConfigExperience().getShakeXP(), XPGainReason.PVE);
applyXpGain(pluginRef.getConfigManager().getConfigExperience().getShakeXP(), XPGainReason.PVE);
}
}
@@ -445,7 +443,7 @@ public class FishingManager extends SkillManager {
}
// Rather than subtracting luck (and causing a minimum 3% chance for every drop), scale by luck.
diceRoll *= (1.0 - luck * mcMMO.getConfigManager().getConfigFishing().getLureLuckModifier() / 100);
diceRoll *= (1.0 - luck * pluginRef.getConfigManager().getConfigFishing().getLureLuckModifier() / 100);
FishingTreasure treasure = null;

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.herbalism;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material;
@@ -60,8 +59,8 @@ public class Herbalism {
int dropAmount = 0;
if (mcMMO.getPlaceStore().isTrue(target))
mcMMO.getPlaceStore().setFalse(target);
if (pluginRef.getPlaceStore().isTrue(target))
pluginRef.getPlaceStore().setFalse(target);
else {
dropAmount++;
@@ -97,13 +96,13 @@ public class Herbalism {
}
} else {
//Check the block itself first
if (!mcMMO.getPlaceStore().isTrue(block)) {
if (!pluginRef.getPlaceStore().isTrue(block)) {
dropAmount++;
if (herbalismManager.checkDoubleDrop(blockState))
bonusDropAmount += bonusAdd;
} else {
mcMMO.getPlaceStore().setFalse(blockState);
pluginRef.getPlaceStore().setFalse(blockState);
}
// Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally
@@ -114,8 +113,8 @@ public class Herbalism {
break;
}
if (mcMMO.getPlaceStore().isTrue(relativeBlock)) {
mcMMO.getPlaceStore().setFalse(relativeBlock);
if (pluginRef.getPlaceStore().isTrue(relativeBlock)) {
pluginRef.getPlaceStore().setFalse(relativeBlock);
} else {
dropAmount++;
@@ -162,10 +161,10 @@ public class Herbalism {
}
private static int addKelpDrops(int dropAmount, Block relativeBlock) {
if (isKelp(relativeBlock) && !mcMMO.getPlaceStore().isTrue(relativeBlock)) {
if (isKelp(relativeBlock) && !pluginRef.getPlaceStore().isTrue(relativeBlock)) {
dropAmount++;
} else {
mcMMO.getPlaceStore().setFalse(relativeBlock);
pluginRef.getPlaceStore().setFalse(relativeBlock);
}
return dropAmount;

View File

@@ -10,7 +10,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.*;
@@ -37,7 +36,7 @@ public class HerbalismManager extends SkillManager {
}
public boolean canBlockCheck() {
return !(mcMMO.getConfigManager().getConfigExploitPrevention().isPreventVehicleAutoFarming() && getPlayer().isInsideVehicle());
return !(pluginRef.getConfigManager().getConfigExploitPrevention().isPreventVehicleAutoFarming() && getPlayer().isInsideVehicle());
}
public boolean canGreenThumbBlock(BlockState blockState) {
@@ -107,7 +106,7 @@ public class HerbalismManager extends SkillManager {
ItemStack seed = new ItemStack(Material.WHEAT_SEEDS);
if (!playerInventory.containsAtLeast(seed, 1)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Herbalism.Ability.GTe.NeedMore");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Herbalism.Ability.GTe.NeedMore");
return false;
}
@@ -126,7 +125,7 @@ public class HerbalismManager extends SkillManager {
boolean oneBlockPlant = isOneBlockPlant(material);
// Prevents placing and immediately breaking blocks for exp
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
if (oneBlockPlant && pluginRef.getPlaceStore().isTrue(blockState)) {
return;
}
@@ -147,7 +146,7 @@ public class HerbalismManager extends SkillManager {
// }
// }
// else {
xp = mcMMO.getDynamicSettingsManager().getExperienceManager().getHerbalismXp(blockState.getType());
xp = pluginRef.getDynamicSettingsManager().getExperienceManager().getHerbalismXp(blockState.getType());
if (!oneBlockPlant) {
//Kelp is actually two blocks mixed together
@@ -173,7 +172,7 @@ public class HerbalismManager extends SkillManager {
}
public boolean isOneBlockPlant(Material material) {
return !mcMMO.getMaterialMapStore().isMultiBlock(material);
return !pluginRef.getMaterialMapStore().isMultiBlock(material);
}
/**
@@ -194,7 +193,7 @@ public class HerbalismManager extends SkillManager {
*/
public boolean processGreenThumbBlocks(BlockState blockState) {
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.HERBALISM_GREEN_THUMB, getPlayer())) {
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.GTh.Fail");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.GTh.Fail");
return false;
}
@@ -233,7 +232,7 @@ public class HerbalismManager extends SkillManager {
}
blockState.setType(Material.AIR);
Misc.dropItem(location, treasure.getDrop());
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Herbalism.HylianLuck");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Herbalism.HylianLuck");
return true;
}
}
@@ -251,12 +250,12 @@ public class HerbalismManager extends SkillManager {
PlayerInventory playerInventory = player.getInventory();
if (!playerInventory.contains(Material.BROWN_MUSHROOM, 1)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(Material.BROWN_MUSHROOM));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(Material.BROWN_MUSHROOM));
return false;
}
if (!playerInventory.contains(Material.RED_MUSHROOM, 1)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(Material.RED_MUSHROOM));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(Material.RED_MUSHROOM));
return false;
}
@@ -265,7 +264,7 @@ public class HerbalismManager extends SkillManager {
player.updateInventory();
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.HERBALISM_SHROOM_THUMB, player)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.ShroomThumb.Fail");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Herbalism.Ability.ShroomThumb.Fail");
return false;
}
@@ -334,13 +333,13 @@ public class HerbalismManager extends SkillManager {
player.updateInventory(); // Needed until replacement available
}
new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
new HerbalismBlockUpdaterTask(blockState).runTaskLater(pluginRef, 0);
}
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
int greenThumbStage = getGreenThumbStage();
blockState.setMetadata(MetadataConstants.GREEN_THUMB_METAKEY, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
blockState.setMetadata(MetadataConstants.GREEN_THUMB_METAKEY, new FixedMetadataValue(pluginRef, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));
Ageable crops = (Ageable) blockState.getBlockData();
switch (blockState.getType()) {

View File

@@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.mining;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.entity.Player;
@@ -15,12 +14,12 @@ public class BlastMining {
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
public static double getBlastRadiusModifier(int rank) {
return mcMMO.getConfigManager().getConfigMining().getBlastMining().getRadius(rank);
return pluginRef.getConfigManager().getConfigMining().getBlastMining().getRadius(rank);
}
public static double getBlastDamageDecrease(int rank) {
return mcMMO.getConfigManager().getConfigMining().getBlastMining().getDamageDecrease(rank);
return pluginRef.getConfigManager().getConfigMining().getBlastMining().getDamageDecrease(rank);
}
@@ -50,7 +49,7 @@ public class BlastMining {
}
// We can make this assumption because we (should) be the only ones using this exact metadata
Player player = mcMMO.p.getServer().getPlayerExact(tnt.getMetadata(MetadataConstants.TNT_TRACKING_METAKEY).get(0).asString());
Player player = pluginRef.getServer().getPlayerExact(tnt.getMetadata(MetadataConstants.TNT_TRACKING_METAKEY).get(0).asString());
if (!player.equals(defender)) {
return false;

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.mining;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc;
import org.bukkit.Material;
@@ -16,7 +15,7 @@ public class Mining {
public Mining() {
//Init detonators
this.detonators = ItemUtils.matchMaterials(mcMMO.getConfigManager().getConfigMining().getDetonators());
this.detonators = ItemUtils.matchMaterials(pluginRef.getConfigManager().getConfigMining().getDetonators());
}
public static Mining getInstance() {
@@ -32,7 +31,7 @@ public class Mining {
* @param blockState The {@link BlockState} to check ability activation for
*/
public static int getBlockXp(BlockState blockState) {
int xp = mcMMO.getDynamicSettingsManager().getExperienceManager().getMiningXp(blockState.getType());
int xp = pluginRef.getDynamicSettingsManager().getExperienceManager().getMiningXp(blockState.getType());
return xp;
}

View File

@@ -7,7 +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.mcMMO;
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.BlockUtils;
@@ -34,15 +33,15 @@ public class MiningManager extends SkillManager {
}
public static double getOreBonus(int rank) {
return mcMMO.getConfigManager().getConfigMining().getBlastMining().getOreBonus(rank);
return pluginRef.getConfigManager().getConfigMining().getBlastMining().getOreBonus(rank);
}
public static double getDebrisReduction(int rank) {
return mcMMO.getConfigManager().getConfigMining().getBlastMining().getDebrisReduction(rank);
return pluginRef.getConfigManager().getConfigMining().getBlastMining().getDebrisReduction(rank);
}
public static int getDropMultiplier(int rank) {
return mcMMO.getConfigManager().getConfigMining().getBlastMining().getDropMultiplier(rank);
return pluginRef.getConfigManager().getConfigMining().getBlastMining().getDropMultiplier(rank);
}
public boolean canUseDemolitionsExpertise() {
@@ -87,15 +86,15 @@ public class MiningManager extends SkillManager {
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);
if (mcMMOPlayer.getAbilityMode(skill.getSuperAbility())) {
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), mcMMO.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage());
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage());
}
if (!canDoubleDrop() || !mcMMO.getDynamicSettingsManager().getBonusDropManager().isBonusDropWhitelisted(blockState.getType()))
if (!canDoubleDrop() || !pluginRef.getDynamicSettingsManager().getBonusDropManager().isBonusDropWhitelisted(blockState.getType()))
return;
boolean silkTouch = player.getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);
if (silkTouch && !mcMMO.getConfigManager().getConfigMining().getMiningSubskills().getDoubleDrops().isAllowSilkTouchDoubleDrops())
if (silkTouch && !pluginRef.getConfigManager().getConfigMining().getMiningSubskills().getDoubleDrops().isAllowSilkTouchDoubleDrops())
return;
//TODO: Make this readable
@@ -119,8 +118,8 @@ public class MiningManager extends SkillManager {
TNTPrimed tnt = player.getWorld().spawn(targetBlock.getLocation(), TNTPrimed.class);
//SkillUtils.sendSkillMessage(player, SuperAbilityType.BLAST_MINING.getAbilityPlayer(player));
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom");
//player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUPER_ABILITY, "Mining.Blast.Boom");
//player.sendMessage(pluginRef.getLocaleManager().getString("Mining.Blast.Boom"));
tnt.setMetadata(MetadataConstants.TNT_TRACKING_METAKEY, mcMMOPlayer.getPlayerMetadata());
tnt.setFuseTicks(0);
@@ -128,7 +127,7 @@ public class MiningManager extends SkillManager {
mcMMOPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
mcMMOPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
new AbilityCooldownTask(mcMMOPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(mcMMO.p, SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
new AbilityCooldownTask(mcMMOPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(pluginRef, SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
}
/**
@@ -160,13 +159,13 @@ public class MiningManager extends SkillManager {
for (BlockState blockState : ores) {
if (Misc.getRandom().nextFloat() < (yield + oreBonus)) {
if (!mcMMO.getPlaceStore().isTrue(blockState)) {
if (!pluginRef.getPlaceStore().isTrue(blockState)) {
xp += Mining.getBlockXp(blockState);
}
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
if (!mcMMO.getPlaceStore().isTrue(blockState)) {
if (!pluginRef.getPlaceStore().isTrue(blockState)) {
for (int i = 1; i < dropMultiplier; i++) {
Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items
}
@@ -257,8 +256,8 @@ public class MiningManager extends SkillManager {
int timeRemaining = mcMMOPlayer.calculateTimeRemaining(SuperAbilityType.BLAST_MINING);
if (timeRemaining > 0) {
//getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
//getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Skills.TooTired", timeRemaining));
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
return false;
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.repair;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;
public class Repair {
@@ -8,7 +7,7 @@ public class Repair {
private Material anvilMaterial;
public Repair() {
anvilMaterial = mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial();
anvilMaterial = pluginRef.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial();
}
public static Repair getInstance() {

View File

@@ -4,8 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@@ -41,11 +39,11 @@ public class RepairManager extends SkillManager {
return;
}
if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilMessages()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Repair.Listener.Anvil");
if (pluginRef.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilMessages()) {
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Repair.Listener.Anvil");
}
if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilPlacedSounds()) {
if (pluginRef.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilPlacedSounds()) {
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
}
@@ -121,7 +119,7 @@ public class RepairManager extends SkillManager {
//
// /* Abort the repair if no compatible basic repairing item found */
// if (repairMaterial == null && foundNonBasicMaterial == true) {
// player.sendMessage(LocaleLoader.getString("Repair.NoBasicRepairMatsFound"));
// player.sendMessage(pluginRef.getLocaleManager().getString("Repair.NoBasicRepairMatsFound"));
// return;
// }
//
@@ -186,7 +184,7 @@ public class RepairManager extends SkillManager {
Player player = getPlayer();
long lastUse = getLastAnvilUse();
if (!SkillUtils.cooldownExpired(lastUse, 3) || !mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isEnchantedItemsRequireConfirm()) {
if (!SkillUtils.cooldownExpired(lastUse, 3) || !pluginRef.getConfigManager().getConfigRepair().getRepairGeneral().isEnchantedItemsRequireConfirm()) {
return true;
}
@@ -195,7 +193,7 @@ public class RepairManager extends SkillManager {
}
actualizeLastAnvilUse();
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Skills.ConfirmOrCancel", LocaleLoader.getString("Repair.Pretty.Name"));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Skills.ConfirmOrCancel", pluginRef.getLocaleManager().getString("Repair.Pretty.Name"));
return false;
}
@@ -215,7 +213,7 @@ public class RepairManager extends SkillManager {
* @return The chance of keeping the enchantment
*/
public double getKeepEnchantChance() {
return mcMMO.getConfigManager().getConfigRepair().getArcaneForging().getKeepEnchantChanceMap().get(getArcaneForgingRank());
return pluginRef.getConfigManager().getConfigRepair().getArcaneForging().getKeepEnchantChanceMap().get(getArcaneForgingRank());
}
/**
@@ -224,7 +222,7 @@ public class RepairManager extends SkillManager {
* @return The chance of the enchantment being downgraded
*/
public double getDowngradeEnchantChance() {
return mcMMO.getConfigManager().getConfigRepair().getArcaneForging().getDowngradeChanceMap().get(getArcaneForgingRank());
return pluginRef.getConfigManager().getConfigRepair().getArcaneForging().getDowngradeChanceMap().get(getArcaneForgingRank());
}
/**
@@ -240,8 +238,8 @@ public class RepairManager extends SkillManager {
if (Permissions.isSubSkillEnabled(player, SubSkillType.REPAIR_REPAIR_MASTERY)
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) {
double maxBonusCalc = mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY) / 100.0D;
double skillLevelBonusCalc = (maxBonusCalc / mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY)) * (getSkillLevel() / 100.0D);
double maxBonusCalc = pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY) / 100.0D;
double skillLevelBonusCalc = (maxBonusCalc / pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY)) * (getSkillLevel() / 100.0D);
double bonus = repairAmount * Math.min(skillLevelBonusCalc, maxBonusCalc);
repairAmount += bonus;
@@ -268,7 +266,7 @@ public class RepairManager extends SkillManager {
return false;
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.REPAIR_SUPER_REPAIR, getPlayer())) {
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Skills.FeltEasy");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Skills.FeltEasy");
return true;
}
@@ -290,7 +288,7 @@ public class RepairManager extends SkillManager {
}
if (Permissions.arcaneBypass(player)) {
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Arcane.Perfect");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Arcane.Perfect");
return;
}
@@ -299,7 +297,7 @@ public class RepairManager extends SkillManager {
item.removeEnchantment(enchant);
}
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Repair.Arcane.Lost");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Repair.Arcane.Lost");
return;
}
@@ -308,7 +306,7 @@ public class RepairManager extends SkillManager {
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
int enchantLevel = enchant.getValue();
if(!mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitRepair().isAllowUnsafeEnchants()) {
if(!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitRepair().isAllowUnsafeEnchants()) {
if(enchantLevel > enchant.getKey().getMaxLevel()) {
enchantLevel = enchant.getKey().getMaxLevel();
@@ -320,7 +318,7 @@ public class RepairManager extends SkillManager {
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getKeepEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING))) {
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() && enchantLevel > 1
if (pluginRef.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() && enchantLevel > 1
&& (!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(100 - getDowngradeEnchantChance(), getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING)))) {
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
downgraded = true;
@@ -333,13 +331,13 @@ public class RepairManager extends SkillManager {
Map<Enchantment, Integer> newEnchants = item.getEnchantments();
if (newEnchants.isEmpty()) {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Fail");
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Fail");
}
else if (downgraded || newEnchants.size() < enchants.size()) {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Downgrade");
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Downgrade");
}
else {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Perfect");
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(getPlayer(), "Repair.Arcane.Perfect");
}
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.salvage;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;
public class Salvage {
@@ -10,9 +9,9 @@ public class Salvage {
public static boolean arcaneSalvageEnchantLoss;
public Salvage() {
anvilMaterial = mcMMO.getConfigManager().getConfigSalvage().getGeneral().getSalvageAnvilMaterial();
arcaneSalvageDowngrades = mcMMO.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().isDowngradesEnabled();
arcaneSalvageEnchantLoss = mcMMO.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().isMayLoseEnchants();
anvilMaterial = pluginRef.getConfigManager().getConfigSalvage().getGeneral().getSalvageAnvilMaterial();
arcaneSalvageDowngrades = pluginRef.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().isDowngradesEnabled();
arcaneSalvageEnchantLoss = pluginRef.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().isMayLoseEnchants();
}
protected static int calculateSalvageableAmount(short currentDurability, short maxDurability, int baseAmount) {

View File

@@ -4,8 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
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.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.util.EventUtils;
@@ -46,11 +44,11 @@ public class SalvageManager extends SkillManager {
return;
}
if (mcMMO.getConfigManager().getConfigSalvage().getGeneral().isAnvilMessages()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Listener.Anvil");
if (pluginRef.getConfigManager().getConfigSalvage().getGeneral().isAnvilMessages()) {
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Listener.Anvil");
}
if (mcMMO.getConfigManager().getConfigSalvage().getGeneral().isAnvilPlacedSounds()) {
if (pluginRef.getConfigManager().getConfigSalvage().getGeneral().isAnvilPlacedSounds()) {
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
}
@@ -60,21 +58,21 @@ public class SalvageManager extends SkillManager {
public void handleSalvage(Location location, ItemStack item) {
Player player = getPlayer();
Salvageable salvageable = mcMMO.getSalvageableManager().getSalvageable(item.getType());
Salvageable salvageable = pluginRef.getSalvageableManager().getSalvageable(item.getType());
if (item.getItemMeta().isUnbreakable()) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
return;
}
// Permissions checks on material and item types
if (!Permissions.salvageItemType(player, salvageable.getSalvageItemType())) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return;
}
if (!Permissions.salvageMaterialType(player, salvageable.getSalvageItemMaterialCategory())) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return;
}
@@ -83,14 +81,14 @@ public class SalvageManager extends SkillManager {
// Level check
if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Salvage.Skills.Adept.Level", String.valueOf(RankUtils.getUnlockLevel(SubSkillType.SALVAGE_ARCANE_SALVAGE)), StringUtils.getPrettyItemString(item.getType()));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Salvage.Skills.Adept.Level", String.valueOf(RankUtils.getUnlockLevel(SubSkillType.SALVAGE_ARCANE_SALVAGE)), StringUtils.getPrettyItemString(item.getType()));
return;
}
int potentialSalvageYield = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
if (potentialSalvageYield <= 0) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
return;
}
@@ -122,11 +120,11 @@ public class SalvageManager extends SkillManager {
}
if(lotteryResults == potentialSalvageYield && potentialSalvageYield != 1 && RankUtils.isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Perfect", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Perfect", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
} else if(salvageable.getMaximumQuantity() == 1 || getSalvageLimit() >= salvageable.getMaximumQuantity()) {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Normal", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Normal", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
} else {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Untrained", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Untrained", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
}
ItemStack salvageResults = new ItemStack(salvageable.getSalvagedItemMaterial(), lotteryResults);
@@ -156,11 +154,11 @@ public class SalvageManager extends SkillManager {
Misc.spawnItemTowardsLocation(anvilLoc.clone(), playerLoc.clone(), salvageResults, vectorSpeed);
// BWONG BWONG BWONG - CLUNK!
if (mcMMO.getConfigManager().getConfigSalvage().getGeneral().isAnvilUseSounds()) {
if (pluginRef.getConfigManager().getConfigSalvage().getGeneral().isAnvilUseSounds()) {
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
}
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Skills.Success");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Skills.Success");
}
/*public double getMaxSalvagePercentage() {
@@ -208,18 +206,18 @@ public class SalvageManager extends SkillManager {
if (Permissions.hasSalvageEnchantBypassPerk(getPlayer()))
return 100.0D;
return mcMMO.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().getExtractFullEnchantChance().get(getArcaneSalvageRank());
return pluginRef.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().getExtractFullEnchantChance().get(getArcaneSalvageRank());
}
public double getExtractPartialEnchantChance() {
return mcMMO.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().getExtractPartialEnchantChance().get(getArcaneSalvageRank());
return pluginRef.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().getExtractPartialEnchantChance().get(getArcaneSalvageRank());
}
private ItemStack arcaneSalvageCheck(Map<Enchantment, Integer> enchants) {
Player player = getPlayer();
if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE) || !Permissions.arcaneSalvage(player)) {
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
return null;
}
@@ -233,7 +231,7 @@ public class SalvageManager extends SkillManager {
int enchantLevel = enchant.getValue();
if(!mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitSkills().getConfigSectionExploitSalvage().isAllowUnsafeEnchants()) {
if(!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitSkills().getConfigSectionExploitSalvage().isAllowUnsafeEnchants()) {
if(enchantLevel > enchant.getKey().getMaxLevel()) {
enchantLevel = enchant.getKey().getMaxLevel();
}
@@ -257,11 +255,11 @@ public class SalvageManager extends SkillManager {
if(failedAllEnchants(arcaneFailureCount, enchants.entrySet().size()))
{
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
return null;
} else if(downgraded)
{
mcMMO.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcanePartial");
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcanePartial");
}
book.setItemMeta(enchantMeta);
@@ -282,7 +280,7 @@ public class SalvageManager extends SkillManager {
Player player = getPlayer();
long lastUse = getLastAnvilUse();
if (!SkillUtils.cooldownExpired(lastUse, 3) || !mcMMO.getConfigManager().getConfigSalvage().getGeneral().isEnchantedItemsRequireConfirm()) {
if (!SkillUtils.cooldownExpired(lastUse, 3) || !pluginRef.getConfigManager().getConfigSalvage().getGeneral().isEnchantedItemsRequireConfirm()) {
return true;
}
@@ -292,7 +290,7 @@ public class SalvageManager extends SkillManager {
actualizeLastAnvilUse();
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Skills.ConfirmOrCancel", LocaleLoader.getString("Salvage.Pretty.Name"));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Skills.ConfirmOrCancel", pluginRef.getLocaleManager().getString("Salvage.Pretty.Name"));
return false;
}

View File

@@ -1,10 +1,9 @@
package com.gmail.nossr50.skills.smelting;
import com.gmail.nossr50.mcMMO;
import org.bukkit.inventory.ItemStack;
public class Smelting {
protected static int getResourceXp(ItemStack smelting) {
return mcMMO.getDynamicSettingsManager().getExperienceManager().getFurnaceItemXP(smelting.getType());
return pluginRef.getDynamicSettingsManager().getExperienceManager().getFurnaceItemXP(smelting.getType());
}
}

View File

@@ -6,7 +6,6 @@ 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.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
@@ -69,16 +68,16 @@ public class SwordsManager extends SkillManager {
if (defender.isBlocking())
return;
if (mcMMO.getNotificationManager().doesPlayerUseNotifications(defender)) {
if (pluginRef.getNotificationManager().doesPlayerUseNotifications(defender)) {
if (!BleedTimerTask.isBleeding(defender))
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started");
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started");
}
}
BleedTimerTask.add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand()));
if (mcMMOPlayer.useChatNotifications()) {
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding");
}
}
}
@@ -106,7 +105,7 @@ public class SwordsManager extends SkillManager {
}
public int getRuptureBleedTicks() {
int bleedTicks = mcMMO.getConfigManager().getConfigSwords().getRuptureBaseTicks() * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
int bleedTicks = pluginRef.getConfigManager().getConfigSwords().getRuptureBaseTicks() * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
/*if (bleedTicks > AdvancedConfig.getInstance().getRuptureMaxTicks())
bleedTicks = AdvancedConfig.getInstance().getRuptureMaxTicks();*/
@@ -122,12 +121,12 @@ public class SwordsManager extends SkillManager {
*/
public void counterAttackChecks(LivingEntity attacker, double damage) {
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_COUNTER_ATTACK, getPlayer())) {
CombatUtils.dealDamage(attacker, damage / mcMMO.getConfigManager().getConfigSwords().getCounterAttackDamageModifier(), getPlayer());
CombatUtils.dealDamage(attacker, damage / pluginRef.getConfigManager().getConfigSwords().getCounterAttackDamageModifier(), getPlayer());
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Countered");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Countered");
if (attacker instanceof Player) {
mcMMO.getNotificationManager().sendPlayerInformation((Player) attacker, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Counter.Hit");
pluginRef.getNotificationManager().sendPlayerInformation((Player) attacker, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Counter.Hit");
}
}
}
@@ -139,6 +138,6 @@ public class SwordsManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event
*/
public void serratedStrikes(LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / mcMMO.getConfigManager().getConfigSwords().getSerratedStrikesDamageModifier(), modifiers, skill);
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / pluginRef.getConfigManager().getConfigSwords().getSerratedStrikesDamageModifier(), modifiers, skill);
}
}

View File

@@ -9,8 +9,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.fake.FakeEntityTameEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
@@ -105,7 +103,7 @@ public class TamingManager extends SkillManager {
* @param entity The LivingEntity to award XP for
*/
public void awardTamingXP(LivingEntity entity) {
applyXpGain(mcMMO.getDynamicSettingsManager().getExperienceManager().getTamingXp(entity.getType()), XPGainReason.PVE);
applyXpGain(pluginRef.getDynamicSettingsManager().getExperienceManager().getTamingXp(entity.getType()), XPGainReason.PVE);
}
/**
@@ -143,10 +141,10 @@ public class TamingManager extends SkillManager {
BleedTimerTask.add(target, getPlayer(), Taming.getInstance().getGoreBleedTicks(), 1, 2);
if (target instanceof Player) {
mcMMO.getNotificationManager().sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore");
pluginRef.getNotificationManager().sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Combat.StruckByGore");
}
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.Gore");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.Gore");
damage = (damage * Taming.getInstance().getGoreModifier()) - damage;
return damage;
@@ -207,13 +205,13 @@ public class TamingManager extends SkillManager {
Player player = getPlayer();
Tameable beast = (Tameable) target;
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
String message = pluginRef.getLocaleManager().getString("Combat.BeastLore") + " ";
if (beast.isTamed() && beast.getOwner() != null) {
message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", beast.getOwner().getName()) + " ");
message = message.concat(pluginRef.getLocaleManager().getString("Combat.BeastLoreOwner", beast.getOwner().getName()) + " ");
}
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));
message = message.concat(pluginRef.getLocaleManager().getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));
player.sendMessage(message);
}
@@ -225,7 +223,7 @@ public class TamingManager extends SkillManager {
Player owner = getPlayer();
wolf.teleport(owner);
mcMMO.getNotificationManager().sendPlayerInformation(owner, NotificationType.SUBSKILL_MESSAGE, "Taming.Listener.Wolf");
pluginRef.getNotificationManager().sendPlayerInformation(owner, NotificationType.SUBSKILL_MESSAGE, "Taming.Listener.Wolf");
}
public void pummel(LivingEntity target, Wolf wolf) {
@@ -241,8 +239,8 @@ public class TamingManager extends SkillManager {
if (target instanceof Player) {
Player defender = (Player) target;
if (mcMMO.getNotificationManager().doesPlayerUseNotifications(defender)) {
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage");
if (pluginRef.getNotificationManager().doesPlayerUseNotifications(defender)) {
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage");
}
}
}
@@ -287,7 +285,7 @@ public class TamingManager extends SkillManager {
if (heldItemAmount < summonAmount) {
int moreAmount = summonAmount - heldItemAmount;
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.NotEnough", String.valueOf(moreAmount), StringUtils.getPrettyItemString(heldItem.getType()));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.NotEnough", String.valueOf(moreAmount), StringUtils.getPrettyItemString(heldItem.getType()));
return;
}
@@ -307,7 +305,7 @@ public class TamingManager extends SkillManager {
LivingEntity callOfWildEntity = (LivingEntity) player.getWorld().spawnEntity(location, type);
FakeEntityTameEvent event = new FakeEntityTameEvent(callOfWildEntity, player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
pluginRef.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
@@ -345,7 +343,7 @@ public class TamingManager extends SkillManager {
}
if (Permissions.renamePets(player)) {
callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(type)));
callOfWildEntity.setCustomName(pluginRef.getLocaleManager().getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(type)));
}
ParticleEffectUtils.playCallOfTheWildEffect(callOfWildEntity);
@@ -357,10 +355,10 @@ public class TamingManager extends SkillManager {
String lifeSpan = "";
if (tamingCOTWLength > 0) {
lifeSpan = LocaleLoader.getString("Taming.Summon.Lifespan", tamingCOTWLength);
lifeSpan = pluginRef.getLocaleManager().getString("Taming.Summon.Lifespan", tamingCOTWLength);
}
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Taming.Summon.Complete", lifeSpan);
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Taming.Summon.Complete", lifeSpan);
player.playSound(location, Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR, 1F, 0.5F);
}
@@ -374,7 +372,7 @@ public class TamingManager extends SkillManager {
for (Entity entity : player.getNearbyEntities(range, range, range)) {
if (entity.getType() == type) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, Taming.getInstance().getCallOfTheWildFailureMessage(type));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, Taming.getInstance().getCallOfTheWildFailureMessage(type));
return false;
}
}
@@ -395,7 +393,7 @@ public class TamingManager extends SkillManager {
int summonAmount = trackedEntities == null ? 0 : trackedEntities.size();
if (summonAmount >= maxAmountSummons) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Taming.Summon.Fail.TooMany", String.valueOf(maxAmountSummons));
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Taming.Summon.Fail.TooMany", String.valueOf(maxAmountSummons));
return false;
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.taming;
import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@@ -26,7 +25,7 @@ public class TrackedTamingEntity extends BukkitRunnable {
if (tamingCOTWLength > 0) {
this.length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
this.runTaskLater(mcMMO.p, length);
this.runTaskLater(pluginRef, length);
}
}

View File

@@ -7,7 +7,6 @@ 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.datatypes.skills.ToolType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils;
@@ -105,12 +104,12 @@ public class UnarmedManager extends SkillManager {
Item item = Misc.dropItem(defender.getLocation(), defender.getInventory().getItemInMainHand());
if (item != null && mcMMO.getConfigManager().getConfigUnarmed().doesDisarmPreventTheft()) {
if (item != null && pluginRef.getConfigManager().getConfigUnarmed().doesDisarmPreventTheft()) {
item.setMetadata(MetadataConstants.DISARMED_ITEM_METAKEY, UserManager.getPlayer(defender).getPlayerMetadata());
}
defender.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Skills.Disarmed");
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Skills.Disarmed");
}
}
@@ -119,7 +118,7 @@ public class UnarmedManager extends SkillManager {
*/
public boolean deflectCheck() {
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.UNARMED_ARROW_DEFLECT, getPlayer())) {
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.ArrowDeflect");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.ArrowDeflect");
return true;
}
@@ -171,8 +170,8 @@ public class UnarmedManager extends SkillManager {
private boolean hasIronGrip(Player defender) {
if (!Misc.isNPCEntityExcludingVillagers(defender) && Permissions.isSubSkillEnabled(defender, SubSkillType.UNARMED_IRON_GRIP)
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.UNARMED_IRON_GRIP, getPlayer())) {
mcMMO.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Defender");
mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Attacker");
pluginRef.getNotificationManager().sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Defender");
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Unarmed.Ability.IronGrip.Attacker");
return true;
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.woodcutting;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -38,7 +37,7 @@ public final class Woodcutting {
* @return Amount of experience
*/
protected static int getExperienceFromLog(BlockState blockState) {
return mcMMO.getDynamicSettingsManager().getExperienceManager().getWoodcuttingXp(blockState.getType());
return pluginRef.getDynamicSettingsManager().getExperienceManager().getWoodcuttingXp(blockState.getType());
}
/**
@@ -52,17 +51,17 @@ public final class Woodcutting {
* @return Amount of experience
*/
protected static int processTreeFellerXPGains(BlockState blockState, int woodCount) {
int rawXP = mcMMO.getDynamicSettingsManager().getExperienceManager().getWoodcuttingXp(blockState.getType());
int rawXP = pluginRef.getDynamicSettingsManager().getExperienceManager().getWoodcuttingXp(blockState.getType());
if(rawXP <= 0)
return 0;
if(mcMMO.getConfigManager().getConfigExperience().getExperienceWoodcutting().isReduceTreeFellerXP()) {
if(pluginRef.getConfigManager().getConfigExperience().getExperienceWoodcutting().isReduceTreeFellerXP()) {
int reducedXP = 1 + (woodCount * 5);
rawXP = Math.max(1, rawXP - reducedXP);
return rawXP;
} else {
return mcMMO.getDynamicSettingsManager().getExperienceManager().getWoodcuttingXp(blockState.getType());
return pluginRef.getDynamicSettingsManager().getExperienceManager().getWoodcuttingXp(blockState.getType());
}
}
@@ -76,7 +75,7 @@ public final class Woodcutting {
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
}
else {*/
if (mcMMO.getDynamicSettingsManager().getBonusDropManager().isBonusDropWhitelisted(blockState.getType())) {
if (pluginRef.getDynamicSettingsManager().getBonusDropManager().isBonusDropWhitelisted(blockState.getType())) {
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
}
//}
@@ -166,12 +165,12 @@ public final class Woodcutting {
for (BlockState blockState : treeFellerBlocks) {
if (BlockUtils.isLog(blockState)) {
durabilityLoss += mcMMO.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage();
durabilityLoss += pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage();
}
}
SkillUtils.handleDurabilityChange(inHand, durabilityLoss);
return (inHand.getDurability() < (mcMMO.getRepairableManager().isRepairable(type) ? mcMMO.getRepairableManager().getRepairable(type).getMaximumDurability() : type.getMaxDurability()));
return (inHand.getDurability() < (pluginRef.getRepairableManager().isRepairable(type) ? pluginRef.getRepairableManager().getRepairable(type).getMaximumDurability() : type.getMaxDurability()));
}
/**
@@ -187,12 +186,12 @@ public final class Woodcutting {
* in treeFellerBlocks.
*/
private static boolean handleBlock(BlockState blockState, List<BlockState> futureCenterBlocks, Set<BlockState> treeFellerBlocks) {
if (treeFellerBlocks.contains(blockState) || mcMMO.getPlaceStore().isTrue(blockState)) {
if (treeFellerBlocks.contains(blockState) || pluginRef.getPlaceStore().isTrue(blockState)) {
return false;
}
// Without this check Tree Feller propagates through leaves until the threshold is hit
if (treeFellerBlocks.size() > mcMMO.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getTreeFeller().getTreeFellerLimit()) {
if (treeFellerBlocks.size() > pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getTreeFeller().getTreeFellerLimit()) {
treeFellerReachedThreshold = true;
}

View File

@@ -6,7 +6,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.mcMMO;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.random.RandomChanceUtil;
@@ -84,13 +83,13 @@ public class WoodcuttingManager extends SkillManager {
if (Woodcutting.treeFellerReachedThreshold) {
Woodcutting.treeFellerReachedThreshold = false;
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Woodcutting.Skills.TreeFeller.Threshold");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Woodcutting.Skills.TreeFeller.Threshold");
return;
}
// If the tool can't sustain the durability loss
if (!Woodcutting.handleDurabilityLoss(treeFellerBlocks, player.getInventory().getItemInMainHand())) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Woodcutting.Skills.TreeFeller.Splinter");
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Woodcutting.Skills.TreeFeller.Splinter");
double health = player.getHealth();