forked from Upstream/mmocore
Reverted changes
This commit is contained in:
parent
c4198f264c
commit
7c20dcb8cb
@ -5,7 +5,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class LinearValue {
|
||||
private final double base, perLevel, min, max;
|
||||
private final boolean hasmin, hasmax;
|
||||
private final boolean hasMin, hasMax;
|
||||
|
||||
public static final LinearValue ZERO = new LinearValue(0, 0, 0, 0);
|
||||
|
||||
@ -20,8 +20,8 @@ public class LinearValue {
|
||||
public LinearValue(double base, double perLevel) {
|
||||
this.base = base;
|
||||
this.perLevel = perLevel;
|
||||
hasmin = false;
|
||||
hasmax = false;
|
||||
hasMin = false;
|
||||
hasMax = false;
|
||||
min = 0;
|
||||
max = 0;
|
||||
}
|
||||
@ -39,8 +39,8 @@ public class LinearValue {
|
||||
public LinearValue(double base, double perLevel, double min, double max) {
|
||||
this.base = base;
|
||||
this.perLevel = perLevel;
|
||||
hasmin = true;
|
||||
hasmax = true;
|
||||
hasMin = true;
|
||||
hasMax = true;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
@ -53,8 +53,8 @@ public class LinearValue {
|
||||
public LinearValue(LinearValue value) {
|
||||
base = value.base;
|
||||
perLevel = value.perLevel;
|
||||
hasmin = value.hasmin;
|
||||
hasmax = value.hasmax;
|
||||
hasMin = value.hasMin;
|
||||
hasMax = value.hasMax;
|
||||
min = value.min;
|
||||
max = value.max;
|
||||
}
|
||||
@ -67,10 +67,10 @@ public class LinearValue {
|
||||
public LinearValue(ConfigurationSection config) {
|
||||
base = config.getDouble("base");
|
||||
perLevel = config.getDouble("per-level");
|
||||
hasmin = config.contains("min");
|
||||
hasmax = config.contains("max");
|
||||
min = hasmin ? config.getDouble("min") : 0;
|
||||
max = hasmax ? config.getDouble("max") : 0;
|
||||
hasMin = config.contains("min");
|
||||
hasMax = config.contains("max");
|
||||
min = hasMin ? config.getDouble("min") : 0;
|
||||
max = hasMax ? config.getDouble("max") : 0;
|
||||
}
|
||||
|
||||
public double getBaseValue() {
|
||||
@ -90,11 +90,11 @@ public class LinearValue {
|
||||
}
|
||||
|
||||
public boolean hasMax() {
|
||||
return hasmax;
|
||||
return hasMax;
|
||||
}
|
||||
|
||||
public boolean hasMin() {
|
||||
return hasmin;
|
||||
return hasMin;
|
||||
}
|
||||
|
||||
public String getDisplay(int level) {
|
||||
@ -104,9 +104,9 @@ public class LinearValue {
|
||||
public double calculate(int level) {
|
||||
double value = base + perLevel * (level - 1);
|
||||
|
||||
if (hasmin) value = Math.max(min, value);
|
||||
if (hasMin) value = Math.max(min, value);
|
||||
|
||||
if (hasmax) value = Math.min(max, value);
|
||||
if (hasMax) value = Math.min(max, value);
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -118,8 +118,8 @@ public class LinearValue {
|
||||
", perLevel=" + perLevel +
|
||||
", min=" + min +
|
||||
", max=" + max +
|
||||
", hasmin=" + hasmin +
|
||||
", hasmax=" + hasmax +
|
||||
", hasmin=" + hasMin +
|
||||
", hasmax=" + hasMax +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class PlayerProfessions {
|
||||
if (check) {
|
||||
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(playerData, profession, oldLevel, level));
|
||||
new SmallParticleEffect(playerData.getPlayer(), Particle.SPELL_INSTANT);
|
||||
new ConfigMessage("profession-level-up").addPlaceholders("level", "" + level, "profession", profession.getId(), "profession-name", profession.getName())
|
||||
new ConfigMessage("profession-level-up").addPlaceholders("level", String.valueOf(level), "profession", profession.getName())
|
||||
.send(playerData.getPlayer());
|
||||
MMOCore.plugin.soundManager.getSound(SoundEvent.LEVEL_UP).playTo(playerData.getPlayer());
|
||||
playerData.getStats().updateStats();
|
||||
@ -234,7 +234,7 @@ public class PlayerProfessions {
|
||||
for (int j = 0; j < 20; j++)
|
||||
bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|");
|
||||
if (playerData.isOnline())
|
||||
MMOCore.plugin.configManager.getSimpleMessage("exp-notification", "profession", profession.getId(), "profession-name", profession.getName(), "progress", bar.toString(), "ratio",
|
||||
MMOCore.plugin.configManager.getSimpleMessage("exp-notification", "profession", profession.getName(), "progress", bar.toString(), "ratio",
|
||||
MythicLib.plugin.getMMOConfig().decimal.format((double) exp / needed * 100)).send(playerData.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ import io.lumine.mythic.lib.player.cooldown.CooldownObject;
|
||||
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
||||
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
||||
import io.lumine.mythic.lib.script.condition.Condition;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -101,12 +101,12 @@ public class ClassSkill implements CooldownObject {
|
||||
Map<String, String> placeholders = calculateModifiers(x);
|
||||
placeholders.put("mana_name", data.getProfess().getManaDisplay().getName());
|
||||
placeholders.put("mana_color", data.getProfess().getManaDisplay().getFull().toString());
|
||||
skill.getLore().forEach(str -> list.add(MMOCore.plugin.placeholderParser.parse(data.getPlayer(), applyPlaceholders(placeholders, str))));
|
||||
skill.getLore().forEach(str -> list.add(applyPlaceholders(data.getPlayer(), placeholders, str)));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private String applyPlaceholders(Map<String, String> placeholders, String str) {
|
||||
private String applyPlaceholders(Player player, Map<String, String> placeholders, String str) {
|
||||
String explored = str;
|
||||
while (explored.contains("{") && explored.substring(explored.indexOf("{")).contains("}")) {
|
||||
final int begin = explored.indexOf("{"), end = explored.indexOf("}");
|
||||
@ -118,7 +118,7 @@ public class ClassSkill implements CooldownObject {
|
||||
// Increase counter
|
||||
explored = explored.substring(end + 1);
|
||||
}
|
||||
return str;
|
||||
return MMOCore.plugin.placeholderParser.parse(player, str);
|
||||
}
|
||||
|
||||
private Map<String, String> calculateModifiers(int x) {
|
||||
|
@ -6,8 +6,8 @@ level-up:
|
||||
- '&eUse &6/p &eto see your new statistics!'
|
||||
- ''
|
||||
profession-level-up:
|
||||
- '&eYou are now level &6{level}&e in &6{profession-name}&e!'
|
||||
exp-notification: '%&f{profession-name} &e{progress} &e{ratio}%'
|
||||
- '&eYou are now level &6{level}&e in &6{profession}&e!'
|
||||
exp-notification: '%&f{profession} &e{progress} &e{ratio}%'
|
||||
exp-hologram: '&e+{exp} EXP!'
|
||||
class-select: '&eYou are now a &6{class}&e!'
|
||||
already-on-class: '&cYou are already a {class}.'
|
||||
|
Loading…
Reference in New Issue
Block a user