mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Add some tests for com.gmail.nossr50.util.random classes
This commit is contained in:
@ -46,6 +46,6 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
if(isSilent)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getLocalizedName()));
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,6 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
if(isSilent)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getLocalizedName()));
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,6 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
if(isSilent)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getLocalizedName(), value));
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getLocalizedName()));
|
||||
}
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName) {
|
||||
@ -155,7 +155,7 @@ public class SkillresetCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,6 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
skill.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getName())));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getLocalizedName())));
|
||||
}
|
||||
}
|
@ -45,7 +45,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
public SkillCommand(PrimarySkillType skill) {
|
||||
this.skill = skill;
|
||||
skillName = skill.getName();
|
||||
skillName = skill.getLocalizedName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill);
|
||||
}
|
||||
|
||||
@ -173,10 +173,10 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
{
|
||||
if(i+1 < parentList.size())
|
||||
{
|
||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getLocalizedName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
parentMessage.append(ChatColor.GRAY).append(", ");
|
||||
} else {
|
||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getLocalizedName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||
|
||||
public SkillGuideCommand(PrimarySkillType skill) {
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getLocalizedName());
|
||||
guide = getGuide(skill);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
@ -919,7 +919,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
int cap = Config.getInstance().getLevelCap(skill);
|
||||
if (Integer.parseInt(character[index]) > cap) {
|
||||
mcMMO.p.getLogger().warning("Truncating " + skill.getName() + " to configured max level for player " + character[USERNAME]);
|
||||
mcMMO.p.getLogger().warning("Truncating " + skill.getLocalizedName() + " to configured max level for player " + character[USERNAME]);
|
||||
character[index] = cap + "";
|
||||
updated = true;
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import net.kyori.adventure.identity.Identified;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -193,7 +192,7 @@ public class McMMOPlayer implements Identified {
|
||||
if(hasReachedPowerLevelCap()) {
|
||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(Config.getInstance().getPowerLevelCap()));
|
||||
} else if(hasReachedLevelCap(primarySkillType)) {
|
||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill", String.valueOf(Config.getInstance().getLevelCap(primarySkillType)), primarySkillType.getName());
|
||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill", String.valueOf(Config.getInstance().getLevelCap(primarySkillType)), primarySkillType.getLocalizedName());
|
||||
}
|
||||
|
||||
//Updates from Party sources
|
||||
@ -828,7 +827,7 @@ public class McMMOPlayer implements Identified {
|
||||
int diff = RankUtils.getSuperAbilityUnlockRequirement(skill.getAbility()) - getSkillLevel(skill);
|
||||
|
||||
//Inform the player they are not yet skilled enough
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), skill.getName());
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), skill.getLocalizedName());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -984,7 +983,7 @@ public class McMMOPlayer implements Identified {
|
||||
String allCDStr = aSuperAbilityCD + ", " + bSuperAbilityCD;
|
||||
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, "Skills.TooTired.Extra",
|
||||
primarySkillType.getName(),
|
||||
primarySkillType.getLocalizedName(),
|
||||
allCDStr);
|
||||
}
|
||||
|
||||
|
@ -234,10 +234,14 @@ public enum PrimarySkillType {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public String getLocalizedName() {
|
||||
return StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return StringUtils.getCapitalized(StringUtils.getCapitalized(this.toString()));
|
||||
}
|
||||
|
||||
public boolean getPermissions(Player player) {
|
||||
return Permissions.skillEnabled(player, this);
|
||||
}
|
||||
|
@ -937,7 +937,7 @@ public class PlayerListener implements Listener {
|
||||
// Do these ACTUALLY have to be lower case to work properly?
|
||||
for (PrimarySkillType skill : PrimarySkillType.values()) {
|
||||
String skillName = skill.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedName = skill.getName().toLowerCase(Locale.ENGLISH);
|
||||
String localizedName = skill.getLocalizedName().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (lowerCaseCommand.equals(localizedName)) {
|
||||
event.setMessage(message.replace(command, skillName));
|
||||
|
@ -3,18 +3,14 @@ package com.gmail.nossr50.listeners;
|
||||
import com.gmail.nossr50.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.event.world.WorldInitEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class WorldListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
// }
|
||||
|
||||
rank = skills.get(skill);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", skill.getName(), (rank == null ? LocaleLoader.getString("Commands.mcrank.Unranked") : rank)));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Skill", skill.getLocalizedName(), (rank == null ? LocaleLoader.getString("Commands.mcrank.Unranked") : rank)));
|
||||
}
|
||||
|
||||
rank = skills.get(null);
|
||||
|
@ -61,10 +61,10 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
||||
}
|
||||
else {
|
||||
if(sender instanceof Player) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName()));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getLocalizedName()));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName())));
|
||||
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getLocalizedName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,6 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!playerInventory.containsAtLeast(seedStack, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public final class CommandRegistrationManager {
|
||||
private static void registerSkillCommands() {
|
||||
for (PrimarySkillType skill : PrimarySkillType.values()) {
|
||||
String commandName = skill.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedName = skill.getName().toLowerCase(Locale.ENGLISH);
|
||||
String localizedName = skill.getLocalizedName().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
PluginCommand command;
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class ExperienceBarManager {
|
||||
private void informPlayer(@NotNull ExperienceBarManager.@NotNull XPBarSettingTarget settingTarget, @Nullable PrimarySkillType skillType) {
|
||||
//Inform player of setting change
|
||||
if(settingTarget != XPBarSettingTarget.RESET) {
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.XPBar.SettingChanged", skillType.getName(), settingTarget.toString());
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.XPBar.SettingChanged", skillType.getLocalizedName(), settingTarget.toString());
|
||||
} else {
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.XPBar.Reset");
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.gmail.nossr50.util.random;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@ -11,109 +9,92 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RandomChanceSkill implements RandomChanceExecution {
|
||||
|
||||
protected final @NotNull PrimarySkillType primarySkillType;
|
||||
protected final @NotNull SubSkillType subSkillType;
|
||||
protected final double probabilityCap;
|
||||
protected final boolean isLucky;
|
||||
protected int skillLevel;
|
||||
protected double resultModifier;
|
||||
protected final double resultModifier;
|
||||
protected final double maximumBonusLevelCap;
|
||||
|
||||
public RandomChanceSkill(@Nullable Player player, @NotNull SubSkillType subSkillType, double resultModifier) {
|
||||
this.primarySkillType = subSkillType.getParentSkill();
|
||||
this.subSkillType = subSkillType;
|
||||
this.probabilityCap = RandomChanceUtil.LINEAR_CURVE_VAR;
|
||||
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
if (player != null && mcMMOPlayer != null) {
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(primarySkillType);
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(subSkillType.getParentSkill());
|
||||
} else {
|
||||
this.skillLevel = 0;
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
isLucky = Permissions.lucky(player, primarySkillType);
|
||||
isLucky = Permissions.lucky(player, subSkillType.getParentSkill());
|
||||
else
|
||||
isLucky = false;
|
||||
|
||||
this.resultModifier = resultModifier;
|
||||
this.maximumBonusLevelCap = RandomChanceUtil.getMaxBonusLevelCap(subSkillType);
|
||||
}
|
||||
|
||||
public RandomChanceSkill(@Nullable Player player, @NotNull SubSkillType subSkillType) {
|
||||
this.primarySkillType = subSkillType.getParentSkill();
|
||||
this.subSkillType = subSkillType;
|
||||
this.probabilityCap = RandomChanceUtil.LINEAR_CURVE_VAR;
|
||||
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
if (player != null && mcMMOPlayer != null) {
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(primarySkillType);
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(subSkillType.getParentSkill());
|
||||
} else {
|
||||
this.skillLevel = 0;
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
isLucky = Permissions.lucky(player, primarySkillType);
|
||||
isLucky = Permissions.lucky(player, subSkillType.getParentSkill());
|
||||
else
|
||||
isLucky = false;
|
||||
|
||||
this.resultModifier = 1.0D;
|
||||
this.maximumBonusLevelCap = RandomChanceUtil.getMaxBonusLevelCap(subSkillType);
|
||||
}
|
||||
|
||||
public RandomChanceSkill(@Nullable Player player, @NotNull SubSkillType subSkillType, boolean hasCap) {
|
||||
if (hasCap)
|
||||
this.probabilityCap = AdvancedConfig.getInstance().getMaximumProbability(subSkillType);
|
||||
this.probabilityCap = RandomChanceUtil.getMaximumProbability(subSkillType);
|
||||
else
|
||||
this.probabilityCap = RandomChanceUtil.LINEAR_CURVE_VAR;
|
||||
|
||||
this.primarySkillType = subSkillType.getParentSkill();
|
||||
this.subSkillType = subSkillType;
|
||||
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
if (player != null && mcMMOPlayer != null) {
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(primarySkillType);
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(subSkillType.getParentSkill());
|
||||
} else {
|
||||
this.skillLevel = 0;
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
isLucky = Permissions.lucky(player, primarySkillType);
|
||||
isLucky = Permissions.lucky(player, subSkillType.getParentSkill());
|
||||
else
|
||||
isLucky = false;
|
||||
|
||||
this.resultModifier = 1.0D;
|
||||
this.maximumBonusLevelCap = RandomChanceUtil.getMaxBonusLevelCap(subSkillType);
|
||||
}
|
||||
|
||||
public RandomChanceSkill(@Nullable Player player, @NotNull SubSkillType subSkillType, boolean hasCap, double resultModifier) {
|
||||
if (hasCap)
|
||||
this.probabilityCap = AdvancedConfig.getInstance().getMaximumProbability(subSkillType);
|
||||
this.probabilityCap = RandomChanceUtil.getMaximumProbability(subSkillType);
|
||||
else
|
||||
this.probabilityCap = RandomChanceUtil.LINEAR_CURVE_VAR;
|
||||
|
||||
this.primarySkillType = subSkillType.getParentSkill();
|
||||
this.subSkillType = subSkillType;
|
||||
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
if (player != null && mcMMOPlayer != null) {
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(primarySkillType);
|
||||
this.skillLevel = mcMMOPlayer.getSkillLevel(subSkillType.getParentSkill());
|
||||
} else {
|
||||
this.skillLevel = 0;
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
isLucky = Permissions.lucky(player, primarySkillType);
|
||||
isLucky = Permissions.lucky(player, subSkillType.getParentSkill());
|
||||
else
|
||||
isLucky = false;
|
||||
|
||||
this.resultModifier = resultModifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* The subskill corresponding to this RandomChanceSkill
|
||||
*
|
||||
* @return this subskill
|
||||
*/
|
||||
public @NotNull SubSkillType getSubSkill() {
|
||||
return subSkillType;
|
||||
this.maximumBonusLevelCap = RandomChanceUtil.getMaxBonusLevelCap(subSkillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,7 +123,7 @@ public class RandomChanceSkill implements RandomChanceExecution {
|
||||
* @return the maximum bonus from skill level for this skill
|
||||
*/
|
||||
public double getMaximumBonusLevelCap() {
|
||||
return AdvancedConfig.getInstance().getMaxBonusLevel(subSkillType);
|
||||
return maximumBonusLevelCap;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,8 +154,4 @@ public class RandomChanceSkill implements RandomChanceExecution {
|
||||
public double getResultModifier() {
|
||||
return resultModifier;
|
||||
}
|
||||
|
||||
public void setResultModifier(double resultModifier) {
|
||||
this.resultModifier = resultModifier;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.util.random;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillEvent;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillRandomCheckEvent;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
@ -20,6 +19,7 @@ public class RandomChanceUtil {
|
||||
public static final @NotNull DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
//public static final DecimalFormat decimal = new DecimalFormat("##0.00");
|
||||
public static final double LINEAR_CURVE_VAR = 100.0D;
|
||||
public static final double LUCKY_MODIFIER = 1.333D;
|
||||
|
||||
/**
|
||||
* This method is the final step in determining if a Sub-Skill / Secondary Skill in mcMMO successfully activates either from chance or otherwise
|
||||
@ -142,7 +142,7 @@ public class RandomChanceUtil {
|
||||
return chanceOfSuccess;
|
||||
}*/
|
||||
|
||||
private static double calculateChanceOfSuccess(@NotNull RandomChanceSkill randomChance) {
|
||||
public static double calculateChanceOfSuccess(@NotNull RandomChanceSkill randomChance) {
|
||||
double skillLevel = randomChance.getSkillLevel();
|
||||
double maximumProbability = randomChance.getProbabilityCap();
|
||||
double maximumBonusLevel = randomChance.getMaximumBonusLevelCap();
|
||||
@ -163,7 +163,7 @@ public class RandomChanceUtil {
|
||||
return chanceOfSuccess;
|
||||
}
|
||||
|
||||
private static double calculateChanceOfSuccess(@NotNull RandomChanceSkillStatic randomChance) {
|
||||
public static double calculateChanceOfSuccess(@NotNull RandomChanceSkillStatic randomChance) {
|
||||
double chanceOfSuccess = getChanceOfSuccess(randomChance.getXPos(), 100, 100);
|
||||
|
||||
//Add Luck
|
||||
@ -304,15 +304,23 @@ public class RandomChanceUtil {
|
||||
|
||||
public static double addLuck(@NotNull Player player, @NotNull PrimarySkillType primarySkillType, double chance) {
|
||||
if (Permissions.lucky(player, primarySkillType))
|
||||
return chance * 1.333D;
|
||||
return chance * LUCKY_MODIFIER;
|
||||
else
|
||||
return chance;
|
||||
}
|
||||
|
||||
public static double addLuck(boolean isLucky, double chance) {
|
||||
if (isLucky)
|
||||
return chance * 1.333D;
|
||||
return chance * LUCKY_MODIFIER;
|
||||
else
|
||||
return chance;
|
||||
}
|
||||
|
||||
public static double getMaximumProbability(@NotNull SubSkillType subSkillType) {
|
||||
return AdvancedConfig.getInstance().getMaximumProbability(subSkillType);
|
||||
}
|
||||
|
||||
public static double getMaxBonusLevelCap(@NotNull SubSkillType subSkillType) {
|
||||
return AdvancedConfig.getInstance().getMaxBonusLevel(subSkillType);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class ScoreboardManager {
|
||||
int i = 0;
|
||||
for (PrimarySkillType type : PrimarySkillType.values()) {
|
||||
// Include child skills
|
||||
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getName(), false));
|
||||
skillLabelBuilder.put(type, getShortenedName(colors.get(i) + type.getLocalizedName(), false));
|
||||
|
||||
if (type.getAbility() != null) {
|
||||
abilityLabelBuilder.put(type.getAbility(), getShortenedName(colors.get(i) + type.getAbility().getLocalizedName()));
|
||||
@ -115,7 +115,7 @@ public class ScoreboardManager {
|
||||
else {
|
||||
for (PrimarySkillType type : PrimarySkillType.values()) {
|
||||
// Include child skills
|
||||
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getName()));
|
||||
skillLabelBuilder.put(type, getShortenedName(ChatColor.GREEN + type.getLocalizedName()));
|
||||
|
||||
if (type.getAbility() != null) {
|
||||
abilityLabelBuilder.put(type.getAbility(), formatAbility(type.getAbility().getLocalizedName()));
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.events.skills.SkillActivationPerkEvent;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
Reference in New Issue
Block a user