diff --git a/pom.xml b/pom.xml
index 0ee1f667..7645458a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
net.Indyuce
MMOCore
- 1.5
+ 1.6
MMOCore
Offer your players a brand new RPG experience.
@@ -40,6 +40,7 @@
org.apache.maven.plugins
maven-compiler-plugin
+ 3.8.1
1.8
@@ -57,6 +58,14 @@
net.indyuce.mmocore.shaded.paperlib
+
+
+ *:*
+
+ net/mmogroup/**
+
+
+
@@ -67,32 +76,6 @@
-
- org.codehaus.mojo
- properties-maven-plugin
- 1.0.0
-
-
- initialize
-
- read-project-properties
-
-
-
- ../build.properties
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.3.1
-
- ${jar.path}
-
-
@@ -114,23 +97,6 @@
-
-
-
- net.Indyuce
- mmoitems
- 6.1.2
- system
- ${basedir}/lib/MMOItems.jar
-
-
- net.mmogroup
- MMOLib
- 1.5
- system
- ${basedir}/lib/MMOLib.jar
-
-
org.spigotmc
@@ -140,6 +106,14 @@
${basedir}/lib/spigot.jar
+
+
+ net.Indyuce
+ MMOLib
+ 1.6
+ compile
+
+
org.jetbrains
diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java
index da360c8c..c080bb78 100644
--- a/src/main/java/net/Indyuce/mmocore/MMOCore.java
+++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java
@@ -306,7 +306,7 @@ public class MMOCore extends JavaPlugin {
* that after registering all the professses otherwise the player datas can't
* recognize what profess the player has and professes will be lost
*/
- Bukkit.getOnlinePlayers().forEach(player -> dataProvider.getDataManager().setup(player));
+ Bukkit.getOnlinePlayers().forEach(player -> dataProvider.getDataManager().setup(player.getUniqueId()));
/*
* load guild data after loading player data
diff --git a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java
index 8b3a5e96..faaf5a74 100644
--- a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java
+++ b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java
@@ -21,7 +21,7 @@ public class PlayerActionBar extends BukkitRunnable {
public void reload(ConfigurationSection cfg) {
config = new ActionBarConfig(cfg);
- digit = new DecimalFormat(config.digit, MMOCore.plugin.configManager.formatSymbols);
+ digit = new DecimalFormat(config.digit, MMOLib.plugin.getMMOConfig().formatSymbols);
if(!initialized && config.enabled) {
runTaskTimer(MMOCore.plugin, 0, config.ticks);
diff --git a/src/main/java/net/Indyuce/mmocore/api/droptable/condition/LevelCondition.java b/src/main/java/net/Indyuce/mmocore/api/droptable/condition/LevelCondition.java
index 498007f5..8a5007f2 100644
--- a/src/main/java/net/Indyuce/mmocore/api/droptable/condition/LevelCondition.java
+++ b/src/main/java/net/Indyuce/mmocore/api/droptable/condition/LevelCondition.java
@@ -1,30 +1,29 @@
package net.Indyuce.mmocore.api.droptable.condition;
+import net.Indyuce.mmocore.api.player.PlayerData;
import net.mmogroup.mmolib.api.MMOLineConfig;
-import net.mmogroup.mmolib.api.player.MMOPlayerData;
import org.bukkit.entity.Player;
public class LevelCondition extends Condition {
- private final int amount;
+ private final int amount;
- private final String profession;
+ private final String profession;
- public LevelCondition(MMOLineConfig config) {
- super(config);
+ public LevelCondition(MMOLineConfig config) {
+ super(config);
- config.validate("amount");
+ config.validate("amount");
- amount = config.getInt("amount");
- profession = config.contains("profession") ? config.getString("profession") : null;
- }
+ amount = config.getInt("amount");
+ profession = config.contains("profession") ? config.getString("profession") : null;
+ }
- @Override
- public boolean isMet(ConditionInstance entity) {
- if (entity.getEntity() instanceof Player) {
- int level = (profession != null) ? MMOPlayerData.get((Player) entity.getEntity()).getMMOCore().getCollectionSkills().getLevel(profession)
- : MMOPlayerData.get((Player) entity.getEntity()).getMMOCore().getLevel();
- return level >= amount;
- }
- return false;
- }
+ @Override
+ public boolean isMet(ConditionInstance entity) {
+ if (entity.getEntity() instanceof Player) {
+ int level = (profession != null) ? PlayerData.get(entity.getEntity().getUniqueId()).getCollectionSkills().getLevel(profession) : PlayerData.get(entity.getEntity().getUniqueId()).getLevel();
+ return level >= amount;
+ }
+ return false;
+ }
}
diff --git a/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java
index 4266a42f..cba32727 100644
--- a/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java
+++ b/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java
@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import net.mmogroup.mmolib.MMOLib;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@@ -184,6 +185,6 @@ public class PlayerProfessions {
bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|");
if(playerData.isOnline())
MMOCore.plugin.configManager.getSimpleMessage("exp-notification", "profession", profession.getName(), "progress", bar.toString(), "ratio",
- MMOCore.plugin.configManager.decimal.format((double) exp / needed * 100)).send(playerData.getPlayer());
+ MMOLib.plugin.getMMOConfig().decimal.format((double) exp / needed * 100)).send(playerData.getPlayer());
}
}
diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java
index 0645eec8..5e55dc15 100644
--- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java
+++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java
@@ -99,7 +99,6 @@ public class PlayerData extends OfflinePlayerData {
public PlayerData(MMOPlayerData mmoData) {
super(mmoData.getUniqueId());
- mmoData.setMMOCore(this);
this.mmoData = mmoData;
this.playerStats = new PlayerStats(this);
@@ -116,8 +115,6 @@ public class PlayerData extends OfflinePlayerData {
super(UUID.randomUUID());
mmoData = new MMOPlayerData(null, null);
- mmoData.setMMOCore(this);
-
playerStats = new PlayerStats(this);
questData = new PlayerQuests(this, null);
}
diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java
index 1b0d2f09..7e7f5353 100644
--- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java
+++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java
@@ -18,7 +18,7 @@ public class AttackEventTrigger implements EventTriggerHandler {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void a(PlayerAttackEvent event) {
- PlayerData player = event.getData().getMMOCore();
+ PlayerData player = PlayerData.get(event.getData().getUniqueId());
PlayerClass profess = player.getProfess();
for (DamageType type : event.getAttack().getTypes()) {
diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java
index f5cec667..33ad10dc 100644
--- a/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java
+++ b/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java
@@ -1,13 +1,13 @@
package net.Indyuce.mmocore.api.player.stats;
-import java.text.DecimalFormat;
-
-import org.bukkit.configuration.file.FileConfiguration;
-
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.ConfigFile;
import net.Indyuce.mmocore.api.experience.Profession;
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
+import net.mmogroup.mmolib.MMOLib;
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.text.DecimalFormat;
public enum StatType {
@@ -51,7 +51,7 @@ public enum StatType {
PROJECTILE_DAMAGE,
WEAPON_DAMAGE,
SKILL_DAMAGE,
-
+
PVP_DAMAGE,
PVE_DAMAGE,
@@ -124,7 +124,7 @@ public enum StatType {
FileConfiguration config = new ConfigFile("stats").getConfig();
for (StatType stat : values()) {
stat.defaultInfo = config.contains("default." + stat.name()) ? new LinearValue(config.getConfigurationSection("default." + stat.name())) : new LinearValue(0, 0);
- stat.format = MMOCore.plugin.configManager.newFormat(config.contains("decimal-format." + stat.name()) ? config.getString("decimal-format." + stat.name()) : "0.#");
+ stat.format = MMOLib.plugin.getMMOConfig().newFormat(config.contains("decimal-format." + stat.name()) ? config.getString("decimal-format." + stat.name()) : "0.#");
}
}
}
diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java b/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java
index 4b11bcc3..a47eaaa6 100644
--- a/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java
+++ b/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java
@@ -1,9 +1,8 @@
package net.Indyuce.mmocore.api.util.math.formula;
+import net.mmogroup.mmolib.MMOLib;
import org.bukkit.configuration.ConfigurationSection;
-import net.Indyuce.mmocore.MMOCore;
-
public class LinearValue {
private final double base, perLevel, min, max;
private final boolean hasmin, hasmax;
@@ -75,17 +74,15 @@ public class LinearValue {
}
public String getDisplay(int level) {
- return MMOCore.plugin.configManager.decimals.format(calculate(level));
+ return MMOLib.plugin.getMMOConfig().decimals.format(calculate(level));
}
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;
}
diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java
index 724e162e..389f1758 100644
--- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java
+++ b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java
@@ -24,7 +24,7 @@ public class ListCommandTreeNode extends CommandTreeNode {
for (Booster booster : MMOCore.plugin.boosterManager.getBoosters())
if (!booster.isTimedOut())
MMOLib.plugin.getVersion().getWrapper().sendJson((Player) sender, "{\"text\":\"" + ChatColor.YELLOW + "- " + ChatColor.GOLD
- + MMOCore.plugin.configManager.decimal.format((1 + booster.getExtra())) + "x" + ChatColor.YELLOW + " Booster - "
+ + MMOLib.plugin.getMMOConfig().decimal.format((1 + booster.getExtra())) + "x" + ChatColor.YELLOW + " Booster - "
+ ChatColor.GOLD + (!booster.hasProfession() ? "ExploreAttributesCommand" : booster.getProfession().getName())
+ ChatColor.YELLOW + " - " + ChatColor.GOLD
+ new DelayFormat().format(booster.getCreationDate() + booster.getLength() - System.currentTimeMillis())
diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/LootColor.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/LootColor.java
deleted file mode 100644
index aa9430e4..00000000
--- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/LootColor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.Indyuce.mmocore.comp.mythicmobs;
-
-import org.bukkit.Color;
-import org.bukkit.Particle;
-import org.bukkit.entity.Item;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import net.Indyuce.mmocore.MMOCore;
-
-public class LootColor extends BukkitRunnable {
- private final Item item;
- private final Color color;
-
- private int j = 0;
-
- public LootColor(Item item, Color color) {
- this.item = item;
- this.color = color;
-
- runTaskTimer(MMOCore.plugin, 0, 1);
- }
-
- @Override
- public void run() {
- if (j++ > 100 || item.isDead() || item.isOnGround()) {
- cancel();
- return;
- }
-
- item.getWorld().spawnParticle(Particle.REDSTONE, item.getLocation(), 1, new Particle.DustOptions(color, 1.3f));
- }
-}
diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/Lootsplosion.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/Lootsplosion.java
deleted file mode 100644
index e9b3ca0a..00000000
--- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/Lootsplosion.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package net.Indyuce.mmocore.comp.mythicmobs;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Item;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.ItemSpawnEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-
-import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicMobDeathEvent;
-import net.Indyuce.mmocore.MMOCore;
-import net.Indyuce.mmoitems.MMOItems;
-import net.Indyuce.mmoitems.api.ItemTier;
-import net.mmogroup.mmolib.MMOLib;
-import net.mmogroup.mmolib.api.item.NBTItem;
-
-public class Lootsplosion implements Listener {
- private static final Random random = new Random();
-
- private final boolean colored;
-
- public Lootsplosion() {
- colored = Bukkit.getPluginManager().getPlugin("MMOItems") != null && MMOCore.plugin.getConfig().getBoolean("lootsplosion.mmoitems-color");
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void b(MythicMobDeathEvent event) {
- if (event.getMob().getVariables().has("Lootsplosion"))
- new LootsplosionHandler(event);
- }
-
- public class LootsplosionHandler implements Listener {
-
- private final List drops;
-
- /*
- * Y coordinate offset so the velocity is not directly negated when the
- * item spawns on the ground
- */
- private final double offset;
-
- public LootsplosionHandler(MythicMobDeathEvent event) {
- offset = event.getEntity().getHeight() / 2;
- drops = new ArrayList<>(event.getDrops());
-
- Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin);
- }
-
- private void close() {
- ItemSpawnEvent.getHandlerList().unregister(this);
- }
-
- @EventHandler
- public void a(ItemSpawnEvent event) {
- Item item = event.getEntity();
- if (!drops.contains(item.getItemStack())) {
- close();
- return;
- }
-
- drops.remove(item.getItemStack());
- item.teleport(item.getLocation().add(0, offset, 0));
- item.setVelocity(randomVector());
-
- if (colored)
- Bukkit.getScheduler().runTask(MMOCore.plugin, () -> {
- NBTItem nbt = MMOLib.plugin.getVersion().getWrapper().getNBTItem(item.getItemStack());
- if (nbt.hasTag("MMOITEMS_TIER")) {
- ItemTier tier = MMOItems.plugin.getTiers().get(nbt.getString("MMOITEMS_TIER"));
- if (tier.hasColor())
- new LootColor(item, tier.getColor().toBukkit());
- }
- });
- }
-
- }
-
- private Vector randomVector() {
- double offset = MMOCore.plugin.getConfig().getDouble("lootsplosion.offset"),
- height = MMOCore.plugin.getConfig().getDouble("lootsplosion.height");
- return new Vector(Math.cos(random.nextDouble() * Math.PI * 2) * offset, height, Math.sin(random.nextDouble() * Math.PI * 2) * offset);
- }
-}
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 8cb91551..c09ea377 100644
--- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java
+++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java
@@ -1,22 +1,17 @@
package net.Indyuce.mmocore.comp.mythicmobs;
-import org.bukkit.Bukkit;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-
import io.lumine.xikage.mythicmobs.MythicMobs;
import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicDropLoadEvent;
import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicReloadedEvent;
import io.lumine.xikage.mythicmobs.skills.placeholders.Placeholder;
-import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.comp.mythicmobs.load.CurrencyItemDrop;
import net.Indyuce.mmocore.comp.mythicmobs.load.GoldPouchDrop;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
public class MythicMobsDrops implements Listener {
public MythicMobsDrops() {
- if (MMOCore.plugin.getConfig().getBoolean("lootsplosion.enabled"))
- Bukkit.getPluginManager().registerEvents(new Lootsplosion(), MMOCore.plugin);
registerPlaceholders();
}
diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/handlers/PlayerAttackSkillHandler.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/handlers/PlayerAttackSkillHandler.java
index 5462c3ae..58a84a8a 100644
--- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/handlers/PlayerAttackSkillHandler.java
+++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/handlers/PlayerAttackSkillHandler.java
@@ -1,5 +1,6 @@
package net.Indyuce.mmocore.comp.mythicmobs.skill.handlers;
+import net.Indyuce.mmocore.api.player.PlayerData;
import org.bukkit.event.EventHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.MythicMobSkill;
@@ -17,6 +18,6 @@ public class PlayerAttackSkillHandler extends PassiveMythicMobSkillHandler {
@EventHandler
private void event(PlayerAttackEvent e) {
- castSkill(e.getData().getMMOCore(), e.getEntity());
+ castSkill(PlayerData.get(e.getData().getUniqueId()), e.getEntity());
}
}
\ No newline at end of file
diff --git a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java
index f5c0a7ad..82808103 100644
--- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java
+++ b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java
@@ -7,6 +7,7 @@ import net.Indyuce.mmocore.api.experience.Profession;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.stats.StatType;
import net.Indyuce.mmocore.api.quest.PlayerQuests;
+import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.util.AltChar;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -55,7 +56,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
else if (identifier.equals("level_percent")) {
PlayerData playerData = PlayerData.get(player);
double current = playerData.getExperience(), next = playerData.getLevelUpExperience();
- return MMOCore.plugin.configManager.decimal.format(current / next * 100);
+ return MMOLib.plugin.getMMOConfig().decimal.format(current / next * 100);
}
else if (identifier.equals("combat"))
@@ -86,7 +87,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
String name = identifier.substring(19).replace(" ", "-").replace("_", "-").toLowerCase();
Profession profession = MMOCore.plugin.professionManager.get(name);
double current = professions.getExperience(profession), next = professions.getLevelUpExperience(profession);
- return MMOCore.plugin.configManager.decimal.format(current / next * 100);
+ return MMOLib.plugin.getMMOConfig().decimal.format(current / next * 100);
}
else if (identifier.startsWith("bound_")) {
@@ -131,7 +132,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
.getAttribute(MMOCore.plugin.attributeManager.get(identifier.substring(10).toLowerCase().replace("_", "-"))));
else if (identifier.equals("mana"))
- return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getMana());
+ return MMOLib.plugin.getMMOConfig().decimal.format(PlayerData.get(player).getMana());
else if (identifier.equals("mana_bar")) {
PlayerData data = PlayerData.get(player);
@@ -141,17 +142,17 @@ public class RPGPlaceholders extends PlaceholderExpansion {
else if (identifier.startsWith("exp_multiplier_")) {
String format = identifier.substring(15).toLowerCase().replace("_", "-").replace(" ", "-");
Profession profession = format.equals("main") ? null : MMOCore.plugin.professionManager.get(format);
- return MMOCore.plugin.configManager.decimal.format(MMOCore.plugin.boosterManager.getMultiplier(profession) * 100);
+ return MMOLib.plugin.getMMOConfig().decimal.format(MMOCore.plugin.boosterManager.getMultiplier(profession) * 100);
}
else if (identifier.startsWith("exp_boost_")) {
String format = identifier.substring(10).toLowerCase().replace("_", "-").replace(" ", "-");
Profession profession = format.equals("main") ? null : MMOCore.plugin.professionManager.get(format);
- return MMOCore.plugin.configManager.decimal.format((MMOCore.plugin.boosterManager.getMultiplier(profession) - 1) * 100);
+ return MMOLib.plugin.getMMOConfig().decimal.format((MMOCore.plugin.boosterManager.getMultiplier(profession) - 1) * 100);
}
else if (identifier.equals("stamina"))
- return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStamina());
+ return MMOLib.plugin.getMMOConfig().decimal.format(PlayerData.get(player).getStamina());
else if (identifier.equals("stamina_bar")) {
StringBuilder format = new StringBuilder();
@@ -168,7 +169,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
}
else if (identifier.equals("stellium"))
- return MMOCore.plugin.configManager.decimal.format(PlayerData.get(player).getStellium());
+ return MMOLib.plugin.getMMOConfig().decimal.format(PlayerData.get(player).getStellium());
else if (identifier.equals("stellium_bar")) {
StringBuilder format = new StringBuilder();
@@ -187,7 +188,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
else if (identifier.equals("quest_progress")) {
PlayerQuests data = PlayerData.get(player).getQuestData();
return data.hasCurrent()
- ? MMOCore.plugin.configManager.decimal
+ ? MMOLib.plugin.getMMOConfig().decimal
.format((int) (double) data.getCurrent().getObjectiveNumber() / data.getCurrent().getQuest().getObjectives().size() * 100)
: "0";
}
diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java b/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java
index 20a5219c..d942c8c9 100644
--- a/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java
+++ b/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java
@@ -5,6 +5,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
import java.util.logging.Level;
+import net.mmogroup.mmolib.MMOLib;
import org.apache.commons.lang.Validate;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@@ -25,7 +26,7 @@ public abstract class EditableInventory {
*/
private final Set items = new LinkedHashSet<>();
- protected static final DecimalFormat decimal = MMOCore.plugin.configManager.decimal;
+ protected static final DecimalFormat decimal = MMOLib.plugin.getMMOConfig().decimal;
public EditableInventory(String id) {
this.id = id;
diff --git a/src/main/java/net/Indyuce/mmocore/listener/PartyListener.java b/src/main/java/net/Indyuce/mmocore/listener/PartyListener.java
index a07a7c1d..ddfb051b 100644
--- a/src/main/java/net/Indyuce/mmocore/listener/PartyListener.java
+++ b/src/main/java/net/Indyuce/mmocore/listener/PartyListener.java
@@ -51,7 +51,7 @@ public class PartyListener implements Listener {
LivingEntity entity = event.getEntity();
if (entity instanceof Player && !entity.hasMetadata("NPC")) {
PlayerData targetData = PlayerData.get((Player) event.getEntity());
- if (targetData.hasParty() && targetData.getParty().getMembers().has(event.getData().getMMOCore()))
+ if (targetData.hasParty() && targetData.getParty().getMembers().has(PlayerData.get(event.getData().getUniqueId())))
event.setCancelled(true);
}
}
diff --git a/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java b/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java
index 7c0319dc..b3bf01f5 100644
--- a/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java
+++ b/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java
@@ -28,7 +28,7 @@ public class PlayerListener implements Listener {
*/
@EventHandler(priority = EventPriority.LOW)
public void a(PlayerJoinEvent event) {
- MMOCore.plugin.dataProvider.getDataManager().setup(event.getPlayer());
+ MMOCore.plugin.dataProvider.getDataManager().setup(event.getPlayer().getUniqueId());
}
/*
diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java
index 5f93d6f7..29fc9b05 100644
--- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java
+++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java
@@ -17,8 +17,6 @@ import org.bukkit.util.Consumer;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
import java.util.List;
import java.util.logging.Level;
@@ -31,9 +29,6 @@ public class ConfigManager {
public ChatColor staminaFull, staminaHalf, staminaEmpty;
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown;
- public final DecimalFormatSymbols formatSymbols = new DecimalFormatSymbols();
- public final DecimalFormat decimal = new DecimalFormat("0.#", formatSymbols), decimals = new DecimalFormat("0.##", formatSymbols);
-
private final FileConfiguration messages;
private final boolean chatInput;
@@ -97,7 +92,6 @@ public class ConfigManager {
hotbarSwap = MMOCore.plugin.getConfig().getBoolean("hotbar-swap");
chatInput = MMOCore.plugin.getConfig().getBoolean("use-chat-input");
partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix");
- formatSymbols.setDecimalSeparator(getFirstChar(MMOCore.plugin.getConfig().getString("number-format.decimal-separator")));
combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer") * 1000;
lootChestExpireTime = Math.max(MMOCore.plugin.getConfig().getInt("loot-chests.chest-expire-time"), 1) * 1000;
lootChestPlayerCooldown = MMOCore.plugin.getConfig().getInt("player-cooldown") * 1000;
@@ -117,14 +111,6 @@ public class ConfigManager {
}
}
- public DecimalFormat newFormat(String pattern) {
- return new DecimalFormat(pattern, formatSymbols);
- }
-
- private char getFirstChar(String str) {
- return str == null || str.isEmpty() ? ',' : str.charAt(0);
- }
-
public PlayerInput newPlayerInput(Player player, InputType type, Consumer output) {
return chatInput ? new ChatInput(player, type, output) : new AnvilGUI(player, type, output);
}
diff --git a/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java b/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java
index cd98c02a..e7b71945 100644
--- a/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java
+++ b/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java
@@ -11,7 +11,6 @@ import org.apache.commons.lang.Validate;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.experience.ExpCurve;
-import net.Indyuce.mmoitems.MMOItems;
public class ExperienceManager {
private final Map expCurves = new HashMap<>();
@@ -40,7 +39,7 @@ public class ExperienceManager {
ExpCurve curve = new ExpCurve(file);
expCurves.put(curve.getId(), curve);
} catch (IllegalArgumentException | IOException exception) {
- MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load exp curve '" + file.getName() + "': " + exception.getMessage());
+ MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp curve '" + file.getName() + "': " + exception.getMessage());
}
}
}
diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java
index 13194cad..6a638b9f 100644
--- a/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java
+++ b/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java
@@ -1,21 +1,21 @@
package net.Indyuce.mmocore.manager.data;
-import java.util.Collection;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.configuration.ConfigurationSection;
-import org.bukkit.entity.Player;
-
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent;
import net.Indyuce.mmocore.api.player.OfflinePlayerData;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.mmogroup.mmolib.api.player.MMOPlayerData;
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.configuration.ConfigurationSection;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
public abstract class PlayerDataManager {
+ private final static Map data = new HashMap<>();
private DefaultPlayerData defaultData = new DefaultPlayerData();
public PlayerData get(OfflinePlayer player) {
@@ -23,37 +23,36 @@ public abstract class PlayerDataManager {
}
public PlayerData get(UUID uuid) {
- PlayerData found = MMOPlayerData.get(uuid).getMMOCore();
- return found == null ? PlayerData.NOT_LOADED : found;
+ return data.getOrDefault(uuid, setup(uuid));
}
public void remove(UUID uuid) {
- if (MMOPlayerData.isLoaded(uuid))
- MMOPlayerData.get(uuid).setMMOCore(null);
+ data.remove(uuid);
}
public abstract OfflinePlayerData getOffline(UUID uuid);
- public void setup(Player player) {
-
+ public PlayerData setup(UUID uuid) {
/*
* Setup playerData based on loadData method to support both MySQL and
* YAML data storage
*/
- MMOPlayerData mmoData = MMOPlayerData.get(player);
- if (mmoData.getMMOCore() == null) {
- PlayerData generated = new PlayerData(mmoData);
+ PlayerData playerData = data.get(uuid);
+ if (playerData == null) {
+ playerData = data.put(uuid, new PlayerData(MMOPlayerData.get(uuid)));
/*
* Loads player data and ONLY THEN refresh the player statistics and
* calls the load event on the MAIN thread
*/
Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> {
- loadData(generated);
- Bukkit.getScheduler().runTask(MMOCore.plugin, () -> Bukkit.getPluginManager().callEvent(new PlayerDataLoadEvent(generated)));
- generated.getStats().updateStats();
+ PlayerData loaded = PlayerData.get(uuid);
+ loadData(loaded);
+ Bukkit.getScheduler().runTask(MMOCore.plugin, () -> Bukkit.getPluginManager().callEvent(new PlayerDataLoadEvent(loaded)));
+ loaded.getStats().updateStats();
});
}
+ return playerData;
}
public DefaultPlayerData getDefaultData() {
@@ -65,12 +64,11 @@ public abstract class PlayerDataManager {
}
public boolean isLoaded(UUID uuid) {
- return MMOPlayerData.isLoaded(uuid) && MMOPlayerData.get(uuid).getMMOCore() != null;
+ return data.containsKey(uuid);
}
public Collection getLoaded() {
- return MMOPlayerData.getLoaded().stream().filter(data -> data.getMMOCore() != null).map(MMOPlayerData::getMMOCore)
- .collect(Collectors.toSet());
+ return data.values();
}
public abstract void loadData(PlayerData data);
diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java
index 5489fe26..3d95c6c1 100644
--- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java
+++ b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java
@@ -22,7 +22,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
@Override
public void loadData(PlayerData data) {
- FileConfiguration config = new ConfigFile(data.getPlayer()).getConfig();
+ FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig();
data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints()));
data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints()));
diff --git a/src/main/java/net/Indyuce/mmocore/skill/Ambers.java b/src/main/java/net/Indyuce/mmocore/skill/Ambers.java
index 28531397..4f4cf3ae 100644
--- a/src/main/java/net/Indyuce/mmocore/skill/Ambers.java
+++ b/src/main/java/net/Indyuce/mmocore/skill/Ambers.java
@@ -37,7 +37,7 @@ public class Ambers extends Skill implements Listener {
@EventHandler
public void a(PlayerAttackEvent event) {
- PlayerData data = event.getData().getMMOCore();
+ PlayerData data = PlayerData.get(event.getData().getUniqueId());
if (!event.getAttack().hasType(DamageType.SKILL) || !data.getProfess().hasSkill(this))
return;
diff --git a/src/main/java/net/Indyuce/mmocore/skill/Backstab.java b/src/main/java/net/Indyuce/mmocore/skill/Backstab.java
index b36f4398..d9c778f9 100644
--- a/src/main/java/net/Indyuce/mmocore/skill/Backstab.java
+++ b/src/main/java/net/Indyuce/mmocore/skill/Backstab.java
@@ -32,7 +32,7 @@ public class Backstab extends Skill implements Listener {
@EventHandler
public void a(PlayerAttackEvent event) {
- PlayerData data = event.getData().getMMOCore();
+ PlayerData data = PlayerData.get(event.getData().getUniqueId());
LivingEntity target = event.getEntity();
if (data.isInCombat() || !event.getAttack().hasType(DamageType.WEAPON)
|| event.getPlayer().getEyeLocation().getDirection().angle(target.getEyeLocation().getDirection()) > Math.PI / 6
diff --git a/src/main/java/net/Indyuce/mmocore/skill/Evade.java b/src/main/java/net/Indyuce/mmocore/skill/Evade.java
index 0e9711c5..c458bef6 100644
--- a/src/main/java/net/Indyuce/mmocore/skill/Evade.java
+++ b/src/main/java/net/Indyuce/mmocore/skill/Evade.java
@@ -69,7 +69,7 @@ public class Evade extends Skill {
@EventHandler(priority = EventPriority.HIGHEST)
public void b(PlayerAttackEvent event) {
- if (event.getAttack().hasType(DamageType.WEAPON) && !event.isCancelled() && event.getData().getMMOCore().equals(data))
+ if (event.getAttack().hasType(DamageType.WEAPON) && !event.isCancelled() && PlayerData.get(event.getData().getUniqueId()).equals(data))
close();
}
diff --git a/src/main/java/net/Indyuce/mmocore/skill/Fire_Berserker.java b/src/main/java/net/Indyuce/mmocore/skill/Fire_Berserker.java
index 38deda10..12df2248 100644
--- a/src/main/java/net/Indyuce/mmocore/skill/Fire_Berserker.java
+++ b/src/main/java/net/Indyuce/mmocore/skill/Fire_Berserker.java
@@ -30,7 +30,7 @@ public class Fire_Berserker extends Skill implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void a(PlayerAttackEvent event) {
- PlayerData data = event.getData().getMMOCore();
+ PlayerData data = PlayerData.get(event.getData().getUniqueId());
if (event.getPlayer().getFireTicks() > 0) {
Optional skill = data.getProfess().findSkill(this);
skill.ifPresent(skillInfo -> event.getAttack().multiplyDamage(1 + skillInfo.getModifier("extra", data.getSkillLevel(this)) / 100));
diff --git a/src/main/java/net/Indyuce/mmocore/skill/Power_Mark.java b/src/main/java/net/Indyuce/mmocore/skill/Power_Mark.java
index 83bc75a7..411dd205 100644
--- a/src/main/java/net/Indyuce/mmocore/skill/Power_Mark.java
+++ b/src/main/java/net/Indyuce/mmocore/skill/Power_Mark.java
@@ -46,7 +46,7 @@ public class Power_Mark extends Skill implements Listener {
@EventHandler
public void a(PlayerAttackEvent event) {
- PlayerData data = event.getData().getMMOCore();
+ PlayerData data = PlayerData.get(event.getData().getUniqueId());
if (!event.getAttack().hasType(DamageType.WEAPON) || !data.getProfess().hasSkill(this))
return;
@@ -89,7 +89,7 @@ public class Power_Mark extends Skill implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void stackDamage(PlayerAttackEvent event) {
- if (!event.isCancelled() && j < 20 * (duration - 2) && radiusCheck(event.getEntity().getLocation()) && event.getData().getMMOCore().equals(data)) {
+ if (!event.isCancelled() && j < 20 * (duration - 2) && radiusCheck(event.getEntity().getLocation()) && PlayerData.get(event.getData().getUniqueId()).equals(data)) {
accumulate += event.getAttack().getDamage() * ratio;
new ParabolicProjectile(event.getEntity().getLocation().add(0, event.getEntity().getHeight() / 2, 0), loc, () -> loc.getWorld().playSound(loc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1), Color.PURPLE);
}
diff --git a/src/main/java/net/Indyuce/mmocore/skill/Sneaky_Picky.java b/src/main/java/net/Indyuce/mmocore/skill/Sneaky_Picky.java
index 91b31c69..f731b9b1 100644
--- a/src/main/java/net/Indyuce/mmocore/skill/Sneaky_Picky.java
+++ b/src/main/java/net/Indyuce/mmocore/skill/Sneaky_Picky.java
@@ -32,7 +32,7 @@ public class Sneaky_Picky extends Skill implements Listener {
@EventHandler
public void a(PlayerAttackEvent event) {
- PlayerData data = event.getData().getMMOCore();
+ PlayerData data = PlayerData.get(event.getData().getUniqueId());
if (!event.getAttack().hasType(DamageType.WEAPON) || data.isInCombat() || !data.getProfess().hasSkill(this))
return;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index b4aed9a0..71da3bcd 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -8,7 +8,7 @@
# a Spigot Plugin by Team Requiem
# DO NOT TOUCH
-config-version: 2
+config-version: 3
# Auto-Save feature automatically saves playerdata
# (class, level, etc.) and guild data
@@ -55,18 +55,7 @@ custom-mine-conditions:
# broken when custom mining conditions are met
protect-custom-mine: false
-# Offset is the distance traveled on X and Y coordinates
-# Height is the Y velocity coordinate. Lootsplosions
-# only trigger with MythicMobs monsters.
-# Requires a SERVER reload when changed.
-lootsplosion:
- enabled: true
- mmoitems-color: true
- offset: .2
- height: .6
-
loot-chests:
-
# Time in seconds it takes for a loot chest to
# expire after it was spawned. 600 is 10 minutes.
chest-expire-time: 600
@@ -127,17 +116,6 @@ death-exp-loss:
# Percentage of current EXP you lose when dying.
percent: 30
-# Edit general plugin number formatting here.
-number-format:
- decimal-separator: .
-
-# Allows to scale health up/down to a specific
-# amount so extra health does not fill up the screen.
-# Requires a SERVER reload when changed.
-health-scale:
- enabled: true
- scale: 20
-
# Allows to toggle exp hologram from gaining experience
display-exp-holograms: true
diff --git a/src/main/resources/default/classes/warrior.yml b/src/main/resources/default/classes/warrior.yml
index 860a5b8f..b6436743 100644
--- a/src/main/resources/default/classes/warrior.yml
+++ b/src/main/resources/default/classes/warrior.yml
@@ -107,7 +107,7 @@ attributes:
base: 24
per-level: 0.5
movement-speed:
- base: .905
+ base: .12
per-level: 0
attack-damage:
base: 2