mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Add chat toggles for the events we have particle effects for.
This commit is contained in:
parent
5c76ef312f
commit
fd47d77800
@ -6,12 +6,15 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class DazeEventHandler {
|
public class DazeEventHandler {
|
||||||
private ArcheryManager manager;
|
private ArcheryManager manager;
|
||||||
|
private McMMOPlayer mcMMOPlayer;
|
||||||
private EntityDamageEvent event;
|
private EntityDamageEvent event;
|
||||||
private Player defender;
|
private Player defender;
|
||||||
|
|
||||||
@ -21,6 +24,7 @@ public class DazeEventHandler {
|
|||||||
|
|
||||||
protected DazeEventHandler (ArcheryManager manager, EntityDamageEvent event, Player defender) {
|
protected DazeEventHandler (ArcheryManager manager, EntityDamageEvent event, Player defender) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
this.mcMMOPlayer = manager.getMcMMOPlayer();
|
||||||
this.event = event;
|
this.event = event;
|
||||||
this.defender = defender;
|
this.defender = defender;
|
||||||
|
|
||||||
@ -48,7 +52,12 @@ public class DazeEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendAbilityMessages() {
|
protected void sendAbilityMessages() {
|
||||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
if (Users.getPlayer(defender).getProfile().useChatNotifications()) {
|
||||||
manager.getMcMMOPlayer().getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mcMMOPlayer.getProfile().useChatNotifications()) {
|
||||||
|
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,20 @@ package com.gmail.nossr50.skills.swords;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
import com.gmail.nossr50.skills.runnables.BleedTimer;
|
||||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||||
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class BleedEventHandler {
|
public class BleedEventHandler {
|
||||||
private SwordsManager manager;
|
private McMMOPlayer mcMMOPlayer;
|
||||||
private int skillLevel;
|
private int skillLevel;
|
||||||
private LivingEntity defender;
|
private LivingEntity defender;
|
||||||
protected int skillModifier;
|
protected int skillModifier;
|
||||||
|
|
||||||
protected BleedEventHandler(SwordsManager manager, LivingEntity defender) {
|
protected BleedEventHandler(SwordsManager manager, LivingEntity defender) {
|
||||||
this.manager = manager;
|
this.mcMMOPlayer = manager.getMcMMOPlayer();
|
||||||
this.skillLevel = manager.getSkillLevel();
|
this.skillLevel = manager.getSkillLevel();
|
||||||
this.defender = defender;
|
this.defender = defender;
|
||||||
|
|
||||||
@ -39,10 +41,16 @@ public class BleedEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void sendAbilityMessages() {
|
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) {
|
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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,10 @@ public class SkillTools {
|
|||||||
profile.setAbilityMode(ability, false);
|
profile.setAbilityMode(ability, false);
|
||||||
profile.setAbilityInformed(ability, false);
|
profile.setAbilityInformed(ability, false);
|
||||||
player.playEffect(player.getEyeLocation(), Effect.POTION_BREAK, new Potion(PotionType.STRENGTH));
|
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));
|
sendSkillMessage(player, ability.getAbilityPlayerOff(player));
|
||||||
}
|
}
|
||||||
@ -392,7 +395,11 @@ public class SkillTools {
|
|||||||
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / abilityLengthIncreaseLevel), ability.getMaxTicks());
|
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / abilityLengthIncreaseLevel), ability.getMaxTicks());
|
||||||
|
|
||||||
player.playEffect(player.getEyeLocation(), Effect.POTION_BREAK, new Potion(PotionType.POISON));
|
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));
|
SkillTools.sendSkillMessage(player, ability.getAbilityPlayer(player));
|
||||||
|
|
||||||
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||||
|
Loading…
Reference in New Issue
Block a user