Add chat toggles for the events we have particle effects for.

This commit is contained in:
GJ 2013-02-19 13:25:59 -05:00
parent 5c76ef312f
commit fd47d77800
3 changed files with 32 additions and 8 deletions

View File

@ -6,12 +6,15 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users;
public class DazeEventHandler {
private ArcheryManager manager;
private McMMOPlayer mcMMOPlayer;
private EntityDamageEvent event;
private Player defender;
@ -21,6 +24,7 @@ public class DazeEventHandler {
protected DazeEventHandler (ArcheryManager manager, EntityDamageEvent event, Player defender) {
this.manager = manager;
this.mcMMOPlayer = manager.getMcMMOPlayer();
this.event = event;
this.defender = defender;
@ -48,7 +52,12 @@ public class DazeEventHandler {
}
protected void sendAbilityMessages() {
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
if (Users.getPlayer(defender).getProfile().useChatNotifications()) {
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
}
if (mcMMOPlayer.getProfile().useChatNotifications()) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
}
}
}

View File

@ -3,18 +3,20 @@ package com.gmail.nossr50.skills.swords;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.runnables.BleedTimer;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.util.Users;
public class BleedEventHandler {
private SwordsManager manager;
private McMMOPlayer mcMMOPlayer;
private int skillLevel;
private LivingEntity defender;
protected int skillModifier;
protected BleedEventHandler(SwordsManager manager, LivingEntity defender) {
this.manager = manager;
this.mcMMOPlayer = manager.getMcMMOPlayer();
this.skillLevel = manager.getSkillLevel();
this.defender = defender;
@ -39,10 +41,16 @@ public class BleedEventHandler {
}
protected void sendAbilityMessages() {
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
if (mcMMOPlayer.getProfile().useChatNotifications()) {
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
}
if (defender instanceof Player) {
((Player) defender).sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
Player defendingPlayer = (Player) defender;
if (Users.getPlayer(defendingPlayer).getProfile().useChatNotifications()) {
defendingPlayer.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Started"));
}
}
}
}

View File

@ -200,7 +200,10 @@ public class SkillTools {
profile.setAbilityMode(ability, false);
profile.setAbilityInformed(ability, false);
player.playEffect(player.getEyeLocation(), Effect.POTION_BREAK, new Potion(PotionType.STRENGTH));
player.sendMessage(ability.getAbilityOff());
if (profile.useChatNotifications()) {
player.sendMessage(ability.getAbilityOff());
}
sendSkillMessage(player, ability.getAbilityPlayerOff(player));
}
@ -392,7 +395,11 @@ public class SkillTools {
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / abilityLengthIncreaseLevel), ability.getMaxTicks());
player.playEffect(player.getEyeLocation(), Effect.POTION_BREAK, new Potion(PotionType.POISON));
player.sendMessage(ability.getAbilityOn());
if (profile.useChatNotifications()) {
player.sendMessage(ability.getAbilityOn());
}
SkillTools.sendSkillMessage(player, ability.getAbilityPlayer(player));
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));