From 4a719ad9b117c7df66e56ec5b90053b3eb8c8c02 Mon Sep 17 00:00:00 2001 From: Jules Date: Sun, 19 Mar 2023 12:58:05 +0100 Subject: [PATCH 01/15] Changed MythicLib dep name --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ec4f22e3..b833b08f 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,7 @@ io.lumine - MythicLib-dist + MythicLib 1.5.1-SNAPSHOT provided From 54b67f6b1ce06d02494f308f03231dfe49a75606 Mon Sep 17 00:00:00 2001 From: Jules Date: Sun, 19 Mar 2023 13:15:35 +0100 Subject: [PATCH 02/15] Fixed ci/cd --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b833b08f..ec4f22e3 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,7 @@ io.lumine - MythicLib + MythicLib-dist 1.5.1-SNAPSHOT provided From 57fe9f1f1b170f33efbf72477fe65cd1be235af7 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 19 Mar 2023 13:15:45 +0100 Subject: [PATCH 03/15] Blocks MMOCore party commands when another Module has been loaded. --- .../main/java/net/Indyuce/mmocore/command/PartyCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java index d36ac5b2..d9f02a10 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java @@ -31,6 +31,10 @@ public class PartyCommand extends RegisteredCommand { sender.sendMessage(ChatColor.RED + "This command is for players only."); return true; } + if(!(MMOCore.plugin.partyModule instanceof MMOCorePartyModule)){ + sender.sendMessage(ChatColor.RED+"You can't use MMOCore party system as you delegated the party system to another plugin."); + return true; + } PlayerData data = PlayerData.get((OfflinePlayer) sender); MMOCommandEvent event = new MMOCommandEvent(data, "party"); From ae9c396c252c426b44b6f9e7833036ccfd5e293a Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 19 Mar 2023 13:33:13 +0100 Subject: [PATCH 04/15] Fixed Multiple Servers Skill Tree Bug --- .../mmocore/api/player/PlayerData.java | 33 ++++++++++--------- .../mmocore/experience/PlayerProfessions.java | 13 +++----- .../data/mysql/MMOCoreDataSynchronizer.java | 3 ++ .../data/yaml/YAMLPlayerDataManager.java | 3 ++ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 3705daeb..bad06b81 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -183,11 +183,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc skillTree.setupNodeStates(this); // Stat triggers setup - if (!areStatsLoaded()) { - for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll()) - for (SkillTreeNode node : skillTree.getNodes()) - node.getExperienceTable().claimStatTriggers(this, node); - } + + for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll()) + for (SkillTreeNode node : skillTree.getNodes()) + node.getExperienceTable().claimStatTriggers(this, node); + } public int getPointSpent(SkillTree skillTree) { @@ -232,15 +232,18 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc return nodeLevelsString.entrySet(); } - public boolean areStatsLoaded() { - // Used to see if the triggers need to be applied - for (StatInstance instance : mmoData.getStatMap().getInstances()) - for (StatModifier modifier : instance.getModifiers()) + public void resetTriggerStats() { + for (StatInstance instance : mmoData.getStatMap().getInstances()) { + Iterator iter = instance.getModifiers().iterator(); + while (iter.hasNext()) { + StatModifier modifier = iter.next(); if (modifier.getKey().startsWith(StatTrigger.TRIGGER_PREFIX)) - return true; - return false; + modifier.unregister(mmoData); + } + } } + public Map getNodeLevels() { return new HashMap<>(nodeLevels); } @@ -748,9 +751,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc final double r = Math.sin((double) t / warpTime * Math.PI); for (double j = 0; j < Math.PI * 2; j += Math.PI / 4) getPlayer().getLocation().getWorld().spawnParticle(Particle.REDSTONE, getPlayer().getLocation().add( - Math.cos((double) 5 * t / warpTime + j) * r, - (double) 2 * t / warpTime, - Math.sin((double) 5 * t / warpTime + j) * r), + Math.cos((double) 5 * t / warpTime + j) * r, + (double) 2 * t / warpTime, + Math.sin((double) 5 * t / warpTime + j) * r), 1, new Particle.DustOptions(Color.PURPLE, 1.25f)); } }.runTaskTimer(MMOCore.plugin, 0, 1); @@ -1199,7 +1202,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc * checks if they could potentially upgrade to one of these * * @return If the player can change its current class to - * a subclass + * a subclass */ @Deprecated public boolean canChooseSubclass() { diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 2540845b..ef8e6f89 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -101,15 +101,12 @@ public class PlayerProfessions { for (Entry entry : obj.getAsJsonObject("timesClaimed").entrySet()) playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt()); - if (!playerData.areStatsLoaded()) { - for (Profession profession : MMOCore.plugin.professionManager.getAll()) { - if (profession.hasExperienceTable()) - profession.getExperienceTable().claimStatTriggers(playerData, profession); - } - if (playerData.getProfess().hasExperienceTable()) - playerData.getProfess().getExperienceTable().claimStatTriggers(playerData, playerData.getProfess()); - + for (Profession profession : MMOCore.plugin.professionManager.getAll()) { + if (profession.hasExperienceTable()) + profession.getExperienceTable().claimStatTriggers(playerData, profession); } + if (playerData.getProfess().hasExperienceTable()) + playerData.getProfess().getExperienceTable().claimStatTriggers(playerData, playerData.getProfess()); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java index 84229919..15923c17 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java @@ -37,6 +37,9 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer { @Override public void loadData(ResultSet result) throws SQLException { + //Reset stats linked to triggers + data.resetTriggerStats(); + // Initialize custom resources data.setMana(result.getFloat("mana")); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java index eabe5e83..a06eb434 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java @@ -33,6 +33,9 @@ public class YAMLPlayerDataManager extends PlayerDataManager { public void loadData(PlayerData data) { FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig(); + //Reset stats linked to triggers. + data.resetTriggerStats(); + data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints())); data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints())); data.setSkillReallocationPoints(config.getInt("skill-reallocation-points", getDefaultData().getSkillReallocationPoints())); From 6c89e78f543c46c1f754b54f79162bfae89d3370 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 19 Mar 2023 17:56:23 +0100 Subject: [PATCH 05/15] Bug Fix --- .../main/java/net/Indyuce/mmocore/api/player/PlayerData.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index bad06b81..37bfc58a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -233,7 +233,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public void resetTriggerStats() { - for (StatInstance instance : mmoData.getStatMap().getInstances()) { + Iterator stat_ite=mmoData.getStatMap().getInstances().iterator(); + while(stat_ite.hasNext()) { + StatInstance instance=stat_ite.next(); Iterator iter = instance.getModifiers().iterator(); while (iter.hasNext()) { StatModifier modifier = iter.next(); From 0f16c987f048b5f11c9d6ba9488d641044ae654c Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 19 Mar 2023 18:20:56 +0100 Subject: [PATCH 06/15] Bug Fix --- .../java/net/Indyuce/mmocore/api/player/PlayerData.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 37bfc58a..9224c564 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -233,14 +233,12 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public void resetTriggerStats() { - Iterator stat_ite=mmoData.getStatMap().getInstances().iterator(); - while(stat_ite.hasNext()) { - StatInstance instance=stat_ite.next(); + for(StatInstance instance:mmoData.getStatMap().getInstances()) { Iterator iter = instance.getModifiers().iterator(); while (iter.hasNext()) { StatModifier modifier = iter.next(); if (modifier.getKey().startsWith(StatTrigger.TRIGGER_PREFIX)) - modifier.unregister(mmoData); + iter.remove(); } } } From 4d89fa8fd9d193dadb7227366f7ee8ee2342154f Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 19 Mar 2023 22:23:33 +0100 Subject: [PATCH 07/15] Class based Ressources that are also saved/set when quitting & connecting to the server. --- .../mmocore/api/player/PlayerData.java | 11 +++++- .../player/profess/SavedClassInformation.java | 38 ++++++++++++++++++- .../data/mysql/MMOCoreDataSynchronizer.java | 10 +++++ .../manager/data/mysql/MySQLDataProvider.java | 11 ++++-- .../data/mysql/MySQLPlayerDataManager.java | 1 + .../data/yaml/YAMLPlayerDataManager.java | 6 ++- .../mmocore/player/ClassDataContainer.java | 8 ++++ .../mmocore/player/DefaultPlayerData.java | 34 +++++++++++++++-- 8 files changed, 110 insertions(+), 9 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 9224c564..f51527f1 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -233,7 +233,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public void resetTriggerStats() { - for(StatInstance instance:mmoData.getStatMap().getInstances()) { + for (StatInstance instance : mmoData.getStatMap().getInstances()) { Iterator iter = instance.getModifiers().iterator(); while (iter.hasNext()) { StatModifier modifier = iter.next(); @@ -939,18 +939,27 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc stellium = Math.max(0, Math.min(stellium + event.getAmount(), max)); } + @Override public double getMana() { return mana; } + @Override + public double getHealth() { + return getPlayer().getHealth(); + } + + @Override public double getStamina() { return stamina; } + @Override public double getStellium() { return stellium; } + public PlayerStats getStats() { return playerStats; } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java index 76eafa7e..31ac030c 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java @@ -10,6 +10,7 @@ import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.Indyuce.mmocore.skilltree.SkillTreeNode; import net.Indyuce.mmocore.skilltree.tree.SkillTree; +import org.bukkit.attribute.Attribute; import org.bukkit.configuration.ConfigurationSection; import java.util.*; @@ -17,7 +18,7 @@ import java.util.Map.Entry; public class SavedClassInformation { private final int level, skillPoints, attributePoints, attributeReallocationPoints, skillTreeReallocationPoints, skillReallocationPoints; - private final double experience; + private final double experience, health, mana, stellium, stamina; private final Map attributeLevels = new HashMap<>(); private final Map skillLevels = new HashMap<>(); private final Map skillTreePoints = new HashMap<>(); @@ -36,6 +37,10 @@ public class SavedClassInformation { attributeReallocationPoints = config.getInt("attribute-realloc-points"); skillReallocationPoints = config.getInt("skill-reallocation-points"); skillTreeReallocationPoints = config.getInt("skill-tree-reallocation-points"); + health = config.getDouble("health", 20); + mana = config.getDouble("mana", 0); + stamina = config.getDouble("stamina", 0); + stellium = config.getDouble("stellium", 0); if (config.contains("attribute")) config.getConfigurationSection("attribute").getKeys(false).forEach(key -> attributeLevels.put(key, config.getInt("attribute." + key))); if (config.contains("skill")) @@ -61,6 +66,11 @@ public class SavedClassInformation { attributeReallocationPoints = json.get("attribute-realloc-points").getAsInt(); skillReallocationPoints = json.get("skill-reallocation-points").getAsInt(); skillTreeReallocationPoints = json.get("skill-tree-reallocation-points").getAsInt(); + health = json.has("health") ? json.get("health").getAsDouble() : 20; + mana = json.has("mana") ? json.get("mana").getAsDouble() : 0; + stamina = json.has("stamina") ? json.get("stamina").getAsDouble() : 0; + stellium = json.has("stellium") ? json.get("stellium").getAsDouble() : 0; + if (json.has("attribute")) for (Entry entry : json.getAsJsonObject("attribute").entrySet()) attributeLevels.put(entry.getKey(), entry.getValue().getAsInt()); @@ -88,6 +98,10 @@ public class SavedClassInformation { this.skillTreeReallocationPoints = data.getSkillTreeReallocationPoints(); this.skillReallocationPoints = data.getSkillReallocationPoints(); this.experience = data.getExperience(); + this.health = data.getHealth(); + this.mana = data.getMana(); + this.stellium = data.getStellium(); + this.stamina = data.getStamina(); data.mapAttributeLevels().forEach((key, val) -> this.attributeLevels.put(key, val)); data.mapSkillLevels().forEach((key, val) -> skillLevels.put(key, val)); @@ -119,6 +133,22 @@ public class SavedClassInformation { return attributeReallocationPoints; } + public double getHealth() { + return health; + } + + public double getMana() { + return mana; + } + + public double getStellium() { + return stellium; + } + + public double getStamina() { + return stamina; + } + public Set getSkillKeys() { return skillLevels.keySet(); } @@ -265,6 +295,12 @@ public class SavedClassInformation { player.setClass(profess); player.unloadClassInfo(profess); + + //These should be loaded after to make sure that the MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded. + player.setMana(mana); + player.setStellium(stellium); + player.setStamina(stamina); + player.getPlayer().setHealth(Math.min(health,player.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())); // Updates level on exp bar player.refreshVanillaExp(); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java index 15923c17..afa1f397 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java @@ -16,6 +16,7 @@ import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skilltree.SkillTreeNode; import net.Indyuce.mmocore.skilltree.tree.SkillTree; import org.apache.commons.lang.Validate; +import org.bukkit.attribute.Attribute; import org.jetbrains.annotations.Nullable; import java.sql.ResultSet; @@ -121,6 +122,15 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer { } } + //These should be loaded after to make sure that the MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded. + data.setMana(result.getDouble("mana")); + data.setStamina(result.getDouble("stamina")); + data.setStellium(result.getDouble("stamina")); + double health = result.getDouble("health"); + health = Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); + data.getPlayer().setHealth(health); + + UtilityMethods.debug(MMOCore.plugin, "SQL", String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); data.setFullyLoaded(); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java index 7a631b47..652714cb 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java @@ -21,9 +21,10 @@ public class MySQLDataProvider extends MMODataSource implements DataProvider { "skill_tree_reallocation_points", "INT(11)", "skill_tree_points", "LONGTEXT", "skill_tree_levels", "LONGTEXT", - "mana","FLOAT", - "stamina","FLOAT", - "stellium","FLOAT"}; + "health", "FLOAT", + "mana", "FLOAT", + "stamina", "FLOAT", + "stellium", "FLOAT"}; public MySQLDataProvider(FileConfiguration config) { super(MMOCore.plugin); @@ -56,6 +57,10 @@ public class MySQLDataProvider extends MMODataSource implements DataProvider { "friends LONGTEXT," + "skills LONGTEXT," + "bound_skills LONGTEXT," + + "health FLOAT," + + "mana FLOAT," + + "stamina FLOAT," + + "stellium FLOAT," + "class_info LONGTEXT," + "is_saved TINYINT," + "PRIMARY KEY (uuid));"); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 1b994b11..e6f8ca30 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -44,6 +44,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { updater.addData("attribute_realloc_points", data.getAttributeReallocationPoints()); updater.addJSONArray("waypoints", data.getWaypoints()); updater.addData("skill_tree_reallocation_points", data.getSkillTreeReallocationPoints()); + updater.addData("health",data.getPlayer().getHealth()); updater.addData("mana", data.getMana()); updater.addData("stellium", data.getStellium()); updater.addData("stamina", data.getStamina()); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java index a06eb434..40926977 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java @@ -12,6 +12,7 @@ import net.Indyuce.mmocore.manager.data.PlayerDataManager; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skilltree.SkillTreeNode; import org.apache.commons.lang.Validate; +import org.bukkit.attribute.Attribute; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; @@ -120,7 +121,9 @@ public class YAMLPlayerDataManager extends PlayerDataManager { data.setMana(config.contains("mana") ? config.getDouble("mana") : data.getStats().getStat("MAX_MANA")); data.setStamina(config.contains("stamina") ? config.getDouble("stamina") : data.getStats().getStat("MAX_STAMINA")); data.setStellium(config.contains("stellium") ? config.getDouble("stellium") : data.getStats().getStat("MAX_STELLIUM")); - + double health=config.contains("health") ? config.getDouble("health") : data.getStats().getStat("MAX_HEALTH"); + health=Math.min(health,data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); + data.getPlayer().setHealth(health); data.setFullyLoaded(); } @@ -145,6 +148,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager { data.mapSkillTreePoints().forEach((key1, value) -> config.set("skill-tree-points." + key1, value)); config.set("skill-tree-reallocation-points", data.getSkillTreeReallocationPoints()); config.set("skill", null); + config.set("health",data.getHealth()); config.set("mana", data.getMana()); config.set("stellium", data.getStellium()); config.set("stamina", data.getStamina()); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java index 9ac8f2b1..90e8367d 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/ClassDataContainer.java @@ -29,6 +29,14 @@ public interface ClassDataContainer { int getSkillTreeReallocationPoints(); + double getHealth(); + + double getMana(); + + double getStamina(); + + double getStellium(); + Map mapAttributeLevels(); Map mapSkillLevels(); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java index f6b16547..62f1695a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/player/DefaultPlayerData.java @@ -13,8 +13,8 @@ import java.util.Map; public class DefaultPlayerData implements ClassDataContainer { private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints, skillReallocPoints, skillTreeReallocPoints; - - public static final DefaultPlayerData DEFAULT = new DefaultPlayerData(1, 0, 0, 0, 0, 0, 0); + private final double health, mana, stamina, stellium; + public static final DefaultPlayerData DEFAULT = new DefaultPlayerData(1, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0); public DefaultPlayerData(ConfigurationSection config) { level = config.getInt("level", 1); @@ -24,9 +24,13 @@ public class DefaultPlayerData implements ClassDataContainer { attrReallocPoints = config.getInt("attribute-realloc-points"); skillReallocPoints = config.getInt("skill-realloc-points", 0); skillTreeReallocPoints = config.getInt("skill-tree-realloc-points", 0); + health=config.getDouble("health",20); + mana=config.getDouble("mana",20); + stamina=config.getDouble("stamina",20); + stellium=config.getDouble("stellium",20); } - public DefaultPlayerData(int level, int classPoints, int skillPoints, int attributePoints, int attrReallocPoints, int skillReallocPoints, int skillTreeReallocPoints) { + public DefaultPlayerData(int level, int classPoints, int skillPoints, int attributePoints, int attrReallocPoints, int skillReallocPoints, int skillTreeReallocPoints, double health, double mana, double stamina, double stellium) { this.level = level; this.classPoints = classPoints; this.skillPoints = skillPoints; @@ -34,6 +38,10 @@ public class DefaultPlayerData implements ClassDataContainer { this.attrReallocPoints = attrReallocPoints; this.skillReallocPoints = skillReallocPoints; this.skillTreeReallocPoints = skillTreeReallocPoints; + this.health = health; + this.mana = mana; + this.stamina = stamina; + this.stellium = stellium; } public int getLevel() { @@ -45,6 +53,26 @@ public class DefaultPlayerData implements ClassDataContainer { return 0; } + @Override + public double getHealth() { + return health; + } + + @Override + public double getMana() { + return mana; + } + + @Override + public double getStamina() { + return stamina; + } + + @Override + public double getStellium() { + return stellium; + } + @Override public int getSkillPoints() { return skillPoints; From 6b91315b576a262b6351979c1cfabb73850140f2 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 20 Mar 2023 16:55:13 +0100 Subject: [PATCH 08/15] Class based Ressources that are also saved/set when quitting & connecting to the server. --- .../src/main/java/net/Indyuce/mmocore/MMOCore.java | 2 ++ .../net/Indyuce/mmocore/api/player/PlayerData.java | 10 +++++++++- .../manager/data/mysql/MMOCoreDataSynchronizer.java | 9 +++------ .../manager/data/mysql/MySQLPlayerDataManager.java | 2 +- .../net/Indyuce/mmocore/listener/PlayerListener.java | 4 ++++ 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java index 71d465c4..8f3e5f00 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -291,6 +291,8 @@ public class MMOCore extends JavaPlugin { for (PlayerData data : PlayerData.getAll()) if (data.isFullyLoaded()) { data.close(); + //Saves player health before saveData as the player will be considered offline into it if it is async. + data.setHealth(data.getPlayer().getHealth()); dataProvider.getDataManager().saveData(data, true); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index f51527f1..94c06980 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -82,6 +82,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc private int level, classPoints, skillPoints, attributePoints, attributeReallocationPoints, skillTreeReallocationPoints, skillReallocationPoints; private double experience; private double mana, stamina, stellium; + /** + * Health is stored in playerData because when saving the playerData we can't access the player health anymore as the payer is Offline. + */ + private double health; private Guild guild; private SkillCastingHandler skillCasting; private final PlayerQuests questData; @@ -946,7 +950,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc @Override public double getHealth() { - return getPlayer().getHealth(); + return health; } @Override @@ -972,6 +976,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc mana = Math.max(0, Math.min(amount, getStats().getStat("MAX_MANA"))); } + public void setHealth(double amount) { + this.health = amount; + } + public void setStamina(double amount) { stamina = Math.max(0, Math.min(amount, getStats().getStat("MAX_STAMINA"))); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java index afa1f397..1364026b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java @@ -16,7 +16,9 @@ import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skilltree.SkillTreeNode; import net.Indyuce.mmocore.skilltree.tree.SkillTree; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.attribute.Attribute; +import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.Nullable; import java.sql.ResultSet; @@ -41,12 +43,6 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer { //Reset stats linked to triggers data.resetTriggerStats(); - - // Initialize custom resources - data.setMana(result.getFloat("mana")); - data.setStellium(result.getFloat("stellium")); - data.setStamina(result.getFloat("stamina")); - data.setClassPoints(result.getInt("class_points")); data.setSkillPoints(result.getInt("skill_points")); data.setSkillReallocationPoints(result.getInt("skill_reallocation_points")); @@ -127,6 +123,7 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer { data.setStamina(result.getDouble("stamina")); data.setStellium(result.getDouble("stamina")); double health = result.getDouble("health"); + health = health == 0 ? 20 : health; health = Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); data.getPlayer().setHealth(health); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index e6f8ca30..8763cce3 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -44,7 +44,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { updater.addData("attribute_realloc_points", data.getAttributeReallocationPoints()); updater.addJSONArray("waypoints", data.getWaypoints()); updater.addData("skill_tree_reallocation_points", data.getSkillTreeReallocationPoints()); - updater.addData("health",data.getPlayer().getHealth()); + updater.addData("health",data.getHealth()); updater.addData("mana", data.getMana()); updater.addData("stellium", data.getStellium()); updater.addData("stamina", data.getStamina()); diff --git a/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java b/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java index e2f663c7..66bae5bb 100644 --- a/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java +++ b/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java @@ -73,6 +73,10 @@ public class PlayerListener implements Listener { @EventHandler public void saveDataOnQuit(PlayerQuitEvent event) { PlayerData playerData = PlayerData.get(event.getPlayer()); + /** + * We save player health as it won't be accessible anymore when saving the player data (player will be offline). + */ + playerData.setHealth(event.getPlayer().getHealth()); MMOCore.plugin.dataProvider.getDataManager().unregisterSafe(playerData); } From cec44d16478d4e0309cf5914e9bad3fd9bfc6efe Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 24 Mar 2023 22:16:04 +0100 Subject: [PATCH 09/15] Fixed default party buffs --- MMOCore-Dist/src/main/resources/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MMOCore-Dist/src/main/resources/config.yml b/MMOCore-Dist/src/main/resources/config.yml index 1ad31185..041ca2e0 100644 --- a/MMOCore-Dist/src/main/resources/config.yml +++ b/MMOCore-Dist/src/main/resources/config.yml @@ -126,8 +126,8 @@ party: # Edit party buffs here. You may # add as many stats as you want. buff: - health-regeneration: 3 - additional-experience: 5 + health-regeneration: 3% + additional-experience: 5% # Prefix you need to put in the chat # to talk in the party chat. From 588665f0b7f2fafca04e8fed66e6da15d470ed7f Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 24 Mar 2023 23:34:59 +0100 Subject: [PATCH 10/15] Fixed 'main-exp-split' --- .../net/Indyuce/mmocore/experience/PlayerProfessions.java | 4 ++-- .../main/java/net/Indyuce/mmocore/manager/ConfigManager.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index ef8e6f89..1a3b3b44 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -237,11 +237,11 @@ public class PlayerProfessions { } StringBuilder bar = new StringBuilder("" + ChatColor.BOLD); - int chars = (int) ((double) exp / needed * 20); + int chars = (int) (exp / needed * 20); 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.getName(), "progress", bar.toString(), "ratio", - MythicLib.plugin.getMMOConfig().decimal.format((double) exp / needed * 100)).send(playerData.getPlayer()); + MythicLib.plugin.getMMOConfig().decimal.format(exp / needed * 100)).send(playerData.getPlayer()); } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index aa8e7764..26e3911c 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -130,6 +130,7 @@ public class ConfigManager { fishingDropsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.fishing-drops"); maxPartyLevelDifference = MMOCore.plugin.getConfig().getInt("party.max-level-difference"); partyMaxExpSplitRange = MMOCore.plugin.getConfig().getDouble("party.max-exp-split-range"); + splitMainExp = MMOCore.plugin.getConfig().getBoolean("party.main-exp-split"); splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split"); disableQuestBossBar = MMOCore.plugin.getConfig().getBoolean("mmocore-quests.disable-boss-bar"); From c59473502f9888b86b7505165684633139291178 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 26 Mar 2023 21:14:29 +0100 Subject: [PATCH 11/15] Fixed issue #750 about custom model data in Atribute view. --- .../java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java index df1d90f3..f585e5dc 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java @@ -130,7 +130,7 @@ public abstract class InventoryItem { } public ItemStack display(T inv) { - return display(inv, 0); + return display(inv, modelData); } public ItemStack display(T inv, int n) { @@ -138,7 +138,7 @@ public abstract class InventoryItem { } public ItemStack display(T inv, int n, Material specificMaterial) { - return display(inv, n, specificMaterial, 0); + return display(inv, n, specificMaterial, modelData); } public ItemStack display(T inv, int n, Material specificMaterial, int modelData) { From 0bc1837460baa2869e31dfb51c9611d693be6990 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 26 Mar 2023 21:14:52 +0100 Subject: [PATCH 12/15] Fixed issue #765 about stellium saving issues when switching server. --- .../mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java index 1364026b..cdeca154 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MMOCoreDataSynchronizer.java @@ -121,7 +121,7 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer { //These should be loaded after to make sure that the MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded. data.setMana(result.getDouble("mana")); data.setStamina(result.getDouble("stamina")); - data.setStellium(result.getDouble("stamina")); + data.setStellium(result.getDouble("stellium")); double health = result.getDouble("health"); health = health == 0 ? 20 : health; health = Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); From 3138f81e4382b1a0649824857a056ed9aefb2f79 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 27 Mar 2023 00:06:55 +0100 Subject: [PATCH 13/15] Fixed issue #691 by adding compatibilty with other party plugins for party buffs. --- .../party/compat/DungeonsXLPartyModule.java | 54 +++++++++++++++++- .../party/compat/McMMOPartyModule.java | 57 ++++++++++++++++++- .../party/compat/PartiesPartyModule.java | 42 +++++++++++++- 3 files changed, 147 insertions(+), 6 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java index efb32c8e..92f89b17 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java @@ -1,17 +1,30 @@ package net.Indyuce.mmocore.party.compat; +import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostJoinEvent; +import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostLeaveEvent; import de.erethon.dungeonsxl.DungeonsXL; +import de.erethon.dungeonsxl.api.event.group.GroupDisbandEvent; +import de.erethon.dungeonsxl.api.event.group.GroupPlayerJoinEvent; +import de.erethon.dungeonsxl.api.event.group.GroupPlayerLeaveEvent; import de.erethon.dungeonsxl.api.player.PlayerGroup; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.PartyModule; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import java.util.ArrayList; import java.util.List; import java.util.UUID; -public class DungeonsXLPartyModule implements PartyModule { +public class DungeonsXLPartyModule implements PartyModule, Listener { + + public DungeonsXLPartyModule() { + Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin); + } @Override public AbstractParty getParty(PlayerData playerData) { @@ -19,7 +32,43 @@ public class DungeonsXLPartyModule implements PartyModule { return group == null ? null : new CustomParty(group); } - class CustomParty implements AbstractParty { + @EventHandler + public void onPlayerJoin(GroupPlayerJoinEvent event) { + //We add 1 because this returns the members of the group excluding the player that just joined. + int membersSize = event.getGroup().getMembers().size() + 1; + applyStatBonuses(PlayerData.get(event.getPlayer().getPlayer()), membersSize); + event.getGroup().getMembers().getOnlinePlayers() + .forEach(p -> applyStatBonuses(PlayerData.get(p), membersSize)); + } + + @EventHandler + public void onPlayerLeave(GroupPlayerLeaveEvent event) { + int membersSize = event.getGroup().getMembers().size(); + clearStatBonuses(PlayerData.get(event.getPlayer().getPlayer())); + event.getGroup().getMembers().getOnlinePlayers() + .forEach(p -> applyStatBonuses(PlayerData.get(p), membersSize)); + } + + @EventHandler + public void onGroupDisband(GroupDisbandEvent event) { + event.getGroup().getMembers().getOnlinePlayers().forEach(p -> clearStatBonuses(PlayerData.get(p))); + } + + /** + * Applies party stat bonuses to a specific player + */ + private void applyStatBonuses(PlayerData player, int membersSize) { + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.multiply(membersSize - 1).register(player.getMMOPlayerData())); + } + + /** + * Clear party stat bonuses from a player + */ + private void clearStatBonuses(PlayerData player) { + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData())); + } + + class CustomParty implements AbstractParty, Listener { private final PlayerGroup group; public CustomParty(PlayerGroup group) { @@ -48,5 +97,6 @@ public class DungeonsXLPartyModule implements PartyModule { public int countMembers() { return group.getMembers().getUniqueIds().size(); } + } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java index 7283bffa..5da0bf71 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java @@ -2,17 +2,28 @@ package net.Indyuce.mmocore.party.compat; import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.events.party.McMMOPartyChangeEvent; +import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.util.player.UserManager; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.PartyModule; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class McMMOPartyModule implements PartyModule { +public class McMMOPartyModule implements PartyModule, Listener { + + + public McMMOPartyModule() { + Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin); + } @Nullable @Override @@ -22,11 +33,53 @@ public class McMMOPartyModule implements PartyModule { return party == null ? null : new CustomParty(party); } - class CustomParty implements AbstractParty { + + @EventHandler + public void onChange(McMMOPartyChangeEvent event) { + if (event.getNewParty() != null) { + Party party = PartyManager.getParty(event.getNewParty()); + if (party != null) { + //This is the size of the party before the player joins=> we increment it by 1. + int membersSize = party.getMembers().size(); + if(membersSize!=1 || party.getOnlineMembers().get(0)!=event.getPlayer()) { + party.getOnlineMembers() + .forEach(p -> applyStatBonuses(PlayerData.get(p), membersSize+1)); + applyStatBonuses(PlayerData.get(event.getPlayer()), membersSize+1); + } + } + } + if (event.getOldParty() != null) { + Party party = PartyManager.getParty(event.getOldParty()); + if (party != null) { + //This is the size of the party before the player leaves=> we decrement it by 1. + int membersSize = party.getMembers().size() - 1; + party.getOnlineMembers() + .forEach(p -> applyStatBonuses(PlayerData.get(p), membersSize)); + clearStatBonuses(PlayerData.get(event.getPlayer().getPlayer())); + } + } + } + + /** + * Applies party stat bonuses to a specific player + */ + private void applyStatBonuses(PlayerData player, int membersSize) { + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.multiply(membersSize - 1).register(player.getMMOPlayerData())); + } + + /** + * Clear party stat bonuses from a player + */ + private void clearStatBonuses(PlayerData player) { + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData())); + } + + class CustomParty implements AbstractParty, Listener { private final Party party; public CustomParty(Party party) { this.party = party; + Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java index 480d5fbd..07edf5da 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java @@ -1,20 +1,29 @@ package net.Indyuce.mmocore.party.compat; import com.alessiodp.parties.api.Parties; +import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostJoinEvent; +import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostLeaveEvent; import com.alessiodp.parties.api.interfaces.PartiesAPI; import com.alessiodp.parties.api.interfaces.Party; import com.alessiodp.parties.api.interfaces.PartyPlayer; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.PartyModule; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class PartiesPartyModule implements PartyModule { +public class PartiesPartyModule implements PartyModule,Listener { + + public PartiesPartyModule(){ + Bukkit.getPluginManager().registerEvents(this,MMOCore.plugin); + } @Nullable @Override @@ -25,7 +34,36 @@ public class PartiesPartyModule implements PartyModule { return party == null ? null : new CustomParty(party); } - class CustomParty implements AbstractParty { + + @EventHandler + public void onPlayerJoin(BukkitPartiesPlayerPostJoinEvent event){ + int membersSize=event.getParty().getMembers().size(); + event.getParty().getOnlineMembers() + .forEach(p-> applyStatBonuses(PlayerData.get(p.getPlayerUUID()),membersSize)); + } + @EventHandler + public void onPlayerLeave(BukkitPartiesPlayerPostLeaveEvent event){ + int membersSize=event.getParty().getMembers().size(); + clearStatBonuses(PlayerData.get(event.getPartyPlayer().getPlayerUUID())); + event.getParty().getOnlineMembers() + .forEach(p-> applyStatBonuses(PlayerData.get(p.getPlayerUUID()),membersSize)); + } + + /** + * Applies party stat bonuses to a specific player + */ + private void applyStatBonuses(PlayerData player,int membersSize) { + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.multiply(membersSize - 1).register(player.getMMOPlayerData())); + } + + /** + * Clear party stat bonuses from a player + */ + private void clearStatBonuses(PlayerData player) { + MMOCore.plugin.partyManager.getBonuses().forEach(buff -> buff.unregister(player.getMMOPlayerData())); + } + + class CustomParty implements AbstractParty { private final Party party; public CustomParty(Party party) { From dca44b232d7759c7dbe4b0bd573d92e3b606f76a Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 29 Mar 2023 11:43:16 +0100 Subject: [PATCH 14/15] Added a fully detailed description and default modifiers for all the default registered skills. --- .../src/main/resources/default/skills/ambers.yml | 10 +++++----- .../main/resources/default/skills/backstab.yml | 8 ++++---- .../resources/default/skills/combo-attack.yml | 8 ++++---- .../main/resources/default/skills/control.yml | 6 +++--- .../main/resources/default/skills/deep-wound.yml | 4 ++-- .../default/skills/empowered-attack.yml | 6 +++--- .../src/main/resources/default/skills/evade.yml | 8 ++++---- .../resources/default/skills/fire-berserker.yml | 8 ++++---- .../main/resources/default/skills/fire-rage.yml | 10 +++++----- .../main/resources/default/skills/fire-storm.yml | 6 +++--- .../main/resources/default/skills/fireball.yml | 6 +++--- .../resources/default/skills/furtive-strike.yml | 6 +++--- .../default/skills/greater-healings.yml | 4 ++-- .../resources/default/skills/human-shield.yml | 8 ++++---- .../main/resources/default/skills/ice-spikes.yml | 6 +++--- .../resources/default/skills/minor-healings.yml | 4 ++-- .../main/resources/default/skills/power-mark.yml | 16 ++++++++-------- .../resources/default/skills/sneaky-picky.yml | 8 ++++---- .../main/resources/default/skills/telekinesy.yml | 6 +++--- .../src/main/resources/default/skills/warp.yml | 4 ++-- .../src/main/resources/default/skills/weaken.yml | 4 ++-- pom.xml | 2 +- 22 files changed, 74 insertions(+), 74 deletions(-) diff --git a/MMOCore-Dist/src/main/resources/default/skills/ambers.yml b/MMOCore-Dist/src/main/resources/default/skills/ambers.yml index 24eab92a..8da7b189 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/ambers.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/ambers.yml @@ -12,13 +12,13 @@ lore: - '&e{cooldown}s Cooldown' material: EMERALD mana: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: @@ -28,6 +28,6 @@ cooldown: min: 1.0 percent: base: 10.0 - per-level: 0.1 + per-level: 1.1 max: 20.0 min: 10.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/backstab.yml b/MMOCore-Dist/src/main/resources/default/skills/backstab.yml index f8a6704b..95d58ac3 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/backstab.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/backstab.yml @@ -8,13 +8,13 @@ mana: base: 8.0 per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 extra: base: 50.0 per-level: 20.0 cooldown: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/combo-attack.yml b/MMOCore-Dist/src/main/resources/default/skills/combo-attack.yml index fb8b986f..c44d5333 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/combo-attack.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/combo-attack.yml @@ -8,15 +8,15 @@ lore: material: IRON_SWORD damage: base: 9.0 - per-level: 0.3 + per-level: 1.3 mana: base: 10.0 per-level: -0.1 max: 5.0 min: 3.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: @@ -26,4 +26,4 @@ cooldown: min: 5.0 count: base: 3.0 - per-level: 0.2 + per-level: 1.2 diff --git a/MMOCore-Dist/src/main/resources/default/skills/control.yml b/MMOCore-Dist/src/main/resources/default/skills/control.yml index d674a4d8..6b2771d3 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/control.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/control.yml @@ -10,13 +10,13 @@ lore: material: MAGENTA_DYE duration: base: 2.0 - per-level: 0.0 + per-level: 1.0 mana: base: 15.0 per-level: 1.5 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/deep-wound.yml b/MMOCore-Dist/src/main/resources/default/skills/deep-wound.yml index bbb31d69..86777fc3 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/deep-wound.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/deep-wound.yml @@ -14,8 +14,8 @@ mana: base: 8.0 per-level: 3.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 extra: diff --git a/MMOCore-Dist/src/main/resources/default/skills/empowered-attack.yml b/MMOCore-Dist/src/main/resources/default/skills/empowered-attack.yml index 05c1173b..7d924914 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/empowered-attack.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/empowered-attack.yml @@ -12,8 +12,8 @@ mana: base: 4.0 per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 extra: @@ -26,7 +26,7 @@ cooldown: min: 5.0 radius: base: 4.0 - per-level: 0.0 + per-level: 1.0 ratio: base: 30.0 per-level: 10.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/evade.yml b/MMOCore-Dist/src/main/resources/default/skills/evade.yml index 3be455a1..acac3e3f 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/evade.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/evade.yml @@ -8,17 +8,17 @@ lore: material: LEATHER_BOOTS duration: base: 2.0 - per-level: 0.3 + per-level: 1.3 max: 10.0 min: 2.0 mana: base: 8.0 per-level: 3.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: base: 20.0 - per-level: 0.0 + per-level: 1.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/fire-berserker.yml b/MMOCore-Dist/src/main/resources/default/skills/fire-berserker.yml index f5cf6db3..7658ef43 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/fire-berserker.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/fire-berserker.yml @@ -3,13 +3,13 @@ lore: - You deal &c{extra}% &7more damage when on fire. material: FLINT_AND_STEEL mana: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 extra: diff --git a/MMOCore-Dist/src/main/resources/default/skills/fire-rage.yml b/MMOCore-Dist/src/main/resources/default/skills/fire-rage.yml index b45746e4..c7e33490 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/fire-rage.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/fire-rage.yml @@ -10,24 +10,24 @@ lore: material: FIRE_CHARGE duration: base: 8.0 - per-level: 0.0 + per-level: 1.0 damage: base: 5.0 per-level: 3.0 ignite: base: 2.0 - per-level: 0.1 + per-level: 1.1 mana: base: 15.0 per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 count: base: 4.0 - per-level: 0.0 + per-level: 1.0 cooldown: base: 9.0 per-level: -0.1 diff --git a/MMOCore-Dist/src/main/resources/default/skills/fire-storm.yml b/MMOCore-Dist/src/main/resources/default/skills/fire-storm.yml index 57f4fc02..07ff2ffc 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/fire-storm.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/fire-storm.yml @@ -13,13 +13,13 @@ damage: per-level: 3.0 ignite: base: 2.0 - per-level: 0.1 + per-level: 1.1 mana: base: 15.0 per-level: 2.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/fireball.yml b/MMOCore-Dist/src/main/resources/default/skills/fireball.yml index faec3105..b871ac9e 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/fireball.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/fireball.yml @@ -16,13 +16,13 @@ damage: per-level: 3.0 ignite: base: 2.0 - per-level: 0.1 + per-level: 1.1 mana: base: 15.0 per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/furtive-strike.yml b/MMOCore-Dist/src/main/resources/default/skills/furtive-strike.yml index ef1fd5e6..9dcf10bb 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/furtive-strike.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/furtive-strike.yml @@ -13,8 +13,8 @@ mana: base: 8.0 per-level: 3.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 extra: @@ -27,4 +27,4 @@ cooldown: min: 5.0 radius: base: 7.0 - per-level: 0.0 + per-level: 1.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/greater-healings.yml b/MMOCore-Dist/src/main/resources/default/skills/greater-healings.yml index 38fc7fe3..462f36a9 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/greater-healings.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/greater-healings.yml @@ -10,8 +10,8 @@ mana: base: 4.0 per-level: 2.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 heal: diff --git a/MMOCore-Dist/src/main/resources/default/skills/human-shield.yml b/MMOCore-Dist/src/main/resources/default/skills/human-shield.yml index 4c1bd8cf..19418a43 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/human-shield.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/human-shield.yml @@ -16,16 +16,16 @@ redirect: min: 20.0 duration: base: 7.0 - per-level: 0.0 + per-level: 1.0 mana: base: 15.0 per-level: 1.5 low: base: 10.0 - per-level: 0.0 + per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/ice-spikes.yml b/MMOCore-Dist/src/main/resources/default/skills/ice-spikes.yml index c366f960..d4fb3484 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/ice-spikes.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/ice-spikes.yml @@ -16,10 +16,10 @@ mana: per-level: 2.0 slow: base: 4.0 - per-level: 0.0 + per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/minor-healings.yml b/MMOCore-Dist/src/main/resources/default/skills/minor-healings.yml index 42c13963..37426698 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/minor-healings.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/minor-healings.yml @@ -10,8 +10,8 @@ mana: base: 4.0 per-level: 2.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 heal: diff --git a/MMOCore-Dist/src/main/resources/default/skills/power-mark.yml b/MMOCore-Dist/src/main/resources/default/skills/power-mark.yml index 5ab415fe..73cc6cb7 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/power-mark.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/power-mark.yml @@ -16,23 +16,23 @@ lore: material: WITHER_SKELETON_SKULL duration: base: 10.0 - per-level: 0.1 + per-level: 1.1 mana: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: base: 30.0 - per-level: 0.0 + per-level: 1.0 stun: - base: 0.4 - per-level: 0.03 + base: 2.4 + per-level: 1.03 ratio: base: 10.0 per-level: 5.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/sneaky-picky.yml b/MMOCore-Dist/src/main/resources/default/skills/sneaky-picky.yml index db00a5f1..07b00614 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/sneaky-picky.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/sneaky-picky.yml @@ -9,13 +9,13 @@ mana: base: 8.0 per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 extra: base: 50.0 per-level: 20.0 cooldown: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 diff --git a/MMOCore-Dist/src/main/resources/default/skills/telekinesy.yml b/MMOCore-Dist/src/main/resources/default/skills/telekinesy.yml index f965da4e..a5ca5a07 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/telekinesy.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/telekinesy.yml @@ -9,15 +9,15 @@ lore: material: MAGENTA_DYE duration: base: 3.0 - per-level: 0.1 + per-level: 1.1 max: 6.0 min: 3.0 mana: base: 20.0 per-level: 2.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/warp.yml b/MMOCore-Dist/src/main/resources/default/skills/warp.yml index 9a98be5b..358f5629 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/warp.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/warp.yml @@ -10,8 +10,8 @@ mana: base: 8.0 per-level: 3.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/MMOCore-Dist/src/main/resources/default/skills/weaken.yml b/MMOCore-Dist/src/main/resources/default/skills/weaken.yml index ad80071e..9835bfc1 100644 --- a/MMOCore-Dist/src/main/resources/default/skills/weaken.yml +++ b/MMOCore-Dist/src/main/resources/default/skills/weaken.yml @@ -16,8 +16,8 @@ mana: base: 4.0 per-level: 1.0 stamina: - base: 0.0 - per-level: 0.0 + base: 2.0 + per-level: 1.0 max: 0.0 min: 0.0 cooldown: diff --git a/pom.xml b/pom.xml index ec4f22e3..a998f2e7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ net.Indyuce MMOCore pom - 1.11.2-SNAPSHOT + 1.11.3-SNAPSHOT MMOCore-API From 739f958d5aad9dc47ac4ed6c27fc314a4f11b390 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Fri, 31 Mar 2023 09:04:58 +0100 Subject: [PATCH 15/15] Refactor of the ClassSelect & ClassConfirmation GUI. Now you can fully customize the GUI depending on each class. Reload the GUI folder & add a class-confirm/... gui for each new class you created. --- MMOCore-API/pom.xml | 2 +- .../java/net/Indyuce/mmocore/MMOCore.java | 3 +- .../mmocore/gui/ClassConfirmation.java | 33 +++---------- .../net/Indyuce/mmocore/gui/ClassSelect.java | 35 +++++++------ .../mmocore/manager/InventoryManager.java | 22 ++++++--- MMOCore-Dist/pom.xml | 4 +- .../class-confirm-arcane-mage.yml} | 10 ---- .../gui/class-confirm/class-confirm-human.yml | 38 ++++++++++++++ .../gui/class-confirm/class-confirm-mage.yml | 38 ++++++++++++++ .../class-confirm/class-confirm-marksman.yml | 38 ++++++++++++++ .../class-confirm/class-confirm-paladin.yml | 38 ++++++++++++++ .../gui/class-confirm/class-confirm-rogue.yml | 38 ++++++++++++++ .../class-confirm/class-confirm-warrior.yml | 38 ++++++++++++++ .../resources/default/gui/class-select.yml | 49 +++++++++++++++++-- README.md | 2 +- 15 files changed, 321 insertions(+), 67 deletions(-) rename MMOCore-Dist/src/main/resources/default/gui/{class-confirm.yml => class-confirm/class-confirm-arcane-mage.yml} (79%) create mode 100644 MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-human.yml create mode 100644 MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-mage.yml create mode 100644 MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-marksman.yml create mode 100644 MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-paladin.yml create mode 100644 MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-rogue.yml create mode 100644 MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-warrior.yml diff --git a/MMOCore-API/pom.xml b/MMOCore-API/pom.xml index 1ac1239c..8add30f8 100644 --- a/MMOCore-API/pom.xml +++ b/MMOCore-API/pom.xml @@ -5,7 +5,7 @@ MMOCore net.Indyuce - 1.11.2-SNAPSHOT + 1.11.3-SNAPSHOT 4.0.0 diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java index 8f3e5f00..ab5968b4 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -341,7 +341,6 @@ public class MMOCore extends JavaPlugin { statManager.initialize(clearBefore); professionManager.initialize(clearBefore); - InventoryManager.load(); skillTreeManager.initialize(clearBefore); classManager.initialize(clearBefore); questManager.initialize(clearBefore); @@ -351,6 +350,8 @@ public class MMOCore extends JavaPlugin { requestManager.initialize(clearBefore); soundManager.initialize(clearBefore); configItems.initialize(clearBefore); + //Needs to be loaded after the class manager. + InventoryManager.load(); if (getConfig().isConfigurationSection("action-bar")) actionBarManager.reload(getConfig().getConfigurationSection("action-bar")); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java index 65fd4308..d5b81205 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java @@ -1,12 +1,12 @@ package net.Indyuce.mmocore.gui; +import io.lumine.mythic.lib.UtilityMethods; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.event.PlayerChangeClassEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; -import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.InventoryClickContext; @@ -21,21 +21,14 @@ import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; public class ClassConfirmation extends EditableInventory { - /** - * This enables to configure the name of the - * class confirmation GUI (for custom GUI textures). - */ - private final Map specificNames = new HashMap<>(); + private final PlayerClass playerClass; - public ClassConfirmation() { - super("class-confirm"); + public ClassConfirmation(PlayerClass playerClass) { + super("class-confirm-"+ UtilityMethods.ymlName(playerClass.getId())); + this.playerClass=playerClass; } @Override @@ -43,21 +36,13 @@ public class ClassConfirmation extends EditableInventory { return function.equalsIgnoreCase("yes") ? new YesItem(config) : new SimplePlaceholderItem(config); } - public GeneratedInventory newInventory(PlayerData data, PlayerClass profess, PluginInventory last) { - return new ClassConfirmationInventory(data, this, profess, last); + public GeneratedInventory newInventory(PlayerData data, PluginInventory last) { + return new ClassConfirmationInventory(data, this, playerClass, last); } @Override public void reload(FileConfiguration config) { super.reload(config); - - specificNames.clear(); - - if (config.contains("class-specific-name")) { - final ConfigurationSection section = config.getConfigurationSection("class-specific-name"); - for (String key : section.getKeys(false)) - specificNames.put(key, section.getString(key)); - } } public class UnlockedItem extends InventoryItem { @@ -154,9 +139,7 @@ public class ClassConfirmation extends EditableInventory { @Override public String calculateName() { - final String professKey = MMOCoreUtils.ymlName(profess.getId()); - final @Nullable String found = specificNames.get(professKey); - return found == null ? getName().replace("{class}", profess.getName()) : found; + return getName().replace("{class}", profess.getName()); } } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java index 9d91c8bf..083cd6b0 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java @@ -1,18 +1,21 @@ package net.Indyuce.mmocore.gui; import io.lumine.mythic.lib.MythicLib; +import io.lumine.mythic.lib.UtilityMethods; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.ClassOption; import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.InventoryClickContext; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; +import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.configuration.ConfigurationSection; @@ -24,6 +27,7 @@ import org.bukkit.persistence.PersistentDataType; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; public class ClassSelect extends EditableInventory { @@ -33,7 +37,7 @@ public class ClassSelect extends EditableInventory { @Override public InventoryItem load(String function, ConfigurationSection config) { - return function.equals("class") ? new ClassItem(config) : new SimplePlaceholderItem(config); + return function.startsWith("class") ? new ClassItem(config) : new SimplePlaceholderItem(config); } public GeneratedInventory newInventory(PlayerData data) { @@ -43,10 +47,13 @@ public class ClassSelect extends EditableInventory { public class ClassItem extends SimplePlaceholderItem { private final String name; private final List lore; + private final PlayerClass playerClass; public ClassItem(ConfigurationSection config) { super(Material.BARRIER, config); - + Validate.isTrue(config.getString("function").length()>6,"Couldn't find the class associated to: "+config.getString("function")); + String classId = UtilityMethods.enumName(config.getString("function").substring(6)); + this.playerClass = Objects.requireNonNull(MMOCore.plugin.classManager.get(classId),classId+" does not correspond to any classId."); this.name = config.getString("name"); this.lore = config.getStringList("lore"); } @@ -60,29 +67,28 @@ public class ClassSelect extends EditableInventory { if (n >= inv.classes.size()) return null; - PlayerClass profess = inv.classes.get(n); - ItemStack item = profess.getIcon(); + ItemStack item = playerClass.getIcon(); ItemMeta meta = item.getItemMeta(); if (hideFlags()) meta.addItemFlags(ItemFlag.values()); - meta.setDisplayName(MythicLib.plugin.parseColors(name).replace("{name}", profess.getName())); + meta.setDisplayName(MythicLib.plugin.parseColors(name).replace("{name}", playerClass.getName())); List lore = new ArrayList<>(this.lore); int index = lore.indexOf("{lore}"); if (index >= 0) { lore.remove(index); - for (int j = 0; j < profess.getDescription().size(); j++) - lore.add(index + j, profess.getDescription().get(j)); + for (int j = 0; j < playerClass.getDescription().size(); j++) + lore.add(index + j, playerClass.getDescription().get(j)); } index = lore.indexOf("{attribute-lore}"); if (index >= 0) { lore.remove(index); - for (int j = 0; j < profess.getAttributeDescription().size(); j++) - lore.add(index + j, profess.getAttributeDescription().get(j)); + for (int j = 0; j < playerClass.getAttributeDescription().size(); j++) + lore.add(index + j, playerClass.getAttributeDescription().get(j)); } - meta.getPersistentDataContainer().set(new NamespacedKey(MMOCore.plugin, "class_id"), PersistentDataType.STRING, profess.getId()); + meta.getPersistentDataContainer().set(new NamespacedKey(MMOCore.plugin, "class_id"), PersistentDataType.STRING, playerClass.getId()); meta.setLore(lore); item.setItemMeta(meta); return item; @@ -104,10 +110,8 @@ public class ClassSelect extends EditableInventory { @Override public void whenClicked(InventoryClickContext context, InventoryItem item) { - if (item.getFunction().equals("class")) { - String classId = context.getClickedItem().getItemMeta().getPersistentDataContainer().get(new NamespacedKey(MMOCore.plugin, "class_id"), PersistentDataType.STRING); - if (classId.equals("")) - return; + if (item instanceof ClassItem) { + PlayerClass profess = ((ClassItem) item).playerClass; if (playerData.getClassPoints() < 1) { MMOCore.plugin.soundManager.getSound(SoundEvent.CANT_SELECT_CLASS).playTo(player); @@ -115,7 +119,6 @@ public class ClassSelect extends EditableInventory { return; } - final PlayerClass profess = MMOCore.plugin.classManager.get(classId); if (profess.hasOption(ClassOption.NEEDS_PERMISSION) && !player.hasPermission("mmocore.class." + profess.getId().toLowerCase())) { MMOCore.plugin.soundManager.getSound(SoundEvent.CANT_SELECT_CLASS).playTo(player); new ConfigMessage("no-permission-for-class").send(player); @@ -129,7 +132,7 @@ public class ClassSelect extends EditableInventory { } final PlayerClass playerClass = findDeepestSubclass(playerData, profess); - InventoryManager.CLASS_CONFIRM.newInventory(playerData, playerClass, this).open(); + InventoryManager.CLASS_CONFIRM.get(MMOCoreUtils.ymlName(playerClass.getId())).newInventory(playerData, this).open(); } } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java index 29d61c18..56953b6b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java @@ -1,10 +1,11 @@ package net.Indyuce.mmocore.manager; -import java.util.Arrays; -import java.util.List; +import java.util.*; import java.util.logging.Level; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.gui.social.friend.EditableFriendList; import net.Indyuce.mmocore.gui.*; import net.Indyuce.mmocore.gui.social.friend.EditableFriendRemoval; @@ -20,7 +21,7 @@ public class InventoryManager { public static final SkillList SKILL_LIST = new SkillList(); public static final ClassSelect CLASS_SELECT = new ClassSelect(); public static final SubclassSelect SUBCLASS_SELECT = new SubclassSelect(); - public static final ClassConfirmation CLASS_CONFIRM = new ClassConfirmation(); + public static final Map CLASS_CONFIRM = new HashMap<>(); public static final SubclassConfirmation SUBCLASS_CONFIRM = new SubclassConfirmation(); public static final WaypointViewer WAYPOINTS = new WaypointViewer(); public static final EditableFriendList FRIEND_LIST = new EditableFriendList(); @@ -32,14 +33,21 @@ public class InventoryManager { public static final QuestViewer QUEST_LIST = new QuestViewer(); public static final AttributeView ATTRIBUTE_VIEW = new AttributeView(); public static final SkillTreeViewer TREE_VIEW = new SkillTreeViewer(); - public static final List list = Arrays.asList(PLAYER_STATS, ATTRIBUTE_VIEW, TREE_VIEW,SKILL_LIST, CLASS_SELECT, SUBCLASS_SELECT, SUBCLASS_CONFIRM, QUEST_LIST, WAYPOINTS, CLASS_CONFIRM, FRIEND_LIST, FRIEND_REMOVAL, PARTY_VIEW, PARTY_CREATION, GUILD_VIEW, GUILD_CREATION); + public static final List list = new ArrayList(Arrays.asList(PLAYER_STATS, ATTRIBUTE_VIEW, TREE_VIEW, SKILL_LIST, CLASS_SELECT, SUBCLASS_SELECT, SUBCLASS_CONFIRM, QUEST_LIST, WAYPOINTS, FRIEND_LIST, FRIEND_REMOVAL, PARTY_VIEW, PARTY_CREATION, GUILD_VIEW, GUILD_CREATION)); public static void load() { + for (PlayerClass playerClass : MMOCore.plugin.classManager.getAll()) { + ClassConfirmation GUI = new ClassConfirmation(playerClass); + CLASS_CONFIRM.put(MMOCoreUtils.ymlName(playerClass.getId()), GUI); + list.add(GUI); + } + list.forEach(inv -> { - MMOCore.plugin.configManager.loadDefaultFile("gui", inv.getId() + ".yml"); + String folder="gui"+(inv instanceof ClassConfirmation?"/class-confirm":""); + MMOCore.plugin.configManager.loadDefaultFile(folder, inv.getId() + ".yml"); try { - inv.reload(new ConfigFile("/gui", inv.getId()).getConfig()); - } catch (IllegalArgumentException exception) { + inv.reload(new ConfigFile("/"+folder, inv.getId()).getConfig()); + } catch (Exception exception) { MMOCore.log(Level.WARNING, "Could not load inventory '" + inv.getId() + "': " + exception.getMessage()); } }); diff --git a/MMOCore-Dist/pom.xml b/MMOCore-Dist/pom.xml index cf6bc6f3..447a720b 100644 --- a/MMOCore-Dist/pom.xml +++ b/MMOCore-Dist/pom.xml @@ -5,7 +5,7 @@ MMOCore net.Indyuce - 1.11.2-SNAPSHOT + 1.11.3-SNAPSHOT 4.0.0 @@ -67,7 +67,7 @@ net.Indyuce MMOCore-API - 1.11.2-SNAPSHOT + 1.11.3-SNAPSHOT true diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-arcane-mage.yml similarity index 79% rename from MMOCore-Dist/src/main/resources/default/gui/class-confirm.yml rename to MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-arcane-mage.yml index 089e1b5f..5c06c186 100644 --- a/MMOCore-Dist/src/main/resources/default/gui/class-confirm.yml +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-arcane-mage.yml @@ -1,16 +1,6 @@ - # GUI display name, used by default name: 'Confirmation: {class}' -# GUI display name which overrides the default one. -# This can be used to apply custom textures to the GUI -class-specific-name: - mage: "Select Mage" - rogue: "Select Rogue" - marksman: "Select Marksman" - warrior: "Select Warrior" - paladin: "Select Paladin" - # Number of slots in your inventory. Must be # between 9 and 54 and must be a multiple of 9. slots: 27 diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-human.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-human.yml new file mode 100644 index 00000000..9a3d74e3 --- /dev/null +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-human.yml @@ -0,0 +1,38 @@ +# GUI display name, used by default +name: 'Confirmation: {class}' + +# Number of slots in your inventory. Must be +# between 9 and 54 and must be a multiple of 9. +slots: 27 + +items: + yes: + slots: [12] + function: 'yes' + + # Displayed when the player had already selected this class + # before (only if class slots are enabled in the config). + unlocked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: + - '' + - '&7Class Level: &e{level}' + - '&7Progression: &e{exp} / {next_level}' + - '&8[&e{progress}&8] &e{percent}%' + - '' + - '&7Skill Points: &6{skill_points}' + - '&7Skills You Unlocked: &6{unlocked_skills}&7/&6{class_skills}' + + # Displayed when the class is being chosen for the first time. + locked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: {} + + back: + slots: [14] + item: RED_TERRACOTTA + function: back + name: '&aBack' + lore: {} diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-mage.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-mage.yml new file mode 100644 index 00000000..5c06c186 --- /dev/null +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-mage.yml @@ -0,0 +1,38 @@ +# GUI display name, used by default +name: 'Confirmation: {class}' + +# Number of slots in your inventory. Must be +# between 9 and 54 and must be a multiple of 9. +slots: 27 + +items: + yes: + slots: [12] + function: 'yes' + + # Displayed when the player had already selected this class + # before (only if class slots are enabled in the config). + unlocked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: + - '' + - '&7Class Level: &e{level}' + - '&7Progression: &e{exp} / {next_level}' + - '&8[&e{progress}&8] &e{percent}%' + - '' + - '&7Skill Points: &6{skill_points}' + - '&7Skills You Unlocked: &6{unlocked_skills}&7/&6{class_skills}' + + # Displayed when the class is being chosen for the first time. + locked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: {} + + back: + slots: [14] + item: RED_TERRACOTTA + function: back + name: '&aBack' + lore: {} diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-marksman.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-marksman.yml new file mode 100644 index 00000000..5c06c186 --- /dev/null +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-marksman.yml @@ -0,0 +1,38 @@ +# GUI display name, used by default +name: 'Confirmation: {class}' + +# Number of slots in your inventory. Must be +# between 9 and 54 and must be a multiple of 9. +slots: 27 + +items: + yes: + slots: [12] + function: 'yes' + + # Displayed when the player had already selected this class + # before (only if class slots are enabled in the config). + unlocked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: + - '' + - '&7Class Level: &e{level}' + - '&7Progression: &e{exp} / {next_level}' + - '&8[&e{progress}&8] &e{percent}%' + - '' + - '&7Skill Points: &6{skill_points}' + - '&7Skills You Unlocked: &6{unlocked_skills}&7/&6{class_skills}' + + # Displayed when the class is being chosen for the first time. + locked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: {} + + back: + slots: [14] + item: RED_TERRACOTTA + function: back + name: '&aBack' + lore: {} diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-paladin.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-paladin.yml new file mode 100644 index 00000000..5c06c186 --- /dev/null +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-paladin.yml @@ -0,0 +1,38 @@ +# GUI display name, used by default +name: 'Confirmation: {class}' + +# Number of slots in your inventory. Must be +# between 9 and 54 and must be a multiple of 9. +slots: 27 + +items: + yes: + slots: [12] + function: 'yes' + + # Displayed when the player had already selected this class + # before (only if class slots are enabled in the config). + unlocked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: + - '' + - '&7Class Level: &e{level}' + - '&7Progression: &e{exp} / {next_level}' + - '&8[&e{progress}&8] &e{percent}%' + - '' + - '&7Skill Points: &6{skill_points}' + - '&7Skills You Unlocked: &6{unlocked_skills}&7/&6{class_skills}' + + # Displayed when the class is being chosen for the first time. + locked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: {} + + back: + slots: [14] + item: RED_TERRACOTTA + function: back + name: '&aBack' + lore: {} diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-rogue.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-rogue.yml new file mode 100644 index 00000000..5c06c186 --- /dev/null +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-rogue.yml @@ -0,0 +1,38 @@ +# GUI display name, used by default +name: 'Confirmation: {class}' + +# Number of slots in your inventory. Must be +# between 9 and 54 and must be a multiple of 9. +slots: 27 + +items: + yes: + slots: [12] + function: 'yes' + + # Displayed when the player had already selected this class + # before (only if class slots are enabled in the config). + unlocked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: + - '' + - '&7Class Level: &e{level}' + - '&7Progression: &e{exp} / {next_level}' + - '&8[&e{progress}&8] &e{percent}%' + - '' + - '&7Skill Points: &6{skill_points}' + - '&7Skills You Unlocked: &6{unlocked_skills}&7/&6{class_skills}' + + # Displayed when the class is being chosen for the first time. + locked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: {} + + back: + slots: [14] + item: RED_TERRACOTTA + function: back + name: '&aBack' + lore: {} diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-warrior.yml b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-warrior.yml new file mode 100644 index 00000000..5c06c186 --- /dev/null +++ b/MMOCore-Dist/src/main/resources/default/gui/class-confirm/class-confirm-warrior.yml @@ -0,0 +1,38 @@ +# GUI display name, used by default +name: 'Confirmation: {class}' + +# Number of slots in your inventory. Must be +# between 9 and 54 and must be a multiple of 9. +slots: 27 + +items: + yes: + slots: [12] + function: 'yes' + + # Displayed when the player had already selected this class + # before (only if class slots are enabled in the config). + unlocked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: + - '' + - '&7Class Level: &e{level}' + - '&7Progression: &e{exp} / {next_level}' + - '&8[&e{progress}&8] &e{percent}%' + - '' + - '&7Skill Points: &6{skill_points}' + - '&7Skills You Unlocked: &6{unlocked_skills}&7/&6{class_skills}' + + # Displayed when the class is being chosen for the first time. + locked: + item: GREEN_TERRACOTTA + name: '&aSelect {class}' + lore: {} + + back: + slots: [14] + item: RED_TERRACOTTA + function: back + name: '&aBack' + lore: {} diff --git a/MMOCore-Dist/src/main/resources/default/gui/class-select.yml b/MMOCore-Dist/src/main/resources/default/gui/class-select.yml index 0e6cad40..582fa074 100644 --- a/MMOCore-Dist/src/main/resources/default/gui/class-select.yml +++ b/MMOCore-Dist/src/main/resources/default/gui/class-select.yml @@ -7,10 +7,51 @@ name: Class Selection slots: 27 items: - class: - slots: [13,12,14,11,15,10,16] - function: class - name: '&a&lThe {name}' + + class-rogue: + slots: [11] + function: class-rogue + name: '&a&lThe Rogue' + hide-flags: true + lore: + - '{lore}' + - '' + - '{attribute-lore}' + + class-mage: + slots: [12] + function: class-mage + name: '&a&lThe Mage' + hide-flags: true + lore: + - '{lore}' + - '' + - '{attribute-lore}' + + class-marksman: + slots: [13] + function: class-marksman + name: '&a&lThe Marksman' + hide-flags: true + lore: + - '{lore}' + - '' + - '{attribute-lore}' + + class-warrior: + slots: [14] + function: class-warrior + name: '&a&lThe Warrior' + hide-flags: true + lore: + - '{lore}' + - '' + - '{attribute-lore}' + + class-paladin: + slots: [15] + function: class-paladin + name: '&a&lThe Paladin' hide-flags: true lore: - '{lore}' diff --git a/README.md b/README.md index 31b4de3a..0ea6e54e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ And then add MMOCore-API as dependency net.Indyuce MMOCore-API - 1.11.2-SNAPSHOT + 1.11.3-SNAPSHOT provided ```