mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Copy-pasta code is bad.
This commit is contained in:
@ -33,6 +33,22 @@ public class Misc {
|
||||
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
|
||||
public static final int TIME_CONVERSION_FACTOR = 1000;
|
||||
public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
|
||||
public static final int NORMAL_SKILL_ACTIVATION_CHANCE = 100;
|
||||
public static final int LUCKY_SKILL_ACTIVATION_CHANCE = 75;
|
||||
|
||||
/**
|
||||
* Calculate activation chance for a skill.
|
||||
*
|
||||
* @param isLucky true if the player has the appropriate "lucky" perk, false otherwise
|
||||
* @return the activation chance
|
||||
*/
|
||||
public static int calculateActivationChance(boolean isLucky) {
|
||||
if (isLucky) {
|
||||
return LUCKY_SKILL_ACTIVATION_CHANCE;
|
||||
}
|
||||
|
||||
return NORMAL_SKILL_ACTIVATION_CHANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player has armor.
|
||||
|
@ -3,6 +3,8 @@ package com.gmail.nossr50.util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
|
||||
public class Permissions {
|
||||
public static boolean hasPermission(CommandSender sender, String perm)
|
||||
{
|
||||
@ -75,6 +77,10 @@ public class Permissions {
|
||||
* MCMMO.PERKS.LUCKY*
|
||||
*/
|
||||
|
||||
public static boolean lucky(Player player, SkillType skill) {
|
||||
return hasPermission(player, "mcmmo.perks.lucky." + skill.toString().toLowerCase());
|
||||
}
|
||||
|
||||
public static boolean luckyAcrobatics(Player player) {
|
||||
return hasPermission(player, "mcmmo.perks.lucky.acrobatics");
|
||||
}
|
||||
|
Reference in New Issue
Block a user