mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
SecondaryAbilityEvent now implements Cancellable
Fire SecondaryAbilityEvent for abilities with static chances Also cleanup some of the event handling for Armor Impact, Greater Impact and Fast Food
This commit is contained in:
@ -1,18 +1,20 @@
|
||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent {
|
||||
|
||||
public class SecondaryAbilityEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private SecondaryAbility secondaryAbility;
|
||||
private boolean cancelled;
|
||||
|
||||
public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
|
||||
super(player, SkillType.bySecondaryAbility(secondaryAbility));
|
||||
this.secondaryAbility = secondaryAbility;
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -22,4 +24,12 @@ public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent {
|
||||
public SecondaryAbility getSecondaryAbility() {
|
||||
return secondaryAbility;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean newValue) {
|
||||
this.cancelled = newValue;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
|
||||
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
|
||||
|
||||
private double chance;
|
||||
|
||||
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, double chance) {
|
||||
|
Reference in New Issue
Block a user