Debug mode will now dump info about XP perks and how they are modifying

incoming XP gains
This commit is contained in:
nossr50 2019-07-25 21:43:19 -07:00
parent b503cb5d80
commit 9b3091add4
3 changed files with 30 additions and 9 deletions

View File

@ -1,3 +1,7 @@
Version 2.1.99
MASSIVE update to the Russian locale (ru) credit to myfbone
Debug mode (/mmodebug) will now print info about XP perks and how they are modifying your incoming XP
Version 2.1.98
Fixed a bug that prevented Taming XP from combat

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.98</version>
<version>2.1.99-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -3,6 +3,8 @@ package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.entity.Player;
public final class PerksUtils {
@ -44,29 +46,44 @@ public final class PerksUtils {
}
public static float handleXpPerks(Player player, float xp, PrimarySkillType skill) {
double modifier = 1.0F;
double originalXP = xp;
if (Permissions.customXpBoost(player, skill)) {
xp *= ExperienceConfig.getInstance().getCustomXpPerkBoost();
if(UserManager.getPlayer(player).isDebugMode()) {
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.DARK_GRAY + "XP Perk Multiplier IS CUSTOM! ");
}
modifier = ExperienceConfig.getInstance().getCustomXpPerkBoost();
}
else if (Permissions.quadrupleXp(player, skill)) {
xp *= 4;
modifier = 4;
}
else if (Permissions.tripleXp(player, skill)) {
xp *= 3;
modifier = 3;
}
else if (Permissions.doubleAndOneHalfXp(player, skill)) {
xp *= 2.5;
modifier = 2.5;
}
else if (Permissions.doubleXp(player, skill)) {
xp *= 2;
modifier = 2;
}
else if (Permissions.oneAndOneHalfXp(player, skill)) {
xp *= 1.5;
modifier = 1.5;
}
else if (Permissions.oneAndOneTenthXp(player, skill)) {
xp *= 1.1;
modifier = 1.1;
}
return xp;
float modifiedXP = (float) (xp * modifier);
if(UserManager.getPlayer(player).isDebugMode()) {
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP Perk Multiplier - " + ChatColor.GREEN + modifier);
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "Original XP before perk boosts " + ChatColor.DARK_GRAY + originalXP);
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.RED + modifiedXP);
}
return modifiedXP;
}
/**