mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
AbilityDeactivateEvent
This commit is contained in:
parent
f189ab30e5
commit
ad39c94773
@ -144,4 +144,14 @@ public enum SkillType {
|
||||
public Color getRunescapeModeColor() {
|
||||
return runescapeColor;
|
||||
}
|
||||
|
||||
public static SkillType byAbility(AbilityType ability) {
|
||||
for (SkillType type : values()) {
|
||||
if (type.getAbility() == ability) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.gmail.nossr50.events.skills.abilities;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerAbilityDeactivateEvent extends McMMOPlayerSkillEvent {
|
||||
|
||||
private AbilityType ability;
|
||||
|
||||
public McMMOPlayerAbilityDeactivateEvent(Player player, SkillType skill) {
|
||||
super(player, skill);
|
||||
this.ability = skill.getAbility();
|
||||
}
|
||||
|
||||
public AbilityType getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
}
|
@ -7,6 +7,8 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
@ -44,6 +46,9 @@ public class AbilityDisableTask extends BukkitRunnable {
|
||||
break;
|
||||
}
|
||||
|
||||
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, SkillType.byAbility(ability));
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
mcMMOPlayer.setAbilityMode(ability, false);
|
||||
mcMMOPlayer.setAbilityInformed(ability, false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user