Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into configurable

This commit is contained in:
nossr50 2019-05-29 14:06:55 -07:00
commit b27d46f0cc
20 changed files with 269 additions and 160 deletions

View File

@ -154,6 +154,39 @@ Version 2.2.0
Added API method to check if a skill was being level capped
Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill
Version 2.1.66
Fixed a bug that could happen if a player was removed from the DB when using MySQL/MariaDB when the user was offline
Fixed a minor memory leak for MySQL
Version 2.1.65
Corrected a bug that would cause RetroMode to use Linear formula regardless of setting
Version 2.1.64
Corrected how Standard mode (1-100 scaling) XP to next level was calculated, it is now a true 1:10 ratio with Retro (1-1000) scale, which is how it was intended to be to begin with
Fixed a bug that caused skill messages to spam nearby players
(API) method to get XP in FormulaManager has been renamed to getXPtoNextLevel(...), this shouldn't break anything as plugins should be using our Experience API methods instead of this
(API) Added method getLevel(Player player, PrimarySkillType primarySkillType) to ExperienceAPI.java
NOTE: The net result of this change is it will take a bit longer to level with Standard, but it should not be a drastic change. You might not even notice it.
Standard is meant to take the same amount of time to level from levels 1-100 as it takes Retro to do 1-1000, this change corrects from errors in the code that made Standard actually take less XP than Retro despite intending for it to be a cosmetic difference in progression.
I made a google sheet visualizing the difference between Standard and Retro Mode using default settings and Linear formula - https://docs.google.com/spreadsheets/d/1VlJtvNHlypACHyz_zulEdhgLwFjL01xMPkqlnu0XBSs/edit?usp=sharing
Version 2.1.63
Fixed Armor Impact not scaling by skill rank
Significantly Buffed the amount of durability damage incurred by a successful Armor Impact
Added new setting to advanced.yml 'Skills.Axes.ArmorImpact.DamagePerRank' which is multiplied against Armor Impact's skill level to determine damage done to armor
Fixed a bug that caused creative mode players to gain XP when qualifying for early game XP boosts
Removed the damage cap setting for Armor Impact, it is inherently capped now based on its max rank and damage setting
Updated hu_HU locale (thanks andris155)
Updated ja_JP locale (thanks snake)
NOTES:
Armor Impact only has a 25% chance to go off, and for it to only incur 20 durability damage seemed incredibly underwhelming, I've buffed it quite a bit.
You can change it back to its underwhelming self by setting DamagePerRank to 1.0
Based on feedback I may tweak the number again or other properties of this skill
>>>>>>> ff1bb0deed61cda7daa75a374da3942de9e2e172
Version 2.1.62
Added a new admin notification system, sensitive commands will print chat messages to "admins" (players with either Operator status or admin chat permission)
Added a setting to disable the new admin notifications to config.yml 'General.AdminNotifications' (this will be more configurable in 2.2)

View File

