mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-31 11:35:28 +02:00
Part 2 of removing bad design patterns
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user