Missed a refactor :P Also, javadoc event

This commit is contained in:
t00thpick1
2013-11-22 12:48:53 -05:00
parent 870987bba7
commit c0dee19cb0
38 changed files with 265 additions and 249 deletions

View File

@ -2,20 +2,24 @@ package com.gmail.nossr50.events.skills.secondaryabilities;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
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 {
private SecondaryAbilityType secondaryAbility;
private SecondaryAbility secondaryAbility;
public SecondaryAbilityEvent(Player player, SecondaryAbilityType secondaryAbility) {
public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
super(player, SkillType.bySecondaryAbility(secondaryAbility));
this.secondaryAbility = secondaryAbility;
}
public SecondaryAbilityType getSecondarySkillAbility() {
/**
* Gets the SecondaryAbility involved in the event
* @return the SecondaryAbility
*/
public SecondaryAbility getSecondaryAbility() {
return secondaryAbility;
}
}

View File

@ -1,25 +1,37 @@
package com.gmail.nossr50.events.skills.secondaryabilities;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
private double chance;
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbilityType ability, double chance) {
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, double chance) {
super(player, ability);
this.chance = chance;
}
/**
* Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance
* @return The activation chance of the ability
*/
public double getChance() {
return chance;
}
/**
* Sets the activation chance of the ability [0D-1.0D]
* @param The activation chance of the ability
*/
public void setChance(double chance) {
this.chance = Math.min(1D, chance);
this.chance = chance;
}
/**
* Sets the activation chance of the ability to 100% or 0%
* @param whether it should be successful or not
*/
public void setSuccessful(boolean success) {
this.chance = success ? 1.0D : 0D;
}