@ -212,7 +212,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.1-R0.1-SNAPSHOT</version>
<version>1.14.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -629,11 +629,28 @@ public final class ExperienceAPI {
* @param skillType The skill to get the level for
* @return the level of a given skill
* @throws InvalidSkillException if the given skill is not valid
* @deprecated Use getLevel(Player player, PrimarySkillType skillType) instead
*/
@Deprecated
public static int getLevel(Player player, String skillType) {
return getPlayer(player).getSkillLevel(getSkillType(skillType));
}
/**
* Get the level a player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param player The player to get the level for
* @param skillType The skill to get the level for
* @return the level of a given skill
*
* @throws InvalidSkillException if the given skill is not valid
*/
public static int getLevel(Player player, PrimarySkillType skillType) {
return getPlayer(player).getSkillLevel(skillType);
}
/**
* Get the level an offline player has in a specific skill.
* </br>
@ -975,7 +992,7 @@ public final class ExperienceAPI {
* @throws InvalidFormulaTypeException if the given formulaType is not valid
*/
public static int getXpNeededToLevel(int level) {
return mcMMO.getFormulaManager().getCachedXpToLevel(level, mcMMO.getConfigManager().getConfigLeveling().getFormulaType());
return mcMMO.getFormulaManager().getXPtoNextLevel(level, mcMMO.getConfigManager().getConfigLeveling().getFormulaType());
}
/**
@ -988,7 +1005,7 @@ public final class ExperienceAPI {
* @throws InvalidFormulaTypeException if the given formulaType is not valid
*/
public static int getXpNeededToLevel(int level, String formulaType) {
return mcMMO.getFormulaManager().getCachedXpToLevel(level, getFormulaType(formulaType));
return mcMMO.getFormulaManager().getXPtoNextLevel(level, getFormulaType(formulaType));
}
/**

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@ -12,6 +13,7 @@ import org.bukkit.util.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class McremoveCommand implements TabExecutor {
@Override
@ -24,7 +26,13 @@ public class McremoveCommand implements TabExecutor {
return true;
}
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
UUID uuid = null;
if(Bukkit.getPlayer(playerName) != null) {
uuid = Bukkit.getPlayer(playerName).getUniqueId();
}
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
} else {
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.

View File

@ -267,22 +267,6 @@ public class AdvancedConfig extends ConfigValidated {
reason.add(SKILLS + "." + AXES + "." + GREATER_IMPACT + "." + BONUS_DAMAGE + " should be at least 1!");
}
if (getArmorImpactIncreaseLevel() < 1) {
reason.add(SKILLS + "." + AXES + "." + ARMOR_IMPACT + "." + INCREASE_LEVEL + " should be at least 1!");
}
if (getImpactChance() < 1) {
reason.add(SKILLS + "." + AXES + "." + ARMOR_IMPACT + "." + CHANCE + " should be at least 1!");
}
if (getArmorImpactMaxDurabilityDamage() < 1) {
reason.add(SKILLS + "." + AXES + "." + ARMOR_IMPACT + "." + MAX_PERCENTAGE_DURABILITY_DAMAGE + " should be at least 1!");
}
if (getSkullSplitterModifier() < 1) {
reason.add(SKILLS + "." + AXES + "." + SKULL_SPLITTER + DAMAGE_MODIFIER + " should be at least 1!");
}
/*if (getFishermanDietRankChange() < 1) {
reason.add(SKILLS + "." + FISHING + ".FishermansDiet.RankChange should be at least 1!");
}*/
@ -657,18 +641,8 @@ public class AdvancedConfig extends ConfigValidated {
return getDoubleValue(SKILLS, AXES, GREATER_IMPACT, BONUS_DAMAGE);
}
public int getArmorImpactIncreaseLevel() {
int increaseLevel = getIntValue(SKILLS, AXES, ARMOR_IMPACT, INCREASE_LEVEL);
if (mcMMO.isRetroModeEnabled())
return increaseLevel * 10;
return increaseLevel;
}
public double getImpactChance() {
return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, CHANCE);
}
public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); }
public double getImpactDurabilityDamageMultiplier() { return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D); }
public double getArmorImpactMaxDurabilityDamage() {
return getDoubleValue(SKILLS, AXES, ARMOR_IMPACT, MAX_PERCENTAGE_DURABILITY_DAMAGE);

View File

@ -20,7 +20,8 @@ public class ConfigSectionSkillLevelCap {
@Setting(value = "Level-Cap",
comment = "Players will be unable to level past this value" +
"\nThe cap is the same for both Retro and Standard, " +
"so a cap of 50 will be the same value in either mode.")
"so a cap of 50 will be the same value in either mode." +
"\nA level cap of 0 or below will result in no level cap.")
private int levelCap = LEVEL_CAP_DEFAULT;
/*
@ -32,6 +33,9 @@ public class ConfigSectionSkillLevelCap {
}
public int getLevelCap() {
if(levelCap <= 0)
return Integer.MAX_VALUE;
return levelCap;
}
}

View File

@ -30,9 +30,17 @@ public interface DatabaseManager {
* Remove a user from the database.
*
* @param playerName The name of the user to remove
* @param uuid player UUID, can be null
* @return true if the user was successfully removed, false otherwise
*/
boolean removeUser(String playerName);
public boolean removeUser(String playerName, UUID uuid);
/**
* Removes any cache used for faster lookups
* Currently only used for SQL
* @param uuid target UUID to cleanup
*/
public void cleanupUser(UUID uuid);
/**
* Save a user to the database.

View File

@ -209,7 +209,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
mcMMO.p.getLogger().info("Purged " + removedPlayers + " users from the database.");
}
public boolean removeUser(String playerName) {
public boolean removeUser(String playerName, UUID uuid) {
//NOTE: UUID is unused for FlatFile for this interface implementation
boolean worked = false;
BufferedReader in = null;
@ -260,6 +261,11 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
return worked;
}
@Override
public void cleanupUser(UUID uuid) {
//Not used in FlatFile
}
public boolean saveUser(PlayerProfile profile) {
String playerName = profile.getPlayerName();
UUID uuid = profile.getUniqueId();

View File

@ -176,7 +176,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
mcMMO.p.getLogger().info("Purged " + purged + " users from the database.");
}
public boolean removeUser(String playerName) {
public boolean removeUser(String playerName, UUID uuid) {
boolean success = false;
Connection connection = null;
PreparedStatement statement = null;
@ -202,12 +202,20 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
if (success) {
if(uuid != null)
cleanupUser(uuid);
Misc.profileCleanup(playerName);
}
return success;
}
public void cleanupUser(UUID uuid) {
if(cachedUserIDs.containsKey(uuid))
cachedUserIDs.remove(uuid);
}
public boolean saveUser(PlayerProfile profile) {
boolean success = true;
PreparedStatement statement = null;

View File

@ -193,7 +193,12 @@ public class Party {
}
public int getXpToLevel() {
<<<<<<< HEAD
return mcMMO.getFormulaManager().getPartyCachedXpToLevel(level);
=======
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
return (mcMMO.getFormulaManager().getXPtoNextLevel(level, formulaType)) * (getOnlineMembers().size() + Config.getInstance().getPartyXpCurveMultiplier());
>>>>>>> ff1bb0deed61cda7daa75a374da3942de9e2e172
}
public String getXpToLevelPercentage() {

View File

@ -56,6 +56,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.Plugin;
import sun.security.krb5.Config;
import java.util.HashMap;
import java.util.Map;
@ -514,6 +515,9 @@ public class McMMOPlayer {
* @param xp Experience amount to process
*/
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if(player.getGameMode() == GameMode.CREATIVE)
return;
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
if (party == null) {
@ -767,8 +771,7 @@ public class McMMOPlayer {
* @return Modified experience
*/
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) {
if (player.getGameMode() == GameMode.CREATIVE
|| ((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType))
if (((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType))
&& mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType))
|| (mcMMO.getPlayerLevelingSettings().getConfigSectionLevelCaps().getPowerLevel().getLevelCap() <= getPowerLevel())) {
return 0;
@ -1016,5 +1019,8 @@ public class McMMOPlayer {
if (inParty()) {
party.removeOnlineMember(thisPlayer);
}
//Remove user from cache
mcMMO.getDatabaseManager().cleanupUser(thisPlayer.getUniqueId());
}
}

View File

@ -392,7 +392,7 @@ public class PlayerProfile {
int level = (mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().isCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType);
FormulaType formulaType = mcMMO.getConfigManager().getConfigLeveling().getFormulaType();
return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType);
return mcMMO.getFormulaManager().getXPtoNextLevel(level, formulaType);
}
private int getChildSkillLevel(PrimarySkillType primarySkillType) {

View File

@ -64,6 +64,12 @@ public enum PrimarySkillType {
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, SuperAbilityType.TREE_FELLER, ToolType.AXE,
ImmutableList.of(SubSkillType.WOODCUTTING_LEAF_BLOWER, SubSkillType.WOODCUTTING_TREE_FELLER, SubSkillType.WOODCUTTING_HARVEST_LUMBER));
private Class<? extends SkillManager> managerClass;
private Color skillColor;
private SuperAbilityType ability;
private ToolType tool;
private List<SubSkillType> subSkillTypes;
public static final List<String> SKILL_NAMES;
public static final List<String> SUBSKILL_NAMES;
public static final List<PrimarySkillType> CHILD_SKILLS;
@ -99,19 +105,13 @@ public enum PrimarySkillType {
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
}
private Class<? extends SkillManager> managerClass;
private Color runescapeColor;
private SuperAbilityType ability;
private ToolType tool;
private List<SubSkillType> subSkillTypes;
PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) {
this(managerClass, runescapeColor, null, null, subSkillTypes);
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color skillColor, List<SubSkillType> subSkillTypes) {
this(managerClass, skillColor, null, null, subSkillTypes);
}
PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) {
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color skillColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) {
this.managerClass = managerClass;
this.runescapeColor = runescapeColor;
this.skillColor = skillColor;
this.ability = ability;
this.tool = tool;
this.subSkillTypes = subSkillTypes;
@ -241,7 +241,7 @@ public enum PrimarySkillType {
}
/* public void celebrateLevelUp(Player player) {
ParticleEffectUtils.fireworkParticleShower(player, runescapeColor);
ParticleEffectUtils.fireworkParticleShower(player, skillColor);
}*/
public boolean shouldProcess(Entity target) {

View File

@ -14,9 +14,7 @@ public class Axes {
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalStrikesPVPModifier();
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalStrikesPVEModifier();
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
//public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
public static double impactMaxDurabilityModifier = AdvancedConfig.getInstance().getArmorImpactMaxDurabilityDamage() / 100D;
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
public static double greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage();
//public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance();

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.skills.axes;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
@ -112,19 +113,19 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by Impact
*/
public void impactCheck(LivingEntity target) {
int durabilityDamage = getImpactDurabilityDamage();
double durabilityDamage = getImpactDurabilityDamage();
for (ItemStack armor : target.getEquipment().getArmorContents()) {
if (armor != null && ItemUtils.isArmor(armor)) {
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer())) {
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
SkillUtils.handleDurabilityChange(armor, durabilityDamage, 1);
}
}
}
}
public int getImpactDurabilityDamage() {
return 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
public double getImpactDurabilityDamage() {
return AdvancedConfig.getInstance().getImpactDurabilityDamageMultiplier() * RankUtils.getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
}
/**

View File

@ -13,20 +13,29 @@ public class FormulaManager {
private static File formulaFile = new File(mcMMO.getFlatFileDirectory() + "formula.yml");
// Experience needed to reach a level, cached values to improve conversion speed
private final Map<Integer, Integer> experienceNeededLinear = new HashMap<>();
private final Map<Integer, Integer> experienceNeededExponential = new HashMap<>();
private Map<Integer, Integer> experienceNeededRetroLinear;
private Map<Integer, Integer> experienceNeededStandardLinear;
private Map<Integer, Integer> experienceNeededRetroExponential;
private Map<Integer, Integer> experienceNeededStandardExponential;
private FormulaType previousFormula;
//Used for XP formula scaling
private boolean retroModeEnabled;
public FormulaManager() {
/* Setting for Classic Mode (Scales a lot of stuff up by * 10) */
retroModeEnabled = mcMMO.isRetroModeEnabled();
initExperienceNeededMaps();
loadFormula();
}
/**
* Initialize maps used for XP to next level
*/
private void initExperienceNeededMaps() {
experienceNeededRetroLinear = new HashMap<>();
experienceNeededRetroExponential = new HashMap<>();
experienceNeededStandardLinear = new HashMap<>();
experienceNeededStandardExponential = new HashMap<>();
}
/**
* Get the formula type that was used before converting
*
@ -58,7 +67,7 @@ public class FormulaManager {
int totalXP = 0;
for (int level = 0; level < skillLevel; level++) {
totalXP += getCachedXpToLevel(level, previousFormula);
totalXP += getXPtoNextLevel(level, previousFormula);
}
totalXP += skillXPLevel;
@ -78,21 +87,10 @@ public class FormulaManager {
public int[] calculateNewLevel(PrimarySkillType primarySkillType, int experience, FormulaType formulaType) {
int newLevel = 0;
int remainder = 0;
int maxLevel = mcMMO.getPlayerLevelingSettings().getLevelCap(primarySkillType);
int maxLevel = mcMMO.getConfigManager().getConfigLeveling().getLevelCap(primarySkillType);
while (experience > 0 && newLevel < Integer.MAX_VALUE) {
//Level Cap
if (mcMMO.getPlayerLevelingSettings().isLevelCapEnabled(primarySkillType)) {
//Break the loop if we're at the cap
if (newLevel + 1 > mcMMO.getPlayerLevelingSettings().getLevelCap(primarySkillType))
break;
//If the maximum level is at or below our starting level, then the player can't level up anymore
if (maxLevel <= mcMMO.getPlayerLevelingSettings().getConfigSectionLevelingGeneral().getStartingLevel())
return new int[]{newLevel, remainder};
}
int experienceToNextLevel = getCachedXpToLevel(newLevel, formulaType);
while (experience > 0 && newLevel < maxLevel) {
int experienceToNextLevel = getXPtoNextLevel(newLevel, formulaType);
if (experience - experienceToNextLevel < 0) {
remainder = experience;
@ -115,75 +113,100 @@ public class FormulaManager {
* @param formulaType The {@link FormulaType} used
* @return amount of experience needed to reach next level
*/
public int getCachedXpToLevel(int level, FormulaType formulaType) {
int experience;
public int getXPtoNextLevel(int level, FormulaType formulaType) {
/**
* Retro mode XP requirements are the default requirements
* Standard mode XP requirements are multiplied by a factor of 10
*/
int xpNeededMultiplier = retroModeEnabled ? 1 : 10;
//TODO: When the heck is Unknown used?
if (formulaType == FormulaType.UNKNOWN) {
formulaType = FormulaType.LINEAR;
}
int base = mcMMO.getConfigManager().getConfigLeveling().getBase(formulaType);
double multiplier = mcMMO.getConfigManager().getConfigLeveling().getMultiplier(formulaType);
double exponent = mcMMO.getConfigManager().getConfigLeveling().getExponentialExponent();
return processXPToNextLevel(level, formulaType);
}
/**
* Gets the value of XP needed for the next level based on the level Scaling, the level, and the formula type
* @param level target level
* @param formulaType target formulaType
*/
private int processXPToNextLevel(int level, FormulaType formulaType) {
if(mcMMO.isRetroModeEnabled())
{
return processXPRetroToNextLevel(level, formulaType);
} else {
return processStandardXPToNextLevel(level, formulaType);
}
}
/**
* Calculate the XP needed for the next level for the linear formula for Standard scaling (1-100)
* @param level target level
* @return raw xp needed to reach the next level
*/
private int processStandardXPToNextLevel(int level, FormulaType formulaType) {
Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededStandardLinear : experienceNeededStandardExponential;
if(!experienceMapRef.containsKey(level)) {
int experienceSum = 0;
int retroIndex = (level * 10) + 1;
//Sum the range of levels in Retro that this Standard level would represent
for(int x = retroIndex; x < (retroIndex + 10); x++) {
//calculateXPNeeded doesn't cache results so we use that instead of invoking the Retro XP methods to avoid memory bloat
experienceSum += calculateXPNeeded(x, formulaType);
}
experienceMapRef.put(level, experienceSum);
}
return experienceMapRef.get(level);
}
/**
* Calculates the XP to next level for Retro Mode scaling
* Results are cached to reduce needless operations
* @param level target level
* @param formulaType target formula type
* @return raw xp needed to reach the next level based on formula type
*/
private int processXPRetroToNextLevel(int level, FormulaType formulaType) {
Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededRetroLinear : experienceNeededRetroExponential;
if (!experienceMapRef.containsKey(level)) {
int experience = calculateXPNeeded(level, formulaType);
experienceMapRef.put(level, experience);
}
return experienceMapRef.get(level);
}
/**
* Does the actual math to get the XP needed for a level in RetroMode scaling
* Standard uses a sum of RetroMode XP needed levels for its own thing, so it uses this too
* @param level target level
* @param formulaType target formulatype
* @return the raw XP needed for the next level based on formula type
*/
private int calculateXPNeeded(int level, FormulaType formulaType) {
int base = mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getBase(formulaType);
double multiplier = mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getMultiplier(formulaType);
switch(formulaType) {
case LINEAR:
if (!experienceNeededLinear.containsKey(level)) {
experience = (int) Math.floor(xpNeededMultiplier * (base + level * multiplier));
experienceNeededLinear.put(level, experience);
}
return experienceNeededLinear.get(level);
return (int) Math.floor(base + level * multiplier);
case EXPONENTIAL:
if (!experienceNeededExponential.containsKey(level)) {
experience = (int) Math.floor(xpNeededMultiplier * (multiplier * Math.pow(level, exponent) + base));
experienceNeededExponential.put(level, experience);
}
return experienceNeededExponential.get(level);
double exponent = mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().getExponentialExponent();
return (int) Math.floor(multiplier * Math.pow(level, exponent) + base);
default:
return 0;
//TODO: Should never be called
mcMMO.p.getLogger().severe("Invalid formula specified for calculation, defaulting to Linear");
return calculateXPNeeded(level, FormulaType.LINEAR);
}
}
/**
* Get the cached amount of experience needed to reach the next party level,
* if cache doesn't contain the given value it is calculated and added
* to the cached data.
* <p>
* Parties use the exponential leveling formula
*
* @param level level to check
* @return amount of experience needed to reach next level
*/
public int getPartyCachedXpToLevel(int level) {
int experience;
/**
* Retro mode XP requirements are the default requirements
* Standard mode XP requirements are multiplied by a factor of 10
*/
int base = mcMMO.getConfigManager().getConfigLeveling().getBase(FormulaType.EXPONENTIAL);
double multiplier = mcMMO.getConfigManager().getConfigLeveling().getMultiplier(FormulaType.EXPONENTIAL);
double exponent = mcMMO.getConfigManager().getConfigLeveling().getExponentialExponent();
if (!experienceNeededExponential.containsKey(level)) {
experience = (int) Math.floor((multiplier * Math.pow(level, exponent) + base));
experience *= mcMMO.getConfigManager().getConfigParty().getPartyXP().getPartyLevel().getPartyXpCurveMultiplier();
experienceNeededExponential.put(level, experience);
}
return experienceNeededExponential.get(level);
}
/**
* Load formula file.
*/
@ -206,7 +229,8 @@ public class FormulaManager {
try {
formulasFile.save(formulaFile);
} catch (Exception e) {
}
catch (Exception e) {
e.printStackTrace();
}
}

View File

@ -53,19 +53,14 @@ public class NotificationManager {
* Sends players notifications from mcMMO
* This does this by sending out an event so other plugins can cancel it
* This event in particular is provided with a source player, and players near the source player are sent the information
*
* @param source the source player for this event
* @param targetPlayer the recipient player for this message
* @param notificationType type of notification
* @param key Locale Key for the string to use with this event
* @param values values to be injected into the locale string
*/
public static void sendNearbyPlayersInformation(Player source, NotificationType notificationType, String key, String... values) {
Location location = source.getLocation();
for (Player otherPlayer : source.getWorld().getPlayers()) {
if (otherPlayer != source && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
sendPlayerInformation(otherPlayer, notificationType, key, values);
}
}
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
{
sendPlayerInformation(targetPlayer, notificationType, key, values);
}
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values) {

View File

@ -116,7 +116,7 @@ public class SkillUtils {
for (Player otherPlayer : player.getWorld().getPlayers()) {
if (otherPlayer != player && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
NotificationManager.sendNearbyPlayersInformation(player, notificationType, key, player.getName());
NotificationManager.sendNearbyPlayersInformation(otherPlayer, notificationType, key, player.getName());
}
}
}
@ -225,7 +225,7 @@ public class SkillUtils {
* @param durabilityModifier the amount to modify the durability by
* @param maxDamageModifier the amount to adjust the max damage by
*/
public static void handleDurabilityChange(ItemStack itemStack, int durabilityModifier, double maxDamageModifier) {
public static void handleDurabilityChange(ItemStack itemStack, double durabilityModifier, double maxDamageModifier) {
if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
return;
}

View File

@ -180,12 +180,12 @@ Skills:
KnockbackModifier: 1.5
BonusDamage: 2.0
ArmorImpact:
# Multiplied against the skill rank to determine how much damage to do
DamagePerRank: 6.5
# IncreaseLevel: Every <IncreaseLevel> the durability damage goes up with 1
# Chance: Chance of hitting with ArmorImpact
# MaxPercentageDurabilityDamage: Durability damage cap for ArmorImpact, 20% means that you can never destroy a piece of armor in less than 5 hits
IncreaseLevel: 5
Chance: 25.0
MaxPercentageDurabilityDamage: 20.0
SkullSplitter:
# DamageModifier: Damage will get divided by this modifier
DamageModifier: 2.0

View File

@ -1,4 +1,5 @@
#I'm going to try to normalize our locale file, forgive the mess for now.
#DO NOT USE COLOR CODES IN THE JSON KEYS
#COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM
JSON.Rank=Szint
@ -46,13 +47,17 @@ JSON.Hover.SuperAbility=[[DARK_PURPLE]]{0}&r
JSON.Hover.MaxRankSkillName=[[GOLD]]{0}&r
JSON.Hover.AtSymbolSkills=[[YELLOW]]@
JSON.Hover.AtSymbolURL=[[YELLOW]]@
#This is the message sent to players when an ability is activated
JSON.Notification.SuperAbility={0}
#These are the JSON Strings used for SubSkills
JSON.Acrobatics.Roll.Interaction.Activated=Teszt [[RED]]Gurul\u00E1s Teszt
JSON.Acrobatics.SubSkill.Roll.Details.Tips=Ha guggolsz es\u00E9s k\u00F6zben megakad\u00E1lyozhatod, hogy k\u00E9tszer annyi k\u00E1rt szenvedj, amit \u00E1ltal\u00E1ban!
#DO NOT USE COLOR CODES IN THE JSON KEYS
#COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM
# BEGIN STYLING
Ability.Generic.Refresh=[[GREEN]]**K\u00C9PESS\u00C9GEK FRISS\u00CDTVE!**
Ability.Generic.Template.Lock=[[GRAY]]{0}
@ -118,6 +123,7 @@ XPBar.Complex.Template={0} [[DARK_AQUA]] {4}[[WHITE]]% [[DARK_AQUA]]([[WHITE]]{1
# XP BAR Allows for the following variables -- {0} = Skill Level, {1} Current XP, {2} XP Needed for next level, {3} Power Level, {4} Percentage of Level
# Make sure you turn on Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained if you want the XP bar title to update every time a player gains XP!
# END STYLING
#ACROBATICS
Acrobatics.Ability.Proc=[[GREEN]]**Kecses Landol\u00E1s**
Acrobatics.Combat.Proc=[[GREEN]]**Kit\u00E9r\u00EDtve**
@ -149,6 +155,8 @@ Alchemy.Listener=Alk\u00EDmia:
Alchemy.Ability.Locked.0=LEZ\u00C1RVA {0}+ K\u00C9PESS\u00C9G SZINTIG (KATAL\u00CDZIS)
Alchemy.SkillName=ALK\u00CDMIA
#ARCHERY
Archery.SubSkill.SkillShot.Name=L\u00F6v\u00E9s K\u00E9pess\u00E9g
Archery.SubSkill.SkillShot.Description=N\u00F6veli az \u00EDjakkal okozott sebz\u00E9st
Archery.SubSkill.SkillShot.Stat=K\u00E9pess\u00E9gi L\u00F6v\u00E9s B\u00F3nusz Sebz\u00E9s
@ -215,10 +223,10 @@ Excavation.Skills.GigaDrillBreaker.Refresh=[[GREEN]]A [[YELLOW]]Giga F\u00FAr\u0
Excavation.Skills.GigaDrillBreaker.Other.Off=Giga F\u00FAr\u00F3-T\u00F6r\u0151[[GREEN]] kikapcsolva: [[YELLOW]]{0}
Excavation.Skills.GigaDrillBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] haszn\u00E1lta a [[RED]]Giga F\u00FAr\u00F3-T\u00F6r\u0151 [[DARK_GREEN]]k\u00E9pess\u00E9get!
#FISHING
Fishing.Scarcity=[[YELLOW]]&oEz a ter\u00FClet t\u00FAlhal\u00E1szott. Pr\u00F3b\u00E1lj meg \u00FAj ter\u00FCleten hal\u00E1szni.
Fishing.ScarcityTip=[[YELLOW]]&oEz a ter\u00FClet t\u00FAlhal\u00E1szott. Horg\u00E1ssz egy m\u00E1sik helyen, ha t\u00F6bb halat szeretn\u00E9l. Legal\u00E1bb {0} blokknyira.
Fishing.Scared=[[GRAY]]&oA Zavaros mozg\u00E1sok megijesztik a halakat!
Fishing.Exhausting=[[RED]]&oA horg\u00E1szbot helytelen haszn\u00E1lata f\u00E1radts\u00E1got okoz, \u00E9s elhaszn\u00E1l\u00F3dik a r\u00FAd!
Fishing.LowResources=[[GRAY]]\u00DAgy \u00E9rzem nem sok hal maradt ezen a ter\u00FCleten.
Fishing.LowResourcesTip=[[GRAY]]\u00DAgy \u00E9rzem nem sok hal maradt ezen a ter\u00FCleten. Pr\u00F3b\u00E1lj meg horg\u00E1szni legal\u00E1bb {0} blokknyira.
Fishing.Ability.Info=M\u00E1gikus Vad\u00E1sz: [[GRAY]] **A Kincsvad\u00E1sz Szinttel Egy\u00FCtt Fejl\u0151dik**
Fishing.Ability.Locked.0=LEZ\u00C1RVA {0}+ K\u00C9PESS\u00C9G SZINTIG (R\u00C1Z\u00C1S)
Fishing.Ability.Locked.1=LEZ\u00C1RVA {0}+ K\u00C9PESS\u00C9G SZINTIG (J\u00C9G HORG\u00C1SZAT)
@ -305,6 +313,7 @@ Mining.SubSkill.BiggerBombs.Description=N\u00F6veli a TNT-k robban\u00E1si erej\
Mining.SubSkill.DemolitionsExpertise.Name=Rombol\u00E1si Tud\u00E1s
Mining.SubSkill.DemolitionsExpertise.Description=Cs\u00F6kkentik a TNT-k \u00E1ltal okozott robbant\u00E1sok sebz\u00E9s\u00E9t
Mining.SubSkill.DemolitionsExpertise.Stat=Rombol\u00E1si Tud\u00E1s Sebz\u00E9s Cs\u00F6kkent\u00E9se
Mining.Listener=B\u00E1ny\u00E1szat:
Mining.SkillName=B\u00C1NY\u00C1SZAT
Mining.Skills.SuperBreaker.Off=**Szuper T\u00F6r\u00E9s v\u00E9get \u00E9rt**
@ -386,7 +395,7 @@ Anvil.Unbreakable=Ez a t\u00E1rgy t\u00F6rhetetlen!
#SWORDS
Swords.Ability.Lower=[[GRAY]]Leengeded a kardod.
Swords.Ability.Ready=[[GOLD]]El\u0151k\u00E9sz\u00EDted[[DARK_AQUA]] a kardod.
Swords.Combat.Bleed.Note=[[GRAY]]Megj.: [[YELLOW]]1 Tick t\u00F6rt\u00E9nik minden 0,5 m\u00E1sodpercenk\u00E9nt
Swords.Combat.Rupture.Note=[[GRAY]]MEGJ.: [[YELLOW]]1 Tick t\u00F6rt\u00E9nik minden 0,5 m\u00E1sodpercenk\u00E9nt
Swords.Combat.Bleeding.Started=[[DARK_RED]] V\u00E9rzel!
Swords.Combat.Bleeding.Stopped=[[GRAY]]A v\u00E9rz\u00E9s [[GREEN]]el\u00E1llt[[GRAY]]!
Swords.Combat.Bleeding=[[GREEN]]**AZ ELLENS\u00C9G V\u00C9RZIK**
@ -531,6 +540,7 @@ Woodcutting.Skills.TreeFeller.Other.On=[[GREEN]]{0}[[DARK_GREEN]] haszn\u00E1lta
Woodcutting.Skills.TreeFeller.Splinter=A BALT\u00C1D TUCATNYI DARABOKRA ESIK SZ\u00C9T!
Woodcutting.Skills.TreeFeller.Threshold=Ez a fa t\u00FAl nagy!
#ABILITIY
#COMBAT
Combat.ArrowDeflect=[[WHITE]]**NY\u00CDL ELH\u00C1R\u00CDTVA**
Combat.BeastLore=[[GREEN]]**VAD\u00C1LLAT TAN**
@ -816,7 +826,19 @@ Commands.Event.Stop.Subtitle=[[GREEN]]Rem\u00E9lem j\u00F3l \u00E9rezted magad!
Commands.Event.XP=[[DARK_AQUA]]Az XP szorz\u00F3 [[GOLD]]{0}[[DARK_AQUA]]x!
Commands.xprate.started.0=[[GOLD]]mcMMO XP szorz\u00F3 esem\u00E9ny kezd\u0151d\u00F6tt!
Commands.xprate.started.1=[[GOLD]]mcMMO XP Ar\u00E1nya most: {0}x!
XPRate.Event=[[GOLD]]mcMMO XP szorz\u00F3 esem\u00E9ny! XP ar\u00E1nya {0}x!
# Admin Notifications
Server.ConsoleName=[[YELLOW]][Szerver]
Notifications.Admin.XPRate.Start.Self=[[GRAY]]Be\u00E1ll\u00EDtottad a glob\u00E1lis XP szorz\u00F3t erre [[GOLD]]{0}x
Notifications.Admin.XPRate.End.Self=[[GRAY]]Megszak\u00EDtottad az XP szorz\u00F3 eventet.
Notifications.Admin.XPRate.End.Others={0} [[GRAY]]megszak\u00EDtotta az XP szorz\u00F3 eventet.
Notifications.Admin.XPRate.Start.Others={0} [[GRAY]]elind\u00EDtotta vagy m\u00F3dos\u00EDtotta az XP szorz\u00F3 eventet glob\u00E1lis {1}x szorz\u00F3val
Notifications.Admin.Format.Others=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin[[GOLD]]) [[GRAY]]{0}
Notifications.Admin.Format.Self=[[GOLD]]([[GREEN]]mcMMO[[GOLD]]) [[GRAY]]{0}
# Event
XPRate.Event= [[GOLD]]mcMMO XP szorz\u00F3 event! Az XP ar\u00E1nya {0}x!
#GUIDES
Guides.Available=[[GRAY]]A {0} seg\u00EDts\u00E9g el\u00E9rhet\u0151 - haszn\u00E1lat: /{1} ? [oldal]
Guides.Header=[[GOLD]]-=[[GREEN]]{0} Seg\u00EDts\u00E9g[[GOLD]]=-
@ -944,7 +966,7 @@ Skills.Child=[[GOLD]](ALK\u00C9PESS\u00C9G)
Skills.Disarmed=[[DARK_RED]]Lefegyvereztek!
Skills.Header=-----[] [[GREEN]]{0}[[RED]] []-----
Skills.NeedMore=[[DARK_RED]]T\u00F6bb[[GRAY]]{0}-ra/re van sz\u00FCks\u00E9ged
Skills.NeedMore=[[DARK_RED]]T\u00F6bb[[GRAY]]{0}{1}-ra/re van sz\u00FCks\u00E9ged
Skills.NeedMore.Extra=[[DARK_RED]]T\u00F6bb[[GRAY]]{0}{1}-ra/re van sz\u00FCks\u00E9ged
Skills.Parents= ANYAK\u00C9PESS\u00C9G
Skills.Stats={0}[[GREEN]]{1}[[DARK_AQUA]] XP([[GRAY]]{2}[[DARK_AQUA]]/[[GRAY]]{3}[[DARK_AQUA]])
Skills.ChildStats={0}[[GREEN]]{1}
@ -1059,8 +1081,8 @@ Scoreboard.Misc.Ability=K\u00E9pess\u00E9g
#DATABASE RECOVERY
Profile.PendingLoad=[[RED]]Az mcMMO j\u00E1t\u00E9kos adatod m\u00E9g nincs bet\u00F6ltve.
Profile.Loading.Success=[[GREEN]]mcMMO profil sikeresen bet\u00F6ltve.
Profile.Loading.Failure=[[RED]]Az mcMMO nem tudja bet\u00F6lteni az adataidat. Besz\u00E9lj a [[AQUA]]szerver tulajdonossal.\n[[YELLOW]]\u00CDgy is tudsz j\u00E1tszani a szerveren, [[BOLD]]de nem lesz mcMMO szinted[[YELLOW]] \u00E9s ami XP-t szerzel [[BOLD]]mentetlen\u00FCl marad[[YELLOW]].
Profile.Loading.AdminFailureNotice=[[DARK_RED]][A][[RED]]Az mcMMO nem tudta bet\u00F6lteni [[YELLOW]]{0}[[RED]] adatait. [[LIGHT_PURPLE]]K\u00E9rlek n\u00E9zd \u00E1t az adatb\u00E1zisod.
Profile.Loading.FailurePlayer=[[RED]]Az mcMMO-nak probl\u00E9m\u00E1i vannak az adataid bet\u00F6lt\u00E9sekor, megpr\u00F3b\u00E1ltuk bet\u00F6lteni [[GREEN]]{0}[[RED]]x.[[LIGHT_GRAY]] Ezzel kapcsolatban \u00E9rdemes kapcsolatba l\u00E9pni a szerver adminisztr\u00E1torokkal. Az mcMMO megpr\u00F3b\u00E1lja bet\u00F6lteni az adatait mindaddig, am\u00EDg nem kapcsol\u00F3dsz le. Nem kapsz XP-t, \u00E9s nem tudod haszn\u00E1lni a k\u00E9pess\u00E9geket, am\u00EDg az adataid nem t\u00F6lt\u0151dnek be.
Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] az mcMMO nem tudta bet\u00F6lteni ennek a j\u00E1t\u00E9kosnak az adatait [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]K\u00E9rj\u00FCk, ellen\u0151rizd az adatb\u00E1zis be\u00E1ll\u00EDt\u00E1sait. Eddig tett k\u00EDs\u00E9rletek {1}.
#Holiday
Holiday.AprilFools.Levelup=[[GOLD]]{0} jelenlegi szint [[GREEN]]{1}[[GOLD]]!
Holiday.Anniversary=[[BLUE]]Boldog {0}. \u00C9vfordul\u00F3t!\n[[BLUE]]nossr50, \u00E9s az \u00F6sszes fejleszt\u0151 tisztelet\u00E9re itt egy t\u0171zij\u00E1t\u00E9k show!