From 6570294900fed58510a142b5a9e5933551160a25 Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 9 Oct 2019 16:25:05 +0200 Subject: [PATCH] Changed MM skill placeholder primitive from int to float --- .../Indyuce/mmocore/api/player/PlayerSkillData.java | 10 +++++----- src/main/java/net/Indyuce/mmocore/api/skill/Skill.java | 4 ++-- .../net/Indyuce/mmocore/api/skill/SkillResult.java | 2 +- .../mmocore/comp/mythicmobs/MythicMobsDrops.java | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerSkillData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerSkillData.java index aed8d1a4..4959af66 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerSkillData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerSkillData.java @@ -52,7 +52,7 @@ public class PlayerSkillData { ambers = 0; } - public double getCachedModifier(String name) { + public int getCachedModifier(String name) { return cache.containsKey(name) ? cache.get(name).getValue() : 0; } @@ -63,7 +63,7 @@ public class PlayerSkillData { cacheModifier(mmSkill, "level", cast.getLevel()); } - public void cacheModifier(MythicMobSkill skill, String name, double value) { + public void cacheModifier(MythicMobSkill skill, String name, int value) { cache.put(skill.getInternalName() + "." + name, new CachedModifier(value)); } @@ -75,9 +75,9 @@ public class PlayerSkillData { public class CachedModifier { private final long date = System.currentTimeMillis(); - private final double value; + private final int value; - public CachedModifier(double value) { + public CachedModifier(int value) { this.value = value; } @@ -85,7 +85,7 @@ public class PlayerSkillData { return date + 1000 * 60 < System.currentTimeMillis(); } - public double getValue() { + public int getValue() { return value; } } diff --git a/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java b/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java index 9345114d..2c1494ca 100644 --- a/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java +++ b/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java @@ -190,8 +190,8 @@ public abstract class Skill { modifiers.put(modifier, linear); } - public double getModifier(String modifier, int level) { - return modifiers.get(modifier).calculate(level); + public int getModifier(String modifier, int level) { + return (int) modifiers.get(modifier).calculate(level); } public boolean isUnlocked(PlayerData profess) { diff --git a/src/main/java/net/Indyuce/mmocore/api/skill/SkillResult.java b/src/main/java/net/Indyuce/mmocore/api/skill/SkillResult.java index 8ae895c0..e9746bdd 100644 --- a/src/main/java/net/Indyuce/mmocore/api/skill/SkillResult.java +++ b/src/main/java/net/Indyuce/mmocore/api/skill/SkillResult.java @@ -64,7 +64,7 @@ public class SkillResult { cancelReason = reason; } - public double getModifier(String modifier) { + public int getModifier(String modifier) { return skill.getModifier(modifier, level); } diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java index 56505469..255b4211 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java @@ -47,6 +47,6 @@ public class MythicMobsDrops implements Listener { private void registerPlaceholders() { MythicMobs.inst().getPlaceholderManager().register("mmocore.skill", Placeholder.meta((metadata, arg) -> String.valueOf(PlayerData.get(metadata.getCaster().getEntity().getUniqueId()).getSkillData().getCachedModifier(arg)))); - MythicMobs.inst().getPlaceholderManager().register("mmocore.mana", Placeholder.meta((metadata, arg) -> String.valueOf(PlayerData.get(metadata.getCaster().getEntity().getUniqueId()).getMana()))); + MythicMobs.inst().getPlaceholderManager().register("mmocore.mana", Placeholder.meta((metadata, arg) -> String.valueOf((int) PlayerData.get(metadata.getCaster().getEntity().getUniqueId()).getMana()))); } } \ No newline at end of file