From 9a315e9431cafda1fc68cf6954af7a772863b30d Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 21 Apr 2022 20:45:07 +0200 Subject: [PATCH 01/91] Fixed default attribute configs --- src/main/resources/default/gui/attribute-view.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/default/gui/attribute-view.yml b/src/main/resources/default/gui/attribute-view.yml index 49c1187a..304eeda4 100644 --- a/src/main/resources/default/gui/attribute-view.yml +++ b/src/main/resources/default/gui/attribute-view.yml @@ -31,7 +31,7 @@ items: - '' - '&8When Leveled Up:' - '&7 +{buff_weapon_damage}% Weapon Damage (&a+{total_weapon_damage}%&7)' - - '&7 +{buff_max_health} Max Health (&a+{total_max_health}&7)' + - '&7 +{buff_max_health}% Max Health (&a+{total_max_health}&7)' - '' - '&eClick to level up for 1 attribute point.' - '&e◆ Current Attribute Points: {attribute_points}' @@ -49,7 +49,7 @@ items: - '&8When Leveled Up:' - '&7 +{buff_physical_damage}% Physical Damage (&a+{total_physical_damage}%&7)' - '&7 +{buff_projectile_damage}% Projectile Damage (&a+{total_projectile_damage}%&7)' - - '&7 +{buff_attack_speed} Attack Speed (&a+{total_attack_speed}&7)' + - '&7 +{buff_attack_speed}% Attack Speed (&a+{total_attack_speed}&7)' - '' - '&eClick to level up for 1 attribute point.' - '&e◆ Current Attribute Points: {attribute_points}' From 41ac1e95ac45ff33dd9ae1944c3bd63acd2b9b28 Mon Sep 17 00:00:00 2001 From: Jules Date: Sun, 24 Apr 2022 08:42:27 +0200 Subject: [PATCH 02/91] Merging expDispensers with expObjects --- .../api/player/profess/PlayerClass.java | 39 ++++++++++++++----- .../api/quest/trigger/ExperienceTrigger.java | 17 ++++---- .../mmocore/experience/ExperienceObject.java | 37 +++++++++++++++++- .../mmocore/experience/Profession.java | 20 ++++++++-- .../dispenser/ClassExperienceDispenser.java | 28 ------------- .../dispenser/ExperienceDispenser.java | 3 ++ .../ProfessionExperienceDispenser.java | 27 ------------- .../dispenser/SimpleExperienceDispenser.java | 22 ----------- .../mmocore/manager/MMOLoadManager.java | 1 + 9 files changed, 93 insertions(+), 101 deletions(-) delete mode 100644 src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java delete mode 100644 src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java delete mode 100644 src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 346a2b9a..cc847430 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -8,6 +8,7 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTrigger; import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; @@ -15,19 +16,18 @@ import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration; import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.loot.chest.particle.CastingParticle; import net.Indyuce.mmocore.experience.ExpCurve; import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; -import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.ClassExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.player.playerclass.ClassTrigger; import net.Indyuce.mmocore.player.playerclass.ClassTriggerType; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.md_5.bungee.api.ChatColor; -import org.apache.commons.lang.Validate; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.configuration.ConfigurationSection; @@ -156,10 +156,9 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { } if (config.contains("main-exp-sources")) { - ExperienceDispenser dispenser = new ClassExperienceDispenser(this); for (String key : config.getStringList("main-exp-sources")) try { - ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), dispenser); + ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); MMOCore.plugin.experience.registerSource(source); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp source '" + key + "' from class '" @@ -389,11 +388,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return stats.containsKey(type) ? stats.get(type) : type.getDefault(); } - @Override - public boolean equals(Object obj) { - return obj instanceof PlayerClass && ((PlayerClass) obj).id.equals(id); - } - public String getActionBar() { return actionBarFormat; } @@ -401,4 +395,29 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { public boolean hasActionBar() { return actionBarFormat != null; } + + @Override + public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { + hologramLocation = !MMOCore.plugin.getConfig().getBoolean("display-main-class-exp-holograms") ? null + : hologramLocation == null ? getPlayerLocation(playerData) : hologramLocation; + playerData.giveExperience(experience, source, hologramLocation, true); + } + + @Override + public boolean shouldHandle(PlayerData playerData) { + return equals(playerData.getProfess()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PlayerClass that = (PlayerClass) o; + return id.equals(that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } } diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java index 4a84e0b0..4f84729d 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java @@ -1,8 +1,6 @@ package net.Indyuce.mmocore.api.quest.trigger; -import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.ProfessionExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.SimpleExperienceDispenser; +import net.Indyuce.mmocore.experience.ExperienceObject; import org.apache.commons.lang.Validate; import net.Indyuce.mmocore.MMOCore; @@ -11,14 +9,17 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import io.lumine.mythic.lib.api.MMOLineConfig; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Objects; public class ExperienceTrigger extends Trigger { @NotNull private final RandomAmount amount; @NotNull private final EXPSource source; - @NotNull - private final ExperienceDispenser dispenser; + @Nullable + private final ExperienceObject expObject; public ExperienceTrigger(MMOLineConfig config) { super(config); @@ -28,15 +29,15 @@ public class ExperienceTrigger extends Trigger { if (config.contains("profession")) { String id = config.getString("profession").toLowerCase().replace("_", "-"); Validate.isTrue(MMOCore.plugin.professionManager.has(id), "Could not find profession"); - dispenser = new ProfessionExperienceDispenser(MMOCore.plugin.professionManager.get(id)); + expObject = MMOCore.plugin.professionManager.get(id); } else - dispenser = new SimpleExperienceDispenser(); + expObject = null; amount = new RandomAmount(config.getString("amount")); source = config.contains("source") ? EXPSource.valueOf(config.getString("source").toUpperCase()) : EXPSource.QUEST; } @Override public void apply(PlayerData player) { - dispenser.giveExperience(player, amount.calculateInt(), null, source); + Objects.requireNonNullElse(expObject, player.getProfess()).giveExperience(player, amount.calculateInt(), null, source); } } diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java index 3f9e6cc8..a5ebf4f4 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java +++ b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java @@ -1,6 +1,10 @@ package net.Indyuce.mmocore.experience; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; +import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; +import org.bukkit.Location; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; @@ -10,7 +14,7 @@ import javax.annotation.Nullable; * * @author jules */ -public interface ExperienceObject { +public interface ExperienceObject extends ExperienceDispenser { String getKey(); @@ -22,11 +26,40 @@ public interface ExperienceObject { @Nullable ExpCurve getExpCurve(); + boolean hasExperienceTable(); + /** * @return Table read when leveling up */ @NotNull ExperienceTable getExperienceTable(); - boolean hasExperienceTable(); + /** + * Called when experience is gained in main class/profession + * + * @param playerData Player gaining the experience + * @param experience Experience gained. Note that it is a double + * because it gets converted to an integer at + * the very last moment in MMOCore + * @param hologramLocation Location of displayed hologram. When set to null + * and if exp holograms are enabled it will take the + * player's location instead. + * @param source Why the EXP was gained + */ + void giveExperience(PlayerData playerData, double experience, @org.jetbrains.annotations.Nullable Location hologramLocation, @NotNull EXPSource source); + + /** + * Experience sources handle both CLASS experience sources and PROFESSION + * experience sources. Professions have no problem because whatever + * class the player has chosen, he can get exp in that profession. + *

+ * But class experience sources must first make sure that the player has + * the right class before giving exp to the player + */ + boolean shouldHandle(PlayerData playerData); + + @Nullable + default Location getPlayerLocation(PlayerData player) { + return player.isOnline() ? MMOCoreUtils.getCenterLocation(player.getPlayer()) : null; + } } diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java index ade8f4fb..27870d28 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -3,14 +3,15 @@ package net.Indyuce.mmocore.experience; import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; -import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.ProfessionExperienceDispenser; import org.apache.commons.lang.Validate; +import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; @@ -64,10 +65,9 @@ public class Profession extends PostLoadObject implements ExperienceObject { maxLevel = config.getInt("max-level"); if (config.contains("exp-sources")) { - ExperienceDispenser dispenser = new ProfessionExperienceDispenser(this); for (String key : config.getStringList("exp-sources")) try { - MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), dispenser)); + MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this)); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not register exp source '" + key + "' from profession '" + id + "': " + exception.getMessage()); @@ -124,6 +124,18 @@ public class Profession extends PostLoadObject implements ExperienceObject { return Objects.requireNonNull(expTable, "Profession has no exp table"); } + @Override + public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { + hologramLocation = !getOption(Profession.ProfessionOption.EXP_HOLOGRAMS) ? null + : hologramLocation == null ? getPlayerLocation(playerData) : hologramLocation; + playerData.getCollectionSkills().giveExperience(this, experience, EXPSource.SOURCE, hologramLocation); + } + + @Override + public boolean shouldHandle(PlayerData playerData) { + return true; + } + public static enum ProfessionOption { /** diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java deleted file mode 100644 index 8be7dfe0..00000000 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.Indyuce.mmocore.experience.dispenser; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.profess.PlayerClass; -import net.Indyuce.mmocore.experience.EXPSource; -import org.bukkit.Location; -import org.jetbrains.annotations.Nullable; - -public class ClassExperienceDispenser implements ExperienceDispenser { - private final PlayerClass profess; - - public ClassExperienceDispenser(PlayerClass profess) { - this.profess = profess; - } - - @Override - public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { - hologramLocation = !MMOCore.plugin.getConfig().getBoolean("display-main-class-exp-holograms") ? null - : hologramLocation == null ? getPlayerLocation(playerData) : hologramLocation; - playerData.giveExperience(experience, source, hologramLocation, true); - } - - @Override - public boolean shouldHandle(PlayerData playerData) { - return playerData.getProfess().equals(profess); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java index 5ac9eac0..2218bace 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java +++ b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java @@ -11,7 +11,10 @@ import org.jetbrains.annotations.Nullable; * Used to differenciate between the main class experience and * experience given in a specific profession. Also being used to * monitor EXP holograms. + * + * @deprecated Merged with {@link net.Indyuce.mmocore.experience.ExperienceObject} */ +@Deprecated public interface ExperienceDispenser { /** diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java deleted file mode 100644 index af385fc1..00000000 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.Indyuce.mmocore.experience.dispenser; - -import net.Indyuce.mmocore.experience.EXPSource; -import net.Indyuce.mmocore.experience.Profession; -import net.Indyuce.mmocore.api.player.PlayerData; -import org.bukkit.Location; -import org.jetbrains.annotations.Nullable; - -public class ProfessionExperienceDispenser implements ExperienceDispenser { - private final Profession profession; - - public ProfessionExperienceDispenser(Profession profession) { - this.profession = profession; - } - - @Override - public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { - hologramLocation = !profession.getOption(Profession.ProfessionOption.EXP_HOLOGRAMS) ? null - : hologramLocation == null ? getPlayerLocation(playerData) : hologramLocation; - playerData.getCollectionSkills().giveExperience(profession, experience, EXPSource.SOURCE, hologramLocation); - } - - @Override - public boolean shouldHandle(PlayerData playerData) { - return true; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java deleted file mode 100644 index fc99e73b..00000000 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.Indyuce.mmocore.experience.dispenser; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.experience.EXPSource; -import org.bukkit.Location; -import org.jetbrains.annotations.Nullable; - -public class SimpleExperienceDispenser implements ExperienceDispenser { - - @Override - public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { - hologramLocation = !MMOCore.plugin.getConfig().getBoolean("display-main-class-exp-holograms") ? null - : hologramLocation == null ? getPlayerLocation(playerData) : hologramLocation; - playerData.giveExperience(experience, source, hologramLocation, true); - } - - @Override - public boolean shouldHandle(PlayerData playerData) { - return true; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java index 67f7c279..be250b6a 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java @@ -41,6 +41,7 @@ public class MMOLoadManager { return load(Objective.class, config, loader -> loader.loadObjective(config, section)); } + @Deprecated public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { return load(ExperienceSource.class, config, loader -> loader.loadExperienceSource(config, dispenser)); } From 93377b6027b56a50038e2d67e19b7f54b1d2caea Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 25 Apr 2022 21:09:01 +0200 Subject: [PATCH 03/91] Fixed chest tier chance rolling --- .../Indyuce/mmocore/loot/chest/ChestTier.java | 7 +++++-- .../mmocore/loot/chest/LootChestRegion.java | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java b/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java index 770c7986..de9ea2a3 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java @@ -10,8 +10,7 @@ public class ChestTier { private final TierEffect effect; private final ScalingFormula capacity; private final DropTable table; - - public final double chance; + private final double chance; public ChestTier(ConfigurationSection config) { effect = config.isConfigurationSection("effect") ? new TierEffect(config.getConfigurationSection("effect")) : null; @@ -24,6 +23,10 @@ public class ChestTier { return capacity.calculate(player.getLevel()); } + public double getChance() { + return chance; + } + public DropTable getDropTable() { return table; } diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java index ef7e8217..c234d155 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java @@ -119,14 +119,19 @@ public class LootChestRegion { // TODO stat to increase chance to get higher tiers? public ChestTier rollTier() { - double s = 0; - for (ChestTier tier : tiers) { - if (random.nextDouble() < tier.chance / (1 - s)) - return tier; - s += tier.chance; - } + // Calculate sum of all chances and then normalize + double norm = 0; + for (ChestTier tier : tiers) + norm += tier.getChance(); - return tiers.stream().findAny().orElse(null); + Validate.isTrue(norm > 0, "No tier was found"); + + double sum = 0; + for (ChestTier tier : tiers) + if (random.nextDouble() < (sum += tier.getChance()) / norm) + return tier; + + throw new RuntimeException("Could not roll random chest tier"); } public Location getRandomLocation(Location center) { From 1765b15707c6ccf1056b251376a8c55f5f454eae Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 26 Apr 2022 14:35:12 +0200 Subject: [PATCH 04/91] Improved party target restriction --- .../java/net/Indyuce/mmocore/MMOCore.java | 6 ++-- .../comp/MMOCoreTargetRestriction.java | 28 ------------------- .../party/PartyMemberTargetRestriction.java | 20 +++++++++++++ .../party/provided/MMOCorePartyModule.java | 1 - .../provided}/PartyListener.java | 25 +---------------- 5 files changed, 24 insertions(+), 56 deletions(-) delete mode 100644 src/main/java/net/Indyuce/mmocore/comp/MMOCoreTargetRestriction.java create mode 100644 src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java rename src/main/java/net/Indyuce/mmocore/{listener => party/provided}/PartyListener.java (61%) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index bb02fa74..cd21f590 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -12,7 +12,6 @@ import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.debug.DebugMode; import net.Indyuce.mmocore.command.*; -import net.Indyuce.mmocore.comp.MMOCoreTargetRestriction; import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader; import net.Indyuce.mmocore.comp.mythicmobs.MythicHook; @@ -41,6 +40,7 @@ import net.Indyuce.mmocore.manager.profession.*; import net.Indyuce.mmocore.manager.social.BoosterManager; import net.Indyuce.mmocore.manager.social.PartyManager; import net.Indyuce.mmocore.manager.social.RequestManager; +import net.Indyuce.mmocore.party.PartyMemberTargetRestriction; import net.Indyuce.mmocore.party.PartyModule; import net.Indyuce.mmocore.party.PartyModuleType; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; @@ -116,8 +116,8 @@ public class MMOCore extends LuminePlugin { return; } - // Register target restrictions due to MMOCore in MythicLib - MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); + // Register MMOCore-specific target restrictions + MythicLib.plugin.getEntities().registerRestriction(new PartyMemberTargetRestriction()); // Register extra objective, drop items... if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) diff --git a/src/main/java/net/Indyuce/mmocore/comp/MMOCoreTargetRestriction.java b/src/main/java/net/Indyuce/mmocore/comp/MMOCoreTargetRestriction.java deleted file mode 100644 index 5935b582..00000000 --- a/src/main/java/net/Indyuce/mmocore/comp/MMOCoreTargetRestriction.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.Indyuce.mmocore.comp; - -import io.lumine.mythic.lib.comp.target.InteractionType; -import io.lumine.mythic.lib.comp.target.TargetRestriction; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.party.AbstractParty; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; - -import java.util.Optional; - -public class MMOCoreTargetRestriction implements TargetRestriction { - - @Override - public boolean canTarget(Player player, LivingEntity target, InteractionType interaction) { - - if (interaction.isOffense() && target instanceof Player && PlayerData.has(target.getUniqueId())) { - PlayerData targetData = PlayerData.get(target.getUniqueId()); - - // Check for the same party - AbstractParty party = targetData.getParty(); - if (party != null && party.hasMember(player)) - return false; - } - - return true; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java b/src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java new file mode 100644 index 00000000..d2a6989f --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java @@ -0,0 +1,20 @@ +package net.Indyuce.mmocore.party; + +import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.comp.target.TargetRestriction; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; + +public class PartyMemberTargetRestriction implements TargetRestriction { + + @Override + public boolean canTarget(Player player, LivingEntity livingEntity, InteractionType interactionType) { + if (!interactionType.isOffense() || !(livingEntity instanceof Player) || livingEntity.hasMetadata("NPC")) + return true; + + AbstractParty party = MMOCore.plugin.partyModule.getParty(PlayerData.get(player)); + return party == null || !party.hasMember((Player) livingEntity); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java b/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java index 98ad8656..3c0155cb 100644 --- a/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java +++ b/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java @@ -2,7 +2,6 @@ package net.Indyuce.mmocore.party.provided; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.listener.PartyListener; import net.Indyuce.mmocore.party.PartyModule; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; diff --git a/src/main/java/net/Indyuce/mmocore/listener/PartyListener.java b/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java similarity index 61% rename from src/main/java/net/Indyuce/mmocore/listener/PartyListener.java rename to src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java index f5ed1be4..10d0a69d 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/PartyListener.java +++ b/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java @@ -1,16 +1,10 @@ -package net.Indyuce.mmocore.listener; +package net.Indyuce.mmocore.party.provided; -import io.lumine.mythic.lib.api.event.PlayerAttackEvent; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.social.PartyChatEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.manager.ConfigManager.SimpleMessage; -import net.Indyuce.mmocore.party.AbstractParty; -import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; -import net.Indyuce.mmocore.party.provided.Party; import org.bukkit.Bukkit; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -45,21 +39,4 @@ public class PartyListener implements Listener { party.getOnlineMembers().forEach(member -> format.send(member.getPlayer())); }); } - - /** - * Cancel damage of players from the same party - * - * @deprecated This should be useful with the {@link io.lumine.mythic.lib.comp.target.TargetRestriction} update - */ - @Deprecated - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) - public void b(PlayerAttackEvent event) { - LivingEntity entity = event.getEntity(); - if (entity instanceof Player && !entity.hasMetadata("NPC")) { - PlayerData targetData = PlayerData.get((Player) event.getEntity()); - AbstractParty party = targetData.getParty(); - if (party != null && party.hasMember(event.getData().getPlayer())) - event.setCancelled(true); - } - } } From a13987cac903d744bf3520b9295cb86bc07afde3 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 5 May 2022 22:22:56 +0200 Subject: [PATCH 05/91] giveExperience does nothing if exp is negative --- src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java | 3 +++ .../java/net/Indyuce/mmocore/experience/PlayerProfessions.java | 2 ++ 2 files changed, 5 insertions(+) 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 0fae0302..3827cad3 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -532,6 +532,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc * @param splitExp Should the exp be split among party members */ public void giveExperience(double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) { + if (value <= 0) + return; + if (hasReachedMaxLevel()) { setExperience(0); return; diff --git a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index f7dd9963..1c84c39e 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -157,6 +157,8 @@ public class PlayerProfessions { public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation) { Validate.isTrue(playerData.isOnline(), "Cannot give experience to offline player"); + if (value <= 0) + return; if (hasReachedMaxLevel(profession)) { setExperience(profession, 0); From 13c04695944cfbde74ce3f324840ede30f0d849e Mon Sep 17 00:00:00 2001 From: Indyuce Date: Fri, 20 May 2022 17:42:48 +0200 Subject: [PATCH 06/91] Tier rolling cleanup --- .../mmocore/loot/chest/LootChestRegion.java | 37 +++++++++++++------ .../condition/PermissionCondition.java | 4 +- .../mmocore/manager/ConfigManager.java | 2 + src/main/resources/config.yml | 12 ++++++ 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java index 6e265a3b..8e6afc9a 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java @@ -14,6 +14,7 @@ import org.bukkit.block.Chest; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.logging.Level; @@ -117,25 +118,39 @@ public class LootChestRegion { MMOCore.plugin.lootChests.register(lootChest); } + /** + * @param player Player rolling the tier + * @return A randomly picked tiers taking into account tier spawn rates + * and the player Chance attribute + */ + @NotNull public ChestTier rollTier(PlayerData player) { - double chance = player.getStats().getStat(StatType.CHANCE); + double chance = player.getStats().getStat(StatType.CHANCE) * MMOCore.plugin.configManager.lootChestsChanceWeight; - //chance=0 ->the tier.chance remains the same - //chance ->+inf -> the tier.chance becomes the same for everyone, uniform law - //chance=8-> tierChance=sqrt(tierChance) double sum = 0; - for (ChestTier tier : tiers) { - sum += Math.pow(tier.chance, 1 / Math.pow((1 + chance),1/3)); - } + for (ChestTier tier : tiers) + sum += getTierCoefficient(tier.getChance(), chance); + Validate.isTrue(sum > 0, "No chest tier was found"); - double s=0; + double cummulated = 0; for (ChestTier tier : tiers) { - s+=Math.pow(tier.chance, 1 / Math.pow((1 + chance),1/3))/sum; - if (random.nextDouble() < s) + cummulated += getTierCoefficient(tier.getChance(), chance); + if (random.nextDouble() < cummulated / sum) return tier; } - return tiers.stream().findAny().orElse(null); + throw new RuntimeException("Could not roll chest tier"); + } + + private static final double CHANCE_COEF = 7 / 100; + + /** + * - Chance = 0 | tier coefficient is left unchanged. + * - Chance -> +oo | all tier coefficients are the same (1) + * - Chance = 50 | coefficients become their square roots + */ + private double getTierCoefficient(double initialTierChance, double chance) { + return Math.pow(initialTierChance, 1 / Math.pow(1 + CHANCE_COEF * chance, 1 / 3)); } public Location getRandomLocation(Location center) { diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/condition/PermissionCondition.java b/src/main/java/net/Indyuce/mmocore/loot/droptable/condition/PermissionCondition.java index 0d009b44..43967da5 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/droptable/condition/PermissionCondition.java +++ b/src/main/java/net/Indyuce/mmocore/loot/droptable/condition/PermissionCondition.java @@ -15,8 +15,6 @@ public class PermissionCondition extends Condition { @Override public boolean isMet(ConditionInstance entity) { - if (entity.getEntity() instanceof Player) - return entity.getEntity().hasPermission(perm); - return false; + return entity.getEntity() instanceof Player && entity.getEntity().hasPermission(perm); } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 96a41f87..bcc54190 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -27,6 +27,7 @@ public class ConfigManager { public String partyChatPrefix, noSkillBoundPlaceholder; public ChatColor staminaFull, staminaHalf, staminaEmpty; public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; + public double lootChestsChanceWeight; private final FileConfiguration messages; private final boolean chatInput; @@ -97,6 +98,7 @@ public class ConfigManager { lootChestPlayerCooldown = (long) MMOCore.plugin.getConfig().getDouble("player-cooldown") * 1000L; globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50; noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message(); + lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests"); staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index adce82fd..5611ba68 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -58,6 +58,18 @@ protect-custom-mine: false # - parties_and_friends party-plugin: mmocore +# MythicLib introduces a CHANCE stat that is used in +# several different systems in MMOCore. By changing these +# weights you can define how much the Chance stat impacts +# the different features implemented by MMOCore +# +# e.g setting some weight to 2 will DOUBLE the effect of +# the chance stat in one particular system. The weights are +# all set to 1 by default, this option is really server specific +chance-stat-weight: + + loot-chests: 1 + # Whether blocks generated with a "cobblegenerator" should # provide the player with experience points or not should-cobblestone-generators-give-exp: false From a7e3f9554fdd598bccd42d1f12072fd0d46b18e7 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 22 May 2022 16:49:53 +0200 Subject: [PATCH 07/91] Loot chest O(1) lookup time --- .../mmocore/api/player/PlayerData.java | 20 ++-- .../listener/LootableChestsListener.java | 42 ++++--- .../Indyuce/mmocore/loot/chest/LootChest.java | 27 +++-- .../mmocore/manager/LootChestManager.java | 107 +++++++++--------- .../Indyuce/mmocore/player/Unlockable.java | 8 +- .../net/Indyuce/mmocore/skill/ClassSkill.java | 4 + .../mmocore/skill/RegisteredSkill.java | 8 +- .../tree/modifier/UnlockSkillModifier.java | 28 +++++ .../mmocore/util/item/HashableLocation.java | 51 +++++++++ 9 files changed, 202 insertions(+), 93 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java create mode 100644 src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java 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 f2ed5051..9bb4c523 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -1,15 +1,11 @@ package net.Indyuce.mmocore.api.player; -import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.player.TemporaryPlayerData; import io.lumine.mythic.lib.player.cooldown.CooldownMap; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.SoundEvent; -import net.Indyuce.mmocore.player.Unlockable; -import net.Indyuce.mmocore.waypoint.CostType; -import net.Indyuce.mmocore.waypoint.Waypoint; import net.Indyuce.mmocore.api.event.PlayerExperienceGainEvent; import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; @@ -25,7 +21,6 @@ import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.api.util.Closable; import net.Indyuce.mmocore.api.util.MMOCoreUtils; -import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.ExperienceTableClaimer; @@ -33,11 +28,14 @@ import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.droptable.ExperienceItem; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.provided.Party; +import net.Indyuce.mmocore.player.Unlockable; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.Indyuce.mmocore.skill.cast.SkillCastingHandler; +import net.Indyuce.mmocore.waypoint.Waypoint; import net.Indyuce.mmocore.waypoint.WaypointOption; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; @@ -88,8 +86,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc /** * Saves all the items that have been unlocked so far by - * the player. This can be used by other plugins by - * implementing the {@link Unlockable} interface + * the player. This is used for: + * - waypoints + * - skills * * @see {@link Unlockable} */ @@ -289,8 +288,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc return guild != null; } + /** + * @return If the item is unlocked by the player + */ public boolean hasUnlocked(Unlockable unlockable) { - throw new RuntimeException("Not implemented yet"); + return unlockedItems.contains(unlockable.getUnlockNamespacedKey()); } /** @@ -299,7 +301,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc * @return If the item was already unlocked when calling this method */ public boolean unlock(Unlockable unlockable) { - throw new RuntimeException("Not implemented yet"); + return unlockedItems.add(unlockable.getUnlockNamespacedKey()); } public void setLevel(int level) { diff --git a/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java b/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java index b7f837d3..06cdf5ad 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java @@ -1,22 +1,36 @@ package net.Indyuce.mmocore.listener; -import org.bukkit.block.Chest; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryCloseEvent; - import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.loot.chest.LootChest; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; public class LootableChestsListener implements Listener { - @EventHandler - public void a(InventoryCloseEvent event) { - if (!(event.getInventory().getHolder() instanceof Chest)) - return; - Chest chest = (Chest) event.getInventory().getHolder(); - LootChest lootChest = MMOCore.plugin.lootChests.getChest(chest.getLocation()); - if (lootChest != null) - lootChest.expire(true); - } + @EventHandler + public void expireOnClose(InventoryCloseEvent event) { + if (!(event.getInventory().getHolder() instanceof Chest)) + return; + + Chest chest = (Chest) event.getInventory().getHolder(); + LootChest lootChest = MMOCore.plugin.lootChests.getChest(chest.getLocation()); + if (lootChest != null) + lootChest.expire(true); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) + public void noBreaking(BlockBreakEvent event) { + Block block = event.getBlock(); + if (block.getType() == Material.CHEST) { + LootChest lootChest = MMOCore.plugin.lootChests.getChest(block.getLocation()); + if (lootChest != null) + event.setCancelled(true); + } + } } diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java index 8c6d2ed3..b5d636e7 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java @@ -2,6 +2,7 @@ package net.Indyuce.mmocore.loot.chest; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.SoundEvent; +import net.Indyuce.mmocore.util.item.HashableLocation; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.Material; @@ -52,7 +53,7 @@ public class LootChest { public boolean hasPlayerNearby() { for (Player player : block.loc.getWorld().getPlayers()) - if (player.getLocation().distanceSquared(block.loc) < 625) + if (player.getLocation().distanceSquared(block.loc.bukkit()) < 625) return true; return false; } @@ -78,8 +79,8 @@ public class LootChest { // If a player is responsible of closing the chest, close it with sound if (player) { - MMOCore.plugin.soundManager.getSound(SoundEvent.CLOSE_LOOT_CHEST).playAt(block.loc); - block.loc.getWorld().spawnParticle(Particle.CRIT, block.loc.clone().add(.5, .5, .5), 16, 0, 0, 0, .5); + MMOCore.plugin.soundManager.getSound(SoundEvent.CLOSE_LOOT_CHEST).playAt(block.loc.bukkit()); + block.loc.getWorld().spawnParticle(Particle.CRIT, block.loc.bukkit().add(.5, .5, .5), 16, 0, 0, 0, .5); } /* @@ -87,7 +88,7 @@ public class LootChest { * off and accumulate on the ground (+during dev phase) */ else - ((Chest) block.loc.getBlock().getState()).getBlockInventory().clear(); + ((Chest) block.loc.bukkit().getBlock().getState()).getBlockInventory().clear(); block.restore(); if (effectRunnable != null) @@ -97,22 +98,28 @@ public class LootChest { public static class ReplacedBlock { private final Material material; private final BlockData data; - private final Location loc; + private final HashableLocation loc; public ReplacedBlock(Block block) { this.material = block.getType(); this.data = block.getBlockData(); - this.loc = block.getLocation(); + this.loc = new HashableLocation(block.getLocation()); } + public HashableLocation getLocation() { + return loc; + } + + @Deprecated public boolean matches(Location loc) { - return this.loc.getWorld().equals(loc.getWorld()) && this.loc.getBlockX() == loc.getBlockX() && this.loc.getBlockY() == loc.getBlockY() - && this.loc.getBlockZ() == loc.getBlockZ(); + return this.loc.getWorld().equals(loc.getWorld()) && this.loc.getX() == loc.getBlockX() && this.loc.getY() == loc.getBlockY() + && this.loc.getZ() == loc.getBlockZ(); } public void restore() { - loc.getBlock().setType(material); - loc.getBlock().setBlockData(data); + Block block = loc.bukkit().getBlock(); + block.setType(material); + block.setBlockData(data); } } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java b/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java index 4dab3230..c0cc59bc 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java @@ -1,33 +1,36 @@ package net.Indyuce.mmocore.manager; -import java.util.*; -import java.util.logging.Level; - -import org.bukkit.Location; -import org.bukkit.configuration.file.FileConfiguration; - import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.loot.chest.LootChest; import net.Indyuce.mmocore.loot.chest.LootChestRegion; +import net.Indyuce.mmocore.util.item.HashableLocation; +import org.bukkit.Location; +import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.logging.Level; + public class LootChestManager implements MMOCoreManager { - /** - * Active loot chests in the server - */ - private final Set active = new HashSet<>(); + /** + * Active loot chests in the server + */ + private final Map active = new HashMap<>(); - /** - * Registered loot chest regions - */ - private final Map regions = new HashMap<>(); + /** + * Registered loot chest regions + */ + private final Map regions = new HashMap<>(); - public boolean hasRegion(String id) { - return regions.containsKey(id); - } + public boolean hasRegion(String id) { + return regions.containsKey(id); + } /** * @return Region with specific identifier @@ -38,48 +41,42 @@ public class LootChestManager implements MMOCoreManager { return Objects.requireNonNull(regions.get(id), "Could not find region with ID '" + id + "'"); } - public Collection getRegions() { - return regions.values(); - } + public Collection getRegions() { + return regions.values(); + } - public Set getActive() { - return active; - } + public Collection getActive() { + return active.values(); + } - public void register(LootChest chest) { - active.add(chest); - } + public void register(LootChest chest) { + active.put(chest.getBlock().getLocation(), chest); + } - public void unregister(LootChest chest) { - active.remove(chest); - } + public void unregister(LootChest chest) { + active.remove(chest.getBlock().getLocation()); + } - @Nullable - public LootChest getChest(Location loc) { + @Nullable + public LootChest getChest(Location loc) { + return active.get(new HashableLocation(loc)); + } - for (LootChest chest : active) - if (chest.getBlock().matches(loc)) - return chest; + @Override + public void initialize(boolean clearBefore) { + if (clearBefore) { + regions.values().forEach(region -> region.getRunnable().cancel()); + regions.clear(); + } - return null; - } - - @Override - public void initialize(boolean clearBefore) { - if (clearBefore) { - regions.values().forEach(region -> region.getRunnable().cancel()); - regions.clear(); - } - - FileConfiguration config = new ConfigFile("loot-chests").getConfig(); - for (String key : config.getKeys(false)) - try { - LootChestRegion region = new LootChestRegion(config.getConfigurationSection(key)); - regions.put(region.getId(), region); - } catch (IllegalArgumentException exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, - "An error occured while trying to load loot chest region '" + key + "': " + exception.getMessage()); - } - - } + FileConfiguration config = new ConfigFile("loot-chests").getConfig(); + for (String key : config.getKeys(false)) + try { + LootChestRegion region = new LootChestRegion(config.getConfigurationSection(key)); + regions.put(region.getId(), region); + } catch (IllegalArgumentException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, + "An error occured while trying to load loot chest region '" + key + "': " + exception.getMessage()); + } + } } diff --git a/src/main/java/net/Indyuce/mmocore/player/Unlockable.java b/src/main/java/net/Indyuce/mmocore/player/Unlockable.java index 6940d1a1..9349f308 100644 --- a/src/main/java/net/Indyuce/mmocore/player/Unlockable.java +++ b/src/main/java/net/Indyuce/mmocore/player/Unlockable.java @@ -3,8 +3,8 @@ package net.Indyuce.mmocore.player; import net.Indyuce.mmocore.api.player.PlayerData; /** - * Some item that can be unlocked. ALl unlockable are saved in the same list in - * the player data. This useful list can be used for: + * Some item that can be unlocked. All unlockables are saved in the + * same list in the player data. This useful list can be used for: * - waypoints * - skill tree nodes * - skills using skill books? TODO @@ -15,8 +15,8 @@ import net.Indyuce.mmocore.api.player.PlayerData; public interface Unlockable { /** - * Format being used is the minecraft's default - * namespaced key format, e.g "skill_tree:strength_1_5" + * Format being used is the minecraft's default namespaced + * key format, e.g "skill_tree:strength_1_5" for readability */ String getUnlockNamespacedKey(); } diff --git a/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java b/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java index 1d72842b..841c76a2 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java +++ b/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.player.cooldown.CooldownObject; import io.lumine.mythic.lib.player.modifier.ModifierSource; import io.lumine.mythic.lib.player.skill.PassiveSkill; +import io.lumine.mythic.lib.skill.custom.condition.Condition; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; @@ -17,6 +18,9 @@ public class ClassSkill implements CooldownObject { private final int unlockLevel, maxSkillLevel; private final Map modifiers = new HashMap<>(); + @Deprecated + private final Set unlockConditions = new HashSet<>(); + /** * Class used to save information about skills IN A CLASS CONTEXT i.e at * which level the skill can be unlocked, etc. diff --git a/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java b/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java index 8fb2b970..0d5ada32 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java +++ b/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java @@ -5,6 +5,7 @@ import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.trigger.TriggerType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.player.Unlockable; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -15,7 +16,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; -public class RegisteredSkill { +public class RegisteredSkill implements Unlockable { private final SkillHandler handler; private final String name; private final Map defaultModifiers = new HashMap<>(); @@ -45,6 +46,11 @@ public class RegisteredSkill { this.triggerType = triggerType; } + @Override + public String getUnlockNamespacedKey() { + return "registered_skill:" + handler.getId().toLowerCase(); + } + public SkillHandler getHandler() { return handler; } diff --git a/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java b/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java new file mode 100644 index 00000000..570b8ab2 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java @@ -0,0 +1,28 @@ +package net.Indyuce.mmocore.tree.modifier; + +import io.lumine.mythic.lib.api.player.EquipmentSlot; +import io.lumine.mythic.lib.api.player.MMOPlayerData; +import io.lumine.mythic.lib.player.modifier.ModifierSource; +import io.lumine.mythic.lib.player.modifier.PlayerModifier; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.skill.RegisteredSkill; +import org.apache.commons.lang.NotImplementedException; + +public class UnlockSkillModifier extends PlayerModifier { + private RegisteredSkill unlocked = null; + + public UnlockSkillModifier(String key, EquipmentSlot slot, ModifierSource source) { + super(key, slot, source); + } + + @Override + public void register(MMOPlayerData mmoPlayerData) { + PlayerData playerData = PlayerData.get(mmoPlayerData.getUniqueId()); + // playerData.unlock(unlocked); + } + + @Override + public void unregister(MMOPlayerData mmoPlayerData) { + throw new NotImplementedException(""); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java b/src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java new file mode 100644 index 00000000..1e910bbd --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java @@ -0,0 +1,51 @@ +package net.Indyuce.mmocore.util.item; + +import org.bukkit.Location; +import org.bukkit.World; + +import java.util.Objects; + +public class HashableLocation { + private final World world; + private final int x, y, z; + + public HashableLocation(Location loc) { + this.world = loc.getWorld(); + this.x = loc.getBlockX(); + this.y = loc.getBlockY(); + this.z = loc.getBlockZ(); + } + + public World getWorld() { + return world; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public Location bukkit() { + return new Location(world, x, y, z); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + HashableLocation that = (HashableLocation) o; + return x == that.x && y == that.y && z == that.z && world.equals(that.world); + } + + @Override + public int hashCode() { + return Objects.hash(world, x, y, z); + } +} \ No newline at end of file From 758caf747db39e5b4e6e421434135a74e7f5225d Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 23 May 2022 11:10:02 +0200 Subject: [PATCH 08/91] Waypoints cleanup --- pom.xml | 4 - .../mmocore/api/player/PlayerData.java | 4 +- .../Indyuce/mmocore/gui/WaypointViewer.java | 56 ++-- .../mmocore/loot/chest/LootChestRegion.java | 10 +- .../mmocore/manager/WaypointManager.java | 7 + .../Indyuce/mmocore/waypoint/CostType.java | 30 --- .../Indyuce/mmocore/waypoint/Waypoint.java | 239 +++++------------- .../mmocore/waypoint/WaypointPath.java | 85 +++++++ src/main/resources/default/gui/waypoints.yml | 2 +- src/main/resources/default/waypoints.yml | 20 +- 10 files changed, 210 insertions(+), 247 deletions(-) delete mode 100644 src/main/java/net/Indyuce/mmocore/waypoint/CostType.java create mode 100644 src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java diff --git a/pom.xml b/pom.xml index 51b355ac..85ecfca0 100644 --- a/pom.xml +++ b/pom.xml @@ -43,12 +43,8 @@ org.apache.maven.plugins maven-jar-plugin 2.3.1 - - C:\Users\guill\Minecraft Server\Server\plugins - - org.apache.maven.plugins maven-compiler-plugin 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 e2ca69ab..8b01f622 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -553,7 +553,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc member.giveExperience(value, EXPSource.PARTY_SHARING, null, false); } - PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(this, value, source); + PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(this, value, source); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) return; @@ -873,7 +873,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 */ public boolean canChooseSubclass() { for (Subclass subclass : getProfess().getSubclasses()) diff --git a/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java b/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java index 1f68d5ac..6dfbfb56 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java +++ b/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java @@ -8,11 +8,10 @@ import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.waypoint.CostType; import net.Indyuce.mmocore.waypoint.Waypoint; -import net.Indyuce.mmocore.waypoint.WaypointOption; +import net.Indyuce.mmocore.waypoint.WaypointPath; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.configuration.ConfigurationSection; @@ -21,8 +20,12 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; +import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class WaypointViewer extends EditableInventory { public WaypointViewer() { @@ -68,7 +71,6 @@ public class WaypointViewer extends EditableInventory { private final SimplePlaceholderItem noWaypoint, locked; private final WaypointItemHandler availWaypoint, noStellium, notLinked, notDynamic, currentWayPoint; - public WaypointItem(ConfigurationSection config) { super(Material.BARRIER, config); @@ -80,7 +82,6 @@ public class WaypointViewer extends EditableInventory { Validate.notNull(config.getConfigurationSection("not-enough-stellium"), "Could not load 'not-enough-stellium' config"); Validate.notNull(config.getConfigurationSection("display"), "Could not load 'display' config"); - noWaypoint = new SimplePlaceholderItem(config.getConfigurationSection("no-waypoint")); locked = new SimplePlaceholderItem(config.getConfigurationSection("locked")); notLinked = new WaypointItemHandler(config.getConfigurationSection("not-a-destination"), true); @@ -107,7 +108,6 @@ public class WaypointViewer extends EditableInventory { if (inv.current != null && inv.current.equals(waypoint)) return currentWayPoint.display(inv, n); - if (!inv.getPlayerData().hasWaypoint(waypoint)) return locked.display(inv, n); @@ -115,7 +115,6 @@ public class WaypointViewer extends EditableInventory { if (inv.current != null && !inv.paths.containsKey(waypoint)) return notLinked.display(inv, n); - // Not dynamic waypoint if (inv.current == null && !inv.paths.containsKey(waypoint)) return notDynamic.display(inv, n); @@ -124,7 +123,6 @@ public class WaypointViewer extends EditableInventory { if (inv.paths.get(waypoint).getCost() > inv.getPlayerData().getStellium()) return noStellium.display(inv, n); - return availWaypoint.display(inv, n); } } @@ -144,6 +142,16 @@ public class WaypointViewer extends EditableInventory { // If a player can teleport to another waypoint given his location Waypoint waypoint = inv.waypoints.get(inv.page * inv.getEditable().getByFunction("waypoint").getSlots().size() + n); ItemMeta meta = disp.getItemMeta(); + + // Add waypoint lore if not empty + if (!waypoint.getLore().isEmpty()) { + List lore = meta.getLore(); + Placeholders placeholders = new Placeholders(); + for (String str : waypoint.getLore()) + lore.add(0, ChatColor.GRAY + placeholders.apply(inv.getPlayer(), str)); + meta.setLore(lore); + } + PersistentDataContainer container = meta.getPersistentDataContainer(); container.set(new NamespacedKey(MMOCore.plugin, "waypointId"), PersistentDataType.STRING, waypoint.getId()); disp.setItemMeta(meta); @@ -160,7 +168,7 @@ public class WaypointViewer extends EditableInventory { holders.register("current_cost", inv.paths.get(waypoint).getCost()); holders.register("normal_cost", decimal.format(inv.paths.containsKey(waypoint) ? inv.paths.get(waypoint).getCost() : Double.POSITIVE_INFINITY)); holders.register("dynamic_cost", decimal.format(waypoint.getDynamicCost())); - holders.register("intermediary_waypoints", inv.paths.containsKey(waypoint) ? inv.paths.get(waypoint).displayIntermediaryWayPoints(inv.waypointCostType.equals(CostType.DYNAMIC_USE)) : "none"); + holders.register("intermediary_waypoints", inv.paths.containsKey(waypoint) ? inv.paths.get(waypoint).displayIntermediaryWayPoints(inv.isDynamicUse()) : "None"); } return holders; @@ -169,9 +177,9 @@ public class WaypointViewer extends EditableInventory { public class WaypointViewerInventory extends GeneratedInventory { private final List waypoints = new ArrayList<>(MMOCore.plugin.waypointManager.getAll()); + @Nullable private final Waypoint current; - private final Map paths = new HashMap<>(); - private final CostType waypointCostType; + private final Map paths = new HashMap<>(); private int page; @@ -179,32 +187,29 @@ public class WaypointViewer extends EditableInventory { super(playerData, editable); this.current = current; - if (current != null) { - for (Waypoint.PathInfo pathInfo : current.getAllPath()) + if (current != null) + for (WaypointPath pathInfo : current.getAllPath()) paths.put(pathInfo.getFinalWaypoint(), pathInfo); - } + if (current == null) { //Iterate through all the dynamic points and find all the points it is linked to and the path HashMap dynamicPoints = new HashMap<>(); //We first check all the dynamic waypoints for (Waypoint waypoint : waypoints) { - if (waypoint.canHaveDynamicUse(playerData.getPlayer())) { - paths.put(waypoint, new Waypoint.PathInfo(waypoint, waypoint.getDynamicCost())); + if (waypoint.mayBeUsedDynamically(playerData.getPlayer())) { + paths.put(waypoint, new WaypointPath(waypoint, waypoint.getDynamicCost())); dynamicPoints.put(waypoint, waypoint.getDynamicCost()); } } - for(Waypoint source: dynamicPoints.keySet()){ - for (Waypoint.PathInfo target : source.getAllPath()) { - if (!paths.containsKey(target.getFinalWaypoint()) || paths.get(target.getFinalWaypoint()).getCost() > target.getCost()+dynamicPoints.get(source)) { + for (Waypoint source : dynamicPoints.keySet()) { + for (WaypointPath target : source.getAllPath()) { + if (!paths.containsKey(target.getFinalWaypoint()) || paths.get(target.getFinalWaypoint()).getCost() > target.getCost() + dynamicPoints.get(source)) { paths.put(target.getFinalWaypoint(), target.addCost(dynamicPoints.get(source))); } } } - } - - this.waypointCostType = current == null ? CostType.DYNAMIC_USE : CostType.NORMAL_USE; } @Override @@ -212,6 +217,10 @@ public class WaypointViewer extends EditableInventory { return getName(); } + public boolean isDynamicUse() { + return current == null; + } + @Override public void whenClicked(InventoryClickEvent event, InventoryItem item) { if (item.getFunction().equals("next")) { @@ -260,7 +269,6 @@ public class WaypointViewer extends EditableInventory { } // Stellium cost - CostType costType = current == null ? CostType.DYNAMIC_USE : CostType.NORMAL_USE; double withdraw = paths.get(waypoint).getCost(); double left = withdraw - playerData.getStellium(); if (left > 0) { diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java index 8e6afc9a..6f455b3e 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java @@ -35,7 +35,7 @@ public class LootChestRegion { } }; - private static final Random random = new Random(); + private static final Random RANDOM = new Random(); public LootChestRegion(ConfigurationSection config) { Validate.notNull(config, "Could not load config"); @@ -110,7 +110,7 @@ public class LootChestRegion { location.getBlock().setType(Material.CHEST); Chest chest = (Chest) location.getBlock().getState(); tier.getDropTable().collect(builder).forEach(item -> { - Integer slot = slots.get(random.nextInt(slots.size())); + Integer slot = slots.get(RANDOM.nextInt(slots.size())); chest.getInventory().setItem(slot, item); slots.remove(slot); }); @@ -135,7 +135,7 @@ public class LootChestRegion { double cummulated = 0; for (ChestTier tier : tiers) { cummulated += getTierCoefficient(tier.getChance(), chance); - if (random.nextDouble() < cummulated / sum) + if (RANDOM.nextDouble() < cummulated / sum) return tier; } @@ -175,9 +175,9 @@ public class LootChestRegion { * Chooses a random direction and get the block in * that direction which has the same height as the player */ - double a = random.nextDouble() * 2 * Math.PI; + double a = RANDOM.nextDouble() * 2 * Math.PI; Vector dir = new Vector(Math.cos(a), 0, Math.sin(a)) - .multiply(algOptions.minRange + random.nextDouble() * (algOptions.maxRange - algOptions.minRange)); + .multiply(algOptions.minRange + RANDOM.nextDouble() * (algOptions.maxRange - algOptions.minRange)); Location random = center.add(dir); /* diff --git a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java b/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java index 9ff105f0..f3b93d32 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java @@ -55,5 +55,12 @@ public class WaypointManager implements MMOCoreManager { } catch (RuntimeException exception) { MMOCore.log(Level.WARNING, "Could not load waypoint '" + key + "': " + exception.getMessage()); } + + for (Waypoint waypoint : waypoints.values()) + try { + waypoint.postLoad(); + } catch (RuntimeException exception) { + MMOCore.log(Level.WARNING, "Could not post-load waypoint '" + waypoint.getId() + "': " + exception.getMessage()); + } } } diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/CostType.java b/src/main/java/net/Indyuce/mmocore/waypoint/CostType.java deleted file mode 100644 index 6a0fefaa..00000000 --- a/src/main/java/net/Indyuce/mmocore/waypoint/CostType.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.Indyuce.mmocore.waypoint; - -public enum CostType { - - /** - * When teleporting to this waypoint - */ - NORMAL_USE, - - /** - * When dynamically teleporting to this waypoint - */ - DYNAMIC_USE, - - /** - * When setting your spawn point to this waypoint. - */ - // SET_SPAWNPOINT - ; - - private final String path; - - CostType() { - this.path = name().toLowerCase().replace("_", "-"); - } - - public String getPath() { - return path; - } -} diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java index 6395ea81..e8d2695f 100644 --- a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java +++ b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java @@ -1,6 +1,7 @@ package net.Indyuce.mmocore.waypoint; import io.lumine.mythic.lib.api.MMOLineConfig; +import io.lumine.mythic.lib.api.util.PostLoadObject; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.loot.chest.condition.ConditionInstance; @@ -12,12 +13,15 @@ import org.bukkit.World; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.craftbukkit.libs.jline.internal.Nullable; import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; import java.util.*; +import java.util.logging.Level; -public class Waypoint implements Unlockable { +public class Waypoint extends PostLoadObject implements Unlockable { private final String id, name; private final Location loc; + private final List lore; private final double radiusSquared; /** @@ -26,36 +30,21 @@ public class Waypoint implements Unlockable { *

* If it's empty it can access any waypoint. */ - private final Map destinations = new HashMap<>(); + private final Map destinations = new HashMap<>(); /** * Waypoint options saved here. */ private final Map options = new HashMap<>(); - - /** - * Stellium cost for each action (0 being the default cost) - */ private final double dynamicCost, setSpawnCost; - private final ArrayList dynamicUseConditions = new ArrayList<>(); - - private final Map costs = new HashMap<>(); - - public double getDynamicCost() { - return dynamicCost; - } - - public double getSetSpawnCost() { - return setSpawnCost; - } - - public double getCost(Waypoint waypoint) { - return getPath(waypoint).cost; - } + private final List dynamicUseConditions = new ArrayList<>(); public Waypoint(ConfigurationSection config) { + super(config); + id = Objects.requireNonNull(config, "Could not load config section").getName(); name = Objects.requireNonNull(config.getString("name"), "Could not load waypoint name"); + lore = Objects.requireNonNullElse(config.getStringList("lore"), new ArrayList<>()); loc = readLocation(Objects.requireNonNull(config.getString("location"), "Could not read location")); radiusSquared = Math.pow(config.getDouble("radius"), 2); @@ -63,36 +52,29 @@ public class Waypoint implements Unlockable { dynamicCost = config.getDouble("cost.dynamic-use"); setSpawnCost = config.getDouble("cost.set-spawnpoint"); - for (WaypointOption option : WaypointOption.values()) options.put(option, config.getBoolean("option." + option.getPath(), option.getDefaultValue())); - //We load all the linked WayPoints - if (config.contains("linked")) { - ConfigurationSection section = config.getConfigurationSection("linked"); - for (String key : section.getKeys(false)) { - destinations.put(key, section.getInt(key)); - } - } - if (config.contains("conditions")) { - List conditions = config.getStringList("conditions"); - for (String condition : conditions) { - dynamicUseConditions.add(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(condition))); - - } - + if (config.contains("dynamic-conditions")) { + List conditions = config.getStringList("dynamic-conditions"); + for (String condition : conditions) + try { + dynamicUseConditions.add(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(condition))); + } catch (RuntimeException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load condition '" + condition + "' from waypoint '" + id + "': " + exception.getMessage()); + } } } - public boolean canHaveDynamicUse(Player player) { - if (!options.get(WaypointOption.DYNAMIC)) - return false; + @Override + protected void whenPostLoaded(@NotNull ConfigurationSection config) { - for (Condition condition : dynamicUseConditions) { - if (!condition.isMet(new ConditionInstance(player))) - return false; + // Load waypoint network + if (config.contains("linked")) { + ConfigurationSection section = config.getConfigurationSection("linked"); + for (String key : section.getKeys(false)) + destinations.put(MMOCore.plugin.waypointManager.get(key), section.getInt(key)); } - return true; } public String getId() { @@ -103,71 +85,85 @@ public class Waypoint implements Unlockable { return name; } + public List getLore() { + return lore; + } + public Location getLocation() { return loc; } - /** * @param other Another waypoint * @return If any player standing on that waypoint can teleport to given waypoint */ @Deprecated public boolean hasDestination(Waypoint other) { - return destinations.isEmpty() || destinations.keySet().contains(other.getId()); + return destinations.isEmpty() || destinations.containsKey(other); + } + + public double getDynamicCost() { + return dynamicCost; + } + + public double getSetSpawnCost() { + return setSpawnCost; + } + + public boolean mayBeUsedDynamically(Player player) { + if (!options.get(WaypointOption.DYNAMIC)) + return false; + + for (Condition condition : dynamicUseConditions) + if (!condition.isMet(new ConditionInstance(player))) + return false; + + return true; } /** - * Checks directly if the waypoint is directly linked to the current one - * * @return Integer.POSITIVE_INFINITY if the way point is not linked + * If it is, cost of the instant travel between the two waypoints. */ - private int getSimpleCostDestination(Waypoint waypoint) { - if (!destinations.keySet().contains(waypoint.getId())) - return Integer.MAX_VALUE; - return destinations.get(waypoint.getId()); + public int getDirectCost(Waypoint waypoint) { + return destinations.getOrDefault(waypoint, Integer.MAX_VALUE); } - - public ArrayList getAllPath() { + public List getAllPath() { //All the WayPoints that have been registered - ArrayList checkedPoints = new ArrayList<>(); + List checkedPoints = new ArrayList<>(); //All the path - ArrayList paths = new ArrayList(); - ArrayList pointsToCheck = new ArrayList<>(); - pointsToCheck.add(new PathInfo(this)); + List paths = new ArrayList(); + List pointsToCheck = new ArrayList<>(); + pointsToCheck.add(new WaypointPath(this)); while (pointsToCheck.size() != 0) { - PathInfo checked = pointsToCheck.get(0); + WaypointPath checked = pointsToCheck.get(0); pointsToCheck.remove(0); paths.add(checked); checkedPoints.add(checked.getFinalWaypoint()); - for (String wayPointId : checked.getFinalWaypoint().destinations.keySet()) { - Waypoint toCheck = MMOCore.plugin.waypointManager.get(wayPointId); + for (Waypoint toCheck : checked.getFinalWaypoint().destinations.keySet()) if (!checkedPoints.contains(toCheck)) { - PathInfo toCheckInfo = checked.addWayPoint(toCheck); - //We keep pointsToCheck ordered + WaypointPath toCheckInfo = checked.addWayPoint(toCheck); + // We keep pointsToCheck ordered pointsToCheck = toCheckInfo.addInOrder(pointsToCheck); } - } } return paths; - } - @Nullable - public PathInfo getPath(Waypoint targetWaypoint) { + public WaypointPath getPath(Waypoint targetWaypoint) { //All the WayPoints that have been registered - ArrayList checkedPoints = new ArrayList<>(); + List checkedPoints = new ArrayList<>(); //All the path - ArrayList paths = new ArrayList(); - ArrayList pointsToCheck = new ArrayList<>(); - pointsToCheck.add(new PathInfo(this)); + List paths = new ArrayList(); + List pointsToCheck = new ArrayList<>(); + pointsToCheck.add(new WaypointPath(this)); while (pointsToCheck.size() != 0) { - PathInfo checked = pointsToCheck.get(0); + WaypointPath checked = pointsToCheck.get(0); pointsToCheck.remove(0); paths.add(checked); checkedPoints.add(checked.getFinalWaypoint()); @@ -175,19 +171,16 @@ public class Waypoint implements Unlockable { if (checked.getFinalWaypoint().equals(targetWaypoint)) return checked; - for (String wayPointId : checked.getFinalWaypoint().destinations.keySet()) { - Waypoint toCheck = MMOCore.plugin.waypointManager.get(wayPointId); + for (Waypoint toCheck : checked.getFinalWaypoint().destinations.keySet()) if (!checkedPoints.contains(toCheck)) { - PathInfo toCheckInfo = checked.addWayPoint(toCheck); - //We keep pointsToCheck ordered + WaypointPath toCheckInfo = checked.addWayPoint(toCheck); + // We keep pointsToCheck ordered pointsToCheck = toCheckInfo.addInOrder(pointsToCheck); } - } } //If no path has been found we return null return null; - } public boolean hasOption(WaypointOption option) { @@ -235,96 +228,4 @@ public class Waypoint implements Unlockable { return new Location(world, x, y, z, yaw, pitch); } - - public static class PathInfo { - private final ArrayList waypoints; - private double cost; - - public ArrayList getWaypoints() { - return waypoints; - } - - public double getCost() { - return cost; - } - - public PathInfo(Waypoint waypoint) { - this.waypoints = new ArrayList<>(); - this.waypoints.add(waypoint); - cost = 0; - } - public PathInfo(Waypoint waypoint,double cost) { - this.waypoints = new ArrayList<>(); - this.waypoints.add(waypoint); - this.cost = cost; - } - - public PathInfo addCost(double cost) { - this.cost+=cost; - return this; - } - - public ArrayList addInOrder(ArrayList pathInfos) { - int index = 0; - while (index < pathInfos.size()) { - if (cost < pathInfos.get(index).cost) { - pathInfos.set(index, this); - return pathInfos; - } - index++; - } - //If index==pathInfos.size() we add the waypoint at the end - pathInfos.add(this); - return pathInfos; - } - - - public PathInfo(List waypoints, double cost) { - this.waypoints = new ArrayList<>(waypoints); - this.cost = cost; - } - - /** - * - * @param dynamic We display the first waypoint if it is dynamic as it is an intermediary point - * @return - */ - public String displayIntermediaryWayPoints(boolean dynamic) { - String result = ""; - if(!dynamic) { - if (waypoints.size() <= 2) - return "none"; - for (int i = 1; i < waypoints.size() - 1; i++) { - result += waypoints.get(i).name + (i != waypoints.size() - 2 ? "," : ""); - } - - } - if(dynamic) { - if (waypoints.size() <= 1) - return "none"; - for (int i = 0; i < waypoints.size() - 1; i++) { - result += waypoints.get(i).name + (i != waypoints.size() - 2 ? "," : ""); - } - } - return result; - } - - public PathInfo addWayPoint(Waypoint waypoint) { - Validate.isTrue(!waypoints.contains(waypoint), "You can't create cyclic path"); - ArrayList newWaypoints = new ArrayList<>(); - newWaypoints.addAll(waypoints); - newWaypoints.add(waypoint); - double cost = this.cost + getFinalWaypoint().getSimpleCostDestination(waypoint); - return new PathInfo(newWaypoints, cost); - } - - - public Waypoint getInitialWaypoint() { - return waypoints.get(0); - } - - public Waypoint getFinalWaypoint() { - return waypoints.get(waypoints.size() - 1); - } - } } \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java b/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java new file mode 100644 index 00000000..e987eff5 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java @@ -0,0 +1,85 @@ +package net.Indyuce.mmocore.waypoint; + +import java.util.ArrayList; +import java.util.List; + +public class WaypointPath { + private final List waypoints; + private double cost; + + public WaypointPath(Waypoint waypoint) { + this.waypoints = new ArrayList<>(); + this.waypoints.add(waypoint); + cost = 0; + } + + public WaypointPath(Waypoint waypoint, double cost) { + this.waypoints = new ArrayList<>(); + this.waypoints.add(waypoint); + this.cost = cost; + } + + public WaypointPath(List waypoints, double cost) { + this.waypoints = new ArrayList<>(waypoints); + this.cost = cost; + } + + public List getWaypoints() { + return waypoints; + } + + public double getCost() { + return cost; + } + + public WaypointPath addCost(double cost) { + this.cost += cost; + return this; + } + + public List addInOrder(List pathInfos) { + int index = 0; + while (index < pathInfos.size()) { + if (cost < pathInfos.get(index).cost) { + pathInfos.set(index, this); + return pathInfos; + } + index++; + } + // If index == pathInfos.size() add the waypoint at the end + pathInfos.add(this); + return pathInfos; + } + + + /** + * @param dynamic Display the first waypoint if it is dynamic as it is an intermediary point + * @return List with all + */ + public String displayIntermediaryWayPoints(boolean dynamic) { + int beginIndex = dynamic ? 0 : 1; + if (waypoints.size() <= beginIndex + 1) + return "None"; + + String result = ""; + for (int i = beginIndex; i < waypoints.size() - 1; i++) + result += waypoints.get(i).getName() + (i != waypoints.size() - 2 ? ", " : ""); + return result; + } + + public WaypointPath addWayPoint(Waypoint waypoint) { + List newWaypoints = new ArrayList<>(); + newWaypoints.addAll(waypoints); + newWaypoints.add(waypoint); + double cost = this.cost + getFinalWaypoint().getDirectCost(waypoint); + return new WaypointPath(newWaypoints, cost); + } + + public Waypoint getInitialWaypoint() { + return waypoints.get(0); + } + + public Waypoint getFinalWaypoint() { + return waypoints.get(waypoints.size() - 1); + } +} diff --git a/src/main/resources/default/gui/waypoints.yml b/src/main/resources/default/gui/waypoints.yml index cd90f0c8..56ade9b9 100644 --- a/src/main/resources/default/gui/waypoints.yml +++ b/src/main/resources/default/gui/waypoints.yml @@ -59,7 +59,7 @@ items: lore: - '&7You cannot teleport as you do not have enough Stellium.' - - '&7Teleporting costs &b&l{normal_cost}&7/&b&l{dynamic_cost} &7Stellium.' + - '&7Teleporting costs &b{normal_cost}&7/&b{dynamic_cost} &7Stellium.' # Displayed when the waypoint is unlocked and usable display: diff --git a/src/main/resources/default/waypoints.yml b/src/main/resources/default/waypoints.yml index 1de64a36..cb57e8fc 100644 --- a/src/main/resources/default/waypoints.yml +++ b/src/main/resources/default/waypoints.yml @@ -12,11 +12,11 @@ spawn: # Radius of waypoint around the specified location. radius: 2.0 + lore: {} + + # Cost for several specific actions cost: - # Stellium cost in order to use the waypoint. - # Stellium is like stamina however it's not used - # by skills and regens much slower than mana. # Cost when not standing on any waypoint. dynamic-use: 5 @@ -46,13 +46,11 @@ spawn: spawn1: 4 spawn2: 5 - spawn1: name: Spawn1 location: 'world 69 71 136 136 0' radius: 2.0 - cost: - normal-use: 3 + lore: {} option: default: false @@ -60,21 +58,19 @@ spawn1: # on any waypoint (waypoint must be unlocked). dynamic: true - ##Not necessary if the waypoint doesn't allow dynamic use - ##The conditions for the dynamic-use of the waypoint - conditions: + # Not necessary if the waypoint doesn't allow dynamic use + # The conditions for the dynamic-use of the waypoint + dynamic-conditions: - 'distance{world=world;x=69;y=71;z=163;distance=500}' - linked: spawn: 4 spawn2: name: Spawn2 + lore: {} location: 'world 69 71 136 136 0' radius: 3.0 - cost: - normal-use: 3 option: enable-menu: false linked: From 75a4b944b6e8db2b432623cab91b334e3900abaa Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 23 May 2022 11:29:45 +0200 Subject: [PATCH 09/91] Quest module fix --- .../Indyuce/mmocore/quest/AbstractQuest.java | 1 + .../mmocore/quest/QuestModuleType.java | 11 +++----- ...estModule.java => BeautyQuestsModule.java} | 15 +++++------ .../quest/compat/BlackVeinQuestsModule.java | 14 +++-------- .../quest/compat/QuestCreatorModule.java | 25 ++++++++++--------- .../mmocore/quest/compat/QuestModule.java | 5 ++-- 6 files changed, 30 insertions(+), 41 deletions(-) rename src/main/java/net/Indyuce/mmocore/quest/compat/{BeautyQuestModule.java => BeautyQuestsModule.java} (65%) diff --git a/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java b/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java index 075ae470..93316ec2 100644 --- a/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java +++ b/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java @@ -3,5 +3,6 @@ package net.Indyuce.mmocore.quest; public interface AbstractQuest { public String getName(); + public String getId(); } diff --git a/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java b/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java index 7bcd4bfa..4c7e0366 100644 --- a/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java +++ b/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java @@ -1,7 +1,6 @@ package net.Indyuce.mmocore.quest; -import net.Indyuce.mmocore.party.PartyModule; -import net.Indyuce.mmocore.quest.compat.BeautyQuestModule; +import net.Indyuce.mmocore.quest.compat.BeautyQuestsModule; import net.Indyuce.mmocore.quest.compat.BlackVeinQuestsModule; import net.Indyuce.mmocore.quest.compat.QuestCreatorModule; import net.Indyuce.mmocore.quest.compat.QuestModule; @@ -10,12 +9,10 @@ import org.bukkit.Bukkit; import javax.inject.Provider; public enum QuestModuleType { - MMOCORE("MMOCore",MMOCoreQuestModule::new), + MMOCORE("MMOCore", MMOCoreQuestModule::new), QUESTS("Quests", BlackVeinQuestsModule::new), - BEAUTY_QUEST("Beauty Quests", BeautyQuestModule::new), - QUEST_CREATOR("Quest Creator", QuestCreatorModule::new); - - + BEAUTY_QUEST("BeautyQuests", BeautyQuestsModule::new), + QUEST_CREATOR("QuestCreator", QuestCreatorModule::new); private final String pluginName; private final Provider provider; diff --git a/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestModule.java b/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java similarity index 65% rename from src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestModule.java rename to src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java index e1e4f720..b060cad3 100644 --- a/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestModule.java +++ b/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java @@ -8,24 +8,21 @@ import fr.skytasul.quests.structure.Quest; import net.Indyuce.mmocore.quest.AbstractQuest; import org.bukkit.entity.Player; -public class BeautyQuestModule implements QuestModule { - +public class BeautyQuestsModule implements QuestModule { @Override public BeautyQuestQuest getQuestOrThrow(String questId) { - Quest quest=QuestsAPI.getQuests().getQuest(Integer.parseInt(questId)); - return quest==null?null:new BeautyQuestQuest(quest); + Quest quest = QuestsAPI.getQuests().getQuest(Integer.parseInt(questId)); + return quest == null ? null : new BeautyQuestQuest(quest); } @Override public boolean hasCompletedQuest(String questId, Player player) { - PlayerAccount account=PlayersManager.getPlayerAccount(player); - PlayerQuestDatas quest=account.getQuestDatas(QuestsAPI.getQuests().getQuest(Integer.parseInt(questId))); + PlayerAccount account = PlayersManager.getPlayerAccount(player); + PlayerQuestDatas quest = account.getQuestDatas(QuestsAPI.getQuests().getQuest(Integer.parseInt(questId))); return quest.isFinished(); } - - public class BeautyQuestQuest implements AbstractQuest { Quest quest; @@ -41,7 +38,7 @@ public class BeautyQuestModule implements QuestModule { private final Quests plugin = (Quests) Bukkit.getPluginManager().getPlugin("Quests"); - - @Override public BlackVeinQuestQuest getQuestOrThrow(String id) { Quests plugin = (Quests) Bukkit.getPluginManager().getPlugin("Quests"); - return plugin.getQuestById(id)==null?null:new BlackVeinQuestQuest(plugin.getQuestById(id)); + return plugin.getQuestById(id) == null ? null : new BlackVeinQuestQuest(plugin.getQuestById(id)); } - @Override public boolean hasCompletedQuest(String questId, Player player) { Quester quester = plugin.getQuester(player.getUniqueId()); - for(Quest quest:quester.getCompletedQuests()) { - if(quest.getId().equals(questId)) + for (Quest quest : quester.getCompletedQuests()) + if (quest.getId().equals(questId)) return true; - } + return false; } - public class BlackVeinQuestQuest implements AbstractQuest { private final Quest quest; @@ -49,5 +44,4 @@ public class BlackVeinQuestsModule implements QuestModule{ +public class QuestCreatorModule implements QuestModule { @Override public QuestCreatorQuest getQuestOrThrow(String id) { @@ -20,27 +21,27 @@ public class QuestCreatorModule implements QuestModule elements=playerData.getQuestHistory().getElements(questId, Arrays.asList(QuestEndType.SUCCESS),0); - for(QuestHistoryElement el:elements) { - if(el.getModelId().equals(questId)) + UserQC playerData = UserQC.cachedOrNull(player); + Validate.notNull(playerData, "QuestCreator User hasn't been loaded!"); + + // Gets all the quests the player has succeeded at + List elements = playerData.getQuestHistory().getElements(questId, Arrays.asList(QuestEndType.SUCCESS), 0); + for (QuestHistoryElement el : elements) + if (el.getModelId().equals(questId)) return true; - } + return false; } - /** - *QC ElementModel corresponds to our quest and their quests correspond to our Quest progress class + * QC ElementModel corresponds to our quest and their + * quests correspond to our Quest progress class */ - public class QuestCreatorQuest implements AbstractQuest { ElementModel questModel; public QuestCreatorQuest(String modelId) { - questModel=ConfigQC.models.getElement(modelId).orNull(); + questModel = ConfigQC.models.getElement(modelId).orNull(); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java b/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java index d4cae6b4..d569db22 100644 --- a/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java +++ b/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java @@ -6,13 +6,12 @@ import org.bukkit.entity.Player; public interface QuestModule { /** - * @return Quest with given name + * @return Quest with given identifier */ public T getQuestOrThrow(String id); /** - * @return If a specific player did a certain quest + * @return If a specific player has made a certain quest */ public boolean hasCompletedQuest(String quest, Player player); - } From c6a45d512014066cf5b19ea854a09e6909d0845e Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 23 May 2022 12:45:53 +0200 Subject: [PATCH 10/91] Deprecated exp dispensers --- pom.xml | 2 +- .../api/player/profess/PlayerClass.java | 21 ++++++++++---- .../api/quest/trigger/ExperienceTrigger.java | 7 ++--- .../mmocore/experience/ExperienceObject.java | 9 ++++-- .../mmocore/experience/Profession.java | 23 +++++++++++---- ...enser.java => SimpleExperienceObject.java} | 6 ++-- .../dispenser/ClassExperienceDispenser.java | 28 ------------------- .../dispenser/ExperienceDispenser.java | 5 ++-- .../ProfessionExperienceDispenser.java | 27 ------------------ 9 files changed, 49 insertions(+), 79 deletions(-) rename src/main/java/net/Indyuce/mmocore/experience/{dispenser/SimpleExperienceDispenser.java => SimpleExperienceObject.java} (79%) delete mode 100644 src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java delete mode 100644 src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java diff --git a/pom.xml b/pom.xml index 85ecfca0..4f0e60df 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.Indyuce MMOCore - 1.9.2 + 1.9.3 MMOCore Offer your players a brand new RPG experience!! diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 346a2b9a..cbd9dcc4 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -8,6 +8,7 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTrigger; import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; @@ -15,19 +16,18 @@ import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration; import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.loot.chest.particle.CastingParticle; import net.Indyuce.mmocore.experience.ExpCurve; import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; -import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.ClassExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.player.playerclass.ClassTrigger; import net.Indyuce.mmocore.player.playerclass.ClassTriggerType; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.md_5.bungee.api.ChatColor; -import org.apache.commons.lang.Validate; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.configuration.ConfigurationSection; @@ -156,10 +156,9 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { } if (config.contains("main-exp-sources")) { - ExperienceDispenser dispenser = new ClassExperienceDispenser(this); for (String key : config.getStringList("main-exp-sources")) try { - ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), dispenser); + ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); MMOCore.plugin.experience.registerSource(source); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp source '" + key + "' from class '" @@ -299,6 +298,18 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return options.containsKey(option) ? options.get(option) : option.getDefault(); } + @Override + public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { + hologramLocation = !MMOCore.plugin.getConfig().getBoolean("display-main-class-exp-holograms") ? null + : hologramLocation; + playerData.giveExperience(experience, source, hologramLocation, true); + } + + @Override + public boolean shouldHandle(PlayerData playerData) { + return equals(playerData.getProfess()); + } + @Nullable @Deprecated public ClassTrigger getClassTrigger(ClassTriggerType type) { diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java index 4a84e0b0..a7181940 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java @@ -1,8 +1,7 @@ package net.Indyuce.mmocore.api.quest.trigger; +import net.Indyuce.mmocore.experience.SimpleExperienceObject; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.ProfessionExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.SimpleExperienceDispenser; import org.apache.commons.lang.Validate; import net.Indyuce.mmocore.MMOCore; @@ -28,9 +27,9 @@ public class ExperienceTrigger extends Trigger { if (config.contains("profession")) { String id = config.getString("profession").toLowerCase().replace("_", "-"); Validate.isTrue(MMOCore.plugin.professionManager.has(id), "Could not find profession"); - dispenser = new ProfessionExperienceDispenser(MMOCore.plugin.professionManager.get(id)); + dispenser = MMOCore.plugin.professionManager.get(id); } else - dispenser = new SimpleExperienceDispenser(); + dispenser = new SimpleExperienceObject(); amount = new RandomAmount(config.getString("amount")); source = config.contains("source") ? EXPSource.valueOf(config.getString("source").toUpperCase()) : EXPSource.QUEST; } diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java index 3f9e6cc8..445e81c8 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java +++ b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java @@ -1,16 +1,21 @@ package net.Indyuce.mmocore.experience; +import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; /** - * Either a profession or a class + * General implementation for professions and classes. + *

+ * An experience object is a type of object that can + * level up. It has an experience curve and table and + * can receive EXP * * @author jules */ -public interface ExperienceObject { +public interface ExperienceObject extends ExperienceDispenser { String getKey(); diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java index ade8f4fb..42db02b1 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -3,14 +3,15 @@ package net.Indyuce.mmocore.experience; import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; -import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; -import net.Indyuce.mmocore.experience.dispenser.ProfessionExperienceDispenser; import org.apache.commons.lang.Validate; +import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; @@ -63,16 +64,14 @@ public class Profession extends PostLoadObject implements ExperienceObject { maxLevel = config.getInt("max-level"); - if (config.contains("exp-sources")) { - ExperienceDispenser dispenser = new ProfessionExperienceDispenser(this); + if (config.contains("exp-sources")) for (String key : config.getStringList("exp-sources")) try { - MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), dispenser)); + MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this)); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not register exp source '" + key + "' from profession '" + id + "': " + exception.getMessage()); } - } } @Override @@ -124,6 +123,18 @@ public class Profession extends PostLoadObject implements ExperienceObject { return Objects.requireNonNull(expTable, "Profession has no exp table"); } + @Override + public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { + hologramLocation = !getOption(Profession.ProfessionOption.EXP_HOLOGRAMS) ? null + : hologramLocation; + playerData.getCollectionSkills().giveExperience(this, experience, EXPSource.SOURCE, hologramLocation); + } + + @Override + public boolean shouldHandle(PlayerData playerData) { + return true; + } + public static enum ProfessionOption { /** diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java similarity index 79% rename from src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java rename to src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java index fc99e73b..87e013c7 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/SimpleExperienceDispenser.java +++ b/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java @@ -1,12 +1,12 @@ -package net.Indyuce.mmocore.experience.dispenser; +package net.Indyuce.mmocore.experience; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import org.bukkit.Location; import org.jetbrains.annotations.Nullable; -public class SimpleExperienceDispenser implements ExperienceDispenser { +public class SimpleExperienceObject implements ExperienceDispenser { @Override public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java deleted file mode 100644 index 917f7b14..00000000 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ClassExperienceDispenser.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.Indyuce.mmocore.experience.dispenser; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.profess.PlayerClass; -import net.Indyuce.mmocore.experience.EXPSource; -import org.bukkit.Location; -import org.jetbrains.annotations.Nullable; - -public class ClassExperienceDispenser implements ExperienceDispenser { - private final PlayerClass profess; - - public ClassExperienceDispenser(PlayerClass profess) { - this.profess = profess; - } - - @Override - public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { - hologramLocation = !MMOCore.plugin.getConfig().getBoolean("display-main-class-exp-holograms") ? null - : hologramLocation; - playerData.giveExperience(experience, source, hologramLocation, true); - } - - @Override - public boolean shouldHandle(PlayerData playerData) { - return playerData.getProfess().equals(profess); - } -} diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java index 5ac9eac0..ad2ce255 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java +++ b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java @@ -12,15 +12,14 @@ import org.jetbrains.annotations.Nullable; * experience given in a specific profession. Also being used to * monitor EXP holograms. */ +@Deprecated public interface ExperienceDispenser { /** * Called when experience is gained in main class/profession * * @param playerData Player gaining the experience - * @param experience Experience gained. Note that it is a double - * because it gets converted to an integer at - * the very last moment in MMOCore + * @param experience Experience gained * @param hologramLocation Location of displayed hologram. When set to null * and if exp holograms are enabled it will take the * player's location instead. diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java deleted file mode 100644 index 273a05b2..00000000 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ProfessionExperienceDispenser.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.Indyuce.mmocore.experience.dispenser; - -import net.Indyuce.mmocore.experience.EXPSource; -import net.Indyuce.mmocore.experience.Profession; -import net.Indyuce.mmocore.api.player.PlayerData; -import org.bukkit.Location; -import org.jetbrains.annotations.Nullable; - -public class ProfessionExperienceDispenser implements ExperienceDispenser { - private final Profession profession; - - public ProfessionExperienceDispenser(Profession profession) { - this.profession = profession; - } - - @Override - public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { - hologramLocation = !profession.getOption(Profession.ProfessionOption.EXP_HOLOGRAMS) ? null - : hologramLocation; - playerData.getCollectionSkills().giveExperience(profession, experience, EXPSource.SOURCE, hologramLocation); - } - - @Override - public boolean shouldHandle(PlayerData playerData) { - return true; - } -} From 31e8e42a1e7311b264e14c1ecd462df900f54df4 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 23 May 2022 20:19:08 +0200 Subject: [PATCH 11/91] Support for placeholders in GUI names --- .../java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java b/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java index f01e98e2..85be0d26 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java @@ -59,7 +59,7 @@ public abstract class GeneratedInventory extends PluginInventory { @Override public Inventory getInventory() { - Inventory inv = Bukkit.createInventory(this, editable.getSlots(), MythicLib.plugin.parseColors(calculateName())); + Inventory inv = Bukkit.createInventory(this, editable.getSlots(), MythicLib.plugin.getPlaceholderParser().parse(getPlayer(), calculateName())); for (InventoryItem item : editable.getItems()) if (item.canDisplay(this)) From 6f812545b77c866912964bc7f4d24ab395e494ce Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 23 May 2022 20:30:53 +0200 Subject: [PATCH 12/91] Fixed loot chests expiring --- .../java/net/Indyuce/mmocore/MMOCore.java | 17 ------------- .../Indyuce/mmocore/loot/chest/LootChest.java | 25 +++++++++++-------- .../mmocore/manager/ConfigManager.java | 2 +- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index aa2bec6f..1fd869fb 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -189,23 +189,6 @@ public class MMOCore extends LuminePlugin { } }.runTaskTimer(MMOCore.plugin, 100, 20); - /* - * Clean active loot chests every 5 minutes. Cannot register this runnable in - * the loot chest manager because it is instanced when the plugin loads - */ - new BukkitRunnable() { - public void run() { - Iterator iterator = lootChests.getActive().iterator(); - while (iterator.hasNext()) { - LootChest next = iterator.next(); - if (next.shouldExpire()) { - iterator.remove(); - next.expire(false); - } - } - } - }.runTaskTimer(this, 5 * 60 * 20, 5 * 60 * 20); - /* * For the sake of the lord, make sure they aren't using MMOItems Mana and * Stamina Addon...This should prevent a couple error reports produced by people diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java index b5d636e7..5672b5eb 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java @@ -10,7 +10,6 @@ import org.bukkit.Particle; import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.block.data.BlockData; -import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import javax.annotation.Nullable; @@ -21,7 +20,7 @@ public class LootChest { private final ReplacedBlock block; @Nullable private final BukkitRunnable effectRunnable; - private final long date = System.currentTimeMillis(); + private final BukkitRunnable closeRunnable; private boolean active = true; @@ -37,6 +36,13 @@ public class LootChest { this.region = region; this.block = new ReplacedBlock(block); this.effectRunnable = tier.hasEffect() ? tier.getEffect().startNewRunnable(block.getLocation().add(.5, .5, .5)) : null; + closeRunnable = new BukkitRunnable() { + @Override + public void run() { + expire(false); + } + }; + closeRunnable.runTaskLater(MMOCore.plugin, MMOCore.plugin.configManager.lootChestExpireTime); } public ChestTier getTier() { @@ -51,15 +57,8 @@ public class LootChest { return region; } - public boolean hasPlayerNearby() { - for (Player player : block.loc.getWorld().getPlayers()) - if (player.getLocation().distanceSquared(block.loc.bukkit()) < 625) - return true; - return false; - } - - public boolean shouldExpire() { - return System.currentTimeMillis() - date > MMOCore.plugin.configManager.lootChestExpireTime; + public boolean isActive() { + return active; } /** @@ -77,6 +76,10 @@ public class LootChest { Validate.isTrue(active, "Chest has already expired"); active = false; + // Close runnable + if (!closeRunnable.isCancelled()) + closeRunnable.cancel(); + // If a player is responsible of closing the chest, close it with sound if (player) { MMOCore.plugin.soundManager.getSound(SoundEvent.CLOSE_LOOT_CHEST).playAt(block.loc.bukkit()); diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index bcc54190..137160c3 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -94,7 +94,7 @@ public class ConfigManager { chatInput = MMOCore.plugin.getConfig().getBoolean("use-chat-input"); partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix"); combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer") * 1000L; - lootChestExpireTime = Math.max(MMOCore.plugin.getConfig().getInt("loot-chests.chest-expire-time"), 1) * 1000L; + lootChestExpireTime = Math.max(MMOCore.plugin.getConfig().getInt("loot-chests.chest-expire-time"), 1) * 20; lootChestPlayerCooldown = (long) MMOCore.plugin.getConfig().getDouble("player-cooldown") * 1000L; globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50; noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message(); From 98dec0f4a2250c840a48f8c38760473ecab1341a Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 23 May 2022 20:42:29 +0200 Subject: [PATCH 13/91] Small refactor --- src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java | 2 +- src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java | 2 +- .../net/Indyuce/mmocore/util/{item => }/HashableLocation.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/net/Indyuce/mmocore/util/{item => }/HashableLocation.java (96%) diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java index 5672b5eb..3277d05e 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java @@ -2,7 +2,7 @@ package net.Indyuce.mmocore.loot.chest; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.SoundEvent; -import net.Indyuce.mmocore.util.item.HashableLocation; +import net.Indyuce.mmocore.util.HashableLocation; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java b/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java index c0cc59bc..96317c16 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java @@ -4,7 +4,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.loot.chest.LootChest; import net.Indyuce.mmocore.loot.chest.LootChestRegion; -import net.Indyuce.mmocore.util.item.HashableLocation; +import net.Indyuce.mmocore.util.HashableLocation; import org.bukkit.Location; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java b/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java rename to src/main/java/net/Indyuce/mmocore/util/HashableLocation.java index 1e910bbd..0ef2336e 100644 --- a/src/main/java/net/Indyuce/mmocore/util/item/HashableLocation.java +++ b/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java @@ -1,4 +1,4 @@ -package net.Indyuce.mmocore.util.item; +package net.Indyuce.mmocore.util; import org.bukkit.Location; import org.bukkit.World; From 0000b76d9694c8a507a14878bd026eae8d2f70c1 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 24 May 2022 13:33:00 +0200 Subject: [PATCH 14/91] Waypoint books --- .../rpg/waypoint/ItemCommandTreeNode.java | 44 +++++++++++++++++++ .../waypoint/WaypointsCommandTreeNode.java | 1 + .../mmocore/listener/WaypointsListener.java | 16 ++++++- .../mmocore/manager/WaypointManager.java | 1 + .../mmocore/util/item/SkillBookBuilder.java | 29 ++++++++++++ .../util/item/WaypointBookBuilder.java | 30 +++++++++++++ src/main/resources/default/items.yml | 36 ++++++++++++--- src/main/resources/default/messages.yml | 1 + 8 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java create mode 100644 src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java create mode 100644 src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java new file mode 100644 index 00000000..d66f5eac --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java @@ -0,0 +1,44 @@ +package net.Indyuce.mmocore.command.rpg.waypoint; + +import io.lumine.mythic.lib.api.util.SmartGive; +import io.lumine.mythic.lib.command.api.CommandTreeNode; +import io.lumine.mythic.lib.command.api.Parameter; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.util.item.WaypointBookBuilder; +import net.Indyuce.mmocore.waypoint.Waypoint; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class ItemCommandTreeNode extends CommandTreeNode { + public ItemCommandTreeNode(CommandTreeNode parent) { + super(parent, "item"); + + addParameter(new Parameter("", (explorer, list) -> MMOCore.plugin.waypointManager.getAll().forEach(way -> list.add(way.getId())))); + addParameter(Parameter.PLAYER); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + if (args.length < 4) + return CommandResult.THROW_USAGE; + + if (!MMOCore.plugin.waypointManager.has(args[2])) { + sender.sendMessage(ChatColor.RED + "Could not find waypoint " + args[2]); + return CommandResult.FAILURE; + } + + Player player = Bukkit.getPlayer(args[3]); + if (player == null) { + sender.sendMessage(ChatColor.RED + "Could not find player " + args[3]); + return CommandResult.FAILURE; + } + + Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[2]); + new SmartGive(player).give(new WaypointBookBuilder(waypoint).build()); + sender.sendMessage(ChatColor.GOLD + "Gave " + player.getName() + ChatColor.YELLOW + " a waypoint book of " + ChatColor.GOLD + waypoint.getId() + + ChatColor.YELLOW + "."); + return CommandResult.SUCCESS; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java index 839f2995..48aeba29 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java @@ -11,6 +11,7 @@ public class WaypointsCommandTreeNode extends CommandTreeNode { addChild(new UnlockCommandTreeNode(this)); addChild(new OpenCommandTreeNode(this)); addChild(new TeleportCommandTreeNode(this)); + addChild(new ItemCommandTreeNode(this)); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java b/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java index f49dc3ca..c703c607 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java @@ -52,7 +52,19 @@ public class WaypointsListener implements Listener { return; NBTItem nbtItem = NBTItem.get(event.getItem()); - if (Objects.equals(nbtItem.getString("MMOCoreItemId"), "WAYPOINT_BOOK")) - InventoryManager.WAYPOINTS.newInventory(PlayerData.get(event.getPlayer())).open(); + if (Objects.equals(nbtItem.getString("MMOCoreItemId"), "WAYPOINT_BOOK")) { + String waypointId = nbtItem.getString("WaypointBookId"); + Waypoint waypoint = MMOCore.plugin.waypointManager.get(waypointId); + if (waypoint == null) + return; + + PlayerData playerData = PlayerData.get(event.getPlayer()); + if (playerData.hasWaypoint(waypoint)) + return; + + playerData.unlockWaypoint(waypoint); + event.getItem().setAmount(event.getItem().getAmount() - 1); // Consume item + MMOCore.plugin.configManager.getSimpleMessage("new-waypoint-book", "waypoint", waypoint.getName()).send(event.getPlayer()); + } } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java b/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java index f3b93d32..97bb5a00 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java @@ -25,6 +25,7 @@ public class WaypointManager implements MMOCoreManager { return waypoints.containsKey(id); } + @Nullable public Waypoint get(String id) { return waypoints.get(id); } diff --git a/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java new file mode 100644 index 00000000..6c809a26 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java @@ -0,0 +1,29 @@ +package net.Indyuce.mmocore.util.item; + +import io.lumine.mythic.lib.api.item.ItemTag; +import io.lumine.mythic.lib.api.item.NBTItem; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.skill.RegisteredSkill; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +@Deprecated +public class SkillBookBuilder extends AbstractItemBuilder { + private final RegisteredSkill skill; + + public SkillBookBuilder(RegisteredSkill skill) { + super(MMOCore.plugin.configItems.get("SKILL_BOOK")); + + this.skill = skill; + } + + @Override + public void whenBuildingMeta(ItemStack item, ItemMeta meta) { + + } + + @Override + public void whenBuildingNBT(NBTItem nbtItem) { + nbtItem.addTag(new ItemTag("SkillBookId", skill.getHandler().getId())); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java new file mode 100644 index 00000000..d16aeeb0 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java @@ -0,0 +1,30 @@ +package net.Indyuce.mmocore.util.item; + +import io.lumine.mythic.lib.api.item.ItemTag; +import io.lumine.mythic.lib.api.item.NBTItem; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.waypoint.Waypoint; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +public class WaypointBookBuilder extends AbstractItemBuilder { + private final Waypoint waypoint; + + public WaypointBookBuilder(Waypoint waypoint) { + super(MMOCore.plugin.configItems.get("WAYPOINT_BOOK")); + + this.waypoint = waypoint; + + addPlaceholders("waypoint", waypoint.getName()); + } + + @Override + public void whenBuildingMeta(ItemStack item, ItemMeta meta) { + + } + + @Override + public void whenBuildingNBT(NBTItem nbtItem) { + nbtItem.addTag(new ItemTag("WaypointBookId", waypoint.getId())); + } +} diff --git a/src/main/resources/default/items.yml b/src/main/resources/default/items.yml index 05de0cbe..ab5b3967 100644 --- a/src/main/resources/default/items.yml +++ b/src/main/resources/default/items.yml @@ -1,3 +1,18 @@ +# The default item template, not used by MMOCore but it does +# indicates all the item options you can use to configure your items. +TEMPLATE: + item: BOOK + name: 'Your item name' + custom-model-data: 0 + damage: 0 + unbreakable: false + lore: + - 'This is your item lore' + - 'And that is the second line' + - 'This supports &acolors &7as well' + # For player heads only, that is the skull texture value + texture: 'eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGUwYzUzN2EzZDAyMjlmNzMyZTlkMWY4NTRiMzc3YWQwNDA3NjE4ZmQwM2NkNGJiZTgwMzc2MjI0YTRmMWQxZSJ9fX0=' + GOLD_COIN: item: GOLD_NUGGET name: '&6Gold Coin' @@ -10,12 +25,23 @@ NOTE: lore: - '&eWorth: {worth}g' -WAYPOINT_BOOK: - item: ENCHANTED_BOOK - name: '&6Waypoints Book' +SKILL_POINT_BOOK: + item: book + name: '&6Skill Book' lore: - - '&7Waypoints are locations used to save your progress.' - - '&7This book gives you the ability to freely warp between these.' + - '&7Click to redeem one skill point.' + +SKILL_BOOK: + item: book + name: '&6Skill Book: {skill}' + lore: + - '&7Click to unlock {skill}' + +WAYPOINT_BOOK: + item: BOOK + name: '&6Waypoint Book: {waypoint}' + lore: + - '&7Click to unlock {waypoint}' DEPOSIT_ITEM: item: BOOK diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index 697ebaa9..b311b6ba 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -67,6 +67,7 @@ leave-combat: '%&aYou left combat.' # Waypoints new-waypoint: '%&eYou unlocked the &6{waypoint} &ewaypoint!' +new-waypoint-book: '%&eYou unlocked the &6{waypoint} &ewaypoint!' not-enough-stellium: '&cYou don''t have enough stellium: you need {more} more.' waypoint-cooldown: '&cPlease wait {cooldown} before using a waypoint again.' not-unlocked-waypoint: '&cYou have not unlocked that waypoint yet.' From 2c0f8094c0c614a6d93bf4f63413d915ae53c8d1 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 24 May 2022 13:33:20 +0200 Subject: [PATCH 15/91] Reduced confusion for config items --- .../java/net/Indyuce/mmocore/util/item/ConfigItem.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java b/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java index f778f7b6..50693c73 100644 --- a/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java +++ b/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java @@ -1,11 +1,13 @@ package net.Indyuce.mmocore.util.item; +import io.lumine.mythic.lib.UtilityMethods; import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import javax.annotation.Nullable; import java.util.List; +import java.util.Objects; public class ConfigItem { private final String name, id, texture; @@ -15,10 +17,12 @@ public class ConfigItem { private final boolean unbreakable; public ConfigItem(ConfigurationSection config) { - id = config.getName(); + id = UtilityMethods.enumName(config.getName()); name = config.getString("name"); lore = config.getStringList("lore"); - material = Material.valueOf(config.getString("item")); + String itemFormat = Objects.requireNonNull(config.getString("item"), "Could not find item material"); + Validate.isTrue(!itemFormat.contains(":"), "Invalid custom model data format, please use 'custom-model-data: X' instead"); + material = Material.valueOf(UtilityMethods.enumName(itemFormat)); Validate.notNull(name, "Name cannot be null"); Validate.notNull(lore, "Lore can be empty but not null"); From 28be26b9c8a9c57a78e0efd5ea8a1497b1064fa5 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 24 May 2022 13:33:37 +0200 Subject: [PATCH 16/91] Attribute modifiers available in ML --- src/main/java/net/Indyuce/mmocore/MMOCore.java | 6 +++--- .../mmocore/api/player/attribute/AttributeModifier.java | 6 ++++-- .../net/Indyuce/mmocore/experience/ExperienceObject.java | 7 +++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 1fd869fb..5141e462 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -8,6 +8,7 @@ import io.lumine.mythic.utils.plugin.LuminePlugin; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.PlayerActionBar; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.attribute.AttributeModifier; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.debug.DebugMode; @@ -31,7 +32,6 @@ import net.Indyuce.mmocore.listener.event.PlayerPressKeyListener; import net.Indyuce.mmocore.listener.option.*; import net.Indyuce.mmocore.listener.profession.FishingListener; import net.Indyuce.mmocore.listener.profession.PlayerCollectStats; -import net.Indyuce.mmocore.loot.chest.LootChest; import net.Indyuce.mmocore.manager.*; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.mysql.MySQLDataProvider; @@ -55,7 +55,6 @@ import org.jetbrains.annotations.NotNull; import java.io.File; import java.lang.reflect.Field; -import java.util.Iterator; import java.util.logging.Level; public class MMOCore extends LuminePlugin { @@ -116,8 +115,9 @@ public class MMOCore extends LuminePlugin { return; } - // Register MMOCore-specific target restrictions + // Register MMOCore-specific objects MythicLib.plugin.getEntities().registerRestriction(new PartyMemberTargetRestriction()); + MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); // Register extra objective, drop items... if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java index 108d3ebb..7dd53051 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java @@ -12,6 +12,7 @@ import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import java.text.DecimalFormat; +import java.util.Objects; public class AttributeModifier extends PlayerModifier { private final String attribute; @@ -74,9 +75,10 @@ public class AttributeModifier extends PlayerModifier { public AttributeModifier(ConfigObject object) { super(object.getString("key"), EquipmentSlot.OTHER, ModifierSource.OTHER); + String str = Objects.requireNonNull(object.getString("value")); + type = str.toCharArray()[str.length() - 1] == '%' ? ModifierType.RELATIVE : ModifierType.FLAT; + value = Double.parseDouble(type == ModifierType.RELATIVE ? str.substring(0, str.length() - 1) : str); this.attribute = object.getString("attribute"); - this.value = object.getDouble("value"); - type = object.getBoolean("multiplicative", false) ? ModifierType.RELATIVE : ModifierType.FLAT; } public String getAttribute() { diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java index 445e81c8..c14f0232 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java +++ b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java @@ -7,11 +7,10 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; /** - * General implementation for professions and classes. + * General implementation for professions, classes and attributes. *

- * An experience object is a type of object that can - * level up. It has an experience curve and table and - * can receive EXP + * An experience object is a type of object that can level up. + * It has an experience curve and table and can receive EXP * * @author jules */ From f9cc6bfb33360b74fb818221afbe214a03c8c633 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 24 May 2022 13:54:52 +0200 Subject: [PATCH 17/91] Class triggers small change --- .../net/Indyuce/mmocore/listener/ClassTriggers.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java b/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java index 44612aea..465b66cb 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java +++ b/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java @@ -52,7 +52,7 @@ public class ClassTriggers implements Listener { public void onAttack(PlayerAttackEvent event) { for (Map.Entry entry : damageTriggers.entrySet()) if (event.getDamage().hasType(entry.getKey())) - applyTriggers(event.getPlayer(), entry.getValue()); //, () -> new TriggerMetadata(event.getAttack(), event.getEntity()) + applyTriggers(event.getPlayer(), entry.getValue(), () -> new TriggerMetadata(event.getAttack(), event.getEntity())); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @@ -88,6 +88,16 @@ public class ClassTriggers implements Listener { return applyTriggers(PlayerData.get(player), type, triggerMetaProvider); } + /** + * Apply class shortcut skills from a specific class trigger type. + * + * @param player Player triggering + * @param type Trigger type + * @param triggerMetaProvider Small optimization: if no shortcut skill is found + * with the corresponding trigger type, trigger meta + * is not calculated which saves computations + * @return Skill result or null if no shortcut skill was cast + */ @Nullable private SkillResult applyTriggers(PlayerData player, ClassTriggerType type, Provider triggerMetaProvider) { ClassTrigger trigger = player.getProfess().getClassTrigger(type); From 7d2af8d787053d7e8f3e36df44c1e15b923528d3 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 24 May 2022 14:03:46 +0200 Subject: [PATCH 18/91] Addex exp tables to attributes --- .../api/player/attribute/PlayerAttribute.java | 126 +++++++++++++----- .../player/attribute/PlayerAttributes.java | 26 ++-- .../experience/droptable/ExperienceItem.java | 8 +- 3 files changed, 111 insertions(+), 49 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java index 8f714bf7..62352c55 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java @@ -3,57 +3,109 @@ package net.Indyuce.mmocore.api.player.attribute; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.experience.ExpCurve; +import net.Indyuce.mmocore.experience.ExperienceObject; +import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import org.apache.commons.lang.Validate; +import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashSet; +import java.util.Objects; import java.util.Set; import java.util.logging.Level; -public class PlayerAttribute { - private final String id, name; - private final int max; +public class PlayerAttribute implements ExperienceObject { + private final String id, name; + private final int max; + private final ExperienceTable expTable; - /** - * Used to store stats using StatType, but attributes also need to access - * non basic MMOCore stats hence the string maps keys - */ - private final Set buffs = new HashSet<>(); + /** + * Used to store stats using StatType, but attributes also need to access + * non basic MMOCore stats hence the string maps keys + */ + private final Set buffs = new HashSet<>(); - public PlayerAttribute(ConfigurationSection config) { - Validate.notNull(config, "Could not load config"); - id = config.getName().toLowerCase().replace("_", "-").replace(" ", "-"); + public PlayerAttribute(ConfigurationSection config) { + Validate.notNull(config, "Could not load config"); + id = config.getName().toLowerCase().replace("_", "-").replace(" ", "-"); - name = MythicLib.plugin.parseColors(config.getString("name", "Attribute")); - max = config.contains("max-points") ? Math.max(1, config.getInt("max-points")) : 0; + name = MythicLib.plugin.parseColors(config.getString("name", "Attribute")); + max = config.contains("max-points") ? Math.max(1, config.getInt("max-points")) : 0; - if (config.contains("buff")) - for (String key : config.getConfigurationSection("buff").getKeys(false)) - try { - String stat = key.toUpperCase().replace("-", "_").replace(" ", "_"); - buffs.add(new StatModifier("attribute." + id, stat, config.getString("buff." + key))); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load buff '" + key + "' from attribute '" + id + "': " + exception.getMessage()); - } - } + if (config.contains("buff")) + for (String key : config.getConfigurationSection("buff").getKeys(false)) + try { + String stat = key.toUpperCase().replace("-", "_").replace(" ", "_"); + buffs.add(new StatModifier("attribute." + id, stat, config.getString("buff." + key))); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load buff '" + key + "' from attribute '" + id + "': " + exception.getMessage()); + } - public String getId() { - return id; - } + // Load exp table + ExperienceTable expTable = null; + if (config.contains("exp-table")) + try { + expTable = MMOCore.plugin.experience.loadExperienceTable(config.get("exp-table")); + } catch (RuntimeException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp table from class '" + id + "': " + exception.getMessage()); + } + this.expTable = expTable; + } - public String getName() { - return name; - } + public String getId() { + return id; + } - public boolean hasMax() { - return max > 0; - } + public String getName() { + return name; + } - public int getMax() { - return max; - } + public boolean hasMax() { + return max > 0; + } - public Set getBuffs() { - return buffs; - } + public int getMax() { + return max; + } + + public Set getBuffs() { + return buffs; + } + + @Override + public String getKey() { + return "attribute:" + getId().replace("-", "_"); + } + + @NotNull + @Override + public ExperienceTable getExperienceTable() { + return Objects.requireNonNull(expTable); + } + + @Override + public boolean hasExperienceTable() { + return expTable != null; + } + + @Nullable + @Override + public ExpCurve getExpCurve() { + throw new RuntimeException("Attributes don't have experience"); + } + + @Override + public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, @NotNull EXPSource source) { + throw new RuntimeException("Attributes don't have experience"); + } + + @Override + public boolean shouldHandle(PlayerData playerData) { + throw new RuntimeException("Attributes don't have experience"); + } } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java index 2569d811..769e34ea 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java @@ -129,8 +129,17 @@ public class PlayerAttributes { update(); } + /** + * Adds X points to the base of the player attribute AND applies + * the attribute experience table. + * + * @param value Amount of attribute points spent in the attribute + */ public void addBase(int value) { + PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); setBase(spent + value); + if (attribute.hasExperienceTable()) + attribute.getExperienceTable().claim(data, spent, attribute); } /* @@ -159,14 +168,14 @@ public class PlayerAttributes { return map.get(key); } - public void addModifier(String key, double value) { - addModifier(new AttributeModifier(key, id, value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)); + public AttributeModifier addModifier(String key, double value) { + return addModifier(new AttributeModifier(key, id, value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)); } - public void addModifier(AttributeModifier modifier) { - map.put(modifier.getKey(), modifier); - + public AttributeModifier addModifier(AttributeModifier modifier) { + AttributeModifier mod = map.put(modifier.getKey(), modifier); update(); + return mod; } public Set getKeys() { @@ -177,7 +186,7 @@ public class PlayerAttributes { return map.containsKey(key); } - public void removeModifier(String key) { + public AttributeModifier removeModifier(String key) { AttributeModifier mod = map.remove(key); /* @@ -190,12 +199,13 @@ public class PlayerAttributes { ((Closeable) mod).close(); update(); } + return mod; } public void update() { - PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); + PlayerAttribute attr = MMOCore.plugin.attributeManager.get(id); int total = getTotal(); - attribute.getBuffs().forEach(buff -> buff.multiply(total).register(data.getMMOPlayerData())); + attr.getBuffs().forEach(buff -> buff.multiply(total).register(data.getMMOPlayerData())); } public String getId() { diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index 4ba8028c..31698af7 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -36,13 +36,13 @@ public class ExperienceItem { * where n is the amount of successive claiming fails * @param triggers Actions cast when the exp item is claimed */ - public ExperienceItem(String id, int period, int firstTrigger,double claimChance, double failReduction, List triggers) { + public ExperienceItem(String id, int period, int firstTrigger, double claimChance, double failReduction, List triggers) { this.id = id; this.period = period; this.claimChance = claimChance; this.failReduction = failReduction; this.triggers = triggers; - this.firstTrigger=firstTrigger; + this.firstTrigger = firstTrigger; } public ExperienceItem(ConfigurationSection config) { @@ -51,7 +51,7 @@ public class ExperienceItem { id = config.getName(); period = config.getInt("period", 0); - firstTrigger=config.getInt("first-trigger",period); + firstTrigger = config.getInt("first-trigger", period); claimChance = config.getDouble("chance", 100) / 100; failReduction = config.getDouble("fail-reduction", 80) / 100; triggers = new ArrayList<>(); @@ -71,7 +71,7 @@ public class ExperienceItem { * account the randomness factor from the 'chance' parameter */ public boolean roll(int professionLevel, int timesCollected) { - int claimsRequired = professionLevel+1 - (firstTrigger-+timesCollected * period); + int claimsRequired = professionLevel + 1 - (firstTrigger - timesCollected * period); if (claimsRequired < 1) return false; From 1f344dbe029d712ce254618be6d7dc06e238cf89 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 24 May 2022 15:27:03 +0200 Subject: [PATCH 19/91] Fixed skill list pagination --- .../net/Indyuce/mmocore/gui/SkillList.java | 33 ++++++------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/SkillList.java b/src/main/java/net/Indyuce/mmocore/gui/SkillList.java index af983f3c..1699f0ef 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SkillList.java +++ b/src/main/java/net/Indyuce/mmocore/gui/SkillList.java @@ -11,10 +11,8 @@ import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.manager.SkillManager; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; -import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -39,7 +37,6 @@ public class SkillList extends EditableInventory { if (function.equals("skill")) return new SkillItem(config); - if (function.equals("level")) return new LevelItem(config); @@ -48,7 +45,7 @@ public class SkillList extends EditableInventory { @Override public Placeholders getPlaceholders(SkillViewerInventory inv, int n) { - RegisteredSkill selected = inv.selected==null?null:inv.selected.getSkill(); + RegisteredSkill selected = inv.selected == null ? null : inv.selected.getSkill(); Placeholders holders = new Placeholders(); holders.register("skill_caps", selected.getName().toUpperCase()); @@ -57,7 +54,6 @@ public class SkillList extends EditableInventory { return holders; } - }; if (function.equals("slot")) @@ -69,7 +65,7 @@ public class SkillList extends EditableInventory { @Override public Placeholders getPlaceholders(SkillViewerInventory inv, int n) { - RegisteredSkill selected = inv.selected==null?null:inv.selected.getSkill(); + RegisteredSkill selected = inv.selected == null ? null : inv.selected.getSkill(); RegisteredSkill skill = inv.getPlayerData().hasSkillBound(n) ? inv.getPlayerData().getBoundSkill(n).getSkill() : null; Placeholders holders = new Placeholders(); @@ -77,7 +73,7 @@ public class SkillList extends EditableInventory { holders.register("skill", skill == null ? none : skill.getName()); holders.register("index", "" + (n + 1)); holders.register("slot", MMOCoreUtils.intToRoman(n + 1)); - holders.register("selected", selected==null?none:selected.getName()); + holders.register("selected", selected == null ? none : selected.getName()); return holders; } @@ -115,7 +111,8 @@ public class SkillList extends EditableInventory { @Override public boolean canDisplay(SkillViewerInventory inv) { - return inv.page < inv.skills.size() / 12; + final int perPage = inv.skillSlots.size(); + return inv.page < (inv.skills.size() - 1) / perPage; } }; } @@ -172,21 +169,15 @@ public class SkillList extends EditableInventory { return NBTItem.get(item).addTag(new ItemTag("skillId", skill.getSkill().getHandler().getId())).toItem(); } - @Override public Placeholders getPlaceholders(SkillViewerInventory inv, int n) { return new Placeholders(); } - - } public class SkillItem extends InventoryItem { - - public SkillItem(ConfigurationSection config) { super(Material.BARRIER, config); - } @Override @@ -197,11 +188,9 @@ public class SkillList extends EditableInventory { @Override public ItemStack display(SkillViewerInventory inv, int n) { - /* - * calculate placeholders - */ - int index=n+inv.skillSlots.size()*inv.page; - if(index>=inv.skills.size()) + // Calculate placeholders + int index = n + inv.skillSlots.size() * inv.page; + if (index >= inv.skills.size()) return new ItemStack(Material.AIR); ClassSkill skill = inv.skills.get(index); @@ -222,9 +211,7 @@ public class SkillList extends EditableInventory { for (int j = 0; j < lore.size(); j++) lore.set(j, ChatColor.GRAY + holders.apply(inv.getPlayer(), lore.get(j))); - /* - * generate item - */ + // Generate item ItemStack item = skill.getSkill().getIcon(); ItemMeta meta = item.getItemMeta(); meta.setDisplayName(holders.apply(inv.getPlayer(), getName())); @@ -266,7 +253,7 @@ public class SkillList extends EditableInventory { skills = new ArrayList<>(playerData.getProfess().getSkills()); skillSlots = getEditable().getByFunction("skill").getSlots(); slotSlots = getEditable().getByFunction("slot").getSlots(); - selected=skills.get(page*skillSlots.size()); + selected = skills.get(page * skillSlots.size()); } @Override From 0648079232a1aec78141678313828b11d28899fc Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 28 May 2022 14:28:18 +0200 Subject: [PATCH 20/91] Fixed waypoint path calculation --- src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java index e8d2695f..7391f8a5 100644 --- a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java +++ b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java @@ -140,6 +140,10 @@ public class Waypoint extends PostLoadObject implements Unlockable { while (pointsToCheck.size() != 0) { WaypointPath checked = pointsToCheck.get(0); pointsToCheck.remove(0); + // If the point has already been checked, pass + if (checkedPoints.contains(checked.getFinalWaypoint())) + continue; + paths.add(checked); checkedPoints.add(checked.getFinalWaypoint()); @@ -165,6 +169,10 @@ public class Waypoint extends PostLoadObject implements Unlockable { while (pointsToCheck.size() != 0) { WaypointPath checked = pointsToCheck.get(0); pointsToCheck.remove(0); + // If the point has already been checked, pass + if (checkedPoints.contains(checked.getFinalWaypoint())) + continue; + paths.add(checked); checkedPoints.add(checked.getFinalWaypoint()); From eed3502029281d373955b915148c529131e7191c Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 28 May 2022 15:26:22 +0200 Subject: [PATCH 21/91] MMOCore now takes in stats from ML --- .../java/net/Indyuce/mmocore/MMOCore.java | 5 +- .../Indyuce/mmocore/api/PlayerActionBar.java | 121 +++++++++--------- .../mmocore/api/player/PlayerData.java | 15 +-- .../api/player/attribute/PlayerAttribute.java | 4 +- .../api/player/profess/PlayerClass.java | 25 ++-- .../profess/resource/PlayerResource.java | 17 ++- .../mmocore/api/player/stats/PlayerStats.java | 55 ++++---- .../mmocore/api/player/stats/StatType.java | 58 ++++----- .../api/util/math/formula/LinearValue.java | 12 ++ .../debug/StatModifiersCommandTreeNode.java | 17 +-- .../rpg/debug/StatValueCommandTreeNode.java | 61 ++++----- .../comp/placeholder/RPGPlaceholders.java | 16 +-- .../mmocore/experience/PlayerProfessions.java | 4 +- .../Indyuce/mmocore/gui/AttributeView.java | 6 +- .../net/Indyuce/mmocore/gui/PlayerStats.java | 54 +++++--- .../listener/profession/FishingListener.java | 7 +- .../profession/PlayerCollectStats.java | 26 ++-- .../mmocore/loot/chest/LootChestRegion.java | 3 +- .../loot/droptable/dropitem/DropItem.java | 3 +- .../Indyuce/mmocore/manager/StatManager.java | 71 ++++++++++ .../data/mysql/MySQLPlayerDataManager.java | 20 +-- .../data/yaml/YAMLPlayerDataManager.java | 7 +- .../manager/profession/FishingManager.java | 16 ++- .../mmocore/manager/social/PartyManager.java | 5 +- .../mmocore/player/stats/StatInfo.java | 71 ++++++++++ 25 files changed, 403 insertions(+), 296 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/manager/StatManager.java create mode 100644 src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 5141e462..04096c71 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -10,7 +10,6 @@ import net.Indyuce.mmocore.api.PlayerActionBar; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.AttributeModifier; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.debug.DebugMode; import net.Indyuce.mmocore.command.*; import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; @@ -77,6 +76,7 @@ public class MMOCore extends LuminePlugin { public final LootChestManager lootChests = new LootChestManager(); public final MMOLoadManager loadManager = new MMOLoadManager(); public final RestrictionManager restrictionManager = new RestrictionManager(); + public final StatManager statManager = new StatManager(); @Deprecated public final SkillTreeManager skillTreeManager = new SkillTreeManager(); @@ -385,6 +385,7 @@ public class MMOCore extends LuminePlugin { configManager = new ConfigManager(); + statManager.initialize(clearBefore); if (clearBefore) MythicLib.plugin.getSkills().initialize(true); skillManager.initialize(clearBefore); @@ -414,8 +415,6 @@ public class MMOCore extends LuminePlugin { if (getConfig().isConfigurationSection("action-bar")) actionBarManager.reload(getConfig().getConfigurationSection("action-bar")); - StatType.load(); - if (clearBefore) PlayerData.getAll().forEach(PlayerData::update); } diff --git a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java index 594696b3..0dbd8859 100644 --- a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java +++ b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java @@ -1,73 +1,72 @@ package net.Indyuce.mmocore.api; -import java.text.DecimalFormat; - +import io.lumine.mythic.lib.MythicLib; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerActivity; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.player.stats.StatInfo; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.attribute.Attribute; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import io.lumine.mythic.lib.MythicLib; +import java.text.DecimalFormat; public class PlayerActionBar extends BukkitRunnable { - boolean initialized = false; - - private ActionBarConfig config; - private DecimalFormat digit; - - public void reload(ConfigurationSection cfg) { - config = new ActionBarConfig(cfg); - digit = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.digit); + boolean initialized = false; - if(!initialized && config.enabled) { - runTaskTimer(MMOCore.plugin, 0, config.ticks); - initialized = true; - } - } - - public long getTimeOut() { - return config.timeout; - } + private ActionBarConfig config; + private DecimalFormat digit; - @Override - public void run() { - for (PlayerData data : PlayerData.getAll()) - if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.getActivityTimeOut(PlayerActivity.ACTION_BAR_MESSAGE) == 0) { - data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(), - MythicLib.plugin.parseColors((data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : config.format) - .replace("{health}", digit.format(data.getPlayer().getHealth())) - .replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())) - .replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon()) - .replace("{mana}", digit.format(data.getMana())) - .replace("{max_mana}", "" + StatType.MAX_MANA.format(data.getStats().getStat(StatType.MAX_MANA))) - .replace("{stamina}", digit.format(data.getStamina())) - .replace("{max_stamina}", "" + StatType.MAX_STAMINA.format(data.getStats().getStat(StatType.MAX_STAMINA))) - .replace("{stellium}", digit.format(data.getStellium())) - .replace("{max_stellium}", "" + StatType.MAX_STELLIUM.format(data.getStats().getStat(StatType.MAX_STELLIUM))) - .replace("{class}", data.getProfess().getName()) - .replace("{xp}", "" + data.getExperience()) - .replace("{armor}", "" + StatType.ARMOR.format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue())) - .replace("{level}", "" + data.getLevel()) - .replace("{name}", data.getPlayer().getDisplayName()))))); - } - } - - private static class ActionBarConfig { - private final boolean enabled; - private final int ticks, timeout; - private final String digit, format; - - private ActionBarConfig(ConfigurationSection config) { - enabled = config.getBoolean("enabled", false); - timeout = config.getInt("", 60); - digit = config.getString("decimal", "0.#"); - ticks = config.getInt("ticks-to-update", 5); - format = config.getString("format", "please format me :c"); - } - } + public void reload(ConfigurationSection cfg) { + config = new ActionBarConfig(cfg); + digit = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.digit); + + if (!initialized && config.enabled) { + runTaskTimer(MMOCore.plugin, 0, config.ticks); + initialized = true; + } + } + + public long getTimeOut() { + return config.timeout; + } + + @Override + public void run() { + for (PlayerData data : PlayerData.getAll()) + if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.getActivityTimeOut(PlayerActivity.ACTION_BAR_MESSAGE) == 0) { + data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(), + MythicLib.plugin.parseColors((data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : config.format) + .replace("{health}", digit.format(data.getPlayer().getHealth())) + .replace("{max_health}", StatInfo.valueOf("MAX_HEALTH").format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())) + .replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon()) + .replace("{mana}", digit.format(data.getMana())) + .replace("{max_mana}", StatInfo.valueOf("MAX_MANA").format(data.getStats().getStat("MAX_MANA"))) + .replace("{stamina}", digit.format(data.getStamina())) + .replace("{max_stamina}", StatInfo.valueOf("MAX_STAMINA").format(data.getStats().getStat("MAX_STAMINA"))) + .replace("{stellium}", digit.format(data.getStellium())) + .replace("{max_stellium}", StatInfo.valueOf("MAX_STELLIUM").format(data.getStats().getStat("MAX_STELLIUM"))) + .replace("{class}", data.getProfess().getName()) + .replace("{xp}", "" + data.getExperience()) + .replace("{armor}", StatInfo.valueOf("ARMOR").format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue())) + .replace("{level}", "" + data.getLevel()) + .replace("{name}", data.getPlayer().getDisplayName()))))); + } + } + + private static class ActionBarConfig { + private final boolean enabled; + private final int ticks, timeout; + private final String digit, format; + + private ActionBarConfig(ConfigurationSection config) { + enabled = config.getBoolean("enabled", false); + timeout = config.getInt("", 60); + digit = config.getString("decimal", "0.#"); + ticks = config.getInt("ticks-to-update", 5); + format = config.getString("format", "please format me :c"); + } + } } 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 8b01f622..8713d21f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -17,7 +17,6 @@ import net.Indyuce.mmocore.api.player.profess.Subclass; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.social.FriendRequest; import net.Indyuce.mmocore.api.player.stats.PlayerStats; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.api.util.Closable; import net.Indyuce.mmocore.api.util.MMOCoreUtils; @@ -542,7 +541,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } value = MMOCore.plugin.boosterManager.calculateExp(null, value); - value *= 1 + getStats().getStat(StatType.ADDITIONAL_EXPERIENCE) / 100; + value *= 1 + getStats().getStat("ADDITIONAL_EXPERIENCE") / 100; // Splitting exp through party members AbstractParty party = getParty(); @@ -615,7 +614,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public void giveMana(double amount, PlayerResourceUpdateEvent.UpdateReason reason) { // Avoid calling useless event - double max = getStats().getStat(StatType.MAX_MANA); + double max = getStats().getStat("MAX_MANA"); double newest = Math.max(0, Math.min(mana + amount, max)); if (mana == newest) return; @@ -640,7 +639,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public void giveStamina(double amount, PlayerResourceUpdateEvent.UpdateReason reason) { // Avoid calling useless event - double max = getStats().getStat(StatType.MAX_STAMINA); + double max = getStats().getStat("MAX_STAMINA"); double newest = Math.max(0, Math.min(stamina + amount, max)); if (stamina == newest) return; @@ -665,7 +664,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public void giveStellium(double amount, PlayerResourceUpdateEvent.UpdateReason reason) { // Avoid calling useless event - double max = getStats().getStat(StatType.MAX_STELLIUM); + double max = getStats().getStat("MAX_STELLIUM"); double newest = Math.max(0, Math.min(stellium + amount, max)); if (stellium == newest) return; @@ -700,15 +699,15 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } public void setMana(double amount) { - mana = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_MANA))); + mana = Math.max(0, Math.min(amount, getStats().getStat("MAX_MANA"))); } public void setStamina(double amount) { - stamina = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_STAMINA))); + stamina = Math.max(0, Math.min(amount, getStats().getStat("MAX_STAMINA"))); } public void setStellium(double amount) { - stellium = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_STELLIUM))); + stellium = Math.max(0, Math.min(amount, getStats().getStat("MAX_STELLIUM"))); } public boolean isFullyLoaded() { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java index 62352c55..af2f7ad5 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java @@ -25,8 +25,8 @@ public class PlayerAttribute implements ExperienceObject { private final ExperienceTable expTable; /** - * Used to store stats using StatType, but attributes also need to access - * non basic MMOCore stats hence the string maps keys + * All buffs granted by an attribute. These are normalized and + * must be multiplied by the player level first */ private final Set buffs = new HashSet<>(); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index cbd9dcc4..eb1fc759 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -13,17 +13,17 @@ import net.Indyuce.mmocore.api.player.profess.event.EventTrigger; import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.experience.EXPSource; -import net.Indyuce.mmocore.loot.chest.particle.CastingParticle; import net.Indyuce.mmocore.experience.ExpCurve; import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; +import net.Indyuce.mmocore.loot.chest.particle.CastingParticle; import net.Indyuce.mmocore.player.playerclass.ClassTrigger; import net.Indyuce.mmocore.player.playerclass.ClassTriggerType; +import net.Indyuce.mmocore.player.stats.StatInfo; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.md_5.bungee.api.ChatColor; @@ -51,7 +51,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { private final ExpCurve expCurve; private final ExperienceTable expTable; - private final Map stats = new HashMap<>(); + private final Map stats = new HashMap<>(); private final Map skills = new LinkedHashMap<>(); private final List subclasses = new ArrayList<>(); @@ -124,7 +124,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { if (config.contains("attributes")) for (String key : config.getConfigurationSection("attributes").getKeys(false)) try { - stats.put(StatType.valueOf(key.toUpperCase().replace("-", "_")), + stats.put(UtilityMethods.enumName(key), new LinearValue(config.getConfigurationSection("attributes." + key))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load stat info '" + key + "' from class '" @@ -331,16 +331,11 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return eventTriggers.get(name); } - @Deprecated - public void setStat(StatType type, double base, double perLevel) { - setStat(type, new LinearValue(base, perLevel)); + public void setDefaultStatFormula(String type, LinearValue value) { + stats.put(UtilityMethods.enumName(type), value); } - public void setStat(StatType type, LinearValue value) { - stats.put(type, value); - } - - public double calculateStat(StatType stat, int level) { + public double calculateStat(String stat, int level) { return getStatInfo(stat).calculate(level); } @@ -396,8 +391,10 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return skills.values(); } - private LinearValue getStatInfo(StatType type) { - return stats.containsKey(type) ? stats.get(type) : type.getDefault(); + @NotNull + private LinearValue getStatInfo(String stat) { + LinearValue found = stats.get(stat); + return found == null ? StatInfo.valueOf(stat).getDefaultFormula() : found; } @Override diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java index fcbec451..56aeb9b5 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java @@ -3,7 +3,6 @@ package net.Indyuce.mmocore.api.player.profess.resource; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.ClassOption; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; import org.bukkit.attribute.Attribute; @@ -20,27 +19,27 @@ public enum PlayerResource { (data, amount) -> data.getPlayer().setHealth(amount)), MANA(PlayerData::getMana, - data -> data.getStats().getStat(StatType.MAX_MANA), + data -> data.getStats().getStat("MAX_MANA"), (data, amount) -> data.giveMana(amount, PlayerResourceUpdateEvent.UpdateReason.REGENERATION), (data, amount) -> data.giveMana(amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND), (data, amount) -> data.giveMana(-amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND), (data, amount) -> data.setMana(amount)), STAMINA(PlayerData::getStamina, - data -> data.getStats().getStat(StatType.MAX_STAMINA), + data -> data.getStats().getStat("MAX_STAMINA"), (data, amount) -> data.giveStamina(amount, PlayerResourceUpdateEvent.UpdateReason.REGENERATION), (data, amount) -> data.giveStamina(amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND), (data, amount) -> data.giveStamina(-amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND), (data, amount) -> data.setStamina(amount)), STELLIUM(PlayerData::getStellium, - data -> data.getStats().getStat(StatType.MAX_STELLIUM), + data -> data.getStats().getStat("MAX_STELLIUM"), (data, amount) -> data.giveStellium(amount, PlayerResourceUpdateEvent.UpdateReason.REGENERATION), (data, amount) -> data.giveStellium(amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND), (data, amount) -> data.giveStellium(-amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND), (data, amount) -> data.setStellium(amount)); - private final StatType regenStat, maxRegenStat; + private final String regenStat, maxRegenStat; private final ClassOption offCombatRegen; private final Function current, max; private final BiConsumer regen; @@ -54,8 +53,8 @@ public enum PlayerResource { BiConsumer give, BiConsumer take, BiConsumer set) { - this.regenStat = StatType.valueOf(name() + "_REGENERATION"); - this.maxRegenStat = StatType.valueOf("MAX_" + name() + "_REGENERATION"); + this.regenStat = name() + "_REGENERATION"; + this.maxRegenStat = "MAX_" + name() + "_REGENERATION"; this.offCombatRegen = ClassOption.valueOf("OFF_COMBAT_" + name() + "_REGEN"); this.current = current; this.max = max; @@ -68,14 +67,14 @@ public enum PlayerResource { /** * @return Stat which corresponds to flat resource regeneration */ - public StatType getRegenStat() { + public String getRegenStat() { return regenStat; } /** * @return Stat which corresponds to resource regeneration scaling with the player's max health */ - public StatType getMaxRegenStat() { + public String getMaxRegenStat() { return maxRegenStat; } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java index be0912c7..0682683c 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java @@ -8,17 +8,14 @@ import io.lumine.mythic.lib.player.modifier.ModifierSource; import io.lumine.mythic.lib.player.modifier.ModifierType; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.Profession; +import net.Indyuce.mmocore.player.stats.StatInfo; import net.Indyuce.mmocore.skill.ClassSkill; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Locale; public class PlayerStats { private final PlayerData data; /** - * Utilclass to easily manipulate the MMOLib stat map + * Util class to easily manipulate the MMOLib stat map * * @param data Playerdata */ @@ -34,6 +31,7 @@ public class PlayerStats { return data.getMMOPlayerData().getStatMap(); } + @Deprecated public StatInstance getInstance(StatType stat) { return getMap().getInstance(stat.name()); } @@ -42,35 +40,26 @@ public class PlayerStats { return getMap().getInstance(stat); } - /** - * Allows for stat type enum to have dynamic professions. - * ID FORMAT: STAT_TYPE_HERE_PROFESSION_HERE - * - * @param type the type of stat - * @param profession the stat's specific permission - * @return instance of found stat - * @author Ehhthan - */ - @NotNull - public StatInstance getInstance(StatType type, @Nullable Profession profession) { - if (profession == null) - return getInstance(type); - else { - String id = (type.name() + '_' + profession.getId()).replace('-', '_').replace(' ', '_').toUpperCase(Locale.ROOT); - return getInstance(id); - } - } - - /* - * applies relative attributes on the base stat too - */ - public double getStat(StatType stat) { + public double getStat(String stat) { return getInstance(stat).getTotal(); } - public double getBase(StatType stat) { - return data.getProfess().calculateStat(stat, - stat.hasProfession() ? data.getCollectionSkills().getLevel(stat.getProfession()) : data.getLevel()); + /** + * MMOCore base stat value differs from the on in MythicLib. + *

+ * MythicLib: the base stat value is only defined for stats + * which are based on vanilla player attributes. It corresponds + * to the stat amount any player has with NO attribute modifier whatsoever. + *

+ * MMOCore: the base stat value corresponds to the stat amount + * the player CLASS grants. It can be similar or equal to the one + * in MMOCore but it really is completely different. + * + * @return MMOCore base stat value + */ + public double getBase(String stat) { + Profession profession = StatInfo.valueOf(stat).profession; + return data.getProfess().calculateStat(stat, profession == null ? data.getLevel() : data.getCollectionSkills().getLevel(profession)); } /** @@ -81,7 +70,7 @@ public class PlayerStats { * see {@link PlayerData#update()} for more info */ public synchronized void updateStats() { - for (StatType stat : StatType.values()) { + for (StatType stat : StatType.values()) { // TODO fix StatInstance instance = getMap().getInstance(stat.name()); StatInstance.ModifierPacket packet = instance.newPacket(); @@ -89,7 +78,7 @@ public class PlayerStats { packet.removeIf(str -> str.equals("mmocoreClass")); // Add newest one - double total = getBase(stat) - instance.getBase(); + double total = getBase(stat.name()) - instance.getBase(); if (total != 0) packet.addModifier(new StatModifier("mmocoreClass", stat.name(), total, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER)); 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 9f66f9bf..6adbde42 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,14 +1,14 @@ package net.Indyuce.mmocore.api.player.stats; -import io.lumine.mythic.lib.MythicLib; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.experience.Profession; -import org.bukkit.configuration.file.FileConfiguration; +import net.Indyuce.mmocore.player.stats.StatInfo; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import java.text.DecimalFormat; +import java.util.Objects; +@Deprecated public enum StatType { // Vanilla stats @@ -87,17 +87,17 @@ public enum StatType { /** * Reduces amount of tugs needed to fish */ - FISHING_STRENGTH("fishing"), + FISHING_STRENGTH, /** * Chance of instant success when fishing */ - CRITICAL_FISHING_CHANCE("fishing"), + CRITICAL_FISHING_CHANCE, /** * Chance of crit fishing failure */ - CRITICAL_FISHING_FAILURE_CHANCE("fishing"), + CRITICAL_FISHING_FAILURE_CHANCE, /** * Chance of dropping more minerals when mining. @@ -114,49 +114,35 @@ public enum StatType { */ LUCK_OF_THE_FIELD; - private String profession; - - private LinearValue defaultInfo; - private DecimalFormat format; - - StatType() { - // Completely custom stat - } - - @SuppressWarnings("SameParameterValue") - StatType(String profession) { - this.profession = profession; - } - + @Deprecated public String getProfession() { - return profession; + return findProfession().getId(); } + @Deprecated + @Nullable public Profession findProfession() { - return MMOCore.plugin.professionManager.get(profession); + return StatInfo.valueOf(name()).profession; } + @Deprecated public boolean hasProfession() { - return profession != null; + return findProfession() != null; } + @Deprecated + @NotNull public LinearValue getDefault() { - return defaultInfo; + return StatInfo.valueOf(name()).getDefaultFormula(); } + @Deprecated public boolean matches(Profession profession) { - return this.profession != null && this.profession.equals(profession.getId()); + return Objects.equals(findProfession(), profession); } + @Deprecated public String format(double value) { - return format.format(value); - } - - public static void load() { - 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 = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.contains("decimal-format." + stat.name()) ? config.getString("decimal-format." + stat.name()) : "0.#"); - } + return StatInfo.valueOf(name()).format(value); } } 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 5bd0d5ef..972bf5b2 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 @@ -110,4 +110,16 @@ public class LinearValue { return value; } + + @Override + public String toString() { + return "LinearValue{" + + "base=" + base + + ", perLevel=" + perLevel + + ", min=" + min + + ", max=" + max + + ", hasmin=" + hasmin + + ", hasmax=" + hasmax + + '}'; + } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java index 38de283c..d440e4ee 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java @@ -1,11 +1,11 @@ package net.Indyuce.mmocore.command.rpg.debug; +import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.stat.StatInstance; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -15,10 +15,7 @@ public class StatModifiersCommandTreeNode extends CommandTreeNode { public StatModifiersCommandTreeNode(CommandTreeNode parent) { super(parent, "statmods"); - addParameter(new Parameter("", (explorer, list) -> { - for (StatType stat : StatType.values()) - list.add(stat.name()); - })); + addParameter(new Parameter("", (explorer, list) -> list.add("STAT_ID"))); } @Override @@ -32,15 +29,7 @@ public class StatModifiersCommandTreeNode extends CommandTreeNode { } PlayerData data = PlayerData.get((Player) sender); - StatType stat; - try { - stat = StatType.valueOf(args[2].toUpperCase().replace("-", "_").replace(" ", "_")); - } catch (IllegalArgumentException exception) { - sender.sendMessage(ChatColor.RED + "Could not find stat: " + args[2] + "."); - return CommandResult.FAILURE; - } - - StatInstance instance = data.getStats().getInstance(stat); + StatInstance instance = data.getStats().getInstance(UtilityMethods.enumName(args[2])); sender.sendMessage("Stat Modifiers (" + instance.getKeys().size() + "):"); for (String key : instance.getKeys()) { StatModifier mod = instance.getModifier(key); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java index f13d42a4..f582ab31 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java @@ -1,51 +1,36 @@ package net.Indyuce.mmocore.command.rpg.debug; +import io.lumine.mythic.lib.UtilityMethods; +import io.lumine.mythic.lib.command.api.CommandTreeNode; +import io.lumine.mythic.lib.command.api.Parameter; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.player.stats.StatInfo; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; -import io.lumine.mythic.lib.command.api.CommandTreeNode; -import io.lumine.mythic.lib.command.api.Parameter; - public class StatValueCommandTreeNode extends CommandTreeNode { - public StatValueCommandTreeNode(CommandTreeNode parent) { - super(parent, "statvalue"); + public StatValueCommandTreeNode(CommandTreeNode parent) { + super(parent, "statvalue"); - addParameter(new Parameter("", (explorer, list) -> { - for (StatType stat : StatType.values()) - list.add(stat.name()); - })); - addParameter(new Parameter("(formatted)", (explorer, list) -> list.add("true"))); - } + addParameter(new Parameter("", (explorer, list) -> list.add("STAT_ID"))); + } - @Override - public CommandResult execute(CommandSender sender, String[] args) { - if (args.length < 3) - return CommandResult.THROW_USAGE; + @Override + public CommandResult execute(CommandSender sender, String[] args) { + if (args.length < 3) + return CommandResult.THROW_USAGE; - if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.RED + "This command can only be used by a player."); - return CommandResult.FAILURE; - } - PlayerData data = PlayerData.get((Player) sender); + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command can only be used by a player."); + return CommandResult.FAILURE; + } + PlayerData data = PlayerData.get((Player) sender); - StatType stat; - try { - stat = StatType.valueOf(args[2].toUpperCase().replace("-", "_").replace(" ", "_")); - } catch (IllegalArgumentException exception) { - sender.sendMessage(ChatColor.RED + "Could not find stat: " + args[2] + "."); - return CommandResult.FAILURE; - } + StatInfo stat = StatInfo.valueOf(UtilityMethods.enumName(args[2])); + sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name + ChatColor.WHITE + "): " + + ChatColor.GREEN + data.getStats().getStat(stat.name)); - if (args.length > 3 && args[3].equals("true")) - sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " - + ChatColor.GREEN + stat.format(data.getStats().getStat(stat)) + ChatColor.WHITE + " *"); - else - sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): " - + ChatColor.GREEN + data.getStats().getStat(stat)); - - return CommandResult.SUCCESS; - } + return CommandResult.SUCCESS; + } } 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 dd9e3433..795ac3a1 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -5,7 +5,7 @@ import io.lumine.mythic.lib.api.util.AltChar; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; +import net.Indyuce.mmocore.player.stats.StatInfo; import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.Profession; @@ -72,11 +72,11 @@ public class RPGPlaceholders extends PlaceholderExpansion { } else if (identifier.equals("health") && player.isOnline()) { - return StatType.MAX_HEALTH.format(player.getPlayer().getHealth()); + return StatInfo.valueOf("MAX_HEALTH").format(player.getPlayer().getHealth()); } else if (identifier.equals("max_health") && player.isOnline()) { - return StatType.MAX_HEALTH.format(player.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); + return StatInfo.valueOf("MAX_HEALTH").format(player.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); } else if (identifier.equals("health_bar") && player.isOnline()) { @@ -153,7 +153,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { return MythicLib.plugin.getMMOConfig().decimal.format(playerData.getMana()); else if (identifier.equals("mana_bar")) { - return playerData.getProfess().getManaDisplay().generateBar(playerData.getMana(), playerData.getStats().getStat(StatType.MAX_MANA)); + return playerData.getProfess().getManaDisplay().generateBar(playerData.getMana(), playerData.getStats().getStat("MAX_MANA")); } else if (identifier.startsWith("exp_multiplier_")) { @@ -173,7 +173,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { else if (identifier.equals("stamina_bar")) { StringBuilder format = new StringBuilder(); - double ratio = 20 * playerData.getStamina() / playerData.getStats().getStat(StatType.MAX_STAMINA); + double ratio = 20 * playerData.getStamina() / playerData.getStats().getStat("MAX_STAMINA"); for (double j = 1; j < 20; j++) format.append(ratio >= j ? MMOCore.plugin.configManager.staminaFull : ratio >= j - .5 ? MMOCore.plugin.configManager.staminaHalf : MMOCore.plugin.configManager.staminaEmpty) @@ -182,8 +182,8 @@ public class RPGPlaceholders extends PlaceholderExpansion { } else if (identifier.startsWith("stat_")) { - StatType type = StatType.valueOf(identifier.substring(5).toUpperCase()); - return type == null ? "Invalid Stat" : type.format(playerData.getStats().getStat(type)); + StatInfo info = StatInfo.valueOf(identifier.substring(5).toUpperCase()); + return info.format(playerData.getStats().getStat(info.name)); } else if (identifier.equals("stellium")) @@ -191,7 +191,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { else if (identifier.equals("stellium_bar")) { StringBuilder format = new StringBuilder(); - double ratio = 20 * playerData.getStellium() / playerData.getStats().getStat(StatType.MAX_STELLIUM); + double ratio = 20 * playerData.getStellium() / playerData.getStats().getStat("MAX_STELLIUM"); for (double j = 1; j < 20; j++) format.append(ratio >= j ? ChatColor.BLUE : ratio >= j - .5 ? ChatColor.AQUA : ChatColor.WHITE).append(AltChar.listSquare); return format.toString(); diff --git a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 2caddb5b..44f3552c 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -4,13 +4,13 @@ import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; 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.event.PlayerExperienceGainEvent; import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import org.apache.commons.lang.Validate; @@ -168,7 +168,7 @@ public class PlayerProfessions { value = MMOCore.plugin.boosterManager.calculateExp(profession, value); // Adds functionality for additional experience per profession. - value *= 1 + playerData.getStats().getInstance(StatType.ADDITIONAL_EXPERIENCE, profession).getTotal() / 100; + value *= 1 + playerData.getStats().getInstance("ADDITIONAL_EXPERIENCE_" + UtilityMethods.enumName(profession.getId())).getTotal() / 100; // Display hologram if (hologramLocation != null) diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 49e74717..058694a8 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -13,6 +13,7 @@ import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.SoundManager; +import net.Indyuce.mmocore.player.stats.StatInfo; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; @@ -66,8 +67,9 @@ public class AttributeView extends EditableInventory { holders.register("current", total); holders.register("attribute_points", inv.getPlayerData().getAttributePoints()); attribute.getBuffs().forEach(buff -> { - holders.register("buff_" + buff.getStat().toLowerCase(), buff.getValue()); - holders.register("total_" + buff.getStat().toLowerCase(), buff.multiply(total).getValue()); + StatInfo info = StatInfo.valueOf(buff.getStat()); + holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); + holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue())); }); return holders; } diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 0a870c26..63759744 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -1,14 +1,15 @@ package net.Indyuce.mmocore.gui; +import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.experience.Booster; -import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; -import net.Indyuce.mmocore.api.player.stats.StatType; +import net.Indyuce.mmocore.player.stats.StatInfo; import net.Indyuce.mmocore.api.util.math.format.DelayFormat; +import net.Indyuce.mmocore.experience.Booster; +import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; @@ -18,10 +19,13 @@ import net.Indyuce.mmocore.party.AbstractParty; import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; +import java.util.Objects; + public class PlayerStats extends EditableInventory { public PlayerStats() { super("player-stats"); @@ -78,7 +82,7 @@ public class PlayerStats extends EditableInventory { Placeholders holders = new Placeholders(); net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.getPlayerData().getStats(); - double ratio = (double) inv.getPlayerData().getCollectionSkills().getExperience(profession) + double ratio = inv.getPlayerData().getCollectionSkills().getExperience(profession) / (double) inv.getPlayerData().getCollectionSkills().getLevelUpExperience(profession); String bar = "" + ChatColor.BOLD; @@ -91,9 +95,9 @@ public class PlayerStats extends EditableInventory { holders.register("level", "" + inv.getPlayerData().getCollectionSkills().getLevel(profession)); holders.register("xp", inv.getPlayerData().getCollectionSkills().getExperience(profession)); holders.register("percent", decimal.format(ratio * 100)); - for (StatType stat : StatType.values()) - if (stat.matches(profession)) - holders.register(stat.name().toLowerCase(), stat.format(stats.getStat(stat))); + for (StatInfo stat : MMOCore.plugin.statManager.getLoaded()) + if (Objects.equals(stat.profession, profession)) + holders.register(stat.name.toLowerCase(), stat.format(stats.getStat(stat.name))); return holders; } @@ -113,21 +117,35 @@ public class PlayerStats extends EditableInventory { @Override public Placeholders getPlaceholders(GeneratedInventory inv, int n) { + return new Placeholders() { + final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.getPlayerData().getStats(); - net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.getPlayerData().getStats(); - Placeholders holders = new Placeholders(); + public String apply(Player player, String str) { + while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { + String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); + String replaced; - for (StatType stat : StatType.values()) { - double base = stats.getBase(stat), total = stats.getStat(stat), extra = total - base; - holders.register(stat.name().toLowerCase(), stat.format(total)); - holders.register(stat.name().toLowerCase() + "_base", stat.format(base)); - holders.register(stat.name().toLowerCase() + "_extra", stat.format(extra)); - } + if (holder.endsWith("_base")) { + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); + replaced = info.format(stats.getBase(info.name)); + } else if (holder.endsWith("_extra")) { + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); + replaced = info.format(stats.getStat(info.name) - stats.getBase(info.name)); + } else if (holder.startsWith("attribute_")) { + PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase()); + replaced = String.valueOf(inv.getPlayerData().getAttributes().getAttribute(attr)); + } else { + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder)); + replaced = info.format(stats.getStat(info.name)); + } - for (PlayerAttribute attribute : MMOCore.plugin.attributeManager.getAll()) - holders.register("attribute_" + attribute.getId().replace("-", "_"), inv.getPlayerData().getAttributes().getAttribute(attribute)); + str = str.replace("{" + holder + "}", replaced); + } - return holders; + // External placeholders + return MMOCore.plugin.placeholderParser.parse(player, str); + } + }; } }; diff --git a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java b/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java index fe678f07..50c1405c 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java @@ -4,7 +4,6 @@ import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.CustomPlayerFishEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.loot.LootBuilder; @@ -84,7 +83,7 @@ public class FishingListener implements Listener { this.playerData = PlayerData.get(this.player = player); this.hook = hook; - this.fishStrength = (int) Math.floor(caught.rollTugs() * (1 - PlayerData.get(player).getStats().getStat(StatType.FISHING_STRENGTH) / 100)); + this.fishStrength = (int) Math.floor(caught.rollTugs() * (1 - PlayerData.get(player).getStats().getStat("FISHING_STRENGTH") / 100)); this.experienceDropped = caught.rollExperience(); fishing.add(player.getUniqueId()); @@ -148,7 +147,7 @@ public class FishingListener implements Listener { return; } - if (currentPulls == 0 && RANDOM.nextDouble() < PlayerData.get(player).getStats().getStat(StatType.CRITICAL_FISHING_CHANCE) / 100) + if (currentPulls == 0 && RANDOM.nextDouble() < PlayerData.get(player).getStats().getStat("CRITICAL_FISHING_CHANCE") / 100) setCriticalFish(); // Check if enough pulls; if not, wait till the next fish event @@ -165,7 +164,7 @@ public class FishingListener implements Listener { (mainhand != null && mainhand.getType() == Material.FISHING_ROD) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND, 1); // Critical fishing failure - if (!isCriticalFish() && RANDOM.nextDouble() < PlayerData.get(player).getStats().getStat(StatType.CRITICAL_FISHING_FAILURE_CHANCE) / 100) { + if (!isCriticalFish() && RANDOM.nextDouble() < PlayerData.get(player).getStats().getStat("CRITICAL_FISHING_FAILURE_CHANCE") / 100) { player.setVelocity(hook.getLocation().subtract(player.getLocation()).toVector().setY(0).multiply(3).setY(.5)); hook.getWorld().spawnParticle(Particle.SMOKE_NORMAL, location, 24, 0, 0, 0, .08); return; diff --git a/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java b/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java index ce81b963..795d6ed7 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java +++ b/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java @@ -1,7 +1,8 @@ package net.Indyuce.mmocore.listener.profession; -import java.util.Random; - +import io.lumine.mythic.lib.MythicLib; +import net.Indyuce.mmocore.api.event.CustomBlockMineEvent; +import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.entity.Player; @@ -11,10 +12,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import net.Indyuce.mmocore.api.event.CustomBlockMineEvent; -import net.Indyuce.mmocore.api.player.stats.StatType; -import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; -import io.lumine.mythic.lib.MythicLib; +import java.util.Random; public class PlayerCollectStats implements Listener { private static final Random random = new Random(); @@ -23,26 +21,26 @@ public class PlayerCollectStats implements Listener { public void a(CustomBlockMineEvent event) { Player player = event.getPlayer(); - // give haste if right enchant - double h = event.getData().getStats().getStat(StatType.GATHERING_HASTE); + // Give haste if right enchant + double h = event.getData().getStats().getStat("GATHERING_HASTE"); if (h > 0 && random.nextDouble() < h * .045) { new SmallParticleEffect(player, Particle.SPELL_INSTANT); player.removePotionEffect(PotionEffectType.FAST_DIGGING); player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, (int) (10 * h), (int) (1 + h / 7))); } - // drop more items if fortune enchant - double f = event.getData().getStats().getStat(StatType.FORTUNE); + // Drop more items if fortune enchant + double f = event.getData().getStats().getStat("FORTUNE"); if (f > 0 && random.nextDouble() < f * .045) { int a = (int) (1.5 * Math.sqrt(f / 1.1)); for (ItemStack item : event.getDrops()) item.setAmount(item.getAmount() + a); } - if(MythicLib.plugin.getVersion().getWrapper().isCropFullyGrown(event.getBlock())) - { - // drop more items if fortune enchant - double l = event.getData().getStats().getStat(StatType.LUCK_OF_THE_FIELD); + if (MythicLib.plugin.getVersion().getWrapper().isCropFullyGrown(event.getBlock())) { + + // Drop more CROP items + double l = event.getData().getStats().getStat("LUCK_OF_THE_FIELD"); if (l > 0 && random.nextDouble() < l * .045) { int a = (int) (1.5 * Math.sqrt(l / 1.1)); Location loc = event.getBlock().getLocation().add(.5, .1, .5); diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java index 6f455b3e..8b39522e 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java +++ b/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java @@ -4,7 +4,6 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.LootChestSpawnEvent; import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.loot.LootBuilder; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; @@ -125,7 +124,7 @@ public class LootChestRegion { */ @NotNull public ChestTier rollTier(PlayerData player) { - double chance = player.getStats().getStat(StatType.CHANCE) * MMOCore.plugin.configManager.lootChestsChanceWeight; + double chance = player.getStats().getStat("CHANCE") * MMOCore.plugin.configManager.lootChestsChanceWeight; double sum = 0; for (ChestTier tier : tiers) diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java b/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java index 143ebbca..8febb7bb 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java +++ b/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java @@ -3,7 +3,6 @@ package net.Indyuce.mmocore.loot.droptable.dropitem; import java.util.Random; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.loot.LootBuilder; import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import io.lumine.mythic.lib.api.MMOLineConfig; @@ -40,7 +39,7 @@ public abstract class DropItem { * If the player chance is 0 the random value will remain the same. When he get lucks the chance gets closer to one. */ public boolean rollChance(PlayerData player) { - return Math.pow(random.nextDouble(), 1 / Math.log(1 + player.getStats().getStat(StatType.CHANCE))) < chance; + return Math.pow(random.nextDouble(), 1 / Math.log(1 + player.getStats().getStat("CHANCE"))) < chance; } public abstract void collect(LootBuilder builder); diff --git a/src/main/java/net/Indyuce/mmocore/manager/StatManager.java b/src/main/java/net/Indyuce/mmocore/manager/StatManager.java new file mode 100644 index 00000000..ee23b9d6 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/manager/StatManager.java @@ -0,0 +1,71 @@ +package net.Indyuce.mmocore.manager; + +import io.lumine.mythic.lib.MythicLib; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.player.stats.StatInfo; +import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.experience.Profession; +import org.bukkit.configuration.file.FileConfiguration; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.text.DecimalFormat; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +public class StatManager implements MMOCoreManager { + private final Map loaded = new HashMap<>(); + + @Override + public void initialize(boolean clearBefore) { + if (clearBefore) + loaded.clear(); + + FileConfiguration config = new ConfigFile("stats").getConfig(); + + // Read decimal formats + for (String key : config.getConfigurationSection("decimal-format").getKeys(false)) + registerDecimalFormat(key, MythicLib.plugin.getMMOConfig().newDecimalFormat(config.getString("decimal-format." + key))); + + // Read default formulas + for (String key : config.getConfigurationSection("default").getKeys(false)) + registerDefaultFormula(key, new LinearValue(config.getConfigurationSection("default." + key))); + } + + public Collection getLoaded() { + return loaded.values(); + } + + @Nullable + public StatInfo getInfo(String stat) { + return loaded.get(stat); + } + + public void registerProfession(String stat, Profession profession) { + compute(stat).profession = profession; + } + + public void registerDefaultFormula(String stat, LinearValue defaultFormula) { + compute(stat).defaultInfo = defaultFormula; + } + + public void registerDecimalFormat(String stat, DecimalFormat format) { + compute(stat).format = format; + } + + /** + * @return A stat info for the specified stat. If it doesn't + * exist when method is called, it is registered into the map + */ + @NotNull + private StatInfo compute(String stat) { + StatInfo found = loaded.get(stat); + if (found != null) + return found; + + StatInfo newInfo = new StatInfo(stat); + loaded.put(stat, newInfo); + return newInfo; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index df083d7a..66d5ed47 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -9,7 +9,6 @@ import net.Indyuce.mmocore.api.player.OfflinePlayerData; 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.player.stats.StatType; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.PlayerDataManager; import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor.Table; @@ -35,6 +34,13 @@ public class MySQLPlayerDataManager extends PlayerDataManager { try { MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); + // Initialize custom resources + if (!data.hasUsedTemporaryData()) { + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); + } + if (!result.next()) { data.setLevel(getDefaultData().getLevel()); data.setClassPoints(getDefaultData().getClassPoints()); @@ -44,12 +50,6 @@ public class MySQLPlayerDataManager extends PlayerDataManager { data.setExperience(0); data.getQuestData().updateBossBar(); - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat(StatType.MAX_MANA)); - data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA)); - data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM)); - } - data.setFullyLoaded(); MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); return; @@ -69,12 +69,6 @@ public class MySQLPlayerDataManager extends PlayerDataManager { json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); } - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat(StatType.MAX_MANA)); - data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA)); - data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM)); - } - if (!isEmpty(result.getString("guild"))) { Guild guild = provider.getGuildManager().getGuild(result.getString("guild")); data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); 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 7efe48fa..e8eaa739 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 @@ -6,7 +6,6 @@ import net.Indyuce.mmocore.api.player.OfflinePlayerData; 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.player.stats.StatType; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.PlayerDataManager; @@ -41,9 +40,9 @@ public class YAMLPlayerDataManager extends PlayerDataManager { data.setClass(MMOCore.plugin.classManager.get(config.getString("class"))); if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat(StatType.MAX_MANA)); - data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA)); - data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM)); + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); } if (config.contains("guild")) { diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java index 93a5a73f..e794c9e3 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java @@ -3,7 +3,6 @@ package net.Indyuce.mmocore.manager.profession; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.loot.chest.condition.ConditionInstance; import net.Indyuce.mmocore.loot.droptable.dropitem.fishing.FishingDropItem; @@ -31,6 +30,11 @@ public class FishingManager extends SpecificProfessionManager { } catch (IllegalArgumentException exception) { MMOCore.log(Level.WARNING, "Could not load fishing drop table " + key + ": " + exception.getMessage()); } + + // Link fishing stats to this profession + MMOCore.plugin.statManager.registerProfession("FISHING_STRENGTH", getLinkedProfession()); + MMOCore.plugin.statManager.registerProfession("CRITICAL_FISHING_CHANCE", getLinkedProfession()); + MMOCore.plugin.statManager.registerProfession("CRITICAL_FISHING_FAILURE_CHANCE", getLinkedProfession()); } public FishingDropTable calculateDropTable(Entity entity) { @@ -46,7 +50,6 @@ public class FishingManager extends SpecificProfessionManager { public static class FishingDropTable { private final Set conditions = new HashSet<>(); private final List items = new ArrayList<>(); - private double maxWeight = 0; public FishingDropTable(ConfigurationSection section) { Validate.notNull(section, "Could not load config"); @@ -72,7 +75,6 @@ public class FishingManager extends SpecificProfessionManager { try { FishingDropItem dropItem = new FishingDropItem(new MMOLineConfig(str)); items.add(dropItem); - maxWeight += dropItem.getItem().getWeight(); } catch (RuntimeException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load item '" + str + "' from fishing drop table '" + id + "': " + exception.getMessage()); @@ -93,11 +95,13 @@ public class FishingManager extends SpecificProfessionManager { } /** - * The Fishing Drop Item is calculated randomly bu the chance stat will make - * low weight items more likely to be caught. + * The chance stat will make low weight items more + * likely to be chosen by the algorithm + * + * @return Randomly computed fishing drop item */ public FishingDropItem getRandomItem(PlayerData player) { - double chance = player.getStats().getStat(StatType.CHANCE); + double chance = player.getStats().getStat("CHANCE"); //chance=0 ->the tier.chance remains the same //chance ->+inf -> the tier.chance becomes the same for everyone, uniform law diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java index be3c8358..b6a1f7f0 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.manager.social; +import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.manager.MMOCoreManager; import org.bukkit.configuration.ConfigurationSection; @@ -26,8 +26,7 @@ public class PartyManager implements MMOCoreManager { if (config != null) for (String key : config.getKeys(false)) try { - StatType stat = StatType.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_")); - buffs.add(new StatModifier("mmocoreParty", stat.name(), config.getString(key))); + buffs.add(new StatModifier("mmocoreParty", UtilityMethods.enumName(key), config.getString(key))); } catch (IllegalArgumentException exception) { MMOCore.log(Level.WARNING, "Could not load party buff '" + key + "': " + exception.getMessage()); } diff --git a/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java b/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java new file mode 100644 index 00000000..078b4af7 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java @@ -0,0 +1,71 @@ +package net.Indyuce.mmocore.player.stats; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.experience.Profession; +import org.jetbrains.annotations.NotNull; + +import java.text.DecimalFormat; +import java.util.Objects; + +/** + * @author Jules + * @impl MMOCore used to have a giant enum of all the stat types + * which is now incompatible with MythicLib because the MMO plugins + * now have completely OPEN to edition numeric stat registries + */ +public class StatInfo { + public final String name; + + /** + * Profession linked to that stat. Stats which have a profession linked to + * them do NOT scale on the main player level but rather on that specific + * profession level + */ + public Profession profession; + + /** + * Default formula for the stat + */ + public LinearValue defaultInfo; + + /** + * How that stat displays anywhere in GUIs + */ + public DecimalFormat format; + + private static final DecimalFormat DEFAULT_DECIMAL_FORMAT = new DecimalFormat("0.#"); + + public StatInfo(String name) { + this.name = name; + } + + @NotNull + public String format(double d) { + return (format == null ? DEFAULT_DECIMAL_FORMAT : format).format(d); + } + + @NotNull + public LinearValue getDefaultFormula() { + return defaultInfo == null ? LinearValue.ZERO : defaultInfo; + } + + @NotNull + public static StatInfo valueOf(String str) { + StatInfo found = MMOCore.plugin.statManager.getInfo(str); + return found == null ? new StatInfo(str) : found; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + StatInfo statInfo = (StatInfo) o; + return name.equals(statInfo.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } +} From 73fbb5844d2c85e2de163fd396963a28f2185341 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Wed, 1 Jun 2022 23:00:49 +0200 Subject: [PATCH 22/91] Push or Ill kill your family --- .../Indyuce/mmocore/waypoint/Waypoint.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java index 7391f8a5..93bee8ae 100644 --- a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java +++ b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java @@ -30,13 +30,13 @@ public class Waypoint extends PostLoadObject implements Unlockable { *

* If it's empty it can access any waypoint. */ - private final Map destinations = new HashMap<>(); + private final Map destinations = new HashMap<>(); /** * Waypoint options saved here. */ private final Map options = new HashMap<>(); - private final double dynamicCost, setSpawnCost; + private final double dynamicCost, setSpawnCost, normalCost; private final List dynamicUseConditions = new ArrayList<>(); public Waypoint(ConfigurationSection config) { @@ -50,6 +50,7 @@ public class Waypoint extends PostLoadObject implements Unlockable { radiusSquared = Math.pow(config.getDouble("radius"), 2); dynamicCost = config.getDouble("cost.dynamic-use"); + normalCost = config.getDouble("cost.normal-use"); setSpawnCost = config.getDouble("cost.set-spawnpoint"); for (WaypointOption option : WaypointOption.values()) @@ -66,6 +67,7 @@ public class Waypoint extends PostLoadObject implements Unlockable { } } + @Override protected void whenPostLoaded(@NotNull ConfigurationSection config) { @@ -73,7 +75,7 @@ public class Waypoint extends PostLoadObject implements Unlockable { if (config.contains("linked")) { ConfigurationSection section = config.getConfigurationSection("linked"); for (String key : section.getKeys(false)) - destinations.put(MMOCore.plugin.waypointManager.get(key), section.getInt(key)); + destinations.put(MMOCore.plugin.waypointManager.get(key), section.getDouble(key)); } } @@ -93,19 +95,11 @@ public class Waypoint extends PostLoadObject implements Unlockable { return loc; } - /** - * @param other Another waypoint - * @return If any player standing on that waypoint can teleport to given waypoint - */ - @Deprecated - public boolean hasDestination(Waypoint other) { - return destinations.isEmpty() || destinations.containsKey(other); - } - public double getDynamicCost() { return dynamicCost; } + @Deprecated public double getSetSpawnCost() { return setSpawnCost; } @@ -125,8 +119,8 @@ public class Waypoint extends PostLoadObject implements Unlockable { * @return Integer.POSITIVE_INFINITY if the way point is not linked * If it is, cost of the instant travel between the two waypoints. */ - public int getDirectCost(Waypoint waypoint) { - return destinations.getOrDefault(waypoint, Integer.MAX_VALUE); + public double getDirectCost(Waypoint waypoint) { + return destinations.isEmpty() ? normalCost : destinations.getOrDefault(waypoint, Double.POSITIVE_INFINITY); } public List getAllPath() { From 560a2def41ddbef368911747d21af08ed4b7ac6e Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 4 Jun 2022 12:08:50 +0200 Subject: [PATCH 23/91] Fixed an issue with paper having durability, like wth spigot --- src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java index b15bb60a..64a5744a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java +++ b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java @@ -196,7 +196,7 @@ public class MMOCoreUtils { */ public static void decreaseDurability(Player player, EquipmentSlot slot, int damage) { ItemStack item = player.getInventory().getItem(slot); - if (!item.hasItemMeta() || !(item.getItemMeta() instanceof Damageable) || item.getItemMeta().isUnbreakable()) + if (item == null || item.getType().getMaxDurability() == 0 || !item.hasItemMeta() || !(item.getItemMeta() instanceof Damageable) || item.getItemMeta().isUnbreakable()) return; PlayerItemDamageEvent event = new PlayerItemDamageEvent(player, item, damage); From 9a08c142fbf7f8fae145dc97b2d630bfe05c096f Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 4 Jun 2022 12:10:01 +0200 Subject: [PATCH 24/91] Cleanup --- .../java/net/Indyuce/mmocore/MMOCore.java | 4 +- .../source/MineBlockExperienceSource.java | 2 +- .../source/MoveExperienceSource.java | 38 ++++++++----------- .../source/PlayExperienceSource.java | 16 ++------ .../source/ProjectileExperienceSource.java | 14 +++---- .../source/ResourceExperienceSource.java | 1 - .../source/TameExperienceSource.java | 3 +- ...ion.java => MMOCoreTargetRestriction.java} | 3 +- .../mmocore/party/PartyModuleType.java | 7 +++- src/main/resources/config.yml | 3 +- 10 files changed, 38 insertions(+), 53 deletions(-) rename src/main/java/net/Indyuce/mmocore/party/{PartyMemberTargetRestriction.java => MMOCoreTargetRestriction.java} (88%) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 04096c71..622b56a8 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -39,7 +39,7 @@ import net.Indyuce.mmocore.manager.profession.*; import net.Indyuce.mmocore.manager.social.BoosterManager; import net.Indyuce.mmocore.manager.social.PartyManager; import net.Indyuce.mmocore.manager.social.RequestManager; -import net.Indyuce.mmocore.party.PartyMemberTargetRestriction; +import net.Indyuce.mmocore.party.MMOCoreTargetRestriction; import net.Indyuce.mmocore.party.PartyModule; import net.Indyuce.mmocore.party.PartyModuleType; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; @@ -116,7 +116,7 @@ public class MMOCore extends LuminePlugin { } // Register MMOCore-specific objects - MythicLib.plugin.getEntities().registerRestriction(new PartyMemberTargetRestriction()); + MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); // Register extra objective, drop items... diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java index 4eef178f..fcc457a4 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java @@ -15,7 +15,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; public class MineBlockExperienceSource extends SpecificExperienceSource { - public final Material material; + private final Material material; private final boolean silkTouch; private final boolean crop; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java index 6af6bf03..66ae8959 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java @@ -1,18 +1,14 @@ package net.Indyuce.mmocore.experience.source; -import com.mojang.datafixers.types.Func; import io.lumine.mythic.lib.api.MMOLineConfig; -import io.lumine.mythic.lib.damage.DamageType; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; -import org.xml.sax.SAXParseException; import java.util.Arrays; import java.util.Objects; @@ -20,9 +16,7 @@ import java.util.function.Function; import java.util.stream.Collectors; public class MoveExperienceSource extends SpecificExperienceSource { - MovingType type; - - + private final MovingType type; public MoveExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) { super(dispenser, config); @@ -42,18 +36,18 @@ public class MoveExperienceSource extends SpecificExperienceSource { return new ExperienceSourceManager() { @EventHandler public void onMove(PlayerMoveEvent e) { - double deltax=e.getTo().getBlockX()-e.getFrom().getBlockX(); - double deltay=e.getTo().getBlockY()-e.getFrom().getBlockY(); - double deltaz=e.getTo().getBlockZ()-e.getFrom().getBlockZ(); - if(deltax!=0&&deltay!=0&&deltaz!=0) { - double delta=Math.sqrt(deltax*deltax+deltay*deltay+deltaz*deltaz); - if(e.getPlayer().hasMetadata("NPC")) + double deltax = e.getTo().getBlockX() - e.getFrom().getBlockX(); + double deltay = e.getTo().getBlockY() - e.getFrom().getBlockY(); + double deltaz = e.getTo().getBlockZ() - e.getFrom().getBlockZ(); + if (deltax != 0 && deltay != 0 && deltaz != 0) { + double delta = Math.sqrt(deltax * deltax + deltay * deltay + deltaz * deltaz); + if (e.getPlayer().hasMetadata("NPC")) return; - Player player=e.getPlayer(); - PlayerData playerData =PlayerData.get(player); - for(MoveExperienceSource source:getSources()) { - if(source.matchesParameter(playerData,null)) { - giveExperience(playerData,delta,null); + Player player = e.getPlayer(); + PlayerData playerData = PlayerData.get(player); + for (MoveExperienceSource source : getSources()) { + if (source.matchesParameter(playerData, null)) { + giveExperience(playerData, delta, null); } } } @@ -63,13 +57,13 @@ public class MoveExperienceSource extends SpecificExperienceSource { @Override public boolean matchesParameter(PlayerData player, Object obj) { - return type==null||type.matches(player.getPlayer()); + return type == null || type.matches(player.getPlayer()); } public enum MovingType { SNEAK(Player::isSneaking), - FLY((p)->p.isFlying()||p.isGliding()), - SWIM((p)->p.getLocation().getBlock().isLiquid()), + FLY((p) -> p.isFlying() || p.isGliding()), + SWIM((p) -> p.getLocation().getBlock().isLiquid()), SPRINT(Player::isSprinting), WALK((p) -> !p.isSneaking() && !p.isSprinting() && !p.isFlying() && !p.getLocation().getBlock().isLiquid()); @@ -80,7 +74,7 @@ public class MoveExperienceSource extends SpecificExperienceSource { } public boolean matches(Player player) { - return !player.isInsideVehicle()&&matching.apply(player); + return !player.isInsideVehicle() && matching.apply(player); } } diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java index d95e6a7b..b2f49d62 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java @@ -6,12 +6,13 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.scheduler.BukkitRunnable; +import java.util.Objects; + public class PlayExperienceSource extends SpecificExperienceSource { private final World world; @@ -25,18 +26,9 @@ public class PlayExperienceSource extends SpecificExperienceSource { */ public PlayExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) { super(dispenser, config); - if (!config.contains("in-combat")) - inCombat = false; - else { - inCombat = config.getBoolean("in-combat"); - } - if (!config.contains("world")) - world = null; - else { - String name = config.getString("world"); - Validate.notNull(world = Bukkit.getWorld(name), "Could not find world " + config.getString("world")); - } + inCombat = config.getBoolean("in-combat", false); + world = config.contains("world") ? Objects.requireNonNull(Bukkit.getWorld(config.getString("world")), "Could not find world " + config.getString("world")) : null; if (!config.contains("x1") || !config.contains("x2")) { x1 = Double.NEGATIVE_INFINITY; x2 = Double.POSITIVE_INFINITY; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java index 49647b70..c3ac3578 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java @@ -1,18 +1,17 @@ package net.Indyuce.mmocore.experience.source; -import de.schlichtherle.key.passwd.swing.BasicUnknownKeyFeedback; -import io.lumine.mythic.core.skills.mechanics.ShootMechanic; import io.lumine.mythic.lib.api.MMOLineConfig; -import me.glaremasters.guilds.utils.BackupUtils; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.entity.*; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Trident; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.ProjectileHitEvent; @@ -21,13 +20,10 @@ import org.bukkit.scheduler.BukkitRunnable; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; -import java.util.Locale; import java.util.function.Function; import java.util.stream.Collectors; public class ProjectileExperienceSource extends SpecificExperienceSource { - private final ProjectileType projectileType; public ProjectileExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) { @@ -59,7 +55,7 @@ public class ProjectileExperienceSource extends SpecificExperienceSource { private final PlayerResource resource; - /** * Gives experience when the player uses a specific resoure. If no resource is precised it will trigger for * mana, stamina and stellium. The amount specified si the xp given per resource consummed. diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java index af7a22a4..83a455c6 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java @@ -13,8 +13,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; public class TameExperienceSource extends SpecificExperienceSource { - - public TameExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) { super(dispenser, config); } @@ -22,6 +20,7 @@ public class TameExperienceSource extends SpecificExperienceSource { @Override public ExperienceSourceManager newManager() { return new ExperienceSourceManager() { + @EventHandler public void onWolfHit(EntityDamageByEntityEvent e) { if(e.getDamager() instanceof Wolf) { diff --git a/src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java b/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java similarity index 88% rename from src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java rename to src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java index d2a6989f..e3603461 100644 --- a/src/main/java/net/Indyuce/mmocore/party/PartyMemberTargetRestriction.java +++ b/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java @@ -7,7 +7,7 @@ import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -public class PartyMemberTargetRestriction implements TargetRestriction { +public class MMOCoreTargetRestriction implements TargetRestriction { @Override public boolean canTarget(Player player, LivingEntity livingEntity, InteractionType interactionType) { @@ -15,6 +15,7 @@ public class PartyMemberTargetRestriction implements TargetRestriction { return true; AbstractParty party = MMOCore.plugin.partyModule.getParty(PlayerData.get(player)); + // TODO check for guild return party == null || !party.hasMember((Player) livingEntity); } } diff --git a/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java index f6b0370a..8a031652 100644 --- a/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java +++ b/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java @@ -1,13 +1,16 @@ package net.Indyuce.mmocore.party; -import net.Indyuce.mmocore.party.compat.*; +import net.Indyuce.mmocore.party.compat.DungeonsXLPartyModule; +import net.Indyuce.mmocore.party.compat.McMMOPartyModule; +import net.Indyuce.mmocore.party.compat.PAFPartyModule; +import net.Indyuce.mmocore.party.compat.PartiesPartyModule; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; import org.bukkit.Bukkit; import javax.inject.Provider; public enum PartyModuleType { - DUNGEONS("Dungeons", DungeonsPartyModule::new), + // DUNGEONS("Dungeons", DungeonsPartyModule::new), DUNGEONSXL("DungeonsXL", DungeonsXLPartyModule::new), MCMMO("mcMMO", McMMOPartyModule::new), MMOCORE("MMOCore", MMOCorePartyModule::new), diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0ccdbde5..db45266d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -55,7 +55,8 @@ protect-custom-mine: false # - mmocore # - dungeonsxl # - parties -# - parties_and_friends +# - party_and_friends +# - mcmmo party-plugin: mmocore ## Edit the plugin handling parties here. From 0ae7c3613d830874a699c8e7d0fe16a96e73f935 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 4 Jun 2022 12:17:33 +0200 Subject: [PATCH 25/91] Fixed an error when setting exp to 0 --- .../mmocore/command/rpg/admin/ExperienceCommandTreeNode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java index b556d3d7..5c4b7664 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java @@ -58,8 +58,8 @@ public class ExperienceCommandTreeNode extends CommandTreeNode { int amount; try { amount = Integer.parseInt(args[5]); - Validate.isTrue(amount > 0); - } catch (NumberFormatException exception) { + Validate.isTrue(amount >= 0); + } catch (RuntimeException exception) { sender.sendMessage(ChatColor.RED + args[5] + " is not a valid number."); return CommandResult.FAILURE; } From a0685334e1df541720fc11d4ba075930399c3854 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 4 Jun 2022 12:20:08 +0200 Subject: [PATCH 26/91] Fixed an issue with enchant plugins + enchant exp source --- .../manager/profession/EnchantManager.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java index 592d69f4..25b3605f 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java @@ -4,17 +4,19 @@ import io.lumine.mythic.lib.MythicLib; import net.Indyuce.mmocore.MMOCore; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.enchantments.Enchantment; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; public class EnchantManager extends SpecificProfessionManager { - private final Map base = new HashMap<>(); + private final Map base = new HashMap<>(); - public EnchantManager() { - super("base-enchant-exp"); - } + public EnchantManager() { + super("base-enchant-exp"); + } @Override public void loadProfessionConfiguration(ConfigurationSection config) { @@ -27,17 +29,20 @@ public class EnchantManager extends SpecificProfessionManager { } } - public void registerBaseExperience(Enchantment enchant, double value) { - base.put(enchant, value); - } + public void registerBaseExperience(Enchantment enchant, double value) { + base.put(enchant, value); + } - public double getBaseExperience(Enchantment enchant) { - return base.get(enchant); - } + @NotNull + public double getBaseExperience(Enchantment enchant) { + // Can be null if argument passed is an enchant with no config attached to it + @Nullable Double found = base.get(enchant); + return found == null ? 0 : found; + } - @Override - public void initialize(boolean clearBefore) { - if (clearBefore) - base.clear(); - } + @Override + public void initialize(boolean clearBefore) { + if (clearBefore) + base.clear(); + } } From 39486771b1ecaf6d5aeea3a4ad464bddb7ace197 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 4 Jun 2022 12:38:27 +0200 Subject: [PATCH 27/91] Added NONE skill casting mode --- .../mmocore/skill/cast/SkillCastingMode.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java b/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java index 49c85ade..ebc82f10 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java +++ b/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java @@ -19,17 +19,27 @@ public enum SkillCastingMode { SKILL_BAR(config -> new SkillBar(config)), /** - * + * When entering casting mode you can use the mouse scroller + * to navigate through the entire castable skill list. Then press + * one key to cast the one selected. */ SKILL_SCROLL(config -> new SkillScroller(config)), /** * Initialize your skill combo by pressing some key. *

- * Then press a certain amount of keys to + * Then press a certain key combo. The config can be used + * to map key combos to skill bind slots, for instance LLR + * would cast the 2nd skill but LRL the 3rd one. */ KEY_COMBOS(config -> new KeyCombos(config)), + /** + * Entirely disables skill casting. + */ + NONE(config -> new Listener() { + }); + /** * Not implemented yet. *

From 617c2a3713ff7937a7b40c564f4d34578fcdbace Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 5 Jun 2022 16:32:08 +0200 Subject: [PATCH 28/91] p.u.s.h --- src/main/java/net/Indyuce/mmocore/MMOCore.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 622b56a8..3af53024 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -119,6 +119,7 @@ public class MMOCore extends LuminePlugin { MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); + // Register extra objective, drop items... if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) loadManager.registerLoader(new WorldGuardMMOLoader()); From ba2691daf2932c821e03e70a59b98fd775750960 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 14 Jun 2022 09:39:58 +0200 Subject: [PATCH 29/91] Fixed exp splitting + now supports professions --- .../mmocore/api/event/PlayerLevelUpEvent.java | 4 ++- .../mmocore/api/player/PlayerData.java | 15 ++++---- .../rpg/admin/ExperienceCommandTreeNode.java | 4 +-- .../Indyuce/mmocore/experience/EXPSource.java | 3 ++ .../mmocore/experience/PlayerProfessions.java | 36 ++++++++++++------- .../mmocore/experience/Profession.java | 2 +- .../listener/profession/FishingListener.java | 2 +- .../manager/social/BoosterManager.java | 7 ++-- 8 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java index b02a90bc..0938dc8a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java +++ b/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java @@ -4,11 +4,12 @@ import org.bukkit.event.HandlerList; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; +import org.jetbrains.annotations.Nullable; public class PlayerLevelUpEvent extends PlayerDataEvent { private static final HandlerList handlers = new HandlerList(); - // if null, this is main level + // If null, this is main level private final Profession profession; private final int oldLevel, newLevel; @@ -36,6 +37,7 @@ public class PlayerLevelUpEvent extends PlayerDataEvent { return profession != null; } + @Nullable public Profession getProfession() { return profession; } 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 8713d21f..b8e3922c 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -540,18 +540,19 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc return; } - value = MMOCore.plugin.boosterManager.calculateExp(null, value); - value *= 1 + getStats().getStat("ADDITIONAL_EXPERIENCE") / 100; - // Splitting exp through party members - AbstractParty party = getParty(); - if (splitExp && party != null) { - List onlineMembers = getParty().getOnlineMembers(); + AbstractParty party; + if (splitExp && (party = getParty()) != null) { + List onlineMembers = party.getOnlineMembers(); value /= onlineMembers.size(); for (PlayerData member : onlineMembers) - member.giveExperience(value, EXPSource.PARTY_SHARING, null, false); + if (!equals(member)) + member.giveExperience(value, source, null, false); } + // Apply buffs AFTER splitting exp + value *= (1 + getStats().getStat("ADDITIONAL_EXPERIENCE") / 100) * MMOCore.plugin.boosterManager.getMultiplier(null); + PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(this, value, source); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java index 5c4b7664..5bd2d305 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java @@ -23,9 +23,9 @@ public class ExperienceCommandTreeNode extends CommandTreeNode { addChild(new ActionCommandTreeNode(this, "set", PlayerData::setExperience, PlayerProfessions::setExperience)); addChild(new ActionCommandTreeNode(this, "give", (data, value) -> data.giveExperience(value, EXPSource.COMMAND), (professions, profession, - value) -> professions.giveExperience(profession, value, EXPSource.COMMAND, professions.getPlayerData().getPlayer().getLocation()))); + value) -> professions.giveExperience(profession, value, EXPSource.COMMAND))); addChild(new ActionCommandTreeNode(this, "take", (data, value) -> data.giveExperience(-value, EXPSource.COMMAND), (professions, profession, - value) -> professions.giveExperience(profession, -value, EXPSource.COMMAND, professions.getPlayerData().getPlayer().getLocation()))); + value) -> professions.giveExperience(profession, -value, EXPSource.COMMAND))); } public static class ActionCommandTreeNode extends CommandTreeNode { diff --git a/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java b/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java index 89f522f3..08ccf6c9 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java @@ -19,7 +19,10 @@ public enum EXPSource { /** * When party members share exp + * + * @deprecated Not used anymore */ + @Deprecated PARTY_SHARING, /** diff --git a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 44f3552c..9b0d11c1 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -13,6 +13,7 @@ import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; +import net.Indyuce.mmocore.party.AbstractParty; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -22,6 +23,7 @@ import org.bukkit.configuration.ConfigurationSection; import javax.annotation.Nullable; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -147,15 +149,15 @@ public class PlayerProfessions { giveExperience(profession, total, source); } - public void giveExperience(Profession profession, double value, EXPSource source) { - giveExperience(profession, value, source, null); - } - public boolean hasReachedMaxLevel(Profession profession) { return profession.hasMaxLevel() && getLevel(profession) >= profession.getMaxLevel(); } - public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation) { + public void giveExperience(Profession profession, double value, EXPSource source) { + giveExperience(profession, value, source, null, true); + } + + public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) { Validate.isTrue(playerData.isOnline(), "Cannot give experience to offline player"); if (value <= 0) return; @@ -165,23 +167,31 @@ public class PlayerProfessions { return; } - value = MMOCore.plugin.boosterManager.calculateExp(profession, value); + // Splitting exp through party members + AbstractParty party; + if (splitExp && (party = playerData.getParty()) != null) { + List onlineMembers = party.getOnlineMembers(); + value /= onlineMembers.size(); + for (PlayerData member : onlineMembers) + if (!member.equals(playerData)) + member.getCollectionSkills().giveExperience(profession, value, source, null, false); + } - // Adds functionality for additional experience per profession. - value *= 1 + playerData.getStats().getInstance("ADDITIONAL_EXPERIENCE_" + UtilityMethods.enumName(profession.getId())).getTotal() / 100; - - // Display hologram - if (hologramLocation != null) - MMOCoreUtils.displayIndicator(hologramLocation.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message()); + // Apply buffs AFTER splitting exp + value *= (1 + playerData.getStats().getStat("ADDITIONAL_EXPERIENCE_" + UtilityMethods.enumName(profession.getId())) / 100) * MMOCore.plugin.boosterManager.getMultiplier(profession); PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(playerData, profession, value, source); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) return; + // Display hologram + if (hologramLocation != null) + MMOCoreUtils.displayIndicator(hologramLocation.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message()); + exp.put(profession.getId(), Math.max(0, exp.getOrDefault(profession.getId(), 0.) + event.getExperience())); int level, oldLevel = getLevel(profession); - double needed,exp; + double needed, exp; /* * Loop for exp overload when leveling up, will continue diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java index 42db02b1..ac71dc28 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -127,7 +127,7 @@ public class Profession extends PostLoadObject implements ExperienceObject { public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { hologramLocation = !getOption(Profession.ProfessionOption.EXP_HOLOGRAMS) ? null : hologramLocation; - playerData.getCollectionSkills().giveExperience(this, experience, EXPSource.SOURCE, hologramLocation); + playerData.getCollectionSkills().giveExperience(this, experience, EXPSource.SOURCE, hologramLocation, true); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java b/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java index 50c1405c..4f1e0588 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java @@ -197,7 +197,7 @@ public class FishingListener implements Listener { location.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, location, 0, 4 * (RANDOM.nextDouble() - .5), RANDOM.nextDouble() + 1, 4 * (RANDOM.nextDouble() - .5), .08); if (MMOCore.plugin.fishingManager.hasLinkedProfession()) - playerData.getCollectionSkills().giveExperience(MMOCore.plugin.fishingManager.getLinkedProfession(), experienceDropped, EXPSource.FISHING, location); + playerData.getCollectionSkills().giveExperience(MMOCore.plugin.fishingManager.getLinkedProfession(), experienceDropped, EXPSource.FISHING, location, true); } } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java index 113b99ba..9d31ace6 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java @@ -2,6 +2,7 @@ package net.Indyuce.mmocore.manager.social; import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.experience.Profession; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; @@ -48,7 +49,7 @@ public class BoosterManager { /** * @return Sums all current experience boosters values */ - public double getMultiplier(Profession profession) { + public double getMultiplier(@Nullable Profession profession) { double d = 1; for (Booster booster : map) @@ -58,10 +59,6 @@ public class BoosterManager { return d; } - public double calculateExp(Profession profession, double exp) { - return (exp * getMultiplier(profession)); - } - /** * @return Collection of currently registered boosters. Some of them can be * expired but are not unregistered yet! From 88da562ebdfc682f93fe5a3241b63b339eab5970 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 16 Jun 2022 11:37:32 +0200 Subject: [PATCH 30/91] Guild module --- .../java/net/Indyuce/mmocore/MMOCore.java | 25 +- .../comp/placeholder/RPGPlaceholders.java | 4 +- .../gui/social/guild/EditableGuildAdmin.java | 33 ++- .../gui/social/guild/EditableGuildView.java | 32 ++- .../Indyuce/mmocore/guild/AbstractGuild.java | 7 + .../mmocore/guild/GuildModuleType.java | 4 +- .../guild/compat/FactionsGuildModule.java | 14 +- .../guild/compat/GuildsGuildModule.java | 10 +- .../guild/compat/KingdomsXGuildModule.java | 16 +- .../compat/UltimateClansGuildModule.java | 11 +- .../Indyuce/mmocore/guild/provided/Guild.java | 242 ++++++++---------- .../mmocore/guild/provided/GuildInvite.java | 2 +- .../mmocore/listener/GuildListener.java | 2 +- .../mmocore/manager/ConfigManager.java | 3 +- .../manager/data/GuildDataManager.java | 2 +- .../data/mysql/MySQLPlayerDataManager.java | 2 +- .../data/yaml/YAMLGuildDataManager.java | 2 +- .../data/yaml/YAMLPlayerDataManager.java | 2 +- src/main/resources/config.yml | 24 +- 19 files changed, 254 insertions(+), 183 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 3af53024..6c9c9454 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -25,7 +25,10 @@ import net.Indyuce.mmocore.comp.region.WorldGuardMMOLoader; import net.Indyuce.mmocore.comp.region.WorldGuardRegionHandler; import net.Indyuce.mmocore.comp.vault.VaultEconomy; import net.Indyuce.mmocore.comp.vault.VaultMMOLoader; +import net.Indyuce.mmocore.guild.GuildModule; +import net.Indyuce.mmocore.guild.GuildModuleType; import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.guild.provided.MMOCoreGuildModule; import net.Indyuce.mmocore.listener.*; import net.Indyuce.mmocore.listener.event.PlayerPressKeyListener; import net.Indyuce.mmocore.listener.option.*; @@ -97,6 +100,8 @@ public class MMOCore extends LuminePlugin { // Modules @NotNull public PartyModule partyModule; + @NotNull + public GuildModule guildModule; public boolean shouldDebugSQL = false; @@ -216,8 +221,8 @@ public class MMOCore extends LuminePlugin { // Load quest module try { - String questPluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin")); - PartyModuleType moduleType = PartyModuleType.valueOf(questPluginName); + String pluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin")); + PartyModuleType moduleType = PartyModuleType.valueOf(pluginName); Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); partyModule = moduleType.provideModule(); } catch (RuntimeException exception) { @@ -225,12 +230,10 @@ public class MMOCore extends LuminePlugin { partyModule = new MMOCorePartyModule(); } - - // Load party module try { - String partyPluginName = UtilityMethods.enumName(getConfig().getString("party-plugin")); - PartyModuleType moduleType = PartyModuleType.valueOf(partyPluginName); + String pluginName = UtilityMethods.enumName(getConfig().getString("party-plugin")); + PartyModuleType moduleType = PartyModuleType.valueOf(pluginName); Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); partyModule = moduleType.provideModule(); } catch (RuntimeException exception) { @@ -238,6 +241,16 @@ public class MMOCore extends LuminePlugin { partyModule = new MMOCorePartyModule(); } + // Load guild module + try { + String pluginName = UtilityMethods.enumName(getConfig().getString("guild-plugin")); + GuildModuleType moduleType = GuildModuleType.valueOf(pluginName); + Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); + guildModule = moduleType.provideModule(); + } catch (RuntimeException exception) { + getLogger().log(Level.WARNING, "Could not initialize guild module: " + exception.getMessage()); + guildModule = new MMOCoreGuildModule(); + } // Skill casting try { 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 795ac3a1..944b25e6 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -226,9 +226,9 @@ public class RPGPlaceholders extends PlaceholderExpansion { else if (placeholder.equalsIgnoreCase("leader")) return Bukkit.getOfflinePlayer(playerData.getGuild().getOwner()).getName(); else if (placeholder.equalsIgnoreCase("members")) - return "" + playerData.getGuild().getMembers().count(); + return String.valueOf(playerData.getGuild().countMembers()); else if (placeholder.equalsIgnoreCase("online_members")) - return "" + playerData.getGuild().getMembers().countOnline(); + return String.valueOf(playerData.getGuild().countOnlineMembers()); } return null; diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java b/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java index accda5e7..33fca626 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java +++ b/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java @@ -1,7 +1,5 @@ package net.Indyuce.mmocore.gui.social.guild; -import io.lumine.mythic.lib.api.item.ItemTag; -import io.lumine.mythic.lib.api.item.NBTItem; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; @@ -25,6 +23,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.persistence.PersistentDataType; +import java.util.List; import java.util.UUID; public class EditableGuildAdmin extends EditableInventory { @@ -43,7 +42,7 @@ public class EditableGuildAdmin extends EditableInventory { return new GuildViewInventory(data, this); } - public static class MemberDisplayItem extends InventoryItem { + public static class MemberDisplayItem extends InventoryItem { public MemberDisplayItem(MemberItem memberItem, ConfigurationSection config) { super(memberItem, config); } @@ -54,8 +53,8 @@ public class EditableGuildAdmin extends EditableInventory { } @Override - public Placeholders getPlaceholders(GeneratedInventory inv, int n) { - PlayerData member = PlayerData.get(inv.getPlayerData().getGuild().getMembers().get(n)); + public Placeholders getPlaceholders(GuildViewInventory inv, int n) { + PlayerData member = PlayerData.get(inv.members.get(n)); Placeholders holders = new Placeholders(); @@ -68,8 +67,8 @@ public class EditableGuildAdmin extends EditableInventory { } @Override - public ItemStack display(GeneratedInventory inv, int n) { - UUID uuid = inv.getPlayerData().getGuild().getMembers().get(n); + public ItemStack display(GuildViewInventory inv, int n) { + UUID uuid = inv.members.get(n); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); ItemStack disp = super.display(inv, n); @@ -87,7 +86,7 @@ public class EditableGuildAdmin extends EditableInventory { } } - public static class MemberItem extends SimplePlaceholderItem { + public static class MemberItem extends SimplePlaceholderItem { private final InventoryItem empty; private final MemberDisplayItem member; @@ -102,8 +101,8 @@ public class EditableGuildAdmin extends EditableInventory { } @Override - public ItemStack display(GeneratedInventory inv, int n) { - return inv.getPlayerData().getGuild().getMembers().count() > n ? member.display(inv, n) : empty.display(inv, n); + public ItemStack display(GuildViewInventory inv, int n) { + return inv.getPlayerData().getGuild().countMembers() > n ? member.display(inv, n) : empty.display(inv, n); } @Override @@ -115,15 +114,23 @@ public class EditableGuildAdmin extends EditableInventory { public class GuildViewInventory extends GeneratedInventory { private final int max; + private List members; + public GuildViewInventory(PlayerData playerData, EditableInventory editable) { super(playerData, editable); max = editable.getByFunction("member").getSlots().size(); } + @Override + public void open() { + members = playerData.getGuild().listMembers(); + super.open(); + } + @Override public String calculateName() { - return getName().replace("{max}", "" + max).replace("{players}", "" + getPlayerData().getGuild().getMembers().count()); + return getName().replace("{max}", "" + max).replace("{players}", "" + getPlayerData().getGuild().countMembers()); } @Override @@ -138,7 +145,7 @@ public class EditableGuildAdmin extends EditableInventory { if (item.getFunction().equals("invite")) { - if (playerData.getGuild().getMembers().count() >= max) { + if (playerData.getGuild().countMembers() >= max) { MMOCore.plugin.configManager.getSimpleMessage("guild-is-full").send(player); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); return; @@ -162,7 +169,7 @@ public class EditableGuildAdmin extends EditableInventory { } PlayerData targetData = PlayerData.get(target); - if (playerData.getGuild().getMembers().has(target.getUniqueId())) { + if (playerData.getGuild().hasMember(target.getUniqueId())) { MMOCore.plugin.configManager.getSimpleMessage("already-in-guild", "player", target.getName()).send(player); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); open(); diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java b/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java index 165b87e3..450c1228 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java @@ -21,6 +21,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.persistence.PersistentDataType; +import java.util.List; import java.util.UUID; public class EditableGuildView extends EditableInventory { @@ -35,7 +36,7 @@ public class EditableGuildView extends EditableInventory { return function.equals("member") ? new MemberItem(config) : (function.equals("next") || function.equals("previous") || function.equals("disband") || function.equals("invite")) ? new ConditionalItem(function, config) : new SimplePlaceholderItem(config); } - public static class MemberDisplayItem extends InventoryItem { + public static class MemberDisplayItem extends InventoryItem { public MemberDisplayItem(MemberItem memberItem, ConfigurationSection config) { super(memberItem, config); } @@ -46,8 +47,8 @@ public class EditableGuildView extends EditableInventory { } @Override - public Placeholders getPlaceholders(GeneratedInventory inv, int n) { - UUID uuid = inv.getPlayerData().getGuild().getMembers().get(n); + public Placeholders getPlaceholders(GuildViewInventory inv, int n) { + UUID uuid = inv.members.get(n); Placeholders holders = new Placeholders(); /* * Will never be null since a players name will always be recorded @@ -64,8 +65,8 @@ public class EditableGuildView extends EditableInventory { } @Override - public ItemStack display(GeneratedInventory inv, int n) { - UUID uuid = inv.getPlayerData().getGuild().getMembers().get(n); + public ItemStack display(GuildViewInventory inv, int n) { + UUID uuid = inv.members.get(n); ItemStack disp = super.display(inv, n); ItemMeta meta = disp.getItemMeta(); @@ -99,7 +100,7 @@ public class EditableGuildView extends EditableInventory { @Override public ItemStack display(GuildViewInventory inv, int n) { int index = n * inv.getPage(); - return inv.getPlayerData().getGuild().getMembers().count() > index ? member.display(inv, index) : empty.display(inv, index); + return inv.getPlayerData().getGuild().countMembers() > index ? member.display(inv, index) : empty.display(inv, index); } @Override @@ -120,7 +121,7 @@ public class EditableGuildView extends EditableInventory { public ItemStack display(GuildViewInventory inv, int n) { if (function.equals("next")) - if (inv.getPage() == (inv.getPlayerData().getGuild().getMembers().count() + 20) + if (inv.getPage() == (inv.getPlayerData().getGuild().countMembers() + 20) / inv.getByFunction("member").getSlots().size()) return null; if (function.equals("previous") && inv.getPage() == 1) @@ -136,19 +137,26 @@ public class EditableGuildView extends EditableInventory { } public class GuildViewInventory extends GeneratedInventory { - private int page = 1; private final int maxpages; + private int page = 1; + private List members; + public GuildViewInventory(PlayerData playerData, EditableInventory editable) { super(playerData, editable); - maxpages = (playerData.getGuild().getMembers().count() + 20) - / editable.getByFunction("member").getSlots().size(); + maxpages = (playerData.getGuild().countMembers() + 20) / editable.getByFunction("member").getSlots().size(); + } + + @Override + public void open() { + members = playerData.getGuild().listMembers(); + super.open(); } @Override public String calculateName() { - return getName().replace("{online_players}", "" + getPlayerData().getGuild().getMembers().countOnline()).replace("{page}", "" + page).replace("{maxpages}", "" + maxpages).replace("{players}", "" + getPlayerData().getGuild().getMembers().count()).replace("{tag}", getPlayerData().getGuild().getTag()).replace("{name}", getPlayerData().getGuild().getName()); + return getName().replace("{online_players}", "" + getPlayerData().getGuild().countOnlineMembers()).replace("{page}", "" + page).replace("{maxpages}", "" + maxpages).replace("{players}", String.valueOf(getPlayerData().getGuild().countMembers())).replace("{tag}", getPlayerData().getGuild().getTag()).replace("{name}", getPlayerData().getGuild().getName()); } @Override @@ -209,7 +217,7 @@ public class EditableGuildView extends EditableInventory { } PlayerData targetData = PlayerData.get(target); - if (playerData.getGuild().getMembers().has(targetData.getUniqueId())) { + if (playerData.getGuild().hasMember(targetData.getUniqueId())) { MMOCore.plugin.configManager.getSimpleMessage("already-in-guild", "player", target.getName()).send(player); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); open(); diff --git a/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java b/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java index 670c5a06..29694a1a 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java +++ b/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java @@ -1,4 +1,11 @@ package net.Indyuce.mmocore.guild; +import org.bukkit.entity.Player; + public interface AbstractGuild { + + /** + * @return If given player is in that party + */ + boolean hasMember(Player player); } diff --git a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java b/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java index bca192f4..dab5c398 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java +++ b/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java @@ -1,6 +1,5 @@ package net.Indyuce.mmocore.guild; -import net.Indyuce.mmocore.guild.compat.FactionsGuildModule; import net.Indyuce.mmocore.guild.compat.GuildsGuildModule; import net.Indyuce.mmocore.guild.compat.UltimateClansGuildModule; import net.Indyuce.mmocore.guild.provided.MMOCoreGuildModule; @@ -9,7 +8,8 @@ import org.bukkit.Bukkit; import javax.inject.Provider; public enum GuildModuleType { - FACTIONS("Factions", FactionsGuildModule::new), + // Useless since MythicLib already supports FactionBridge + // FACTIONS("Factions", FactionsGuildModule::new), GUILDS("Guilds", GuildsGuildModule::new), KINGDOMSX("Guilds", GuildsGuildModule::new), MMOCORE("MMOCore", MMOCoreGuildModule::new), diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java b/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java index 066b6181..bf3b4447 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java +++ b/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java @@ -6,13 +6,20 @@ import com.massivecraft.factions.Faction; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.GuildModule; +import org.apache.commons.lang.NotImplementedException; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import java.util.Objects; + public class FactionsGuildModule implements GuildModule { @Override public AbstractGuild getGuild(PlayerData playerData) { FPlayer fPlayer = FPlayers.getInstance().getByPlayer(playerData.getPlayer()); + if (fPlayer == null) + return null; + return fPlayer.hasFaction() ? new CustomGuild(fPlayer.getFaction()) : null; } @@ -22,7 +29,12 @@ public class FactionsGuildModule implements GuildModule { private final Faction faction; CustomGuild(Faction faction) { - this.faction = faction; + this.faction = Objects.requireNonNull(faction); + } + + @Override + public boolean hasMember(Player player) { + throw new NotImplementedException(); } } } diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java b/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java index bfeca8ce..2350fd88 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java +++ b/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java @@ -5,8 +5,11 @@ import me.glaremasters.guilds.guild.Guild; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.GuildModule; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import java.util.Objects; + public class GuildsGuildModule implements GuildModule { @Override @@ -21,7 +24,12 @@ public class GuildsGuildModule implements GuildModule { private final Guild guild; CustomGuild(Guild guild) { - this.guild = guild; + this.guild = Objects.requireNonNull(guild); + } + + @Override + public boolean hasMember(Player player) { + return guild.getMember(player.getUniqueId()) != null; } } } diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java b/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java index 21487d76..41eed066 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java +++ b/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java @@ -3,18 +3,23 @@ package net.Indyuce.mmocore.guild.compat; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.GuildModule; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.kingdoms.constants.kingdom.Kingdom; import org.kingdoms.constants.player.KingdomPlayer; import org.kingdoms.main.Kingdoms; +import java.util.Objects; + public class KingdomsXGuildModule implements GuildModule { @Override public AbstractGuild getGuild(PlayerData playerData) { KingdomPlayer kPlayer = Kingdoms.get().getDataHandlers().getKingdomPlayerManager().getData(playerData.getUniqueId()); - Kingdom kingdom = kPlayer == null ? null : kPlayer.getKingdom(); + if (kPlayer == null) + return null; + + Kingdom kingdom = kPlayer.getKingdom(); return kingdom == null ? null : new CustomGuild(kingdom); } @@ -24,7 +29,12 @@ public class KingdomsXGuildModule implements GuildModule { private final Kingdom kingdom; CustomGuild(Kingdom kingdom) { - this.kingdom = kingdom; + this.kingdom = Objects.requireNonNull(kingdom); + } + + @Override + public boolean hasMember(Player player) { + return kingdom.isMember(player); } } } diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java b/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java index 1005db38..2996a53d 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java +++ b/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java @@ -6,8 +6,11 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.guild.GuildModule; import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import java.util.Objects; + public class UltimateClansGuildModule implements GuildModule { private static final UClans API = (UClans) Bukkit.getPluginManager().getPlugin("UltimateCLans"); @@ -22,7 +25,13 @@ public class UltimateClansGuildModule implements GuildModule { private final ClanData clan; CustomGuild(ClanData clan) { - this.clan = clan; + this.clan = Objects.requireNonNull(clan); + } + + @Override + public boolean hasMember(Player player) { + // List implementation. Pretty bad + return clan.getMembers().contains(player); } } } diff --git a/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java b/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java index 32106ae8..33aefcab 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java +++ b/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java @@ -1,164 +1,148 @@ package net.Indyuce.mmocore.guild.provided; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.Consumer; - -import net.Indyuce.mmocore.guild.AbstractGuild; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.Request; import net.Indyuce.mmocore.gui.api.PluginInventory; import net.Indyuce.mmocore.gui.social.guild.EditableGuildView.GuildViewInventory; +import net.Indyuce.mmocore.guild.AbstractGuild; import net.Indyuce.mmocore.manager.InventoryManager; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.*; +import java.util.function.Consumer; public class Guild implements AbstractGuild { - private final GuildMembers members = new GuildMembers(); - private final Map invites = new HashMap<>(); - private final String guildId, guildName, guildTag; + private final Map invites = new HashMap<>(); + private final String guildId, guildName, guildTag; - /** - * Owner changes when the old owner leaves guild - */ - private UUID owner; + private final Set members = new HashSet<>(); - public Guild(UUID owner, String name, String tag) { - this.owner = owner; - this.guildId = tag.toLowerCase(); - this.guildName = name; - this.guildTag = tag; - } + /** + * Owner changes when the old owner leaves guild + */ + private UUID owner; - public UUID getOwner() { - return owner; - } - - public String getName() { - return guildName; - } + public Guild(UUID owner, String name, String tag) { + this.owner = owner; + this.guildId = tag.toLowerCase(); + this.guildName = name; + this.guildTag = tag; + } - public String getId() { - return guildId; - } - - public String getTag() { - return guildTag; - } + public UUID getOwner() { + return owner; + } - public GuildMembers getMembers() { - return members; - } + public String getName() { + return guildName; + } - public long getLastInvite(Player player) { - return invites.containsKey(player.getUniqueId()) ? invites.get(player.getUniqueId()) : 0; - } + public String getId() { + return guildId; + } - public void removeLastInvite(Player player) { - invites.remove(player.getUniqueId()); - } - - public void removeMember(UUID uuid) - { removeMember(uuid, false); } - - // Disband boolean is to prevent co-modification exception when disbanding a guild - public void removeMember(UUID uuid, boolean disband) { - PlayerData data = PlayerData.get(uuid); - if (data != null && data.isOnline() && data.getPlayer().getOpenInventory() != null && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof GuildViewInventory) - InventoryManager.GUILD_CREATION.newInventory(data).open(); + public String getTag() { + return guildTag; + } - if(!disband) members.remove(uuid); - if(data != null) data.setGuild(null); - reopenInventories(); + public long getLastInvite(Player player) { + return invites.containsKey(player.getUniqueId()) ? invites.get(player.getUniqueId()) : 0; + } - //if(!disband) { + public void removeLastInvite(Player player) { + invites.remove(player.getUniqueId()); + } - // disband the guild if no member left - if (members.count() < 1) { - MMOCore.plugin.dataProvider.getGuildManager().unregisterGuild(this); - return; - } + public void removeMember(UUID uuid) { + removeMember(uuid, false); + } - // transfer ownership - if (owner.equals(uuid)) { - owner = members.get(0); - MMOCore.plugin.configManager.getSimpleMessage("transfer-guild-ownership").send(Bukkit.getPlayer(owner)); - } - //} - } + // Disband boolean is to prevent co-modification exception when disbanding a guild + public void removeMember(UUID uuid, boolean disband) { + PlayerData data = PlayerData.get(uuid); + if (data != null && data.isOnline() && data.getPlayer().getOpenInventory() != null && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof GuildViewInventory) + InventoryManager.GUILD_CREATION.newInventory(data).open(); - public void addMember(UUID uuid) { - PlayerData data = PlayerData.get(uuid); - if (data.inGuild()) - data.getGuild().removeMember(uuid); + if (!disband) + members.remove(uuid); + if (data != null) + data.setGuild(null); + reopenInventories(); - data.setGuild(this); - members.add(uuid); + // Disband the guild if no member left + if (members.size() < 1) { + MMOCore.plugin.dataProvider.getGuildManager().unregisterGuild(this); + return; + } - reopenInventories(); - } - - public void registerMember(UUID uuid) { - members.add(uuid); - } + // Transfer ownership + if (owner.equals(uuid)) { + owner = members.stream().findAny().get(); + MMOCore.plugin.configManager.getSimpleMessage("transfer-guild-ownership").send(Bukkit.getPlayer(owner)); + } + } - public void reopenInventories() { - for (UUID uuid : members.members) { - PlayerData member = PlayerData.get(uuid); - if (member != null && member.isOnline() && member.getPlayer().getOpenInventory() != null && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof GuildViewInventory) - ((PluginInventory) member.getPlayer().getOpenInventory().getTopInventory().getHolder()).open(); - } - } + public void addMember(UUID uuid) { + PlayerData data = PlayerData.get(uuid); + if (data.inGuild()) + data.getGuild().removeMember(uuid); - public void sendGuildInvite(PlayerData inviter, PlayerData target) { - invites.put(target.getUniqueId(), System.currentTimeMillis()); - Request request = new GuildInvite(this, inviter, target); - new ConfigMessage("guild-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString()).sendAsJSon(target.getPlayer()); - MMOCore.plugin.requestManager.registerRequest(request); - } - - public static class GuildMembers { - private final List members = new ArrayList<>(); + data.setGuild(this); + members.add(uuid); - public UUID get(int count) { - return members.get(count); - } + reopenInventories(); + } - public boolean has(UUID player) { - return members.contains(player); - } + public void registerMember(UUID uuid) { + members.add(uuid); + } - public void add(UUID player) { - members.add(player); - } + public void reopenInventories() { + for (UUID uuid : members) { + PlayerData member = PlayerData.get(uuid); + if (member != null && member.isOnline() && member.getPlayer().getOpenInventory() != null && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof GuildViewInventory) + ((PluginInventory) member.getPlayer().getOpenInventory().getTopInventory().getHolder()).open(); + } + } - public void remove(UUID player) { - members.remove(player); - } + public void sendGuildInvite(PlayerData inviter, PlayerData target) { + invites.put(target.getUniqueId(), System.currentTimeMillis()); + Request request = new GuildInvite(this, inviter, target); + new ConfigMessage("guild-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString()).sendAsJSon(target.getPlayer()); + MMOCore.plugin.requestManager.registerRequest(request); + } - public void forEach(Consumer action) { - members.forEach(action); - } + @Override + public boolean hasMember(Player player) { + return hasMember(player.getUniqueId()); + } - public int countOnline() { - int online = 0; - - for(UUID member : members) - if(Bukkit.getOfflinePlayer(member).isOnline()) - online += 1; - - return online; - } + public boolean hasMember(UUID player) { + return members.contains(player); + } - public int count() - { return members.size(); } - public void clear() - { members.clear(); } - } + public List listMembers() { + return new ArrayList<>(members); + } + + public void forEachMember(Consumer action) { + members.forEach(action); + } + + public int countOnlineMembers() { + int online = 0; + + for (UUID member : members) + if (Bukkit.getOfflinePlayer(member).isOnline()) + online++; + + return online; + } + + public int countMembers() { + return members.size(); + } } diff --git a/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java b/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java index 7e908639..7c6a9a9b 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java +++ b/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java @@ -27,7 +27,7 @@ public class GuildInvite extends Request { @Override public void whenAccepted() { guild.removeLastInvite(getCreator().getPlayer()); - guild.getMembers().forEach(member -> { + guild.forEachMember(member -> { if (Bukkit.getPlayer(member) != null) { MMOCore.plugin.configManager.getSimpleMessage("guild-joined-other", "player", getTarget().getPlayer().getName()).send(Bukkit.getPlayer(member)); diff --git a/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java b/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java index c94ce3f0..43aaad9b 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java @@ -32,7 +32,7 @@ public class GuildListener implements Listener { GuildChatEvent called = new GuildChatEvent(data, format.message()); Bukkit.getPluginManager().callEvent(called); if (!called.isCancelled()) - data.getGuild().getMembers().forEach(member -> { + data.getGuild().forEachMember(member -> { Player p = Bukkit.getPlayer(member); if (p != null) format.send(p); diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 137160c3..2ecfc2ec 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -23,7 +23,7 @@ import java.util.logging.Level; public class ConfigManager { public final CommandVerbose commandVerbose = new CommandVerbose(); - public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo; + public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo; public String partyChatPrefix, noSkillBoundPlaceholder; public ChatColor staminaFull, staminaHalf, staminaEmpty; public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; @@ -99,6 +99,7 @@ public class ConfigManager { globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50; noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message(); lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests"); + attributesAsClassInfo = MMOCore.plugin.getConfig().getBoolean("attributes-as-class-info"); staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN); diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java index cedf04aa..1c3a8f43 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java @@ -33,7 +33,7 @@ public abstract class GuildDataManager { } public void unregisterGuild(Guild guild) { - guild.getMembers().forEach(member -> guild.removeMember(member, true)); + guild.forEachMember(member -> guild.removeMember(member, true)); // guild.getMembers().clear(); guilds.remove(guild.getId()); delete(guild); diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 66d5ed47..a01e69f4 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -71,7 +71,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { if (!isEmpty(result.getString("guild"))) { Guild guild = provider.getGuildManager().getGuild(result.getString("guild")); - data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); } if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes")); if (!isEmpty(result.getString("professions"))) diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java index 8c4e0808..15d9e65e 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java @@ -22,7 +22,7 @@ public class YAMLGuildDataManager extends GuildDataManager { config.getConfig().set("owner", guild.getOwner().toString()); List memberList = new ArrayList<>(); - guild.getMembers().forEach(uuid -> memberList.add(uuid.toString())); + guild.forEachMember(uuid -> memberList.add(uuid.toString())); config.getConfig().set("members", memberList); config.save(); 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 e8eaa739..e9f6986d 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 @@ -47,7 +47,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager { if (config.contains("guild")) { Guild guild = provider.getGuildManager().getGuild(config.getString("guild")); - data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); } if (config.contains("attribute")) data.getAttributes().load(config.getConfigurationSection("attribute")); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index db45266d..aadb32bf 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -59,14 +59,22 @@ protect-custom-mine: false # - mcmmo party-plugin: mmocore -## Edit the plugin handling parties here. -## Supported values (just copy and paste): -## - mmocore -## - beauty_quest -## - quest_creator -## - quests +# Edit the plugin handling parties here. +# Supported values (just copy and paste): +# - mmocore +# - beauty_quest +# - quest_creator +# - quests quest-plugin: mmocore +# Edit the plugin handling guilds here. +# Supported values (just copy and paste): +# - mmocore +# - guilds +# - kingdomsx +# - ultimate_clans +guild-plugin: mmocore + # MythicLib introduces a CHANCE stat that is used in # several different systems in MMOCore. By changing these # weights you can define how much the Chance stat impacts @@ -206,6 +214,10 @@ resource-bar-colors: stamina-half: 'DARK_GREEN' stamina-empty: 'WHITE' +# When set to true, attributes are saved and +# reset when a player changes their class. +attributes-as-class-info: true + # Whether or not the admin commands should display # the result of the command when ran. # For Example: "Players Level is now 10." From 9004ce8ea15add155a4c5e5750c062c49fb7b2eb Mon Sep 17 00:00:00 2001 From: Indyuce Date: Fri, 17 Jun 2022 18:33:24 +0200 Subject: [PATCH 31/91] Guild module works with ability targets --- .../java/net/Indyuce/mmocore/MMOCore.java | 1 - .../mmocore/guild/GuildModuleType.java | 3 ++- .../party/MMOCoreTargetRestriction.java | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 6c9c9454..72845b4c 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -124,7 +124,6 @@ public class MMOCore extends LuminePlugin { MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); - // Register extra objective, drop items... if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) loadManager.registerLoader(new WorldGuardMMOLoader()); diff --git a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java b/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java index dab5c398..cfbbaf25 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java +++ b/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java @@ -1,6 +1,7 @@ package net.Indyuce.mmocore.guild; import net.Indyuce.mmocore.guild.compat.GuildsGuildModule; +import net.Indyuce.mmocore.guild.compat.KingdomsXGuildModule; import net.Indyuce.mmocore.guild.compat.UltimateClansGuildModule; import net.Indyuce.mmocore.guild.provided.MMOCoreGuildModule; import org.bukkit.Bukkit; @@ -11,7 +12,7 @@ public enum GuildModuleType { // Useless since MythicLib already supports FactionBridge // FACTIONS("Factions", FactionsGuildModule::new), GUILDS("Guilds", GuildsGuildModule::new), - KINGDOMSX("Guilds", GuildsGuildModule::new), + KINGDOMSX("KingdomsX", KingdomsXGuildModule::new), MMOCORE("MMOCore", MMOCoreGuildModule::new), ULTIMATE_CLANS("UltimateClans", UltimateClansGuildModule::new), ; diff --git a/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java b/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java index e3603461..0e67bf43 100644 --- a/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java +++ b/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.comp.target.InteractionType; import io.lumine.mythic.lib.comp.target.TargetRestriction; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.guild.AbstractGuild; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -11,11 +12,21 @@ public class MMOCoreTargetRestriction implements TargetRestriction { @Override public boolean canTarget(Player player, LivingEntity livingEntity, InteractionType interactionType) { - if (!interactionType.isOffense() || !(livingEntity instanceof Player) || livingEntity.hasMetadata("NPC")) + if (!interactionType.isOffense() || !(livingEntity instanceof Player)) return true; - AbstractParty party = MMOCore.plugin.partyModule.getParty(PlayerData.get(player)); - // TODO check for guild - return party == null || !party.hasMember((Player) livingEntity); + PlayerData data = PlayerData.get(player); + + // Check for party + AbstractParty party = MMOCore.plugin.partyModule.getParty(data); + if (party != null && party.hasMember((Player) livingEntity)) + return false; + + // Check for guild + AbstractGuild guild = MMOCore.plugin.guildModule.getGuild(data); + if (guild != null && guild.hasMember((Player) livingEntity)) + return false; + + return true; } } From 1aa7d96347c4f65c1cb4d8c0b922939c32c9f3f2 Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 18 Jun 2022 12:35:26 +0200 Subject: [PATCH 32/91] Option to prevent high party level difference --- .../gui/social/party/EditablePartyView.java | 7 +++++++ .../Indyuce/mmocore/manager/ConfigManager.java | 1 - .../net/Indyuce/mmocore/party/provided/Party.java | 13 +++++++++++++ src/main/resources/config.yml | 15 +++++++++++++-- src/main/resources/default/messages.yml | 1 + 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java b/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java index ce442cf2..aa93e292 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java @@ -172,6 +172,13 @@ public class EditablePartyView extends EditableInventory { return; } + if (Math.abs(targetData.getLevel() - party.getLevel()) > MMOCore.plugin.configManager.maxPartyLevelDifference) { + MMOCore.plugin.configManager.getSimpleMessage("high-level-difference", "player", target.getName()).send(player); + player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); + open(); + return; + } + party.sendInvite(playerData, targetData); MMOCore.plugin.configManager.getSimpleMessage("sent-party-invite", "player", target.getName()).send(player); player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 2ecfc2ec..da56b890 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -99,7 +99,6 @@ public class ConfigManager { globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50; noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message(); lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests"); - attributesAsClassInfo = MMOCore.plugin.getConfig().getBoolean("attributes-as-class-info"); staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN); diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/Party.java b/src/main/java/net/Indyuce/mmocore/party/provided/Party.java index 659906f1..218a830e 100644 --- a/src/main/java/net/Indyuce/mmocore/party/provided/Party.java +++ b/src/main/java/net/Indyuce/mmocore/party/provided/Party.java @@ -9,6 +9,7 @@ import net.Indyuce.mmocore.gui.social.party.EditablePartyView.PartyViewInventory import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.party.AbstractParty; import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.function.Consumer; @@ -25,13 +26,21 @@ public class Party implements AbstractParty { /** * Owner has to change when previous owner leaves party */ + @NotNull private PlayerData owner; + /** + * If the difference between a player level and the party + * level is too high then players cannot join the party. + */ + private final int partyLevel; + private final MMOCorePartyModule module; public Party(MMOCorePartyModule module, PlayerData owner) { this.owner = owner; this.module = module; + this.partyLevel = owner.getLevel(); addMember(owner); } @@ -59,6 +68,10 @@ public class Party implements AbstractParty { return online; } + public int getLevel() { + return partyLevel; + } + @Override public int countMembers() { return members.size(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index aadb32bf..e2fee491 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -143,10 +143,21 @@ party: # to talk in the party chat. chat-prefix: '@' - # The max players that can be in - # any given party. Between 2-8. + # The max amount of players in a party + # Has to be higher than 2 max-players: 8 + # If the difference between a player's level and the + # initial party owner's level is higher that this + # value, then that player can't join the party. + # + # This prevents low level players from joining + # high level players and earning tons of EXP. + # + # Set to the max level possible if you want to disable + # that feature. + max-level-difference: 3 + # Redirects vanilla experience obtained to MMOCore # class experience. You can define the % of the vanilla # experience that is being transfered as MMOCore exp. diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index b311b6ba..8d1f7fb0 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -118,6 +118,7 @@ party-joined-other: '&6{player}&e joined your party!' transfer-party-ownership: '&eYou were transfered the party ownership.' kick-from-party: '&eYou successfully kicked &6{player}&e.' party-invite-cooldown: '&cPlease wait {cooldown} before inviting {player}.' +high-level-difference: '&cYou cannot invite {player} as the level difference is too high.' # Guilds guild-chat: '&a[{tag}] {player}: {message}' From e1d43c8a05e908a98880244483c25495eadd7254 Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 18 Jun 2022 19:10:10 +0200 Subject: [PATCH 33/91] Fixed party max lvl diff --- pom.xml | 28 +++++-------------- .../mmocore/manager/ConfigManager.java | 2 ++ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 4f0e60df..de0373c3 100644 --- a/pom.xml +++ b/pom.xml @@ -15,20 +15,6 @@ UTF-8 - - - nexus - Lumine Releases - https://mvn.lumine.io/repository/maven-releases/ - - - nexus - Lumine Snapshots - https://mvn.lumine.io/repository/maven-snapshots/ - - - - ${project.name}-${project.version} @@ -81,13 +67,13 @@ - lumine - https://mvn.lumine.io/repository/maven/ + nexus + https://mvn.lumine.io/repository/maven-public/ - placeholderapi - https://repo.extendedclip.com/content/repositories/placeholderapi/ + phoenix + http://la-grange-evasion.pro.dns-orange.fr:8081/repository/maven-public/ @@ -160,8 +146,8 @@ me.clip - placeholderapi - 2.9.2 + PlaceholderAPI + 2.11.1 provided @@ -182,7 +168,7 @@ net.citizensnpcs Citizens - 2.0.25 + 2.0.30-b2571 provided diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index da56b890..bbf3ce55 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -28,6 +28,7 @@ public class ConfigManager { public ChatColor staminaFull, staminaHalf, staminaEmpty; public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; public double lootChestsChanceWeight; + public int maxPartyLevelDifference; private final FileConfiguration messages; private final boolean chatInput; @@ -99,6 +100,7 @@ public class ConfigManager { globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50; noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message(); lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests"); + maxPartyLevelDifference = MMOCore.plugin.getConfig().getInt("party.max-level-difference"); staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN); From 99962112968f0ee1b944bce491034063e4c0167b Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 18 Jun 2022 20:08:05 +0200 Subject: [PATCH 34/91] Fixed exp hologram display --- src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java | 2 +- src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java | 3 ++- .../mmocore/command/rpg/admin/ExperienceCommandTreeNode.java | 3 ++- .../Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java | 3 ++- .../net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java | 2 +- .../java/net/Indyuce/mmocore/experience/PlayerProfessions.java | 2 +- src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java | 3 ++- src/main/resources/config.yml | 3 ++- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java index 0dbd8859..79328c22 100644 --- a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java +++ b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java @@ -49,7 +49,7 @@ public class PlayerActionBar extends BukkitRunnable { .replace("{stellium}", digit.format(data.getStellium())) .replace("{max_stellium}", StatInfo.valueOf("MAX_STELLIUM").format(data.getStats().getStat("MAX_STELLIUM"))) .replace("{class}", data.getProfess().getName()) - .replace("{xp}", "" + data.getExperience()) + .replace("{xp}", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience())) .replace("{armor}", StatInfo.valueOf("ARMOR").format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue())) .replace("{level}", "" + data.getLevel()) .replace("{name}", data.getPlayer().getDisplayName()))))); 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 b8e3922c..b3c3797d 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.api.player; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.player.TemporaryPlayerData; import io.lumine.mythic.lib.player.cooldown.CooldownMap; @@ -560,7 +561,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc // Experience hologram if (hologramLocation != null && isOnline()) - MMOCoreUtils.displayIndicator(hologramLocation, MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", String.valueOf(event.getExperience())).message()); + MMOCoreUtils.displayIndicator(hologramLocation, MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", MythicLib.plugin.getMMOConfig().decimal.format(event.getExperience())).message()); experience = Math.max(0, experience + event.getExperience()); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java index 5bd2d305..9bf465de 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.command.rpg.admin; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.MMOCore; @@ -68,7 +69,7 @@ public class ExperienceCommandTreeNode extends CommandTreeNode { if (args[4].equalsIgnoreCase("main")) { main.accept(data, amount); CommandVerbose.verbose(sender, CommandVerbose.CommandType.EXPERIENCE, ChatColor.GOLD + player.getName() + ChatColor.YELLOW - + " now has " + ChatColor.GOLD + data.getExperience() + ChatColor.YELLOW + " EXP."); + + " now has " + ChatColor.GOLD + MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience()) + ChatColor.YELLOW + " EXP."); return CommandResult.SUCCESS; } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java index 4b26626e..fcb7416b 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.command.rpg.admin; +import io.lumine.mythic.lib.MythicLib; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -33,7 +34,7 @@ public class InfoCommandTreeNode extends CommandTreeNode { sender.sendMessage(ChatColor.YELLOW + "----------------------------------------------------"); sender.sendMessage(ChatColor.YELLOW + "Class: " + ChatColor.GOLD + playerData.getProfess().getName()); sender.sendMessage(ChatColor.YELLOW + "Level: " + ChatColor.GOLD + playerData.getLevel()); - sender.sendMessage(ChatColor.YELLOW + "Experience: " + ChatColor.GOLD + playerData.getExperience() + ChatColor.YELLOW + " / " + ChatColor.GOLD + sender.sendMessage(ChatColor.YELLOW + "Experience: " + ChatColor.GOLD + MythicLib.plugin.getMMOConfig().decimal.format(playerData.getExperience()) + ChatColor.YELLOW + " / " + ChatColor.GOLD + playerData.getLevelUpExperience()); sender.sendMessage(ChatColor.YELLOW + "Class Points: " + ChatColor.GOLD + playerData.getClassPoints()); sender.sendMessage(ChatColor.YELLOW + "Quests: " + ChatColor.GOLD + playerData.getQuestData().getFinishedQuests().size() + ChatColor.YELLOW 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 944b25e6..ca6556eb 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -128,7 +128,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { .valueOf(playerData.getCollectionSkills().getLevel(identifier.substring(11).replace(" ", "-").replace("_", "-").toLowerCase())); else if (identifier.equals("experience")) - return String.valueOf(playerData.getExperience()); + return MythicLib.plugin.getMMOConfig().decimal.format(playerData.getExperience()); else if (identifier.equals("next_level")) return String.valueOf(playerData.getLevelUpExperience()); diff --git a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 9b0d11c1..9a364586 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -187,7 +187,7 @@ public class PlayerProfessions { // Display hologram if (hologramLocation != null) - MMOCoreUtils.displayIndicator(hologramLocation.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message()); + MMOCoreUtils.displayIndicator(hologramLocation.add(.5, 1.5, .5), MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", MythicLib.plugin.getMMOConfig().decimal.format(event.getExperience())).message()); exp.put(profession.getId(), Math.max(0, exp.getOrDefault(profession.getId(), 0.) + event.getExperience())); int level, oldLevel = getLevel(profession); diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 63759744..9f306d65 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.gui; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; @@ -243,7 +244,7 @@ public class PlayerStats extends EditableInventory { bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|"); holders.register("percent", decimal.format(ratio * 100)); - holders.register("exp", "" + data.getExperience()); + holders.register("exp", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience())); holders.register("level", "" + data.getLevel()); holders.register("class_points", "" + data.getClassPoints()); holders.register("skill_points", "" + data.getSkillPoints()); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e2fee491..141b310d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -227,7 +227,8 @@ resource-bar-colors: # When set to true, attributes are saved and # reset when a player changes their class. -attributes-as-class-info: true +# Not implemented yet. +# attributes-as-class-info: true # Whether or not the admin commands should display # the result of the command when ran. From 09ef313642b0e51484caa3709134faa9f2a01f3e Mon Sep 17 00:00:00 2001 From: Nertzhul Date: Sat, 18 Jun 2022 16:56:48 -0300 Subject: [PATCH 35/91] Option to spend multiple attribute/skill points at once by shift clicking (#423) --- .../Indyuce/mmocore/gui/AttributeView.java | 28 +++++++- .../net/Indyuce/mmocore/gui/SkillList.java | 65 ++++++++++++++----- .../resources/default/gui/attribute-view.yml | 9 +++ src/main/resources/default/gui/skill-list.yml | 2 + src/main/resources/default/messages.yml | 2 + 5 files changed, 85 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 058694a8..5ad00e3b 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -18,6 +18,8 @@ import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; +import java.util.logging.Level; + public class AttributeView extends EditableInventory { public AttributeView() { super("attribute-view"); @@ -47,12 +49,18 @@ public class AttributeView extends EditableInventory { public static class AttributeItem extends InventoryItem { private final PlayerAttribute attribute; + private int shiftCost; public AttributeItem(String function, ConfigurationSection config) { super(config); attribute = MMOCore.plugin.attributeManager .get(function.substring("attribute_".length()).toLowerCase().replace(" ", "-").replace("_", "-")); + shiftCost = config.getInt("shift-cost"); + if (shiftCost < 1) { + MMOCore.log(Level.WARNING, "Level up points cost must not be less than 1. Using default value: 1"); + shiftCost = 1; + } } @Override @@ -66,6 +74,7 @@ public class AttributeView extends EditableInventory { holders.register("max", attribute.getMax()); holders.register("current", total); holders.register("attribute_points", inv.getPlayerData().getAttributePoints()); + holders.register("shift_points", shiftCost); attribute.getBuffs().forEach(buff -> { StatInfo info = StatInfo.valueOf(buff.getStat()); holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); @@ -112,6 +121,7 @@ public class AttributeView extends EditableInventory { if (item.getFunction().startsWith("attribute_")) { PlayerAttribute attribute = ((AttributeItem) item).attribute; + int shiftCost = ((AttributeItem) item).shiftCost; if (playerData.getAttributePoints() < 1) { MMOCore.plugin.configManager.getSimpleMessage("not-attribute-point").send(player); @@ -125,9 +135,21 @@ public class AttributeView extends EditableInventory { MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); return; } - - ins.addBase(1); - playerData.giveAttributePoints(-1); + + if (event.isShiftClick()) { + if (playerData.getAttributePoints() < shiftCost) { + MMOCore.plugin.configManager.getSimpleMessage("not-attribute-point-shift", "shift_points", "" + shiftCost).send(player); + MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); + return; + } + + ins.addBase(shiftCost); + playerData.giveAttributePoints(-shiftCost); + } else { + ins.addBase(1); + playerData.giveAttributePoints(-1); + } + MMOCore.plugin.configManager.getSimpleMessage("attribute-level-up", "attribute", attribute.getName(), "level", "" + ins.getBase()).send(player); MMOCore.plugin.soundManager.getSound(SoundEvent.LEVEL_ATTRIBUTE).playTo(getPlayer()); diff --git a/src/main/java/net/Indyuce/mmocore/gui/SkillList.java b/src/main/java/net/Indyuce/mmocore/gui/SkillList.java index 1699f0ef..5c611a8f 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SkillList.java +++ b/src/main/java/net/Indyuce/mmocore/gui/SkillList.java @@ -25,6 +25,7 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; public class SkillList extends EditableInventory { public SkillList() { @@ -41,20 +42,7 @@ public class SkillList extends EditableInventory { return new LevelItem(config); if (function.equals("upgrade")) - return new InventoryItem(config) { - - @Override - public Placeholders getPlaceholders(SkillViewerInventory inv, int n) { - RegisteredSkill selected = inv.selected == null ? null : inv.selected.getSkill(); - Placeholders holders = new Placeholders(); - - holders.register("skill_caps", selected.getName().toUpperCase()); - holders.register("skill", selected.getName()); - holders.register("skill_points", "" + inv.getPlayerData().getSkillPoints()); - - return holders; - } - }; + return new UpgradeItem(config); if (function.equals("slot")) return new InventoryItem(config) { @@ -235,7 +223,34 @@ public class SkillList extends EditableInventory { return new Placeholders(); } } - + + public class UpgradeItem extends InventoryItem { + private int shiftCost; + + public UpgradeItem(ConfigurationSection config) { + super(config); + + this.shiftCost = config.getInt("shift-cost"); + if (shiftCost < 1) { + MMOCore.log(Level.WARNING, "Upgrade shift-cost cannot be less than 1. Using default value: 1"); + shiftCost = 1; + } + + } + + @Override + public Placeholders getPlaceholders(SkillViewerInventory inv, int n) { + RegisteredSkill selected = inv.selected == null ? null : inv.selected.getSkill(); + Placeholders holders = new Placeholders(); + + holders.register("skill_caps", selected.getName().toUpperCase()); + holders.register("skill", selected.getName()); + holders.register("skill_points", "" + inv.getPlayerData().getSkillPoints()); + holders.register("shift_points", shiftCost); + return holders; + } + } + public class SkillViewerInventory extends GeneratedInventory { // Cached information @@ -348,6 +363,8 @@ public class SkillList extends EditableInventory { * upgrading a player skill */ if (item.getFunction().equals("upgrade")) { + int shiftCost = ((UpgradeItem) item).shiftCost; + if (!playerData.hasSkillUnlocked(selected)) { MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(player); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); @@ -365,9 +382,21 @@ public class SkillList extends EditableInventory { player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); return; } - - playerData.giveSkillPoints(-1); - playerData.setSkillLevel(selected.getSkill(), playerData.getSkillLevel(selected.getSkill()) + 1); + + if (event.isShiftClick()) { + if (playerData.getSkillPoints() < shiftCost) { + MMOCore.plugin.configManager.getSimpleMessage("not-enough-skill-points-shift", "shift_points", "" + shiftCost).send(player); + player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); + return; + } + + playerData.giveSkillPoints(-shiftCost); + playerData.setSkillLevel(selected.getSkill(), playerData.getSkillLevel(selected.getSkill()) + shiftCost); + } else { + playerData.giveSkillPoints(-1); + playerData.setSkillLevel(selected.getSkill(), playerData.getSkillLevel(selected.getSkill()) + 1); + } + MMOCore.plugin.configManager.getSimpleMessage("upgrade-skill", "skill", selected.getSkill().getName(), "level", "" + playerData.getSkillLevel(selected.getSkill())).send(player); player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2); diff --git a/src/main/resources/default/gui/attribute-view.yml b/src/main/resources/default/gui/attribute-view.yml index 304eeda4..a93b8d6b 100644 --- a/src/main/resources/default/gui/attribute-view.yml +++ b/src/main/resources/default/gui/attribute-view.yml @@ -22,6 +22,7 @@ items: str: slots: [11] function: attribute_strength + shift-cost: 10 name: '&a{name}' item: GOLDEN_APPLE lore: # {buffs} returns amount of buffs @@ -34,10 +35,13 @@ items: - '&7 +{buff_max_health}% Max Health (&a+{total_max_health}&7)' - '' - '&eClick to level up for 1 attribute point.' + - '&eShift-Click to level up for {shift_points} attribute points.' + - '' - '&e◆ Current Attribute Points: {attribute_points}' dex: slots: [13] function: attribute_dexterity + shift-cost: 10 name: '&a{name}' item: LEATHER_BOOTS hide-flags: true @@ -52,10 +56,13 @@ items: - '&7 +{buff_attack_speed}% Attack Speed (&a+{total_attack_speed}&7)' - '' - '&eClick to level up for 1 attribute point.' + - '&eShift-Click to level up for {shift_points} attribute points.' + - '' - '&e◆ Current Attribute Points: {attribute_points}' int: slots: [15] function: attribute_intelligence + shift-cost: 10 name: '&a{name}' item: BOOK lore: @@ -68,4 +75,6 @@ items: - '&7 +{buff_cooldown_reduction}% Cooldown Reduction (&a+{total_cooldown_reduction}%&7)' - '' - '&eClick to level up for 1 attribute point.' + - '&eShift-Click to level up for {shift_points} attribute points.' + - '' - '&e◆ Current Attribute Points: {attribute_points}' diff --git a/src/main/resources/default/gui/skill-list.yml b/src/main/resources/default/gui/skill-list.yml index 04dc88a6..f3c5598c 100644 --- a/src/main/resources/default/gui/skill-list.yml +++ b/src/main/resources/default/gui/skill-list.yml @@ -87,9 +87,11 @@ items: upgrade: slots: [ 15 ] function: upgrade + shift-cost: 10 item: GREEN_STAINED_GLASS_PANE name: '&a&lUPGRADE {skill_caps}' lore: - '&7Costs 1 skill point.' + - '&7Shift-Click to spend {shift_points} points' - '' - '&eCurrent Skill Points: {skill_points}' diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index 8d1f7fb0..5ff5d69a 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -157,6 +157,7 @@ cant-choose-new-class: no-attribute-points-spent: '&cYou have not spent any attribute points.' not-attribute-reallocation-point: '&cYou do not have 1 reallocation point.' not-attribute-point: '&cYou do not have 1 attribute point.' +not-attribute-point-shift: '&cYou do not have &4{shift_points} &cattribute points.' attribute-points-reallocated: '&eYou successfully reset your attributes. You now have &6{points} &eattribute points.' attribute-max-points-hit: '&cYou cannot level up this attribute anymore.' attribute-level-up: '&eYou successfully leveled up your &6{attribute}&e.' # {level} @@ -164,6 +165,7 @@ attribute-level-up: '&eYou successfully leveled up your &6{attribute}&e.' # {lev # Skills no-class-skill: '&cYour class has no skill.' not-enough-skill-points: '&cYou need one skill point.' +not-enough-skill-points-shift: '&cYou need {shift_points} skill points.' upgrade-skill: '&eYour &6{skill} &eis now Level &6{level}&e!' not-unlocked-skill: '&cYou have not unlocked that skill yet.' no-skill-bound: '&cYou don''t have any skill bound to this slot.' From 5dd060abc614ec673570b9697bdcadd1a212054d Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 19 Jun 2022 21:46:16 +0200 Subject: [PATCH 36/91] Bungee update --- .../java/net/Indyuce/mmocore/MMOCore.java | 799 +++++++++--------- .../mmocore/api/player/PlayerData.java | 61 ++ .../mmocore/api/util/MMOCoreUtils.java | 27 +- .../net/Indyuce/mmocore/bungee/Bungee.java | 52 ++ .../Indyuce/mmocore/bungee/CacheManager.java | 28 + .../mmocore/bungee/MessageListener.java | 65 ++ .../source/ClimbExperienceSource.java | 4 +- .../bungee/GetMMOCorePlayerListener.java | 21 + .../manager/data/PlayerDataManager.java | 67 ++ .../manager/data/mysql/MySQLDataProvider.java | 2 +- .../data/mysql/MySQLPlayerDataManager.java | 398 ++++----- src/main/resources/bungee.yml | 3 + 12 files changed, 939 insertions(+), 588 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/bungee/Bungee.java create mode 100644 src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java create mode 100644 src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java create mode 100644 src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java create mode 100644 src/main/resources/bungee.yml diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 3af53024..4817237c 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -27,6 +27,7 @@ import net.Indyuce.mmocore.comp.vault.VaultEconomy; import net.Indyuce.mmocore.comp.vault.VaultMMOLoader; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.listener.*; +import net.Indyuce.mmocore.listener.bungee.GetMMOCorePlayerListener; import net.Indyuce.mmocore.listener.event.PlayerPressKeyListener; import net.Indyuce.mmocore.listener.option.*; import net.Indyuce.mmocore.listener.profession.FishingListener; @@ -51,401 +52,417 @@ import org.bukkit.command.CommandMap; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; +import org.spigotmc.SpigotConfig; import java.io.File; import java.lang.reflect.Field; import java.util.logging.Level; public class MMOCore extends LuminePlugin { - public static MMOCore plugin; - - public final WaypointManager waypointManager = new WaypointManager(); - public final SoundManager soundManager = new SoundManager(); - public final RequestManager requestManager = new RequestManager(); - public final ConfigItemManager configItems = new ConfigItemManager(); - public final PlayerActionBar actionBarManager = new PlayerActionBar(); - public final SkillManager skillManager = new SkillManager(); - public final ClassManager classManager = new ClassManager(); - public final DropTableManager dropTableManager = new DropTableManager(); - public final BoosterManager boosterManager = new BoosterManager(); - public final AttributeManager attributeManager = new AttributeManager(); - public final PartyManager partyManager = new PartyManager(); - public final QuestManager questManager = new QuestManager(); - public final ProfessionManager professionManager = new ProfessionManager(); - public final ExperienceManager experience = new ExperienceManager(); - public final LootChestManager lootChests = new LootChestManager(); - public final MMOLoadManager loadManager = new MMOLoadManager(); - public final RestrictionManager restrictionManager = new RestrictionManager(); - public final StatManager statManager = new StatManager(); - @Deprecated - public final SkillTreeManager skillTreeManager = new SkillTreeManager(); - - // Profession managers - public final CustomBlockManager mineManager = new CustomBlockManager(); - public final FishingManager fishingManager = new FishingManager(); - public final AlchemyManager alchemyManager = new AlchemyManager(); - public final EnchantManager enchantManager = new EnchantManager(); - public final SmithingManager smithingManager = new SmithingManager(); - - @NotNull - public ConfigManager configManager; - public VaultEconomy economy; - public RegionHandler regionHandler = new DefaultRegionHandler(); - public PlaceholderParser placeholderParser = new DefaultParser(); - public DataProvider dataProvider = new YAMLDataProvider(); - - // Modules - @NotNull - public PartyModule partyModule; - - public boolean shouldDebugSQL = false; - - private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7; - - public MMOCore() { - plugin = this; - } - - public void load() { - - // Check if the ML build matches - if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOCORE_COMPATIBILITY_INDEX) { - getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOCore do not match. Make sure you are using the latest builds of both plugins"); - disable(); - return; - } - - // Register MMOCore-specific objects - MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); - MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); - - - // Register extra objective, drop items... - if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) - loadManager.registerLoader(new WorldGuardMMOLoader()); - - if (Bukkit.getPluginManager().getPlugin("Citizens") != null) - loadManager.registerLoader(new CitizensMMOLoader()); - - if (Bukkit.getPluginManager().getPlugin("Vault") != null) loadManager.registerLoader(new VaultMMOLoader()); - - if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) - loadManager.registerLoader(new MythicMobsMMOLoader()); - } - - public void enable() { - new SpigotPlugin(70575, this).checkForUpdate(); - new Metrics(this); - saveDefaultConfig(); - - final int configVersion = getConfig().contains("config-version", true) ? getConfig().getInt("config-version") : -1; - final int defConfigVersion = getConfig().getDefaults().getInt("config-version"); - if (configVersion != defConfigVersion) { - getLogger().warning("You may be using an outdated config.yml!"); - getLogger().warning("(Your config version: '" + configVersion + "' | Expected config version: '" + defConfigVersion + "')"); - } - - if (getConfig().isConfigurationSection("mysql") && getConfig().getBoolean("mysql.enabled")) - dataProvider = new MySQLDataProvider(getConfig()); - shouldDebugSQL = getConfig().getBoolean("mysql.debug"); - - if (getConfig().isConfigurationSection("default-playerdata")) - dataProvider.getDataManager().loadDefaultData(getConfig().getConfigurationSection("default-playerdata")); - - if (Bukkit.getPluginManager().getPlugin("Vault") != null) economy = new VaultEconomy(); - - if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { - placeholderParser = new PlaceholderAPIParser(); - getLogger().log(Level.INFO, "Hooked onto PlaceholderAPI"); - } - - if (Bukkit.getPluginManager().getPlugin("Citizens") != null) { - Bukkit.getPluginManager().registerEvents(new CitizenInteractEventListener(), this); - getLogger().log(Level.INFO, "Hooked onto Citizens"); - } - - if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) { - regionHandler = new WorldGuardRegionHandler(); - getLogger().log(Level.INFO, "Hooked onto WorldGuard"); - } - - if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) { - Bukkit.getServer().getPluginManager().registerEvents(new MythicHook(), this); - MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs"); - } - - /* - * Resource regeneration. Must check if entity is dead otherwise regen will make - * the 'respawn' button glitched plus HURT entity effect bug - */ - new BukkitRunnable() { - public void run() { - for (PlayerData player : PlayerData.getAll()) - if (player.isOnline() && !player.getPlayer().isDead()) - for (PlayerResource resource : PlayerResource.values()) { - double regenAmount = player.getProfess().getHandler(resource).getRegen(player); - if (regenAmount != 0) - resource.regen(player, regenAmount); - } - } - }.runTaskTimer(MMOCore.plugin, 100, 20); - - /* - * For the sake of the lord, make sure they aren't using MMOItems Mana and - * Stamina Addon...This should prevent a couple error reports produced by people - * not reading the installation guide... - */ - if (Bukkit.getPluginManager().getPlugin("MMOMana") != null) { - getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina"); - getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!"); - Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina"); - Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!"); - return; - } - - initializePlugin(false); - - if (getConfig().getBoolean("vanilla-exp-redirection.enabled")) - Bukkit.getPluginManager().registerEvents(new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this); - - // Enable debug mode for extra debug tools - if (getConfig().contains("debug")) { - DebugMode.setLevel(getConfig().getInt("debug", 0)); - DebugMode.enableActionBar(); - } - - // Load quest module - try { - String questPluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin")); - PartyModuleType moduleType = PartyModuleType.valueOf(questPluginName); - Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); - partyModule = moduleType.provideModule(); - } catch (RuntimeException exception) { - getLogger().log(Level.WARNING, "Could not initialize quest module: " + exception.getMessage()); - partyModule = new MMOCorePartyModule(); - } - - - - // Load party module - try { - String partyPluginName = UtilityMethods.enumName(getConfig().getString("party-plugin")); - PartyModuleType moduleType = PartyModuleType.valueOf(partyPluginName); - Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); - partyModule = moduleType.provideModule(); - } catch (RuntimeException exception) { - getLogger().log(Level.WARNING, "Could not initialize party module: " + exception.getMessage()); - partyModule = new MMOCorePartyModule(); - } - - - // Skill casting - try { - SkillCastingMode mode = SkillCastingMode.valueOf(UtilityMethods.enumName(getConfig().getString("skill-casting.mode"))); - Bukkit.getPluginManager().registerEvents(mode.loadFromConfig(getConfig().getConfigurationSection("skill-casting")), this); - } catch (RuntimeException exception) { - getLogger().log(Level.WARNING, "Could not load skill casting: " + exception.getMessage()); - } - - if (configManager.overrideVanillaExp = getConfig().getBoolean("override-vanilla-exp")) - Bukkit.getPluginManager().registerEvents(new VanillaExperienceOverride(), this); - - if (getConfig().getBoolean("hotbar-swapping.enabled")) - try { - Bukkit.getPluginManager().registerEvents(new HotbarSwap(getConfig().getConfigurationSection("hotbar-swapping")), this); - } catch (RuntimeException exception) { - getLogger().log(Level.WARNING, "Could not load hotbar swapping: " + exception.getMessage()); - } - - if (getConfig().getBoolean("prevent-spawner-xp")) - Bukkit.getPluginManager().registerEvents(new NoSpawnerEXP(), this); - - if (getConfig().getBoolean("death-exp-loss.enabled")) - Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this); - - if (getConfig().getBoolean("shift-click-player-profile-check")) - Bukkit.getPluginManager().registerEvents(new PlayerProfileCheck(), this); - - Bukkit.getPluginManager().registerEvents(new WaypointsListener(), this); - Bukkit.getPluginManager().registerEvents(new PlayerListener(), this); - Bukkit.getPluginManager().registerEvents(new GoldPouchesListener(), this); - Bukkit.getPluginManager().registerEvents(new BlockListener(), this); - Bukkit.getPluginManager().registerEvents(new LootableChestsListener(), this); - Bukkit.getPluginManager().registerEvents(new GuildListener(), this); - Bukkit.getPluginManager().registerEvents(new FishingListener(), this); - Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), this); - Bukkit.getPluginManager().registerEvents(new PlayerPressKeyListener(), this); - // Bukkit.getPluginManager().registerEvents(new ClassTriggers(), this); - - /* - * Initialize player data from all online players. This is very important to do - * 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.getUniqueId())); - - // load guild data after loading player data - dataProvider.getGuildManager().load(); - - // Command - try { - final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap"); - - bukkitCommandMap.setAccessible(true); - CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer()); - - FileConfiguration config = new ConfigFile("commands").getConfig(); - - if (config.contains("player")) - commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); - if (config.contains("attributes")) - commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); - if (config.contains("class")) - commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class"))); - if (config.contains("waypoints")) - commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); - if (config.contains("quests")) - commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); - if (config.contains("skills")) - commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); - if (config.contains("friends")) - commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); - if (config.contains("party")) - commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party"))); - if (config.contains("guild")) - commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild"))); - - if (hasEconomy() && economy.isValid()) { - if (config.contains("withdraw")) - commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); - if (config.contains("deposit")) - commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); - } - } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) { - ex.printStackTrace(); - } - - MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); - getCommand("mmocore").setExecutor(mmoCoreCommand); - getCommand("mmocore").setTabCompleter(mmoCoreCommand); - - if (getConfig().getBoolean("auto-save.enabled")) { - int autosave = getConfig().getInt("auto-save.interval") * 20; - new BukkitRunnable() { - public void run() { - - // Save player data - for (PlayerData data : PlayerData.getAll()) - if (data.isFullyLoaded()) - dataProvider.getDataManager().saveData(data); - - // Save guild info - for (Guild guild : dataProvider.getGuildManager().getAll()) - dataProvider.getGuildManager().save(guild); - } - }.runTaskTimerAsynchronously(MMOCore.plugin, autosave, autosave); - } - } - - public void disable() { - - // Save player data - for (PlayerData data : PlayerData.getAll()) - if (data.isFullyLoaded()) { - data.close(); - dataProvider.getDataManager().saveData(data); - } - - // Save guild info - for (Guild guild : dataProvider.getGuildManager().getAll()) - dataProvider.getGuildManager().save(guild); - - // Close MySQL data provider (memory leaks) - if (dataProvider instanceof MySQLDataProvider) - ((MySQLDataProvider) dataProvider).close(); - - // Reset active blocks - mineManager.resetRemainingBlocks(); - - // Clear spawned loot chests - lootChests.getActive().forEach(chest -> chest.expire(false)); - } - - /** - * Called either when the server starts when initializing the manager for - * the first time, or when issuing a plugin reload; in that case, stuff - * like listeners must all be cleared before. - * - * Also see {@link MMOCoreManager} - * - * @param clearBefore True when issuing a plugin reload - */ - public void initializePlugin(boolean clearBefore) { - if (clearBefore) - reloadConfig(); - - configManager = new ConfigManager(); - - statManager.initialize(clearBefore); - if (clearBefore) - MythicLib.plugin.getSkills().initialize(true); - skillManager.initialize(clearBefore); - mineManager.initialize(clearBefore); - partyManager.initialize(clearBefore); - attributeManager.initialize(clearBefore); - - // Experience must be loaded before professions and classes - experience.initialize(clearBefore); - - // Drop tables must be loaded before professions - dropTableManager.initialize(clearBefore); - - professionManager.initialize(clearBefore); - classManager.initialize(clearBefore); - - InventoryManager.load(); - - questManager.initialize(clearBefore); - lootChests.initialize(clearBefore); - restrictionManager.initialize(clearBefore); - waypointManager.initialize(clearBefore); - requestManager.initialize(clearBefore); - soundManager.initialize(clearBefore); - configItems.initialize(clearBefore); - - if (getConfig().isConfigurationSection("action-bar")) - actionBarManager.reload(getConfig().getConfigurationSection("action-bar")); - - if (clearBefore) - PlayerData.getAll().forEach(PlayerData::update); - } - - public static void log(String message) { - log(Level.INFO, message); - } - - public static void debug(int value, String message) { - debug(value, Level.INFO, message); - } - - public static void log(Level level, String message) { - plugin.getLogger().log(level, message); - } - - public static void debug(int value, Level level, String message) { - if (DebugMode.level > (value - 1)) plugin.getLogger().log(level, message); - } - - public File getJarFile() { - return getFile(); - } - - public boolean hasEconomy() { - return economy != null && economy.isValid(); - } - - public static void sqlDebug(String s) { - if(!MMOCore.plugin.shouldDebugSQL) return; - MMOCore.plugin.getLogger().warning("- [SQL Debug] " + s); - } + public static MMOCore plugin; + + public final WaypointManager waypointManager = new WaypointManager(); + public final SoundManager soundManager = new SoundManager(); + public final RequestManager requestManager = new RequestManager(); + public final ConfigItemManager configItems = new ConfigItemManager(); + public final PlayerActionBar actionBarManager = new PlayerActionBar(); + public final SkillManager skillManager = new SkillManager(); + public final ClassManager classManager = new ClassManager(); + public final DropTableManager dropTableManager = new DropTableManager(); + public final BoosterManager boosterManager = new BoosterManager(); + public final AttributeManager attributeManager = new AttributeManager(); + public final PartyManager partyManager = new PartyManager(); + public final QuestManager questManager = new QuestManager(); + public final ProfessionManager professionManager = new ProfessionManager(); + public final ExperienceManager experience = new ExperienceManager(); + public final LootChestManager lootChests = new LootChestManager(); + public final MMOLoadManager loadManager = new MMOLoadManager(); + public final RestrictionManager restrictionManager = new RestrictionManager(); + public final StatManager statManager = new StatManager(); + @Deprecated + public final SkillTreeManager skillTreeManager = new SkillTreeManager(); + + // Profession managers + public final CustomBlockManager mineManager = new CustomBlockManager(); + public final FishingManager fishingManager = new FishingManager(); + public final AlchemyManager alchemyManager = new AlchemyManager(); + public final EnchantManager enchantManager = new EnchantManager(); + public final SmithingManager smithingManager = new SmithingManager(); + + @NotNull + public ConfigManager configManager; + public VaultEconomy economy; + public RegionHandler regionHandler = new DefaultRegionHandler(); + public PlaceholderParser placeholderParser = new DefaultParser(); + public DataProvider dataProvider = new YAMLDataProvider(); + + // Modules + @NotNull + public PartyModule partyModule; + + public boolean shouldDebugSQL = false; + public boolean hasBungee=false; + private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7; + + public MMOCore() { + plugin = this; + } + + public void load() { + + // Check if the ML build matches + if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOCORE_COMPATIBILITY_INDEX) { + getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOCore do not match. Make sure you are using the latest builds of both plugins"); + disable(); + return; + } + + // Register MMOCore-specific objects + MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); + MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); + + + // Register extra objective, drop items... + if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) + loadManager.registerLoader(new WorldGuardMMOLoader()); + + if (Bukkit.getPluginManager().getPlugin("Citizens") != null) + loadManager.registerLoader(new CitizensMMOLoader()); + + if (Bukkit.getPluginManager().getPlugin("Vault") != null) loadManager.registerLoader(new VaultMMOLoader()); + + if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) + loadManager.registerLoader(new MythicMobsMMOLoader()); + } + + public void enable() { + new SpigotPlugin(70575, this).checkForUpdate(); + new Metrics(this); + saveDefaultConfig(); + + final int configVersion = getConfig().contains("config-version", true) ? getConfig().getInt("config-version") : -1; + final int defConfigVersion = getConfig().getDefaults().getInt("config-version"); + if (configVersion != defConfigVersion) { + getLogger().warning("You may be using an outdated config.yml!"); + getLogger().warning("(Your config version: '" + configVersion + "' | Expected config version: '" + defConfigVersion + "')"); + } + + if (getConfig().isConfigurationSection("mysql") && getConfig().getBoolean("mysql.enabled")) + dataProvider = new MySQLDataProvider(getConfig()); + shouldDebugSQL = getConfig().getBoolean("mysql.debug"); + + if (getConfig().isConfigurationSection("default-playerdata")) + dataProvider.getDataManager().loadDefaultData(getConfig().getConfigurationSection("default-playerdata")); + + if (Bukkit.getPluginManager().getPlugin("Vault") != null) economy = new VaultEconomy(); + + if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { + placeholderParser = new PlaceholderAPIParser(); + getLogger().log(Level.INFO, "Hooked onto PlaceholderAPI"); + } + + if (Bukkit.getPluginManager().getPlugin("Citizens") != null) { + Bukkit.getPluginManager().registerEvents(new CitizenInteractEventListener(), this); + getLogger().log(Level.INFO, "Hooked onto Citizens"); + } + + if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) { + regionHandler = new WorldGuardRegionHandler(); + getLogger().log(Level.INFO, "Hooked onto WorldGuard"); + } + + if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) { + Bukkit.getServer().getPluginManager().registerEvents(new MythicHook(), this); + MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs"); + } + + //Checks if the server runs with bungee + boolean bungee = SpigotConfig.bungee; + boolean onlineMode = Bukkit.getServer().getOnlineMode(); + if (bungee && (!(onlineMode))) + hasBungee=true; + else + hasBungee=false; + + //Setups the channel for Bungee + if(hasBungee) { + getServer().getMessenger().registerOutgoingPluginChannel(this,"namespace:give_mmocore_player"); + getServer().getMessenger().registerOutgoingPluginChannel(this,"namespace:get_mmocore_player"); + getServer().getMessenger().registerIncomingPluginChannel(this,"namespace:get_mmocore_player",new GetMMOCorePlayerListener()); + } + + + /* + * Resource regeneration. Must check if entity is dead otherwise regen will make + * the 'respawn' button glitched plus HURT entity effect bug + */ + new BukkitRunnable() { + public void run() { + for (PlayerData player : PlayerData.getAll()) + if (player.isOnline() && !player.getPlayer().isDead()) + for (PlayerResource resource : PlayerResource.values()) { + double regenAmount = player.getProfess().getHandler(resource).getRegen(player); + if (regenAmount != 0) + resource.regen(player, regenAmount); + } + } + }.runTaskTimer(MMOCore.plugin, 100, 20); + + /* + * For the sake of the lord, make sure they aren't using MMOItems Mana and + * Stamina Addon...This should prevent a couple error reports produced by people + * not reading the installation guide... + */ + if (Bukkit.getPluginManager().getPlugin("MMOMana") != null) { + getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina"); + getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!"); + Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina"); + Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!"); + return; + } + + initializePlugin(false); + + if (getConfig().getBoolean("vanilla-exp-redirection.enabled")) + Bukkit.getPluginManager().registerEvents(new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this); + + // Enable debug mode for extra debug tools + if (getConfig().contains("debug")) { + DebugMode.setLevel(getConfig().getInt("debug", 0)); + DebugMode.enableActionBar(); + } + + // Load quest module + try { + String questPluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin")); + PartyModuleType moduleType = PartyModuleType.valueOf(questPluginName); + Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); + partyModule = moduleType.provideModule(); + } catch (RuntimeException exception) { + getLogger().log(Level.WARNING, "Could not initialize quest module: " + exception.getMessage()); + partyModule = new MMOCorePartyModule(); + } + + + // Load party module + try { + String partyPluginName = UtilityMethods.enumName(getConfig().getString("party-plugin")); + PartyModuleType moduleType = PartyModuleType.valueOf(partyPluginName); + Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed"); + partyModule = moduleType.provideModule(); + } catch (RuntimeException exception) { + getLogger().log(Level.WARNING, "Could not initialize party module: " + exception.getMessage()); + partyModule = new MMOCorePartyModule(); + } + + + // Skill casting + try { + SkillCastingMode mode = SkillCastingMode.valueOf(UtilityMethods.enumName(getConfig().getString("skill-casting.mode"))); + Bukkit.getPluginManager().registerEvents(mode.loadFromConfig(getConfig().getConfigurationSection("skill-casting")), this); + } catch (RuntimeException exception) { + getLogger().log(Level.WARNING, "Could not load skill casting: " + exception.getMessage()); + } + + if (configManager.overrideVanillaExp = getConfig().getBoolean("override-vanilla-exp")) + Bukkit.getPluginManager().registerEvents(new VanillaExperienceOverride(), this); + + if (getConfig().getBoolean("hotbar-swapping.enabled")) + try { + Bukkit.getPluginManager().registerEvents(new HotbarSwap(getConfig().getConfigurationSection("hotbar-swapping")), this); + } catch (RuntimeException exception) { + getLogger().log(Level.WARNING, "Could not load hotbar swapping: " + exception.getMessage()); + } + + if (getConfig().getBoolean("prevent-spawner-xp")) + Bukkit.getPluginManager().registerEvents(new NoSpawnerEXP(), this); + + if (getConfig().getBoolean("death-exp-loss.enabled")) + Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this); + + if (getConfig().getBoolean("shift-click-player-profile-check")) + Bukkit.getPluginManager().registerEvents(new PlayerProfileCheck(), this); + + Bukkit.getPluginManager().registerEvents(new WaypointsListener(), this); + Bukkit.getPluginManager().registerEvents(new PlayerListener(), this); + Bukkit.getPluginManager().registerEvents(new GoldPouchesListener(), this); + Bukkit.getPluginManager().registerEvents(new BlockListener(), this); + Bukkit.getPluginManager().registerEvents(new LootableChestsListener(), this); + Bukkit.getPluginManager().registerEvents(new GuildListener(), this); + Bukkit.getPluginManager().registerEvents(new FishingListener(), this); + Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), this); + Bukkit.getPluginManager().registerEvents(new PlayerPressKeyListener(), this); + // Bukkit.getPluginManager().registerEvents(new ClassTriggers(), this); + + /* + * Initialize player data from all online players. This is very important to do + * 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.getUniqueId())); + + // load guild data after loading player data + dataProvider.getGuildManager().load(); + + // Command + try { + final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap"); + + bukkitCommandMap.setAccessible(true); + CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer()); + + FileConfiguration config = new ConfigFile("commands").getConfig(); + + if (config.contains("player")) + commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); + if (config.contains("attributes")) + commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); + if (config.contains("class")) + commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class"))); + if (config.contains("waypoints")) + commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); + if (config.contains("quests")) + commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); + if (config.contains("skills")) + commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); + if (config.contains("friends")) + commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); + if (config.contains("party")) + commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party"))); + if (config.contains("guild")) + commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild"))); + + if (hasEconomy() && economy.isValid()) { + if (config.contains("withdraw")) + commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); + if (config.contains("deposit")) + commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); + } + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) { + ex.printStackTrace(); + } + + MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); + getCommand("mmocore").setExecutor(mmoCoreCommand); + getCommand("mmocore").setTabCompleter(mmoCoreCommand); + + if (getConfig().getBoolean("auto-save.enabled")) { + int autosave = getConfig().getInt("auto-save.interval") * 20; + new BukkitRunnable() { + public void run() { + + // Save player data + for (PlayerData data : PlayerData.getAll()) + if (data.isFullyLoaded()) + dataProvider.getDataManager().saveData(data); + + // Save guild info + for (Guild guild : dataProvider.getGuildManager().getAll()) + dataProvider.getGuildManager().save(guild); + } + }.runTaskTimerAsynchronously(MMOCore.plugin, autosave, autosave); + } + } + + public void disable() { + + // Save player data + for (PlayerData data : PlayerData.getAll()) + if (data.isFullyLoaded()) { + data.close(); + dataProvider.getDataManager().saveData(data); + } + + // Save guild info + for (Guild guild : dataProvider.getGuildManager().getAll()) + dataProvider.getGuildManager().save(guild); + + // Close MySQL data provider (memory leaks) + if (dataProvider instanceof MySQLDataProvider) + ((MySQLDataProvider) dataProvider).close(); + + // Reset active blocks + mineManager.resetRemainingBlocks(); + + // Clear spawned loot chests + lootChests.getActive().forEach(chest -> chest.expire(false)); + } + + /** + * Called either when the server starts when initializing the manager for + * the first time, or when issuing a plugin reload; in that case, stuff + * like listeners must all be cleared before. + *

+ * Also see {@link MMOCoreManager} + * + * @param clearBefore True when issuing a plugin reload + */ + public void initializePlugin(boolean clearBefore) { + if (clearBefore) + reloadConfig(); + + configManager = new ConfigManager(); + + statManager.initialize(clearBefore); + if (clearBefore) + MythicLib.plugin.getSkills().initialize(true); + skillManager.initialize(clearBefore); + mineManager.initialize(clearBefore); + partyManager.initialize(clearBefore); + attributeManager.initialize(clearBefore); + + // Experience must be loaded before professions and classes + experience.initialize(clearBefore); + + // Drop tables must be loaded before professions + dropTableManager.initialize(clearBefore); + + professionManager.initialize(clearBefore); + classManager.initialize(clearBefore); + + InventoryManager.load(); + + questManager.initialize(clearBefore); + lootChests.initialize(clearBefore); + restrictionManager.initialize(clearBefore); + waypointManager.initialize(clearBefore); + requestManager.initialize(clearBefore); + soundManager.initialize(clearBefore); + configItems.initialize(clearBefore); + + if (getConfig().isConfigurationSection("action-bar")) + actionBarManager.reload(getConfig().getConfigurationSection("action-bar")); + + if (clearBefore) + PlayerData.getAll().forEach(PlayerData::update); + } + + public static void log(String message) { + log(Level.INFO, message); + } + + public static void debug(int value, String message) { + debug(value, Level.INFO, message); + } + + public static void log(Level level, String message) { + plugin.getLogger().log(level, message); + } + + public static void debug(int value, Level level, String message) { + if (DebugMode.level > (value - 1)) plugin.getLogger().log(level, message); + } + + public File getJarFile() { + return getFile(); + } + + public boolean hasEconomy() { + return economy != null && economy.isValid(); + } + + public static void sqlDebug(String s) { + if (!MMOCore.plugin.shouldDebugSQL) return; + MMOCore.plugin.getLogger().warning("- [SQL Debug] " + s); + } } 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 8713d21f..c75d3080 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.api.player; +import com.google.gson.JsonObject; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.player.TemporaryPlayerData; import io.lumine.mythic.lib.player.cooldown.CooldownMap; @@ -28,6 +29,7 @@ import net.Indyuce.mmocore.experience.droptable.ExperienceItem; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; +import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.provided.Party; import net.Indyuce.mmocore.player.Unlockable; @@ -50,6 +52,7 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; import java.util.*; import java.util.logging.Level; +import java.util.stream.Collectors; public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer { @@ -508,6 +511,64 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc }.runTaskTimer(MMOCore.plugin, 0, 1); } + public String toJson() { + + //We create the JSON correspondign to player Data + JsonObject jsonObject = new JsonObject(); + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, getUniqueId()); + MMOCore.sqlDebug("Saving data for: '" + getUniqueId() + "'..."); + + jsonObject.addProperty("class_points", getClassPoints()); + jsonObject.addProperty("skill_points", getSkillPoints()); + jsonObject.addProperty("attribute_points", getAttributePoints()); + jsonObject.addProperty("attribute_realloc_points", getAttributeReallocationPoints()); + jsonObject.addProperty("level", getLevel()); + jsonObject.addProperty("experience", getExperience()); + jsonObject.addProperty("class", getProfess().getId()); + jsonObject.addProperty("last_login", getLastLogin()); + jsonObject.addProperty("guild", hasGuild() ? getGuild().getId() : null); + + jsonObject.addProperty("waypoints", MMOCoreUtils.arrayToJsonString(getWaypoints())); + jsonObject.addProperty("friends", MMOCoreUtils.arrayToJsonString(getFriends().stream().map(UUID::toString).collect(Collectors.toList()))); + jsonObject.addProperty("bound_skills", MMOCoreUtils.arrayToJsonString(getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList()))); + + jsonObject.addProperty("skills", MMOCoreUtils.entrySetToJsonString(mapSkillLevels().entrySet())); + jsonObject.addProperty("times_claimed", MMOCoreUtils.entrySetToJsonString(getItemClaims().entrySet())); + + jsonObject.addProperty("attributes", getAttributes().toJsonString()); + jsonObject.addProperty("professions", getCollectionSkills().toJsonString()); + jsonObject.addProperty("quests", getQuestData().toJsonString()); + jsonObject.addProperty("class_info", createClassInfoData(this).toString()); + + return jsonObject.toString(); + } + + + public static JsonObject createClassInfoData(PlayerData data) { + JsonObject json = new JsonObject(); + for (String c : data.getSavedClasses()) { + SavedClassInformation info = data.getClassInfo(c); + JsonObject classinfo = new JsonObject(); + classinfo.addProperty("level", info.getLevel()); + classinfo.addProperty("experience", info.getExperience()); + classinfo.addProperty("skill-points", info.getSkillPoints()); + classinfo.addProperty("attribute-points", info.getAttributePoints()); + classinfo.addProperty("attribute-realloc-points", info.getAttributeReallocationPoints()); + JsonObject skillinfo = new JsonObject(); + for (String skill : info.getSkillKeys()) + skillinfo.addProperty(skill, info.getSkillLevel(skill)); + classinfo.add("skill", skillinfo); + JsonObject attributeinfo = new JsonObject(); + for (String attribute : info.getAttributeKeys()) + attributeinfo.addProperty(attribute, info.getAttributeLevel(attribute)); + classinfo.add("attribute", attributeinfo); + + json.add(c, classinfo); + } + + return json; + } + public boolean hasReachedMaxLevel() { return getProfess().getMaxLevel() > 0 && getLevel() >= getProfess().getMaxLevel(); } diff --git a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java index 64a5744a..bd3b4050 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java +++ b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.api.util; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.version.VersionMaterial; import io.lumine.mythic.utils.holograms.Hologram; @@ -26,9 +28,7 @@ import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; public class MMOCoreUtils { public static boolean pluginItem(ItemStack item) { @@ -140,6 +140,27 @@ public class MMOCoreUtils { return result.toString(); } + + public static Collection jsonArrayToList(String json) { + return new ArrayList<>(Arrays.asList(MythicLib.plugin.getJson().parse(json, String[].class))); + } + + public static String arrayToJsonString(Collection array) { + JsonArray object = new JsonArray(); + for (String str : array) { + object.add(str); + } + return object.toString(); + } + + public static String entrySetToJsonString(Set> entrySet) { + JsonObject object = new JsonObject(); + for (Map.Entry entry : entrySet) { + object.addProperty(entry.getKey(), entry.getValue()); + } + return object.toString(); + } + /** * Method to get all entities surrounding a location. This method does not * take every entity in the world but rather takes all the entities from the diff --git a/src/main/java/net/Indyuce/mmocore/bungee/Bungee.java b/src/main/java/net/Indyuce/mmocore/bungee/Bungee.java new file mode 100644 index 00000000..0d59c7c8 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/bungee/Bungee.java @@ -0,0 +1,52 @@ +package net.Indyuce.mmocore.bungee; + +import net.md_5.bungee.api.plugin.Plugin; +import org.checkerframework.checker.units.qual.C; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.logging.Level; + +public class Bungee extends Plugin { + public static Bungee plugin; + public CacheManager cacheManager = new CacheManager(); + + + @Override + public void onEnable() { + //Register a new communication channel + getProxy().registerChannel("give_mmocore_player"); + getProxy().registerChannel("get_mmocore_player"); + getProxy().getPluginManager().registerListener(this, new MessageListener()); + + + try { + getProxy().getLogger().log(Level.WARNING,"enabling socket"); + ServerSocket serverSocket= new ServerSocket(25580); + Socket clientSocket=serverSocket.accept(); + getProxy().getLogger().log(Level.WARNING,"port: "+clientSocket.getPort()); + + BufferedReader bufferedReader= new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + String line; + while((line=bufferedReader.readLine())!=null) { + getProxy().getLogger().log(Level.WARNING,line); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + + } + + @Override + public void onDisable() { + + } + + @Override + public void onLoad() { + plugin = this; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java b/src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java new file mode 100644 index 00000000..88b19f63 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java @@ -0,0 +1,28 @@ +package net.Indyuce.mmocore.bungee; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor; + +import java.util.HashMap; +import java.util.UUID; +import java.util.stream.Collectors; + +public class CacheManager { + private final HashMap cachedPlayers= new HashMap<>(); + + + public String getCachedPlayer(UUID uuid) { + return cachedPlayers.get(uuid); + } + public boolean hasCachedPlayer(UUID uuid) { + return cachedPlayers.containsKey(uuid); + } + + public void addCachedPlayer(UUID uuid,String playerData) { + cachedPlayers.put(uuid,playerData); + } + + + public void save() { + } +} diff --git a/src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java b/src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java new file mode 100644 index 00000000..a0bd7477 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java @@ -0,0 +1,65 @@ +package net.Indyuce.mmocore.bungee; + +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.event.PluginMessageEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.event.EventHandler; +import org.bukkit.entity.Player; +import org.bukkit.plugin.messaging.PluginMessageListener; +import org.jetbrains.annotations.NotNull; + +import java.io.*; +import java.util.Collection; +import java.util.UUID; + +public class MessageListener implements Listener { + + /** + * Used to register in the cached Players the data that is sent + */ + @EventHandler + public void onPluginMessage(PluginMessageEvent e) throws IOException { + + //When a server gives the player data + if (e.getTag().equals("give_mmocore_player")) { + + byte[] data = e.getData(); + ByteArrayInputStream in = new ByteArrayInputStream(e.getData()); + DataInputStream inputStream = new DataInputStream(in); + + UUID uuid = UUID.fromString(inputStream.readUTF()); + String jsonMsg = inputStream.readUTF(); + + //We put this data into the CacheManager + Bungee.plugin.cacheManager.addCachedPlayer(uuid,jsonMsg); + } + + + //When a server asks for the player data + if (e.getTag().equals("get_mmocore_player")) { + byte[] data = e.getData(); + ByteArrayInputStream in = new ByteArrayInputStream(e.getData()); + DataInputStream inputStream = new DataInputStream(in); + UUID uuid = UUID.fromString(inputStream.readUTF()); + + + + String response=Bungee.plugin.cacheManager.hasCachedPlayer(uuid)? + Bungee.plugin.cacheManager.getCachedPlayer(uuid):"{}"; + //We format the data corresponding to the player + ByteArrayOutputStream out=new ByteArrayOutputStream(); + DataOutputStream outputStream= new DataOutputStream(out); + outputStream.writeChars(response); + + //We get the corresponding player + ProxiedPlayer proxiedPlayer= Bungee.plugin.getProxy().getPlayer(uuid); + //We send the answer + proxiedPlayer.getServer().getInfo().sendData("get_mmocore_player",out.toByteArray()); + + + } + + } +} + diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java index c26ebd0a..dd27e927 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java @@ -30,8 +30,8 @@ public class ClimbExperienceSource extends SpecificExperienceSource { else { String str = config.getString("type").toUpperCase().replace("-", "_"); Validate.isTrue(str.equals("LADDER") || - str.equals("VINE") || str.equals("TWISTING_VINES_PLANT") || str.equals("WEEPING_VINES"), - "ClimbExperienceSource problem: The type must be ladder, vine, twisted-vines or weeping-vines"); + str.equals("VINE") || str.equals("TWISTING_VINES") || str.equals("WEEPING_VINES"), + "ClimbExperienceSource problem: The type must be ladder, vine, twisting-vines or weeping-vines"); type = Material.valueOf(str); } diff --git a/src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java b/src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java new file mode 100644 index 00000000..81e40242 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java @@ -0,0 +1,21 @@ +package net.Indyuce.mmocore.listener.bungee; + +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteStreams; +import org.bukkit.entity.Player; +import org.bukkit.plugin.messaging.PluginMessageListener; + +import java.util.UUID; + +public class GetMMOCorePlayerListener implements PluginMessageListener { + @Override + public void onPluginMessageReceived( String channel, Player player, byte[] bytes) { + if(!channel.equals("give_mmocore_player")) + return; + ByteArrayDataInput input= ByteStreams.newDataInput(bytes); + UUID uuid=UUID.fromString(input.readUTF()); + String Json=input.readUTF(); + } + + +} 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 20549d26..bb5f148a 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java @@ -1,5 +1,9 @@ package net.Indyuce.mmocore.manager.data; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.player.TemporaryPlayerData; import net.Indyuce.mmocore.MMOCore; @@ -7,12 +11,18 @@ import net.Indyuce.mmocore.api.event.AsyncPlayerDataLoadEvent; import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent; import net.Indyuce.mmocore.api.player.OfflinePlayerData; 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.guild.provided.Guild; +import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.configuration.ConfigurationSection; import org.jetbrains.annotations.NotNull; import java.util.*; +import java.util.logging.Level; public abstract class PlayerDataManager { private final static Map data = Collections.synchronizedMap(new HashMap<>()); @@ -35,6 +45,63 @@ public abstract class PlayerDataManager { return Objects.requireNonNull(data.get(uuid), "Player data is not loaded"); } + + public static void loadDataFromJson(PlayerData data, String json) { + JsonObject object = MythicLib.plugin.getJson().parse(json, JsonObject.class); + + data.setClassPoints(object.get("class_points").getAsInt()); + data.setSkillPoints(object.get("skill_points").getAsInt()); + data.setAttributePoints(object.get("attribute_points").getAsInt()); + data.setAttributeReallocationPoints(object.get("attribute_realloc_points").getAsInt()); + data.setLevel(object.get("level").getAsInt()); + data.setExperience(object.get("experience").getAsInt()); + if (object.has("class")) + data.setClass(MMOCore.plugin.classManager.get(object.get(("class")).getAsString())); + + if (object.has("times_claimed")) { + JsonObject timesClaimed =object.get(("times_claimed")).getAsJsonObject(); + timesClaimed.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); + } + + if (object.has(("guild"))) { + Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(object.get("guild").getAsString()); + data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); + } + if (object.has(("attributes"))) data.getAttributes().load(object.get("attributes").getAsString()); + if (object.has(("professions"))) + data.getCollectionSkills().load(object.get("professions").getAsString()); + if (object.has(("quests"))) data.getQuestData().load(object.get("quests").getAsString()); + data.getQuestData().updateBossBar(); + if (object.has(("waypoints"))) + data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(object.get("waypoints").getAsString())); + if (object.has(("friends"))) + MMOCoreUtils.jsonArrayToList(object.get("friends").getAsString()).forEach(str -> data.getFriends().add(UUID.fromString(str))) + ; + if (object.has(("skills"))) { + JsonObject skillsObject = object.get("skills").getAsJsonObject(); + for (Map.Entry entry : skillsObject.entrySet()) + data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); + } + if (object.has(("bound_skills"))) + for (String skill : MMOCoreUtils.jsonArrayToList(object.get("bound_skills").getAsString())) + if (data.getProfess().hasSkill(skill)) + data.getBoundSkills().add(data.getProfess().getSkill(skill)); + if (object.has(("class_info"))) { + JsonObject classObject = object.get("class_info").getAsJsonObject(); + for (Map.Entry entry : classObject.entrySet()) { + try { + PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); + Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); + data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); + } + } + } + + } + + /** * Safely unregisters the player data from the map. * This saves the player data either through SQL or YAML, diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java index e720ab8f..38597892 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java @@ -42,7 +42,7 @@ getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" + "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG," + "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT," + "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT," - + "class_info LONGTEXT,PRIMARY KEY (uuid));"); + + "class_info LONGTEXT, PRIMARY KEY (uuid));"); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 66d5ed47..977b6784 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.manager.data.mysql; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -9,238 +10,253 @@ import net.Indyuce.mmocore.api.player.OfflinePlayerData; 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.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.PlayerDataManager; import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor.Table; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.jetbrains.annotations.NotNull; +import java.io.*; +import java.net.Socket; import java.sql.SQLException; import java.util.*; import java.util.Map.Entry; import java.util.logging.Level; import java.util.stream.Collectors; +import static net.Indyuce.mmocore.api.player.PlayerData.createClassInfoData; + public class MySQLPlayerDataManager extends PlayerDataManager { - private final MySQLDataProvider provider; + private final MySQLDataProvider provider; - public MySQLPlayerDataManager(MySQLDataProvider provider) { - this.provider = provider; - } + public MySQLPlayerDataManager(MySQLDataProvider provider) { + this.provider = provider; + } - @Override - public void loadData(PlayerData data) { - provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + data.getUniqueId() + "';", (result) -> { - try { - MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); + @Override + public void loadData(PlayerData data) { + provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + data.getUniqueId() + "';", (result) -> { + try { + MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); - // Initialize custom resources - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat("MAX_MANA")); - data.setStamina(data.getStats().getStat("MAX_STAMINA")); - data.setStellium(data.getStats().getStat("MAX_STELLIUM")); - } + // Initialize custom resources + if (!data.hasUsedTemporaryData()) { + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); + } - if (!result.next()) { - data.setLevel(getDefaultData().getLevel()); - data.setClassPoints(getDefaultData().getClassPoints()); - data.setSkillPoints(getDefaultData().getSkillPoints()); - data.setAttributePoints(getDefaultData().getAttributePoints()); - data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints()); - data.setExperience(0); - data.getQuestData().updateBossBar(); + if (!result.next()) { + data.setLevel(getDefaultData().getLevel()); + data.setClassPoints(getDefaultData().getClassPoints()); + data.setSkillPoints(getDefaultData().getSkillPoints()); + data.setAttributePoints(getDefaultData().getAttributePoints()); + data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints()); + data.setExperience(0); + data.getQuestData().updateBossBar(); - data.setFullyLoaded(); - MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); - return; - } + data.setFullyLoaded(); + MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); + return; + } - data.setClassPoints(result.getInt("class_points")); - data.setSkillPoints(result.getInt("skill_points")); - data.setAttributePoints(result.getInt("attribute_points")); - data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points")); - data.setLevel(result.getInt("level")); - data.setExperience(result.getInt("experience")); - if (!isEmpty(result.getString("class"))) - data.setClass(MMOCore.plugin.classManager.get(result.getString("class"))); + data.setClassPoints(result.getInt("class_points")); + data.setSkillPoints(result.getInt("skill_points")); + data.setAttributePoints(result.getInt("attribute_points")); + data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points")); + data.setLevel(result.getInt("level")); + data.setExperience(result.getInt("experience")); + if (!isEmpty(result.getString("class"))) + data.setClass(MMOCore.plugin.classManager.get(result.getString("class"))); - if (!isEmpty(result.getString("times_claimed"))) { - JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); - json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); - } + if (!isEmpty(result.getString("times_claimed"))) { + JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); + json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); + } - if (!isEmpty(result.getString("guild"))) { - Guild guild = provider.getGuildManager().getGuild(result.getString("guild")); - data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); - } - if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes")); - if (!isEmpty(result.getString("professions"))) - data.getCollectionSkills().load(result.getString("professions")); - if (!isEmpty(result.getString("quests"))) data.getQuestData().load(result.getString("quests")); - data.getQuestData().updateBossBar(); - if (!isEmpty(result.getString("waypoints"))) - data.getWaypoints().addAll(getJSONArray(result.getString("waypoints"))); - if (!isEmpty(result.getString("friends"))) - getJSONArray(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); - if (!isEmpty(result.getString("skills"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); - for (Entry entry : object.entrySet()) - data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); - } - if (!isEmpty(result.getString("bound_skills"))) - for (String skill : getJSONArray(result.getString("bound_skills"))) - if (data.getProfess().hasSkill(skill)) - data.getBoundSkills().add(data.getProfess().getSkill(skill)); - if (!isEmpty(result.getString("class_info"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class); - for (Entry entry : object.entrySet()) { - try { - PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); - Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); - data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); - } - } - } + if (!isEmpty(result.getString("guild"))) { + Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild")); + data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); + } + if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes")); + if (!isEmpty(result.getString("professions"))) + data.getCollectionSkills().load(result.getString("professions")); + if (!isEmpty(result.getString("quests"))) data.getQuestData().load(result.getString("quests")); + data.getQuestData().updateBossBar(); + if (!isEmpty(result.getString("waypoints"))) + data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(result.getString("waypoints"))); + if (!isEmpty(result.getString("friends"))) + MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); + if (!isEmpty(result.getString("skills"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); + for (Entry entry : object.entrySet()) + data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); + } + if (!isEmpty(result.getString("bound_skills"))) + for (String skill : MMOCoreUtils.jsonArrayToList(result.getString("bound_skills"))) + if (data.getProfess().hasSkill(skill)) + data.getBoundSkills().add(data.getProfess().getSkill(skill)); + if (!isEmpty(result.getString("class_info"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class); + for (Entry entry : object.entrySet()) { + try { + PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); + Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); + data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); + } + } + } - data.setFullyLoaded(); - MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!"); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } + //We now change the saved status to false because the data on SQL won't be the same as in the RAM + MySQLTableEditor sql = new MySQLTableEditor(Table.PLAYERDATA, data.getUniqueId()); - private boolean isEmpty(String s) { - return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); - } - @Override - public void saveData(PlayerData data) { - MySQLTableEditor sql = new MySQLTableEditor(Table.PLAYERDATA, data.getUniqueId()); - MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); + data.setFullyLoaded(); + MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!"); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } - sql.updateData("class_points", data.getClassPoints()); - sql.updateData("skill_points", data.getSkillPoints()); - sql.updateData("attribute_points", data.getAttributePoints()); - sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); - sql.updateData("level", data.getLevel()); - sql.updateData("experience", data.getExperience()); - sql.updateData("class", data.getProfess().getId()); - sql.updateData("last_login", data.getLastLogin()); - sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); + private boolean isEmpty(String s) { + return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); + } - sql.updateJSONArray("waypoints", data.getWaypoints()); - sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); - sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); + @Override + public void saveData(PlayerData data) { - sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); - sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); + if (MMOCore.plugin.hasBungee) { + //Initialize a connection with bungee using Sockets + try { + Socket socket=new Socket("localhost",25580); + BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + writer.write("BONJOUR"); + } catch (IOException e) { + throw new RuntimeException(e); + } - sql.updateData("attributes", data.getAttributes().toJsonString()); - sql.updateData("professions", data.getCollectionSkills().toJsonString()); - sql.updateData("quests", data.getQuestData().toJsonString()); - sql.updateData("class_info", createClassInfoData(data).toString()); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + DataOutputStream outStream = new DataOutputStream(out); + try { + outStream.writeChars(data.toJson()); + } catch (IOException e) { + MMOCore.plugin.getLogger().log(Level.SEVERE, "Couldn't send the data to Bungee for player " + data.getPlayer().getName()); + return; + } + MMOCore.plugin.getLogger().log(Level.WARNING, "BUNGEE"+ Bukkit.getOnlinePlayers().size()); - MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - } - private JsonObject createClassInfoData(PlayerData data) { - JsonObject json = new JsonObject(); - for (String c : data.getSavedClasses()) { - SavedClassInformation info = data.getClassInfo(c); - JsonObject classinfo = new JsonObject(); - classinfo.addProperty("level", info.getLevel()); - classinfo.addProperty("experience", info.getExperience()); - classinfo.addProperty("skill-points", info.getSkillPoints()); - classinfo.addProperty("attribute-points", info.getAttributePoints()); - classinfo.addProperty("attribute-realloc-points", info.getAttributeReallocationPoints()); - JsonObject skillinfo = new JsonObject(); - for (String skill : info.getSkillKeys()) - skillinfo.addProperty(skill, info.getSkillLevel(skill)); - classinfo.add("skill", skillinfo); - JsonObject attributeinfo = new JsonObject(); - for (String attribute : info.getAttributeKeys()) - attributeinfo.addProperty(attribute, info.getAttributeLevel(attribute)); - classinfo.add("attribute", attributeinfo); + MMOCore.sqlDebug("Sent data to bungee for: " + data.getUniqueId()); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - json.add(c, classinfo); - } - return json; - } + } else { + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); - @NotNull - @Override - public OfflinePlayerData getOffline(UUID uuid) { - return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); - } + sql.updateData("class_points", data.getClassPoints()); + sql.updateData("skill_points", data.getSkillPoints()); + sql.updateData("attribute_points", data.getAttributePoints()); + sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); + sql.updateData("level", data.getLevel()); + sql.updateData("experience", data.getExperience()); + sql.updateData("class", data.getProfess().getId()); + sql.updateData("last_login", data.getLastLogin()); + sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); - private Collection getJSONArray(String json) { - return new ArrayList<>(Arrays.asList(MythicLib.plugin.getJson().parse(json, String[].class))); - } + sql.updateJSONArray("waypoints", data.getWaypoints()); + sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); + sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); - public class MySQLOfflinePlayerData extends OfflinePlayerData { - private int level; - private long lastLogin; - private PlayerClass profess; - private List friends; + sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); + sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); - public MySQLOfflinePlayerData(UUID uuid) { - super(uuid); + sql.updateData("attributes", data.getAttributes().toJsonString()); + sql.updateData("professions", data.getCollectionSkills().toJsonString()); + sql.updateData("quests", data.getQuestData().toJsonString()); - provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { - try { - MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'."); - if (!result.next()) { - level = 0; - lastLogin = 0; - profess = MMOCore.plugin.classManager.getDefaultClass(); - friends = new ArrayList<>(); - MMOCore.sqlDebug("Default OFFLINE data loaded."); - } else { - level = result.getInt("level"); - lastLogin = result.getLong("last_login"); - profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class")); - if (!isEmpty(result.getString("friends"))) - getJSONArray(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str))); - else friends = new ArrayList<>(); - MMOCore.sqlDebug("Saved OFFLINE data loaded."); - } - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } + sql.updateData("class_info", createClassInfoData(data).toString()); - @Override - public void removeFriend(UUID uuid) { - friends.remove(uuid); - new MySQLTableEditor(Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); - } - @Override - public boolean hasFriend(UUID uuid) { - return friends.contains(uuid); - } + MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - @Override - public PlayerClass getProfess() { - return profess; - } - @Override - public int getLevel() { - return level; - } + } + } - @Override - public long getLastLogin() { - return lastLogin; - } - } + + @NotNull + @Override + public OfflinePlayerData getOffline(UUID uuid) { + return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); + } + + + public class MySQLOfflinePlayerData extends OfflinePlayerData { + private int level; + private long lastLogin; + private PlayerClass profess; + private List friends; + + public MySQLOfflinePlayerData(UUID uuid) { + super(uuid); + + provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { + try { + MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'."); + if (!result.next()) { + level = 0; + lastLogin = 0; + profess = MMOCore.plugin.classManager.getDefaultClass(); + friends = new ArrayList<>(); + MMOCore.sqlDebug("Default OFFLINE data loaded."); + } else { + level = result.getInt("level"); + lastLogin = result.getLong("last_login"); + profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class")); + if (!isEmpty(result.getString("friends"))) + MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str))); + else friends = new ArrayList<>(); + MMOCore.sqlDebug("Saved OFFLINE data loaded."); + } + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } + + @Override + public void removeFriend(UUID uuid) { + friends.remove(uuid); + new MySQLTableEditor(Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); + } + + @Override + public boolean hasFriend(UUID uuid) { + return friends.contains(uuid); + } + + @Override + public PlayerClass getProfess() { + return profess; + } + + @Override + public int getLevel() { + return level; + } + + @Override + public long getLastLogin() { + return lastLogin; + } + } } diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml new file mode 100644 index 00000000..1495d76a --- /dev/null +++ b/src/main/resources/bungee.yml @@ -0,0 +1,3 @@ +name: MMOCore +main: net.Indyuce.mmocore.bungee.Bungee +author: Ka0rX From 71773b0c8cdffb9211be1b8984f93e79965b9b32 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 19 Jun 2022 22:42:58 +0200 Subject: [PATCH 37/91] New module --- MMOCore (1).iml | 18 - bungee-plugin/pom.xml | 40 ++ .../fr/phoenix}/mmocore/bungee/Bungee.java | 4 +- .../phoenix}/mmocore/bungee/CacheManager.java | 6 +- .../mmocore/bungee/MessageListener.java | 7 +- bungee-plugin/src/main/resources/bungee.yml | 3 + dist/pom.xml | 98 ++++ pom.xml | 252 +-------- spigot-plugin/pom.xml | 255 +++++++++ .../java/net/Indyuce/mmocore/MMOCore.java | 56 +- .../net/Indyuce/mmocore/api/ConfigFile.java | 5 +- .../Indyuce/mmocore/api/ConfigMessage.java | 0 .../net/Indyuce/mmocore/api/MMOCoreAPI.java | 2 +- .../Indyuce/mmocore/api/PlayerActionBar.java | 144 ++--- .../net/Indyuce/mmocore/api/SoundEvent.java | 0 .../net/Indyuce/mmocore/api/SoundObject.java | 0 .../Indyuce/mmocore/api/block/BlockInfo.java | 350 ++++++------ .../Indyuce/mmocore/api/block/BlockType.java | 60 +- .../Indyuce/mmocore/api/block/RegenInfo.java | 62 +-- .../mmocore/api/block/SkullBlockType.java | 118 ++-- .../mmocore/api/block/VanillaBlockType.java | 138 ++--- .../net/Indyuce/mmocore/api/eco/Withdraw.java | 2 +- .../api/event/AsyncPlayerDataEvent.java | 0 .../api/event/AsyncPlayerDataLoadEvent.java | 0 .../api/event/CustomBlockMineEvent.java | 0 .../api/event/CustomPlayerFishEvent.java | 0 .../api/event/LootChestSpawnEvent.java | 0 .../mmocore/api/event/MMOCommandEvent.java | 0 .../api/event/PlayerAttributeUseEvent.java | 0 .../api/event/PlayerChangeClassEvent.java | 0 .../mmocore/api/event/PlayerCombatEvent.java | 0 .../mmocore/api/event/PlayerDataEvent.java | 0 .../api/event/PlayerDataLoadEvent.java | 0 .../api/event/PlayerExperienceGainEvent.java | 2 +- .../api/event/PlayerKeyPressEvent.java | 0 .../mmocore/api/event/PlayerLevelUpEvent.java | 0 .../api/event/PlayerResourceUpdateEvent.java | 12 +- .../api/event/social/GuildChatEvent.java | 0 .../api/event/social/PartyChatEvent.java | 0 .../mmocore/api/load/DefaultMMOLoader.java | 6 +- .../Indyuce/mmocore/api/load/MMOLoader.java | 2 +- .../mmocore/api/player/CombatRunnable.java | 0 .../mmocore/api/player/OfflinePlayerData.java | 0 .../mmocore/api/player/PlayerActivity.java | 0 .../mmocore/api/player/PlayerData.java | 10 +- .../player/attribute/AttributeModifier.java | 0 .../api/player/attribute/PlayerAttribute.java | 4 +- .../player/attribute/PlayerAttributes.java | 0 .../api/player/profess/ClassOption.java | 102 ++-- .../api/player/profess/PlayerClass.java | 8 +- .../player/profess/SavedClassInformation.java | 8 +- .../mmocore/api/player/profess/Subclass.java | 44 +- .../player/profess/event/EventTrigger.java | 1 - .../profess/event/EventTriggerHandler.java | 0 .../event/trigger/AttackEventTrigger.java | 2 +- .../event/trigger/BlockBrokenTrigger.java | 0 .../event/trigger/BlockPlacedTrigger.java | 0 .../trigger/ClassChosenEventTrigger.java | 0 .../event/trigger/LevelUpEventTrigger.java | 4 +- .../trigger/MultipleLevelUpEventTrigger.java | 2 +- .../profess/resource/ManaDisplayOptions.java | 0 .../profess/resource/PlayerResource.java | 5 +- .../resource/ResourceRegeneration.java | 2 +- .../api/player/social/FriendRequest.java | 0 .../mmocore/api/player/social/Request.java | 0 .../mmocore/api/player/stats/PlayerStats.java | 2 +- .../mmocore/api/player/stats/StatType.java | 0 .../mmocore/api/quest/ObjectiveProgress.java | 0 .../mmocore/api/quest/PlayerQuests.java | 0 .../net/Indyuce/mmocore/api/quest/Quest.java | 0 .../mmocore/api/quest/QuestProgress.java | 0 .../api/quest/objective/ClickonObjective.java | 4 +- .../api/quest/objective/GoToObjective.java | 4 +- .../api/quest/objective/KillMobObjective.java | 4 +- .../quest/objective/MineBlockObjective.java | 6 +- .../api/quest/objective/Objective.java | 0 .../api/quest/trigger/CommandTrigger.java | 0 .../api/quest/trigger/ExperienceTrigger.java | 2 +- .../api/quest/trigger/ItemTrigger.java | 0 .../api/quest/trigger/ManaTrigger.java | 0 .../api/quest/trigger/MessageTrigger.java | 0 .../api/quest/trigger/SoundTrigger.java | 0 .../api/quest/trigger/StaminaTrigger.java | 0 .../api/quest/trigger/StelliumTrigger.java | 0 .../mmocore/api/quest/trigger/Trigger.java | 0 .../Indyuce/mmocore/api/util/Closable.java | 0 .../mmocore/api/util/MMOCoreUtils.java | 0 .../api/util/debug/ActionBarRunnable.java | 64 +-- .../mmocore/api/util/debug/DebugMode.java | 50 +- .../mmocore/api/util/input/AnvilGUI.java | 2 +- .../mmocore/api/util/input/ChatInput.java | 3 +- .../mmocore/api/util/input/PlayerInput.java | 3 +- .../Indyuce/mmocore/api/util/math/Line3D.java | 0 .../mmocore/api/util/math/VectorRotation.java | 0 .../api/util/math/format/DelayFormat.java | 0 .../util/math/formula/IntegerLinearValue.java | 0 .../api/util/math/formula/LinearValue.java | 0 .../api/util/math/formula/RandomAmount.java | 0 .../mmocore/command/AttributesCommand.java | 4 +- .../Indyuce/mmocore/command/ClassCommand.java | 4 +- .../mmocore/command/CommandVerbose.java | 0 .../mmocore/command/DepositCommand.java | 3 +- .../mmocore/command/FriendsCommand.java | 2 +- .../Indyuce/mmocore/command/GuildCommand.java | 6 +- .../command/MMOCoreCommandTreeRoot.java | 2 +- .../Indyuce/mmocore/command/PartyCommand.java | 6 +- .../mmocore/command/PlayerStatsCommand.java | 4 +- .../mmocore/command/QuestsCommand.java | 4 +- .../mmocore/command/SkillsCommand.java | 6 +- .../mmocore/command/WaypointsCommand.java | 2 +- .../mmocore/command/WithdrawCommand.java | 2 +- .../command/rpg/CoinsCommandTreeNode.java | 0 .../command/rpg/NoteCommandTreeNode.java | 0 .../command/rpg/ReloadCommandTreeNode.java | 3 +- .../rpg/admin/AdminCommandTreeNode.java | 0 .../rpg/admin/AttributeCommandTreeNode.java | 8 +- .../rpg/admin/ClassCommandTreeNode.java | 6 +- .../rpg/admin/ExperienceCommandTreeNode.java | 4 +- .../rpg/admin/ForceClassCommandTreeNode.java | 4 +- .../admin/HideActionBarCommandTreeNode.java | 0 .../rpg/admin/InfoCommandTreeNode.java | 2 +- .../rpg/admin/LevelCommandTreeNode.java | 4 +- .../rpg/admin/NoCooldownCommandTreeNode.java | 0 .../rpg/admin/PointsCommandTreeNode.java | 0 .../rpg/admin/ResetCommandTreeNode.java | 6 +- .../rpg/admin/ResourceCommandTreeNode.java | 2 +- .../rpg/booster/BoosterCommandTreeNode.java | 0 .../rpg/booster/CreateCommandTreeNode.java | 2 +- .../rpg/booster/ListCommandTreeNode.java | 2 +- .../rpg/booster/RemoveCommandTreeNode.java | 2 +- .../rpg/debug/DebugCommandTreeNode.java | 0 .../debug/StatModifiersCommandTreeNode.java | 0 .../rpg/debug/StatValueCommandTreeNode.java | 0 .../rpg/quest/CancelCommandTreeNode.java | 86 +-- .../rpg/quest/FinishCommandTreeNode.java | 2 +- .../rpg/quest/QuestCommandTreeNode.java | 42 +- .../rpg/quest/StartCommandTreeNode.java | 110 ++-- .../rpg/waypoint/ItemCommandTreeNode.java | 2 +- .../rpg/waypoint/OpenCommandTreeNode.java | 3 +- .../rpg/waypoint/TeleportCommandTreeNode.java | 0 .../rpg/waypoint/UnlockCommandTreeNode.java | 4 +- .../waypoint/WaypointsCommandTreeNode.java | 0 .../comp/citizens/CitizenInteractEvent.java | 0 .../CitizenInteractEventListener.java | 0 .../comp/citizens/CitizensMMOLoader.java | 0 .../comp/citizens/GetItemObjective.java | 0 .../comp/citizens/TalktoCitizenObjective.java | 0 .../mmocore/comp/mythicmobs/MythicHook.java | 2 +- .../comp/mythicmobs/MythicMobsMMOLoader.java | 2 +- .../mythicmobs/load/CurrencyItemDrop.java | 0 .../comp/mythicmobs/load/GoldPouchDrop.java | 0 .../KillMythicFactionExperienceSource.java | 0 .../load/KillMythicFactionObjective.java | 0 .../load/KillMythicMobExperienceSource.java | 0 .../load/KillMythicMobObjective.java | 0 .../mythicmobs/load/MMDropTableDropItem.java | 0 .../mythicmobs/load/MythicSkillTrigger.java | 2 - .../comp/placeholder/DefaultParser.java | 0 .../placeholder/PlaceholderAPIParser.java | 0 .../comp/placeholder/PlaceholderParser.java | 0 .../comp/placeholder/RPGPlaceholders.java | 4 +- .../comp/region/DefaultRegionHandler.java | 0 .../mmocore/comp/region/RegionCondition.java | 0 .../mmocore/comp/region/RegionHandler.java | 0 .../comp/region/WorldGuardMMOLoader.java | 0 .../comp/region/WorldGuardRegionHandler.java | 0 .../mmocore/comp/vault/MoneyTrigger.java | 2 +- .../mmocore/comp/vault/VaultEconomy.java | 2 +- .../mmocore/comp/vault/VaultMMOLoader.java | 2 +- .../Indyuce/mmocore/experience/Booster.java | 4 +- .../Indyuce/mmocore/experience/EXPSource.java | 0 .../Indyuce/mmocore/experience/ExpCurve.java | 0 .../mmocore/experience/ExperienceObject.java | 2 +- .../experience/ExperienceTableClaimer.java | 0 .../mmocore/experience/PlayerProfessions.java | 0 .../mmocore/experience/Profession.java | 0 .../experience/SimpleExperienceObject.java | 0 .../dispenser/ExperienceDispenser.java | 5 +- .../experience/droptable/ExperienceItem.java | 2 +- .../experience/droptable/ExperienceTable.java | 0 .../source/BrewPotionExperienceSource.java | 2 +- .../source/ClimbExperienceSource.java | 2 - .../source/CraftItemExperienceSource.java | 2 +- .../source/DamageDealtExperienceSource.java | 3 +- .../source/DamageTakenExperienceSource.java | 3 +- .../source/EatExperienceSource.java | 2 +- .../source/EnchantItemExperienceSource.java | 2 +- .../source/FishItemExperienceSource.java | 2 +- .../source/KillMobExperienceSource.java | 2 +- .../source/MineBlockExperienceSource.java | 2 +- .../source/MoveExperienceSource.java | 2 +- .../source/PlaceBlockExperienceSource.java | 2 +- .../source/PlayExperienceSource.java | 2 +- .../source/ProjectileExperienceSource.java | 2 +- .../source/RepairItemExperienceSource.java | 2 +- .../source/ResourceExperienceSource.java | 6 +- .../source/RideExperienceSource.java | 3 +- .../source/SmeltItemExperienceSource.java | 2 +- .../source/TameExperienceSource.java | 2 +- .../source/type/ExperienceSource.java | 2 +- .../source/type/SpecificExperienceSource.java | 3 +- .../Indyuce/mmocore/gui/AttributeView.java | 14 +- .../mmocore/gui/ClassConfirmation.java | 7 +- .../net/Indyuce/mmocore/gui/ClassSelect.java | 9 +- .../net/Indyuce/mmocore/gui/PlayerStats.java | 10 +- .../net/Indyuce/mmocore/gui/QuestViewer.java | 9 +- .../net/Indyuce/mmocore/gui/SkillList.java | 4 +- .../mmocore/gui/SubclassConfirmation.java | 5 +- .../Indyuce/mmocore/gui/SubclassSelect.java | 9 +- .../Indyuce/mmocore/gui/WaypointViewer.java | 4 +- .../mmocore/gui/api/EditableInventory.java | 0 .../mmocore/gui/api/GeneratedInventory.java | 2 +- .../mmocore/gui/api/PluginInventory.java | 0 .../mmocore/gui/api/item/InventoryItem.java | 0 .../mmocore/gui/api/item/Placeholders.java | 0 .../gui/api/item/SimplePlaceholderItem.java | 0 .../mmocore/gui/api/item/TriggerItem.java | 1 - .../Indyuce/mmocore/gui/eco/DepositMenu.java | 2 +- .../Indyuce/mmocore/gui/eco/GoldPouch.java | 0 .../gui/social/friend/EditableFriendList.java | 6 +- .../social/friend/EditableFriendRemoval.java | 4 +- .../gui/social/guild/EditableGuildAdmin.java | 12 +- .../social/guild/EditableGuildCreation.java | 10 +- .../gui/social/guild/EditableGuildView.java | 14 +- .../social/party/EditablePartyCreation.java | 4 +- .../gui/social/party/EditablePartyView.java | 12 +- .../Indyuce/mmocore/guild/AbstractGuild.java | 0 .../Indyuce/mmocore/guild/GuildModule.java | 0 .../mmocore/guild/GuildModuleType.java | 0 .../guild/compat/FactionsGuildModule.java | 0 .../guild/compat/GuildsGuildModule.java | 0 .../guild/compat/KingdomsXGuildModule.java | 0 .../compat/UltimateClansGuildModule.java | 0 .../Indyuce/mmocore/guild/provided/Guild.java | 10 +- .../mmocore/guild/provided/GuildInvite.java | 2 +- .../guild/provided/MMOCoreGuildModule.java | 0 .../mmocore/listener/BlockListener.java | 3 +- .../mmocore/listener/ClassTriggers.java | 0 .../mmocore/listener/GoldPouchesListener.java | 0 .../mmocore/listener/GuildListener.java | 8 +- .../listener/LootableChestsListener.java | 0 .../mmocore/listener/PlayerListener.java | 0 .../mmocore/listener/WaypointsListener.java | 4 +- .../bungee/GetMMOCorePlayerListener.java | 0 .../event/PlayerPressKeyListener.java | 0 .../listener/option/DeathExperienceLoss.java | 50 +- .../mmocore/listener/option/HotbarSwap.java | 2 +- .../mmocore/listener/option/NoSpawnerEXP.java | 33 +- .../listener/option/PlayerProfileCheck.java | 0 .../listener/option/RedirectVanillaExp.java | 46 +- .../option/VanillaExperienceOverride.java | 70 +-- .../listener/profession/FishingListener.java | 2 +- .../profession/PlayerCollectStats.java | 0 .../net/Indyuce/mmocore/loot/LootBuilder.java | 3 +- .../loot/chest/ChestAlgorithmOptions.java | 0 .../Indyuce/mmocore/loot/chest/ChestTier.java | 2 +- .../Indyuce/mmocore/loot/chest/LootChest.java | 0 .../mmocore/loot/chest/LootChestRegion.java | 0 .../mmocore/loot/chest/RegionBounds.java | 3 +- .../mmocore/loot/chest/TierEffect.java | 5 +- .../loot/chest/condition/BiomeCondition.java | 0 .../loot/chest/condition/Condition.java | 0 .../chest/condition/ConditionInstance.java | 3 +- .../chest/condition/DistanceCondition.java | 0 .../loot/chest/condition/LevelCondition.java | 0 .../chest/condition/PermissionCondition.java | 0 .../loot/chest/condition/WorldCondition.java | 0 .../loot/chest/particle/CastingParticle.java | 0 .../chest/particle/ChestParticleEffect.java | 3 +- .../chest/particle/ParabolicProjectile.java | 3 +- .../loot/chest/particle/PotionParticles.java | 3 +- .../chest/particle/SmallParticleEffect.java | 3 +- .../mmocore/loot/droptable/DropTable.java | 4 +- .../loot/droptable/dropitem/DropItem.java | 2 +- .../droptable/dropitem/DropTableDropItem.java | 0 .../loot/droptable/dropitem/GoldDropItem.java | 0 .../loot/droptable/dropitem/NoteDropItem.java | 0 .../droptable/dropitem/VanillaDropItem.java | 0 .../dropitem/fishing/FishingDropItem.java | 0 .../mmocore/manager/AttributeManager.java | 2 +- .../Indyuce/mmocore/manager/ClassManager.java | 3 +- .../mmocore/manager/ConfigItemManager.java | 2 +- .../mmocore/manager/ConfigManager.java | 0 .../mmocore/manager/DropTableManager.java | 2 +- .../mmocore/manager/ExperienceManager.java | 220 ++++---- .../mmocore/manager/InventoryManager.java | 16 +- .../mmocore/manager/LootChestManager.java | 164 +++--- .../mmocore/manager/MMOCoreManager.java | 0 .../mmocore/manager/MMOLoadManager.java | 4 +- .../Indyuce/mmocore/manager/QuestManager.java | 5 +- .../mmocore/manager/RestrictionManager.java | 2 +- .../Indyuce/mmocore/manager/SkillManager.java | 2 +- .../mmocore/manager/SkillTreeManager.java | 0 .../Indyuce/mmocore/manager/SoundManager.java | 0 .../Indyuce/mmocore/manager/StatManager.java | 0 .../mmocore/manager/WaypointManager.java | 2 +- .../mmocore/manager/data/DataProvider.java | 30 +- .../manager/data/GuildDataManager.java | 254 ++++----- .../manager/data/PlayerDataManager.java | 509 +++++++++-------- .../manager/data/mysql/MySQLDataProvider.java | 114 ++-- .../data/mysql/MySQLPlayerDataManager.java | 522 +++++++++--------- .../manager/data/mysql/MySQLTableEditor.java | 110 ++-- .../manager/data/yaml/YAMLDataProvider.java | 40 +- .../data/yaml/YAMLGuildDataManager.java | 100 ++-- .../data/yaml/YAMLOfflinePlayerData.java | 102 ++-- .../data/yaml/YAMLPlayerDataManager.java | 294 +++++----- .../manager/profession/AlchemyManager.java | 0 .../profession/CustomBlockManager.java | 9 +- .../manager/profession/EnchantManager.java | 0 .../profession/ExperienceSourceManager.java | 0 .../manager/profession/FishingManager.java | 0 .../manager/profession/ProfessionManager.java | 0 .../manager/profession/SmithingManager.java | 0 .../profession/SpecificProfessionManager.java | 0 .../manager/registry/MMOCoreRegister.java | 0 .../manager/registry/RegisterObject.java | 0 .../manager/social/BoosterManager.java | 0 .../mmocore/manager/social/PartyManager.java | 0 .../manager/social/RequestManager.java | 0 .../Indyuce/mmocore/party/AbstractParty.java | 0 .../party/MMOCoreTargetRestriction.java | 0 .../Indyuce/mmocore/party/PartyModule.java | 0 .../mmocore/party/PartyModuleType.java | 0 .../party/compat/DungeonsPartyModule.java | 0 .../party/compat/DungeonsXLPartyModule.java | 0 .../party/compat/McMMOPartyModule.java | 0 .../mmocore/party/compat/PAFPartyModule.java | 0 .../party/compat/PartiesPartyModule.java | 0 .../party/provided/MMOCorePartyModule.java | 0 .../Indyuce/mmocore/party/provided/Party.java | 10 +- .../mmocore/party/provided/PartyInvite.java | 2 +- .../mmocore/party/provided/PartyListener.java | 4 +- .../Indyuce/mmocore/player/Unlockable.java | 0 .../player/playerclass/ClassTrigger.java | 0 .../player/playerclass/ClassTriggerType.java | 0 .../mmocore/player/stats/StatInfo.java | 0 .../Indyuce/mmocore/quest/AbstractQuest.java | 0 .../mmocore/quest/MMOCoreQuestModule.java | 2 +- .../mmocore/quest/PlayerQuestData.java | 0 .../mmocore/quest/QuestModuleType.java | 0 .../java/net/Indyuce/mmocore/quest/TODO.txt | 0 .../quest/compat/BeautyQuestsModule.java | 0 .../quest/compat/BlackVeinQuestsModule.java | 0 .../quest/compat/QuestCreatorModule.java | 0 .../mmocore/quest/compat/QuestModule.java | 0 .../Indyuce/mmocore/skill/CastableSkill.java | 2 - .../net/Indyuce/mmocore/skill/ClassSkill.java | 2 +- .../mmocore/skill/RegisteredSkill.java | 0 .../Indyuce/mmocore/skill/cast/KeyCombo.java | 0 .../Indyuce/mmocore/skill/cast/PlayerKey.java | 0 .../skill/cast/SkillCastingHandler.java | 0 .../mmocore/skill/cast/SkillCastingMode.java | 0 .../skill/cast/listener/KeyCombos.java | 2 +- .../mmocore/skill/cast/listener/SkillBar.java | 2 +- .../skill/cast/listener/SkillScroller.java | 2 +- .../skill/custom/mechanic/ManaMechanic.java | 0 .../custom/mechanic/StaminaMechanic.java | 0 .../custom/mechanic/StelliumMechanic.java | 0 .../Indyuce/mmocore/skill/list/Ambers.java | 0 .../mmocore/skill/list/Neptune_Gift.java | 0 .../mmocore/skill/list/Sneaky_Picky.java | 0 .../mmocore/tree/IntegerCoordinates.java | 0 .../net/Indyuce/mmocore/tree/SkillTree.java | 0 .../Indyuce/mmocore/tree/SkillTreeNode.java | 0 .../tree/modifier/UnlockSkillModifier.java | 0 .../mmocore/util/HashableLocation.java | 0 .../util/item/AbstractItemBuilder.java | 0 .../Indyuce/mmocore/util/item/ConfigItem.java | 0 .../util/item/CurrencyItemBuilder.java | 0 .../mmocore/util/item/SimpleItemBuilder.java | 0 .../mmocore/util/item/SkillBookBuilder.java | 0 .../util/item/WaypointBookBuilder.java | 0 .../Indyuce/mmocore/waypoint/Waypoint.java | 0 .../mmocore/waypoint/WaypointOption.java | 0 .../mmocore/waypoint/WaypointPath.java | 0 .../src}/main/resources/config.yml | 0 .../main/resources/default/attributes.yml | 0 .../resources/default/classes/arcane-mage.yml | 0 .../main/resources/default/classes/human.yml | 0 .../main/resources/default/classes/mage.yml | 0 .../resources/default/classes/marksman.yml | 0 .../resources/default/classes/paladin.yml | 0 .../main/resources/default/classes/rogue.yml | 0 .../resources/default/classes/warrior.yml | 0 .../src}/main/resources/default/commands.yml | 64 +-- .../drop-tables/example-drop-tables.yml | 0 .../main/resources/default/exp-tables.yml | 0 .../resources/default/expcurves/levels.txt | 0 .../resources/default/expcurves/mining.txt | 0 .../resources/default/gui/attribute-view.yml | 0 .../resources/default/gui/class-confirm.yml | 0 .../resources/default/gui/class-select.yml | 0 .../resources/default/gui/friend-list.yml | 0 .../resources/default/gui/friend-removal.yml | 0 .../resources/default/gui/guild-creation.yml | 0 .../main/resources/default/gui/guild-view.yml | 0 .../resources/default/gui/party-creation.yml | 0 .../main/resources/default/gui/party-view.yml | 0 .../resources/default/gui/player-stats.yml | 0 .../main/resources/default/gui/quest-list.yml | 0 .../main/resources/default/gui/skill-list.yml | 0 .../default/gui/subclass-confirm.yml | 0 .../resources/default/gui/subclass-select.yml | 0 .../main/resources/default/gui/waypoints.yml | 0 .../src}/main/resources/default/guilds.yml | 80 +-- .../src}/main/resources/default/items.yml | 0 .../main/resources/default/loot-chests.yml | 0 .../src}/main/resources/default/messages.yml | 0 .../resources/default/professions/alchemy.yml | 0 .../default/professions/enchanting.yml | 0 .../resources/default/professions/farming.yml | 0 .../resources/default/professions/fishing.yml | 0 .../resources/default/professions/mining.yml | 0 .../default/professions/smelting.yml | 0 .../default/professions/smithing.yml | 0 .../default/professions/woodcutting.yml | 0 .../resources/default/quests/adv-begins.yml | 0 .../resources/default/quests/fetch-mango.yml | 0 .../resources/default/quests/tutorial.yml | 0 .../resources/default/recipes/brewing.yml | 0 .../resources/default/recipes/furnace.yml | 0 .../main/resources/default/restrictions.yml | 0 .../main/resources/default/skills/ambers.yml | 0 .../resources/default/skills/backstab.yml | 0 .../resources/default/skills/combo-attack.yml | 0 .../main/resources/default/skills/control.yml | 0 .../resources/default/skills/deep-wound.yml | 0 .../default/skills/empowered-attack.yml | 0 .../main/resources/default/skills/evade.yml | 0 .../default/skills/fire-berserker.yml | 0 .../resources/default/skills/fire-rage.yml | 0 .../resources/default/skills/fire-storm.yml | 0 .../resources/default/skills/fireball.yml | 0 .../default/skills/furtive-strike.yml | 0 .../default/skills/greater-healings.yml | 0 .../resources/default/skills/human-shield.yml | 0 .../resources/default/skills/ice-spikes.yml | 0 .../default/skills/minor-healings.yml | 0 .../resources/default/skills/neptune-gift.yml | 0 .../resources/default/skills/power-mark.yml | 0 .../resources/default/skills/sneaky-picky.yml | 0 .../resources/default/skills/telekinesy.yml | 0 .../main/resources/default/skills/warp.yml | 0 .../main/resources/default/skills/weaken.yml | 0 .../src}/main/resources/default/sounds.yml | 0 .../src}/main/resources/default/stats.yml | 0 .../src}/main/resources/default/waypoints.yml | 0 .../src}/main/resources/plugin.yml | 0 src/main/resources/bungee.yml | 3 - 449 files changed, 2793 insertions(+), 2688 deletions(-) delete mode 100644 MMOCore (1).iml create mode 100644 bungee-plugin/pom.xml rename {src/main/java/net/Indyuce => bungee-plugin/src/main/java/fr/phoenix}/mmocore/bungee/Bungee.java (94%) rename {src/main/java/net/Indyuce => bungee-plugin/src/main/java/fr/phoenix}/mmocore/bungee/CacheManager.java (74%) rename {src/main/java/net/Indyuce => bungee-plugin/src/main/java/fr/phoenix}/mmocore/bungee/MessageListener.java (89%) create mode 100644 bungee-plugin/src/main/resources/bungee.yml create mode 100644 dist/pom.xml create mode 100644 spigot-plugin/pom.xml rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/MMOCore.java (91%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/ConfigFile.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/ConfigMessage.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/SoundEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/SoundObject.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/block/BlockType.java (77%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java (86%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/PlayerData.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java (93%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/social/Request.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/Quest.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/Closable.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/AttributesCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/ClassCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/CommandVerbose.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/DepositCommand.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/FriendsCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/GuildCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/PartyCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/QuestsCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/SkillsCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java (87%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/Booster.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/EXPSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/ExpCurve.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/Profession.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java (94%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/AttributeView.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/ClassSelect.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/PlayerStats.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/QuestViewer.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/SkillList.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/PluginInventory.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/item/SimplePlaceholderItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java (93%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/eco/GoldPouch.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java (92%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/GuildModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/provided/Guild.java (94%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/guild/provided/MMOCoreGuildModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/BlockListener.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/GoldPouchesListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/GuildListener.java (78%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/PlayerListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/event/PlayerPressKeyListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/LootBuilder.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/ChestAlgorithmOptions.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/BiomeCondition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/Condition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/DistanceCondition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/LevelCondition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/PermissionCondition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/condition/WorldCondition.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/particle/CastingParticle.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropTableDropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/GoldDropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/NoteDropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/VanillaDropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/AttributeManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/ClassManager.java (98%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/ConfigManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/DropTableManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/InventoryManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/LootChestManager.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/MMOCoreManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/QuestManager.java (99%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/SkillManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/SkillTreeManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/SoundManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/StatManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/WaypointManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java (94%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java (95%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/AbstractParty.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/PartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/PartyModuleType.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/provided/Party.java (96%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java (87%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/player/Unlockable.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java (93%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/TODO.txt (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/CastableSkill.java (97%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/ClassSkill.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/list/Ambers.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/tree/SkillTree.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/HashableLocation.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java (100%) rename {src => spigot-plugin/src}/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java (100%) rename {src => spigot-plugin/src}/main/resources/config.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/attributes.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/arcane-mage.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/human.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/mage.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/marksman.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/paladin.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/rogue.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/classes/warrior.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/commands.yml (94%) rename {src => spigot-plugin/src}/main/resources/default/drop-tables/example-drop-tables.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/exp-tables.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/expcurves/levels.txt (100%) rename {src => spigot-plugin/src}/main/resources/default/expcurves/mining.txt (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/attribute-view.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/class-confirm.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/class-select.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/friend-list.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/friend-removal.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/guild-creation.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/guild-view.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/party-creation.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/party-view.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/player-stats.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/quest-list.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/skill-list.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/subclass-confirm.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/subclass-select.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/gui/waypoints.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/guilds.yml (96%) rename {src => spigot-plugin/src}/main/resources/default/items.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/loot-chests.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/messages.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/alchemy.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/enchanting.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/farming.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/fishing.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/mining.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/smelting.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/smithing.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/professions/woodcutting.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/quests/adv-begins.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/quests/fetch-mango.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/quests/tutorial.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/recipes/brewing.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/recipes/furnace.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/restrictions.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/ambers.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/backstab.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/combo-attack.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/control.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/deep-wound.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/empowered-attack.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/evade.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/fire-berserker.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/fire-rage.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/fire-storm.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/fireball.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/furtive-strike.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/greater-healings.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/human-shield.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/ice-spikes.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/minor-healings.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/neptune-gift.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/power-mark.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/sneaky-picky.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/telekinesy.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/warp.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/skills/weaken.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/sounds.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/stats.yml (100%) rename {src => spigot-plugin/src}/main/resources/default/waypoints.yml (100%) rename {src => spigot-plugin/src}/main/resources/plugin.yml (100%) delete mode 100644 src/main/resources/bungee.yml diff --git a/MMOCore (1).iml b/MMOCore (1).iml deleted file mode 100644 index 86300f98..00000000 --- a/MMOCore (1).iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bungee-plugin/pom.xml b/bungee-plugin/pom.xml new file mode 100644 index 00000000..9cb7151a --- /dev/null +++ b/bungee-plugin/pom.xml @@ -0,0 +1,40 @@ + + + + MMOCore + net.Indyuce + ${revision} + + 4.0.0 + + bungee-plugin + + + 16 + 16 + + + + + + bungeecord-repo + https://oss.sonatype.org/content/repositories/snapshots + + + + + + + net.md-5 + bungeecord-api + 1.19-R0.1-SNAPSHOT + jar + provided + + + + + + \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/bungee/Bungee.java b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java similarity index 94% rename from src/main/java/net/Indyuce/mmocore/bungee/Bungee.java rename to bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java index 0d59c7c8..42e7daf2 100644 --- a/src/main/java/net/Indyuce/mmocore/bungee/Bungee.java +++ b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java @@ -1,7 +1,6 @@ -package net.Indyuce.mmocore.bungee; +package fr.phoenix.mmocore.bungee; import net.md_5.bungee.api.plugin.Plugin; -import org.checkerframework.checker.units.qual.C; import java.io.BufferedReader; import java.io.IOException; @@ -14,7 +13,6 @@ public class Bungee extends Plugin { public static Bungee plugin; public CacheManager cacheManager = new CacheManager(); - @Override public void onEnable() { //Register a new communication channel diff --git a/src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java similarity index 74% rename from src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java rename to bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java index 88b19f63..c2c5e5b2 100644 --- a/src/main/java/net/Indyuce/mmocore/bungee/CacheManager.java +++ b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java @@ -1,11 +1,7 @@ -package net.Indyuce.mmocore.bungee; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor; +package fr.phoenix.mmocore.bungee; import java.util.HashMap; import java.util.UUID; -import java.util.stream.Collectors; public class CacheManager { private final HashMap cachedPlayers= new HashMap<>(); diff --git a/src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java similarity index 89% rename from src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java rename to bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java index a0bd7477..67ff585c 100644 --- a/src/main/java/net/Indyuce/mmocore/bungee/MessageListener.java +++ b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java @@ -1,16 +1,11 @@ -package net.Indyuce.mmocore.bungee; +package fr.phoenix.mmocore.bungee; -import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; -import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.PluginMessageListener; -import org.jetbrains.annotations.NotNull; import java.io.*; -import java.util.Collection; import java.util.UUID; public class MessageListener implements Listener { diff --git a/bungee-plugin/src/main/resources/bungee.yml b/bungee-plugin/src/main/resources/bungee.yml new file mode 100644 index 00000000..f7b9ea21 --- /dev/null +++ b/bungee-plugin/src/main/resources/bungee.yml @@ -0,0 +1,3 @@ +name: MMOCore +main: fr.phoenix.mmocore.bungee.Bungee +author: PhoenixDevelopment diff --git a/dist/pom.xml b/dist/pom.xml new file mode 100644 index 00000000..ffadb113 --- /dev/null +++ b/dist/pom.xml @@ -0,0 +1,98 @@ + + + + MMOCore + net.Indyuce + ${revision} + + 4.0.0 + + dist + + + 16 + 16 + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + MMOCore-${revision} + ../target + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.2.2 + + true + + + + flatten + package + + flatten + + + + flatten.clean + clean + + clean + + + + + + + + + + + + net.Indyuce + bungee-plugin + ${revision} + + + + net.Indyuce + spigot-plugin + ${revision} + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index de0373c3..00718dc4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,18 @@ 4.0.0 net.Indyuce MMOCore - 1.9.3 + pom + ${revision} + + bungee-plugin + spigot-plugin + dist + MMOCore Offer your players a brand new RPG experience!! + 1.9.3 false false UTF-8 @@ -16,255 +23,22 @@ - ${project.name}-${project.version} - - - true - ${basedir}/src/main/resources/ - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.1 - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - - 9 - 9 - UTF-8 - -proc:none - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - false - + maven-clean-plugin + 3.1.0 - package + auto-clean + initialize - shade + clean - - - - nexus - https://mvn.lumine.io/repository/maven-public/ - - - - phoenix - http://la-grange-evasion.pro.dns-orange.fr:8081/repository/maven-public/ - - - - jitpack.io - https://jitpack.io - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - - sk89q-repo - https://maven.enginehub.org/repo/ - - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - - - - - - - org.spigotmc - spigot-1.17.1 - dev - provided - - - - - org.jetbrains - annotations - 19.0.0 - provided - - - - io.papermc - paperlib - 1.0.5 - - - - org.projectlombok - lombok - 1.18.20 - provided - - - - - io.lumine - MythicLib-dist - 1.3.1 - provided - - - - io.lumine - Mythic-Dist - 5.0.1 - provided - - - - me.clip - PlaceholderAPI - 2.11.1 - provided - - - - com.github.MilkBowl - VaultAPI - 1.7 - provided - - - - com.sk89q.worldguard - worldguard-bukkit - 7.0.2-SNAPSHOT - provided - - - - net.citizensnpcs - Citizens - 2.0.30-b2571 - provided - - - - - de.simonsator - PartyAndFriends - 1.0.65 - provided - - - - com.alessiodp - Parties - 3.1.14 - provided - - - - com.gmail.nossr50 - mcMMO - 2.1.209 - provided - - - - de.erethon - DungeonsXL - 0.18-PRE-02 - provided - - - - org.denizen - Dungeons - 1.0 - provided - - - - - me.blackvein - Quests - 4.4.1-b340 - provided - - - fr.skytasul.quests - BeautyQuests - 0.19.5 - provided - - - com.guillaumevdn - QuestCreator - 6.39.0 - provided - - - com.guillaumevdn - GCore - 8.39.0 - provided - - - - - - com.massivecraft - Factions - 1.6.9.5-2.9.8-RC - provided - - - - me.ulrich - UltimateClans - 4.2.0 - provided - - - - me.glaremasters - Guilds - 3.5.6.0 - provided - - - - org.kingdoms.main - Kingdoms - 1.11.15.0.0.0.1.1 - provided - - - - - diff --git a/spigot-plugin/pom.xml b/spigot-plugin/pom.xml new file mode 100644 index 00000000..1798aa26 --- /dev/null +++ b/spigot-plugin/pom.xml @@ -0,0 +1,255 @@ + + + + MMOCore + net.Indyuce + ${revision} + + 4.0.0 + + spigot-plugin + + + 16 + 16 + + + + + + . + true + ${basedir}/src/main/resources/ + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + 9 + 9 + UTF-8 + -proc:none + + + + + + + + + + phoenix + http://la-grange-evasion.pro.dns-orange.fr:8081/repository/maven-public/ + + + + nexus + https://mvn.lumine.io/repository/maven-public/ + + + + jitpack.io + https://jitpack.io + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + sk89q-repo + https://maven.enginehub.org/repo/ + + + + papermc + https://papermc.io/repo/repository/maven-public/ + + + + + + + + + org.spigotmc + spigot-1.17.1 + dev + provided + + + + + org.jetbrains + annotations + 19.0.0 + provided + + + + io.papermc + paperlib + 1.0.5 + + + + org.projectlombok + lombok + 1.18.20 + provided + + + + + io.lumine + MythicLib-dist + 1.3.1 + provided + + + + io.lumine + Mythic-Dist + 5.0.1 + provided + + + + me.clip + PlaceholderAPI + 2.11.1 + provided + + + + com.github.MilkBowl + VaultAPI + 1.7 + provided + + + + com.sk89q.worldguard + worldguard-bukkit + 7.0.2-SNAPSHOT + provided + + + + net.citizensnpcs + Citizens + 2.0.30-b2571 + provided + + + + + de.simonsator + PartyAndFriends + 1.0.65 + provided + + + + com.alessiodp + Parties + 3.1.14 + provided + + + + com.gmail.nossr50 + mcMMO + 2.1.209 + provided + + + + de.erethon + DungeonsXL + 0.18-PRE-02 + provided + + + + org.denizen + Dungeons + 1.0 + provided + + + + + me.blackvein + Quests + 4.4.1-b340 + provided + + + fr.skytasul.quests + BeautyQuests + 0.19.5 + provided + + + com.guillaumevdn + QuestCreator + 6.39.0 + provided + + + com.guillaumevdn + GCore + 8.39.0 + provided + + + + + + com.massivecraft + Factions + 1.6.9.5-2.9.8-RC + provided + + + + me.ulrich + UltimateClans + 4.2.0 + provided + + + + me.glaremasters + Guilds + 3.5.6.0 + provided + + + + org.kingdoms.main + Kingdoms + 1.11.15.0.0.0.1.1 + provided + + + + + + + \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java similarity index 91% rename from src/main/java/net/Indyuce/mmocore/MMOCore.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java index 3e91f338..38c7df42 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -5,6 +5,10 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.comp.Metrics; import io.lumine.mythic.lib.version.SpigotPlugin; import io.lumine.mythic.utils.plugin.LuminePlugin; +import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; +import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader; +import net.Indyuce.mmocore.comp.mythicmobs.MythicHook; +import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.PlayerActionBar; import net.Indyuce.mmocore.api.player.PlayerData; @@ -12,10 +16,6 @@ import net.Indyuce.mmocore.api.player.attribute.AttributeModifier; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.util.debug.DebugMode; import net.Indyuce.mmocore.command.*; -import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; -import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader; -import net.Indyuce.mmocore.comp.mythicmobs.MythicHook; -import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader; import net.Indyuce.mmocore.comp.placeholder.DefaultParser; import net.Indyuce.mmocore.comp.placeholder.PlaceholderAPIParser; import net.Indyuce.mmocore.comp.placeholder.PlaceholderParser; @@ -25,8 +25,12 @@ import net.Indyuce.mmocore.comp.region.WorldGuardMMOLoader; import net.Indyuce.mmocore.comp.region.WorldGuardRegionHandler; import net.Indyuce.mmocore.comp.vault.VaultEconomy; import net.Indyuce.mmocore.comp.vault.VaultMMOLoader; +import net.Indyuce.mmocore.guild.GuildModule; +import net.Indyuce.mmocore.guild.GuildModuleType; import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.guild.provided.MMOCoreGuildModule; import net.Indyuce.mmocore.listener.*; +import net.Indyuce.mmocore.listener.bungee.GetMMOCorePlayerListener; import net.Indyuce.mmocore.listener.event.PlayerPressKeyListener; import net.Indyuce.mmocore.listener.option.*; import net.Indyuce.mmocore.listener.profession.FishingListener; @@ -51,6 +55,7 @@ import org.bukkit.command.CommandMap; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; +import org.spigotmc.SpigotConfig; import java.io.File; import java.lang.reflect.Field; @@ -100,9 +105,9 @@ public class MMOCore extends LuminePlugin { @NotNull public GuildModule guildModule; - public boolean shouldDebugSQL = false; - public boolean hasBungee=false; - private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7; + public boolean shouldDebugSQL, hasBungee; + + private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7; public MMOCore() { plugin = this; @@ -176,13 +181,8 @@ public class MMOCore extends LuminePlugin { MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs"); } - //Checks if the server runs with bungee - boolean bungee = SpigotConfig.bungee; - boolean onlineMode = Bukkit.getServer().getOnlineMode(); - if (bungee && (!(onlineMode))) - hasBungee=true; - else - hasBungee=false; + // Checks if the server runs with Bungee + hasBungee = SpigotConfig.bungee & !Bukkit.getServer().getOnlineMode(); //Setups the channel for Bungee if(hasBungee) { @@ -191,7 +191,6 @@ public class MMOCore extends LuminePlugin { getServer().getMessenger().registerIncomingPluginChannel(this,"namespace:get_mmocore_player",new GetMMOCorePlayerListener()); } - /* * Resource regeneration. Must check if entity is dead otherwise regen will make * the 'respawn' button glitched plus HURT entity effect bug @@ -243,7 +242,6 @@ public class MMOCore extends LuminePlugin { partyModule = new MMOCorePartyModule(); } - // Load party module try { String partyPluginName = UtilityMethods.enumName(getConfig().getString("party-plugin")); @@ -324,37 +322,37 @@ public class MMOCore extends LuminePlugin { FileConfiguration config = new ConfigFile("commands").getConfig(); if (config.contains("player")) - commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); + commandMap.register("net/Indyuce/mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); if (config.contains("attributes")) - commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); + commandMap.register("net/Indyuce/mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); if (config.contains("class")) - commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class"))); + commandMap.register("net/Indyuce/mmocore", new ClassCommand(config.getConfigurationSection("class"))); if (config.contains("waypoints")) - commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); + commandMap.register("net/Indyuce/mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); if (config.contains("quests")) - commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); + commandMap.register("net/Indyuce/mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); if (config.contains("skills")) - commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); + commandMap.register("net/Indyuce/mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); if (config.contains("friends")) - commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); + commandMap.register("net/Indyuce/mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); if (config.contains("party")) - commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party"))); + commandMap.register("net/Indyuce/mmocore", new PartyCommand(config.getConfigurationSection("party"))); if (config.contains("guild")) - commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild"))); + commandMap.register("net/Indyuce/mmocore", new GuildCommand(config.getConfigurationSection("guild"))); if (hasEconomy() && economy.isValid()) { if (config.contains("withdraw")) - commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); + commandMap.register("net/Indyuce/mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); if (config.contains("deposit")) - commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); + commandMap.register("net/Indyuce/mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); } } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) { ex.printStackTrace(); } MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); - getCommand("mmocore").setExecutor(mmoCoreCommand); - getCommand("mmocore").setTabCompleter(mmoCoreCommand); + getCommand("net/Indyuce/mmocore").setExecutor(mmoCoreCommand); + getCommand("net/Indyuce/mmocore").setTabCompleter(mmoCoreCommand); if (getConfig().getBoolean("auto-save.enabled")) { int autosave = getConfig().getInt("auto-save.interval") * 20; diff --git a/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/api/ConfigFile.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java index 5c611746..9aaa4e92 100644 --- a/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java @@ -5,14 +5,13 @@ import java.io.IOException; import java.util.UUID; import java.util.logging.Level; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.guild.provided.Guild; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.guild.provided.Guild; - public class ConfigFile { private final File file; private final String name; diff --git a/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java diff --git a/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java index 1a843613..8cc99d58 100644 --- a/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java @@ -6,11 +6,11 @@ import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.result.SkillResult; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.skill.CastableSkill; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; diff --git a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java index 79328c22..354d8888 100644 --- a/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java @@ -1,72 +1,72 @@ -package net.Indyuce.mmocore.api; - -import io.lumine.mythic.lib.MythicLib; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerActivity; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.player.stats.StatInfo; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.attribute.Attribute; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.scheduler.BukkitRunnable; - -import java.text.DecimalFormat; - -public class PlayerActionBar extends BukkitRunnable { - boolean initialized = false; - - private ActionBarConfig config; - private DecimalFormat digit; - - public void reload(ConfigurationSection cfg) { - config = new ActionBarConfig(cfg); - digit = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.digit); - - if (!initialized && config.enabled) { - runTaskTimer(MMOCore.plugin, 0, config.ticks); - initialized = true; - } - } - - public long getTimeOut() { - return config.timeout; - } - - @Override - public void run() { - for (PlayerData data : PlayerData.getAll()) - if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.getActivityTimeOut(PlayerActivity.ACTION_BAR_MESSAGE) == 0) { - data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(), - MythicLib.plugin.parseColors((data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : config.format) - .replace("{health}", digit.format(data.getPlayer().getHealth())) - .replace("{max_health}", StatInfo.valueOf("MAX_HEALTH").format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())) - .replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon()) - .replace("{mana}", digit.format(data.getMana())) - .replace("{max_mana}", StatInfo.valueOf("MAX_MANA").format(data.getStats().getStat("MAX_MANA"))) - .replace("{stamina}", digit.format(data.getStamina())) - .replace("{max_stamina}", StatInfo.valueOf("MAX_STAMINA").format(data.getStats().getStat("MAX_STAMINA"))) - .replace("{stellium}", digit.format(data.getStellium())) - .replace("{max_stellium}", StatInfo.valueOf("MAX_STELLIUM").format(data.getStats().getStat("MAX_STELLIUM"))) - .replace("{class}", data.getProfess().getName()) - .replace("{xp}", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience())) - .replace("{armor}", StatInfo.valueOf("ARMOR").format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue())) - .replace("{level}", "" + data.getLevel()) - .replace("{name}", data.getPlayer().getDisplayName()))))); - } - } - - private static class ActionBarConfig { - private final boolean enabled; - private final int ticks, timeout; - private final String digit, format; - - private ActionBarConfig(ConfigurationSection config) { - enabled = config.getBoolean("enabled", false); - timeout = config.getInt("", 60); - digit = config.getString("decimal", "0.#"); - ticks = config.getInt("ticks-to-update", 5); - format = config.getString("format", "please format me :c"); - } - } -} +package net.Indyuce.mmocore.api; + +import io.lumine.mythic.lib.MythicLib; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerActivity; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.player.stats.StatInfo; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.attribute.Attribute; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.scheduler.BukkitRunnable; + +import java.text.DecimalFormat; + +public class PlayerActionBar extends BukkitRunnable { + boolean initialized = false; + + private ActionBarConfig config; + private DecimalFormat digit; + + public void reload(ConfigurationSection cfg) { + config = new ActionBarConfig(cfg); + digit = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.digit); + + if (!initialized && config.enabled) { + runTaskTimer(MMOCore.plugin, 0, config.ticks); + initialized = true; + } + } + + public long getTimeOut() { + return config.timeout; + } + + @Override + public void run() { + for (PlayerData data : PlayerData.getAll()) + if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.getActivityTimeOut(PlayerActivity.ACTION_BAR_MESSAGE) == 0) { + data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(), + MythicLib.plugin.parseColors((data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : config.format) + .replace("{health}", digit.format(data.getPlayer().getHealth())) + .replace("{max_health}", StatInfo.valueOf("MAX_HEALTH").format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())) + .replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon()) + .replace("{mana}", digit.format(data.getMana())) + .replace("{max_mana}", StatInfo.valueOf("MAX_MANA").format(data.getStats().getStat("MAX_MANA"))) + .replace("{stamina}", digit.format(data.getStamina())) + .replace("{max_stamina}", StatInfo.valueOf("MAX_STAMINA").format(data.getStats().getStat("MAX_STAMINA"))) + .replace("{stellium}", digit.format(data.getStellium())) + .replace("{max_stellium}", StatInfo.valueOf("MAX_STELLIUM").format(data.getStats().getStat("MAX_STELLIUM"))) + .replace("{class}", data.getProfess().getName()) + .replace("{xp}", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience())) + .replace("{armor}", StatInfo.valueOf("ARMOR").format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue())) + .replace("{level}", "" + data.getLevel()) + .replace("{name}", data.getPlayer().getDisplayName()))))); + } + } + + private static class ActionBarConfig { + private final boolean enabled; + private final int ticks, timeout; + private final String digit, format; + + private ActionBarConfig(ConfigurationSection config) { + enabled = config.getBoolean("enabled", false); + timeout = config.getInt("", 60); + digit = config.getString("decimal", "0.#"); + ticks = config.getInt("ticks-to-update", 5); + format = config.getString("format", "please format me :c"); + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/SoundEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/SoundEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/SoundObject.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundObject.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/SoundObject.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundObject.java diff --git a/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java index 874e3507..04d444b7 100644 --- a/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java @@ -1,175 +1,175 @@ -package net.Indyuce.mmocore.api.block; - -import io.lumine.mythic.lib.UtilityMethods; -import io.lumine.mythic.lib.api.MMOLineConfig; -import io.lumine.mythic.lib.api.condition.type.BlockCondition; -import io.lumine.mythic.lib.api.condition.type.MMOCondition; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.loot.droptable.DropTable; -import net.Indyuce.mmocore.loot.LootBuilder; -import net.Indyuce.mmocore.api.quest.trigger.Trigger; -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.*; -import java.util.logging.Level; - -public class BlockInfo { - private final BlockType block; - private final DropTable table; - private final RegenInfo regen; - private final List triggers = new ArrayList<>(); - private final List conditions = new ArrayList<>(); - private final Map options = new HashMap<>(); - - public BlockInfo(ConfigurationSection config) { - Validate.notNull(config, "Could not load config"); - Validate.isTrue(config.contains("material"), "Could not find block type"); - - block = MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("material"))); - table = config.contains("drop-table") ? MMOCore.plugin.dropTableManager.loadDropTable(config.get("drop-table")) : null; - - regen = config.contains("regen") ? new RegenInfo(config.getConfigurationSection("regen")) : null; - - if (config.contains("options")) - for (String key : config.getConfigurationSection("options").getKeys(false)) - try { - BlockInfoOption option = BlockInfoOption.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_")); - options.put(option, config.getBoolean("options." + key)); - } catch (IllegalArgumentException exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, - "Could not load option '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage()); - } - - if (config.contains("triggers")) { - List list = config.getStringList("triggers"); - Validate.notNull(list, "Could not load triggers"); - - for (String key : list) - try { - triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key))); - } catch (IllegalArgumentException exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, - "Could not load trigger '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage()); - } - } - - if (config.isList("conditions")) - for (String key : config.getStringList("conditions")) { - MMOCondition condition = UtilityMethods.getCondition(key); - if (condition instanceof BlockCondition) - conditions.add((BlockCondition) condition); - } - - } - - public boolean getOption(BlockInfoOption option) { - return options.getOrDefault(option, option.getDefault()); - } - - public BlockType getBlock() { - return block; - } - - @NotNull - public DropTable getDropTable() { - return Objects.requireNonNull(table, "Block has no drop table"); - } - - public boolean hasDropTable() { - return table != null; - } - - public List collectDrops(LootBuilder builder) { - return table != null ? table.collect(builder) : new ArrayList<>(); - } - - public boolean hasRegen() { - return regen != null; - } - - public boolean regenerates() { - return regen != null; - } - - public RegenInfo getRegenerationInfo() { - return regen; - } - - public RegeneratingBlock startRegeneration(BlockData data, Location loc) { - return new RegeneratingBlock(data, loc, this); - } - - public boolean hasTriggers() { - return !triggers.isEmpty(); - } - - public List getTriggers() { - return triggers; - } - - public boolean checkConditions(Block block) { - for (BlockCondition condition : conditions) - if (!condition.check(block)) - return false; - return true; - } - - public static enum BlockInfoOption { - - /** - * When disabled, removes the vanilla drops when a block is mined - */ - VANILLA_DROPS(true), - - /** - * When disabled, removes exp holograms when mined - */ - EXP_HOLOGRAMS(true); - - private final boolean def; - - private BlockInfoOption(boolean def) { - this.def = def; - } - - public boolean getDefault() { - return def; - } - } - - public static class RegeneratingBlock { - private final BlockData data; - private final Location loc; - private final BlockInfo regenerating; - - private final long date = System.currentTimeMillis(); - - public RegeneratingBlock(BlockData data, Location loc, BlockInfo regenerating) { - this.data = data; - this.loc = loc; - this.regenerating = regenerating; - } - - public boolean isTimedOut() { - return date + regenerating.getRegenerationInfo().getTime() * 50 < System.currentTimeMillis(); - } - - public BlockData getBlockData() { - return data; - } - - public Location getLocation() { - return loc; - } - - public BlockInfo getRegeneratingBlock() { - return regenerating; - } - } -} +package net.Indyuce.mmocore.api.block; + +import io.lumine.mythic.lib.UtilityMethods; +import io.lumine.mythic.lib.api.MMOLineConfig; +import io.lumine.mythic.lib.api.condition.type.BlockCondition; +import io.lumine.mythic.lib.api.condition.type.MMOCondition; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.quest.trigger.Trigger; +import net.Indyuce.mmocore.loot.droptable.DropTable; +import net.Indyuce.mmocore.loot.LootBuilder; +import org.apache.commons.lang.Validate; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.*; +import java.util.logging.Level; + +public class BlockInfo { + private final BlockType block; + private final DropTable table; + private final RegenInfo regen; + private final List triggers = new ArrayList<>(); + private final List conditions = new ArrayList<>(); + private final Map options = new HashMap<>(); + + public BlockInfo(ConfigurationSection config) { + Validate.notNull(config, "Could not load config"); + Validate.isTrue(config.contains("material"), "Could not find block type"); + + block = MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("material"))); + table = config.contains("drop-table") ? MMOCore.plugin.dropTableManager.loadDropTable(config.get("drop-table")) : null; + + regen = config.contains("regen") ? new RegenInfo(config.getConfigurationSection("regen")) : null; + + if (config.contains("options")) + for (String key : config.getConfigurationSection("options").getKeys(false)) + try { + BlockInfoOption option = BlockInfoOption.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_")); + options.put(option, config.getBoolean("options." + key)); + } catch (IllegalArgumentException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, + "Could not load option '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage()); + } + + if (config.contains("triggers")) { + List list = config.getStringList("triggers"); + Validate.notNull(list, "Could not load triggers"); + + for (String key : list) + try { + triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key))); + } catch (IllegalArgumentException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, + "Could not load trigger '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage()); + } + } + + if (config.isList("conditions")) + for (String key : config.getStringList("conditions")) { + MMOCondition condition = UtilityMethods.getCondition(key); + if (condition instanceof BlockCondition) + conditions.add((BlockCondition) condition); + } + + } + + public boolean getOption(BlockInfoOption option) { + return options.getOrDefault(option, option.getDefault()); + } + + public BlockType getBlock() { + return block; + } + + @NotNull + public DropTable getDropTable() { + return Objects.requireNonNull(table, "Block has no drop table"); + } + + public boolean hasDropTable() { + return table != null; + } + + public List collectDrops(LootBuilder builder) { + return table != null ? table.collect(builder) : new ArrayList<>(); + } + + public boolean hasRegen() { + return regen != null; + } + + public boolean regenerates() { + return regen != null; + } + + public RegenInfo getRegenerationInfo() { + return regen; + } + + public RegeneratingBlock startRegeneration(BlockData data, Location loc) { + return new RegeneratingBlock(data, loc, this); + } + + public boolean hasTriggers() { + return !triggers.isEmpty(); + } + + public List getTriggers() { + return triggers; + } + + public boolean checkConditions(Block block) { + for (BlockCondition condition : conditions) + if (!condition.check(block)) + return false; + return true; + } + + public static enum BlockInfoOption { + + /** + * When disabled, removes the vanilla drops when a block is mined + */ + VANILLA_DROPS(true), + + /** + * When disabled, removes exp holograms when mined + */ + EXP_HOLOGRAMS(true); + + private final boolean def; + + private BlockInfoOption(boolean def) { + this.def = def; + } + + public boolean getDefault() { + return def; + } + } + + public static class RegeneratingBlock { + private final BlockData data; + private final Location loc; + private final BlockInfo regenerating; + + private final long date = System.currentTimeMillis(); + + public RegeneratingBlock(BlockData data, Location loc, BlockInfo regenerating) { + this.data = data; + this.loc = loc; + this.regenerating = regenerating; + } + + public boolean isTimedOut() { + return date + regenerating.getRegenerationInfo().getTime() * 50 < System.currentTimeMillis(); + } + + public BlockData getBlockData() { + return data; + } + + public Location getLocation() { + return loc; + } + + public BlockInfo getRegeneratingBlock() { + return regenerating; + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java similarity index 77% rename from src/main/java/net/Indyuce/mmocore/api/block/BlockType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java index aa86aa21..f375f96f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java @@ -1,31 +1,29 @@ -package net.Indyuce.mmocore.api.block; - -import org.bukkit.block.Block; - -import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock; - -public interface BlockType { - - /** - * Called when placing temporary blocks - */ - void place(RegeneratingBlock placed); - - /** - * Called when regenerating an older block with block regen - */ - void regenerate(RegeneratingBlock regenerating); - - /** - * Generates a key used to store the BlockInfo instance in the manager map, - * the key depends on the block type to make sure there is no interference - */ - String generateKey(); - - /** - * Applies some extra break restrictions; returns TRUE if the block can be - * broken. This method is used to prevent non mature crops from being broken - * for example - */ - boolean breakRestrictions(Block block); -} +package net.Indyuce.mmocore.api.block; + +import org.bukkit.block.Block; + +public interface BlockType { + + /** + * Called when placing temporary blocks + */ + void place(BlockInfo.RegeneratingBlock placed); + + /** + * Called when regenerating an older block with block regen + */ + void regenerate(BlockInfo.RegeneratingBlock regenerating); + + /** + * Generates a key used to store the BlockInfo instance in the manager map, + * the key depends on the block type to make sure there is no interference + */ + String generateKey(); + + /** + * Applies some extra break restrictions; returns TRUE if the block can be + * broken. This method is used to prevent non mature crops from being broken + * for example + */ + boolean breakRestrictions(Block block); +} diff --git a/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java index c33183ab..851c7eb0 100644 --- a/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java @@ -1,31 +1,31 @@ -package net.Indyuce.mmocore.api.block; - -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.ConfigurationSection; - -import net.Indyuce.mmocore.MMOCore; -import io.lumine.mythic.lib.api.MMOLineConfig; - -public class RegenInfo { - private final BlockType temporary; - private final int regenTime; - - public RegenInfo(ConfigurationSection config) { - Validate.notNull(config, "Could not read regen info config"); - - temporary = config.contains("temp-block") ? MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("temp-block"))) : null; - regenTime = config.getInt("time", 2 * 60 * 20); - } - - public int getTime() { - return regenTime; - } - - public boolean hasTemporaryBlock() { - return temporary != null; - } - - public BlockType getTemporaryBlock() { - return temporary; - } -} +package net.Indyuce.mmocore.api.block; + +import net.Indyuce.mmocore.MMOCore; +import org.apache.commons.lang.Validate; +import org.bukkit.configuration.ConfigurationSection; + +import io.lumine.mythic.lib.api.MMOLineConfig; + +public class RegenInfo { + private final BlockType temporary; + private final int regenTime; + + public RegenInfo(ConfigurationSection config) { + Validate.notNull(config, "Could not read regen info config"); + + temporary = config.contains("temp-block") ? MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("temp-block"))) : null; + regenTime = config.getInt("time", 2 * 60 * 20); + } + + public int getTime() { + return regenTime; + } + + public boolean hasTemporaryBlock() { + return temporary != null; + } + + public BlockType getTemporaryBlock() { + return temporary; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java index b3d01e3b..2c6d1cc8 100644 --- a/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java @@ -1,59 +1,59 @@ -package net.Indyuce.mmocore.api.block; - -import org.bukkit.Location; -import org.bukkit.block.Block; - -import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock; -import net.Indyuce.mmocore.api.util.MMOCoreUtils; -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.api.MMOLineConfig; -import io.lumine.mythic.lib.version.VersionMaterial; - -public class SkullBlockType implements BlockType { - private final String value; - - public SkullBlockType(MMOLineConfig config) { - config.validate("value"); - - value = config.getString("value"); - } - - public SkullBlockType(Block block) { - value = MythicLib.plugin.getVersion().getWrapper().getSkullValue(block); - } - - public String getValue() { - return value; - } - - @Override - public void place(RegeneratingBlock block) { - Location loc = block.getLocation(); - loc.getBlock().setType(VersionMaterial.PLAYER_HEAD.toMaterial()); - - // save skull orientation if replaced block is a player head - if (MMOCoreUtils.isPlayerHead(block.getBlockData().getMaterial())) - loc.getBlock().setBlockData(block.getBlockData()); - - MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value); - } - - @Override - public void regenerate(RegeneratingBlock block) { - Location loc = block.getLocation(); - // This makes sure that if a skull loses its original rotation - // it can revert back to it when the base block is regenerated - loc.getBlock().setBlockData(block.getBlockData()); - MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value); - } - - @Override - public String generateKey() { - return "vanilla-skull-" + value; - } - - @Override - public boolean breakRestrictions(Block block) { - return true; - } -} +package net.Indyuce.mmocore.api.block; + +import org.bukkit.Location; +import org.bukkit.block.Block; + +import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; +import io.lumine.mythic.lib.MythicLib; +import io.lumine.mythic.lib.api.MMOLineConfig; +import io.lumine.mythic.lib.version.VersionMaterial; + +public class SkullBlockType implements BlockType { + private final String value; + + public SkullBlockType(MMOLineConfig config) { + config.validate("value"); + + value = config.getString("value"); + } + + public SkullBlockType(Block block) { + value = MythicLib.plugin.getVersion().getWrapper().getSkullValue(block); + } + + public String getValue() { + return value; + } + + @Override + public void place(RegeneratingBlock block) { + Location loc = block.getLocation(); + loc.getBlock().setType(VersionMaterial.PLAYER_HEAD.toMaterial()); + + // save skull orientation if replaced block is a player head + if (MMOCoreUtils.isPlayerHead(block.getBlockData().getMaterial())) + loc.getBlock().setBlockData(block.getBlockData()); + + MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value); + } + + @Override + public void regenerate(RegeneratingBlock block) { + Location loc = block.getLocation(); + // This makes sure that if a skull loses its original rotation + // it can revert back to it when the base block is regenerated + loc.getBlock().setBlockData(block.getBlockData()); + MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value); + } + + @Override + public String generateKey() { + return "vanilla-skull-" + value; + } + + @Override + public boolean breakRestrictions(Block block) { + return true; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java index 121538b0..e0076cf0 100644 --- a/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java @@ -1,69 +1,69 @@ -package net.Indyuce.mmocore.api.block; - -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.data.Ageable; -import org.bukkit.block.data.BlockData; - -import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock; -import io.lumine.mythic.lib.api.MMOLineConfig; - -public class VanillaBlockType implements BlockType { - private final Material type; - - /* - * allows to plant back crops with a custom age so that it does not always - * have to full grow again- - */ - private final int age; - - public VanillaBlockType(MMOLineConfig config) { - config.validate("type"); - - type = Material.valueOf(config.getString("type").toUpperCase().replace("-", "_").replace(" ", "_")); - age = config.getInt("age", 0); - - Validate.isTrue(age >= 0 && age < 8, "Age must be between 0 and 7"); - } - - public VanillaBlockType(Block block) { - type = block.getType(); - age = 0; - } - - public Material getType() { - return type; - } - - @Override - public void place(RegeneratingBlock block) { - Location loc = block.getLocation(); - block.getLocation().getBlock().setType(type); - - BlockData state = block.getLocation().getBlock().getBlockData(); - if (age > 0 && state instanceof Ageable) { - ((Ageable) state).setAge(age); - loc.getBlock().setBlockData(state); - } - } - - @Override - public void regenerate(RegeneratingBlock block) { - Location loc = block.getLocation(); - loc.getBlock().setType(type); - // Sets the original blocks old data (only when regenerating) - loc.getBlock().setBlockData(block.getBlockData()); - } - - @Override - public String generateKey() { - return "vanilla-block-" + type.name(); - } - - @Override - public boolean breakRestrictions(Block block) { - return age == 0 || (block.getBlockData() instanceof Ageable && ((Ageable) block.getBlockData()).getAge() >= age); - } -} +package net.Indyuce.mmocore.api.block; + +import org.apache.commons.lang.Validate; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.data.Ageable; +import org.bukkit.block.data.BlockData; + +import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock; +import io.lumine.mythic.lib.api.MMOLineConfig; + +public class VanillaBlockType implements BlockType { + private final Material type; + + /* + * allows to plant back crops with a custom age so that it does not always + * have to full grow again- + */ + private final int age; + + public VanillaBlockType(MMOLineConfig config) { + config.validate("type"); + + type = Material.valueOf(config.getString("type").toUpperCase().replace("-", "_").replace(" ", "_")); + age = config.getInt("age", 0); + + Validate.isTrue(age >= 0 && age < 8, "Age must be between 0 and 7"); + } + + public VanillaBlockType(Block block) { + type = block.getType(); + age = 0; + } + + public Material getType() { + return type; + } + + @Override + public void place(RegeneratingBlock block) { + Location loc = block.getLocation(); + block.getLocation().getBlock().setType(type); + + BlockData state = block.getLocation().getBlock().getBlockData(); + if (age > 0 && state instanceof Ageable) { + ((Ageable) state).setAge(age); + loc.getBlock().setBlockData(state); + } + } + + @Override + public void regenerate(RegeneratingBlock block) { + Location loc = block.getLocation(); + loc.getBlock().setType(type); + // Sets the original blocks old data (only when regenerating) + loc.getBlock().setBlockData(block.getBlockData()); + } + + @Override + public String generateKey() { + return "vanilla-block-" + type.name(); + } + + @Override + public boolean breakRestrictions(Block block) { + return age == 0 || (block.getBlockData() instanceof Ageable && ((Ageable) block.getBlockData()).getAge() >= age); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java index e143c2b7..9b46af96 100644 --- a/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java @@ -4,6 +4,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -16,7 +17,6 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.util.item.CurrencyItemBuilder; import io.lumine.mythic.lib.api.util.SmartGive; diff --git a/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java index bd48b40d..eebb698b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java @@ -2,10 +2,10 @@ package net.Indyuce.mmocore.api.event; import javax.annotation.Nullable; +import net.Indyuce.mmocore.experience.EXPSource; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; -import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java similarity index 86% rename from src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java index 291f4876..6a10469e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java @@ -1,5 +1,9 @@ package net.Indyuce.mmocore.api.event; +import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; +import net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger; +import net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger; +import net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.skill.list.Neptune_Gift; @@ -104,14 +108,14 @@ public class PlayerResourceUpdateEvent extends PlayerDataEvent implements Cancel /** * Used by quests triggers - * - {@link net.Indyuce.mmocore.api.quest.trigger.ManaTrigger} - * - {@link net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger} - * - {@link net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger} + * - {@link ManaTrigger} + * - {@link StaminaTrigger} + * - {@link StelliumTrigger} */ TRIGGER, /** - * When using the resource command {@link net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode} + * When using the resource command {@link ResourceCommandTreeNode} */ COMMAND, diff --git a/src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index 9ec22aca..da0ec28f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -1,13 +1,13 @@ package net.Indyuce.mmocore.api.load; +import net.Indyuce.mmocore.api.block.BlockType; +import net.Indyuce.mmocore.api.block.SkullBlockType; +import net.Indyuce.mmocore.api.block.VanillaBlockType; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.*; import net.Indyuce.mmocore.loot.chest.condition.*; import org.bukkit.configuration.ConfigurationSection; -import net.Indyuce.mmocore.api.block.BlockType; -import net.Indyuce.mmocore.api.block.SkullBlockType; -import net.Indyuce.mmocore.api.block.VanillaBlockType; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import net.Indyuce.mmocore.loot.droptable.dropitem.DropTableDropItem; diff --git a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java index c1bed441..51564421 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java @@ -2,12 +2,12 @@ package net.Indyuce.mmocore.api.load; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.api.block.BlockType; +import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.api.quest.objective.Objective; -import net.Indyuce.mmocore.api.quest.trigger.Trigger; import org.bukkit.configuration.ConfigurationSection; /** diff --git a/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index a98ef3ae..52210361 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.api.player; +import com.google.gson.JsonObject; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.player.TemporaryPlayerData; import io.lumine.mythic.lib.player.cooldown.CooldownMap; @@ -22,12 +24,10 @@ import net.Indyuce.mmocore.api.util.Closable; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.ExperienceObject; -import net.Indyuce.mmocore.experience.ExperienceTableClaimer; -import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.droptable.ExperienceItem; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import net.Indyuce.mmocore.guild.provided.Guild; -import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; +import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.provided.Party; import net.Indyuce.mmocore.player.Unlockable; @@ -36,6 +36,9 @@ import net.Indyuce.mmocore.skill.RegisteredSkill; import net.Indyuce.mmocore.skill.cast.SkillCastingHandler; import net.Indyuce.mmocore.waypoint.Waypoint; import net.Indyuce.mmocore.waypoint.WaypointOption; +import net.Indyuce.mmocore.experience.ExperienceTableClaimer; +import net.Indyuce.mmocore.experience.PlayerProfessions; +import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.apache.commons.lang.Validate; @@ -50,6 +53,7 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; import java.util.*; import java.util.logging.Level; +import java.util.stream.Collectors; public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java index af2f7ad5..b2858e48 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java @@ -3,11 +3,11 @@ package net.Indyuce.mmocore.api.player.attribute; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.experience.droptable.ExperienceTable; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.ExpCurve; import net.Indyuce.mmocore.experience.ExperienceObject; -import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java similarity index 93% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java index 5a6e5e29..d0f6a72a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java @@ -1,52 +1,52 @@ -package net.Indyuce.mmocore.api.player.profess; - -public enum ClassOption { - - /** - * If the class should be applied to newcomers - */ - DEFAULT, - - /** - * If the class should in the /class GUI - */ - DISPLAY(true), - - /** - * Health only regens when out of combat - */ - OFF_COMBAT_HEALTH_REGEN, - - /** - * Mana only regens when out of combat - */ - OFF_COMBAT_MANA_REGEN, - - /** - * Stamina only regens when out of combat - */ - OFF_COMBAT_STAMINA_REGEN, - - /** - * Stellium only regens when out of combat - */ - OFF_COMBAT_STELLIUM_REGEN; - - private final boolean def; - - ClassOption() { - this(false); - } - - ClassOption(boolean def) { - this.def = def; - } - - public boolean getDefault() { - return def; - } - - public String getPath() { - return name().toLowerCase().replace("_", "-"); - } +package net.Indyuce.mmocore.api.player.profess; + +public enum ClassOption { + + /** + * If the class should be applied to newcomers + */ + DEFAULT, + + /** + * If the class should in the /class GUI + */ + DISPLAY(true), + + /** + * Health only regens when out of combat + */ + OFF_COMBAT_HEALTH_REGEN, + + /** + * Mana only regens when out of combat + */ + OFF_COMBAT_MANA_REGEN, + + /** + * Stamina only regens when out of combat + */ + OFF_COMBAT_STAMINA_REGEN, + + /** + * Stellium only regens when out of combat + */ + OFF_COMBAT_STELLIUM_REGEN; + + private final boolean def; + + ClassOption() { + this(false); + } + + ClassOption(boolean def) { + this.def = def; + } + + public boolean getDefault() { + return def; + } + + public String getPath() { + return name().toLowerCase().replace("_", "-"); + } } \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index eb1fc759..48246532 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -8,6 +8,9 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.skill.list.Ambers; +import net.Indyuce.mmocore.skill.list.Neptune_Gift; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTrigger; import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions; @@ -15,7 +18,6 @@ import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; -import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.ExpCurve; import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; @@ -374,8 +376,8 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { * commonly called like EntityDamageEvent or regen events. *

* Examples: - * - {@link net.Indyuce.mmocore.skill.list.Neptune_Gift} - * - {@link net.Indyuce.mmocore.skill.list.Ambers} + * - {@link Neptune_Gift} + * - {@link Ambers} */ public Optional findSkill(RegisteredSkill skill) { ClassSkill found = skills.get(skill.getHandler().getId()); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java index f5d2698e..52e06d1f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java @@ -6,15 +6,15 @@ import java.util.Map.Entry; import java.util.Set; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; +import net.Indyuce.mmocore.manager.data.PlayerDataManager; +import net.Indyuce.mmocore.skill.RegisteredSkill; import org.bukkit.configuration.ConfigurationSection; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; -import net.Indyuce.mmocore.skill.RegisteredSkill; -import net.Indyuce.mmocore.manager.data.PlayerDataManager.DefaultPlayerData; public class SavedClassInformation { private final int level, skillPoints, attributePoints, attributeReallocationPoints; @@ -60,7 +60,7 @@ public class SavedClassInformation { player.getAttributes().mapPoints(), player.mapSkillLevels()); } - public SavedClassInformation(DefaultPlayerData data) { + public SavedClassInformation(PlayerDataManager.DefaultPlayerData data) { this(data.getLevel(), 0, data.getSkillPoints(), data.getAttributePoints(), data.getAttrReallocPoints()); } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java index 5a088a88..9bfd4fde 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java @@ -1,23 +1,23 @@ -package net.Indyuce.mmocore.api.player.profess; - -import org.apache.commons.lang.Validate; - -public class Subclass { - private final PlayerClass profess; - private final int level; - - public Subclass(PlayerClass profess, int level) { - Validate.notNull(profess, "Subclass cannot be null"); - - this.profess = profess; - this.level = level; - } - - public PlayerClass getProfess() { - return profess; - } - - public int getLevel() { - return level; - } +package net.Indyuce.mmocore.api.player.profess; + +import org.apache.commons.lang.Validate; + +public class Subclass { + private final PlayerClass profess; + private final int level; + + public Subclass(PlayerClass profess, int level) { + Validate.notNull(profess, "Subclass cannot be null"); + + this.profess = profess; + this.level = level; + } + + public PlayerClass getProfess() { + return profess; + } + + public int getLevel() { + return level; + } } \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java index 17923fbd..fca598b2 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java @@ -3,7 +3,6 @@ package net.Indyuce.mmocore.api.player.profess.event; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.quest.trigger.Trigger; -import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import org.apache.commons.lang.Validate; import java.util.LinkedHashSet; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java index e2b3d8e7..87f2e978 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.api.player.profess.event.trigger; import io.lumine.mythic.lib.api.event.PlayerAttackEvent; import io.lumine.mythic.lib.damage.DamageType; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java index 325aaf5d..40d25462 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java @@ -1,11 +1,11 @@ package net.Indyuce.mmocore.api.player.profess.event.trigger; +import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler; @Deprecated diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java index 20f4800b..0844a62b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.api.player.profess.event.trigger; import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java index 56aeb9b5..d5c4de3b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java @@ -1,9 +1,10 @@ package net.Indyuce.mmocore.api.player.profess.resource; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; +import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; +import net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.ClassOption; -import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; import org.bukkit.attribute.Attribute; import java.util.function.BiConsumer; @@ -111,7 +112,7 @@ public enum PlayerResource { } /** - * Used by MMOCore admin commands here: {@link net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode} + * Used by MMOCore admin commands here: {@link ResourceCommandTreeNode} */ public BiConsumer getConsumer(ManaTrigger.Operation operation) { switch (operation) { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java index 071fe4b7..6062cf11 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java @@ -1,7 +1,7 @@ package net.Indyuce.mmocore.api.player.profess.resource; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/social/Request.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/Request.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/social/Request.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/Request.java diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java index 0682683c..56204d7f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java @@ -6,10 +6,10 @@ import io.lumine.mythic.lib.api.stat.StatMap; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.player.modifier.ModifierSource; import io.lumine.mythic.lib.player.modifier.ModifierType; +import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.player.stats.StatInfo; -import net.Indyuce.mmocore.skill.ClassSkill; public class PlayerStats { private final PlayerData data; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/Quest.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/Quest.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/Quest.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/Quest.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java index 506b13c2..c3e8b0ed 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.api.quest.objective; +import net.Indyuce.mmocore.api.quest.ObjectiveProgress; +import net.Indyuce.mmocore.api.quest.QuestProgress; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -11,8 +13,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import net.Indyuce.mmocore.api.quest.ObjectiveProgress; -import net.Indyuce.mmocore.api.quest.QuestProgress; import io.lumine.mythic.lib.api.MMOLineConfig; public class ClickonObjective extends Objective { diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java index ee85470a..59e65860 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.api.quest.objective; +import net.Indyuce.mmocore.api.quest.ObjectiveProgress; +import net.Indyuce.mmocore.api.quest.QuestProgress; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -10,8 +12,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; -import net.Indyuce.mmocore.api.quest.ObjectiveProgress; -import net.Indyuce.mmocore.api.quest.QuestProgress; import io.lumine.mythic.lib.api.MMOLineConfig; public class GoToObjective extends Objective { diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java index 7af8e7fd..9cfaee40 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java @@ -1,13 +1,13 @@ package net.Indyuce.mmocore.api.quest.objective; import io.lumine.mythic.lib.api.event.PlayerKillEntityEvent; +import net.Indyuce.mmocore.api.quest.ObjectiveProgress; +import net.Indyuce.mmocore.api.quest.QuestProgress; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import net.Indyuce.mmocore.api.quest.ObjectiveProgress; -import net.Indyuce.mmocore.api.quest.QuestProgress; import io.lumine.mythic.lib.api.MMOLineConfig; public class KillMobObjective extends Objective { diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java index 59ddf77c..c01a2c38 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java @@ -1,5 +1,8 @@ package net.Indyuce.mmocore.api.quest.objective; +import net.Indyuce.mmocore.api.event.CustomBlockMineEvent; +import net.Indyuce.mmocore.api.quest.ObjectiveProgress; +import net.Indyuce.mmocore.api.quest.QuestProgress; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.EventHandler; @@ -7,9 +10,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; -import net.Indyuce.mmocore.api.event.CustomBlockMineEvent; -import net.Indyuce.mmocore.api.quest.ObjectiveProgress; -import net.Indyuce.mmocore.api.quest.QuestProgress; import io.lumine.mythic.lib.api.MMOLineConfig; public class MineBlockObjective extends Objective { diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java index a7181940..6a9c0b9c 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java @@ -1,11 +1,11 @@ package net.Indyuce.mmocore.api.quest.trigger; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.SimpleExperienceObject; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import org.apache.commons.lang.Validate; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import io.lumine.mythic.lib.api.MMOLineConfig; diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/Closable.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/Closable.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/Closable.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/Closable.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java index 452dd438..bc9fbe41 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java @@ -1,32 +1,32 @@ -package net.Indyuce.mmocore.api.util.debug; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; - -import net.Indyuce.mmocore.MMOCore; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; - -public class ActionBarRunnable extends BukkitRunnable { - - /* - * how to enable it: set 'debug' to true in the config and use the - * 'debug-action-bar' string parameter. hot changes, only need /mmocore - * reload. - */ - - @Override - public void run() { - Bukkit.getOnlinePlayers().forEach(this::sendActionBar); - } - - private void sendActionBar(Player player) { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(player, getMessage()))); - } - - private String getMessage() { - String str = MMOCore.plugin.getConfig().getString("debug-action-bar.format"); - return str == null ? "" : str; - } -} +package net.Indyuce.mmocore.api.util.debug; + +import net.Indyuce.mmocore.MMOCore; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; + +public class ActionBarRunnable extends BukkitRunnable { + + /* + * how to enable it: set 'debug' to true in the config and use the + * 'debug-action-bar' string parameter. hot changes, only need /mmocore + * reload. + */ + + @Override + public void run() { + Bukkit.getOnlinePlayers().forEach(this::sendActionBar); + } + + private void sendActionBar(Player player) { + player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(player, getMessage()))); + } + + private String getMessage() { + String str = MMOCore.plugin.getConfig().getString("debug-action-bar.format"); + return str == null ? "" : str; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java index b5033900..a4b00706 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java @@ -1,25 +1,25 @@ -package net.Indyuce.mmocore.api.util.debug; - -import net.Indyuce.mmocore.MMOCore; - -public class DebugMode { - /* - * Debug Levels: - * 1: - * - Print WorldGuard Flag Registry - * 2: - * - Print Profession Trigger Things - * 3: - * - Debug Action Bar - */ - public static int level = 0; - - public static void setLevel(int i) { - level = i; - } - - public static void enableActionBar() { - if (level > 2 && MMOCore.plugin.getConfig().getBoolean("debug-action-bar.enabled")) - new ActionBarRunnable().runTaskTimer(MMOCore.plugin, 0, 10); - } -} +package net.Indyuce.mmocore.api.util.debug; + +import net.Indyuce.mmocore.MMOCore; + +public class DebugMode { + /* + * Debug Levels: + * 1: + * - Print WorldGuard Flag Registry + * 2: + * - Print Profession Trigger Things + * 3: + * - Debug Action Bar + */ + public static int level = 0; + + public static void setLevel(int i) { + level = i; + } + + public static void enableActionBar() { + if (level > 2 && MMOCore.plugin.getConfig().getBoolean("debug-action-bar.enabled")) + new ActionBarRunnable().runTaskTimer(MMOCore.plugin, 0, 10); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java index 45e3a4f4..2363716b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.api.util.input; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -11,7 +12,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.util.Consumer; -import net.Indyuce.mmocore.MMOCore; import io.lumine.mythic.lib.MythicLib; public class AnvilGUI extends PlayerInput { diff --git a/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java index 001e6214..a5b94106 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.api.util.input; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -8,8 +9,6 @@ import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.util.Consumer; -import net.Indyuce.mmocore.MMOCore; - public class ChatInput extends PlayerInput { public ChatInput(Player player, InputType type, Consumer output) { super(player, output); diff --git a/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java index aa1f374f..e2934f3f 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java @@ -1,12 +1,11 @@ package net.Indyuce.mmocore.api.util.input; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.util.Consumer; -import net.Indyuce.mmocore.MMOCore; - public abstract class PlayerInput implements Listener { private final Player player; private final Consumer output; diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java diff --git a/src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java diff --git a/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java index 4c5240b0..8f800686 100644 --- a/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -7,9 +9,7 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; public class AttributesCommand extends BukkitCommand { public AttributesCommand(ConfigurationSection config) { diff --git a/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/ClassCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java index 2691ad07..3927741d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -7,9 +9,7 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; public class ClassCommand extends BukkitCommand { public ClassCommand(ConfigurationSection config) { diff --git a/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java diff --git a/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/command/DepositCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java index 214334e4..75c8bd69 100644 --- a/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.gui.eco.DepositMenu; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -7,8 +8,6 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.gui.eco.DepositMenu; - public class DepositCommand extends BukkitCommand { public DepositCommand(ConfigurationSection config) { super(config.getString("main")); diff --git a/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java index e4ad152e..41af99ec 100644 --- a/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java @@ -2,11 +2,11 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.player.OfflinePlayerData; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.FriendRequest; import net.Indyuce.mmocore.api.player.social.Request; -import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/GuildCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java index 30f6efc9..c67f8b85 100644 --- a/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java @@ -2,6 +2,9 @@ package net.Indyuce.mmocore.command; import java.util.UUID; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; @@ -10,12 +13,9 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.Request; import net.Indyuce.mmocore.guild.provided.GuildInvite; -import net.Indyuce.mmocore.manager.InventoryManager; public class GuildCommand extends BukkitCommand { diff --git a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java index dcefd387..49806a5d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java @@ -23,7 +23,7 @@ public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandEx (explorer, list) -> MMOCore.plugin.questManager.getAll().forEach(quest -> list.add(quest.getId()))); public MMOCoreCommandTreeRoot() { - super("mmocore", "mmocore.admin"); + super("net/Indyuce/mmocore", "mmocore.admin"); addChild(new ReloadCommandTreeNode(this)); addChild(new CoinsCommandTreeNode(this)); diff --git a/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/PartyCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java index 603ca617..ab7a6bef 100644 --- a/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java @@ -2,6 +2,9 @@ package net.Indyuce.mmocore.command; import java.util.UUID; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -11,12 +14,9 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.party.provided.PartyInvite; import net.Indyuce.mmocore.api.player.social.Request; -import net.Indyuce.mmocore.manager.InventoryManager; public class PartyCommand extends BukkitCommand { diff --git a/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java index a8bfe6fa..edcbe743 100644 --- a/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -7,9 +9,7 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; public class PlayerStatsCommand extends BukkitCommand { public PlayerStatsCommand(ConfigurationSection config) { diff --git a/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java index 2eebc76b..4bf898a5 100644 --- a/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java @@ -1,14 +1,14 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; public class QuestsCommand extends BukkitCommand { public QuestsCommand(ConfigurationSection config) { diff --git a/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java index a13b5c1f..cd49dcf6 100644 --- a/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; public class SkillsCommand extends BukkitCommand { public SkillsCommand(ConfigurationSection config) { diff --git a/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java index 0e958636..9726333c 100644 --- a/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java @@ -1,12 +1,12 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.manager.InventoryManager; diff --git a/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java index 4b5c03e2..361b38b2 100644 --- a/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.MMOCore; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -9,7 +10,6 @@ import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.eco.Withdraw; public class WithdrawCommand extends BukkitCommand { diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java index c85df307..c7df1d41 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java @@ -1,10 +1,9 @@ package net.Indyuce.mmocore.command.rpg; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import io.lumine.mythic.lib.command.api.CommandTreeNode; public class ReloadCommandTreeNode extends CommandTreeNode { diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java index c1682b00..f4adcb6d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.command.rpg.admin; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; import net.Indyuce.mmocore.command.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; -import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; @@ -61,7 +61,7 @@ public class AttributeCommandTreeNode extends CommandTreeNode { return CommandResult.FAILURE; } - AttributeInstance instance = PlayerData.get(player).getAttributes().getInstance(attribute); + PlayerAttributes.AttributeInstance instance = PlayerData.get(player).getAttributes().getInstance(attribute); instance.setBase(Math.min(attribute.getMax(), instance.getBase() + c * amount)); CommandVerbose.verbose(sender, CommandVerbose.CommandType.ATTRIBUTE, ChatColor.GOLD + player.getName() + ChatColor.YELLOW + " now has " + ChatColor.GOLD + instance.getBase() + ChatColor.YELLOW + " " + attribute.getName() + "."); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java index 4328fa8a..a25c10f4 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.command.rpg.admin; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.PlayerChangeClassEvent; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; -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.command.CommandVerbose; import io.lumine.mythic.lib.command.api.CommandTreeNode; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java index 9bf465de..e025fc2c 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java @@ -4,10 +4,10 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.command.CommandVerbose; import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; -import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.Profession; import org.apache.commons.lang.Validate; @@ -24,7 +24,7 @@ public class ExperienceCommandTreeNode extends CommandTreeNode { addChild(new ActionCommandTreeNode(this, "set", PlayerData::setExperience, PlayerProfessions::setExperience)); addChild(new ActionCommandTreeNode(this, "give", (data, value) -> data.giveExperience(value, EXPSource.COMMAND), (professions, profession, - value) -> professions.giveExperience(profession, value, EXPSource.COMMAND))); + value) -> professions.giveExperience(profession, value, EXPSource.COMMAND))); addChild(new ActionCommandTreeNode(this, "take", (data, value) -> data.giveExperience(-value, EXPSource.COMMAND), (professions, profession, value) -> professions.giveExperience(profession, -value, EXPSource.COMMAND))); } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java index 17bdcbce..6fded3c4 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java @@ -1,14 +1,14 @@ package net.Indyuce.mmocore.command.rpg.admin; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.command.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.profess.PlayerClass; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java index fcb7416b..7590a394 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java @@ -1,12 +1,12 @@ package net.Indyuce.mmocore.command.rpg.admin; import io.lumine.mythic.lib.MythicLib; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; import io.lumine.mythic.lib.command.api.CommandTreeNode; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java index 512c187a..6e2d874d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java @@ -2,14 +2,14 @@ package net.Indyuce.mmocore.command.rpg.admin; import java.util.function.BiConsumer; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.command.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java index de2b6824..cb7df301 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java @@ -1,14 +1,14 @@ package net.Indyuce.mmocore.command.rpg.admin; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance; import net.Indyuce.mmocore.command.CommandVerbose; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; @@ -171,7 +171,7 @@ public class ResetCommandTreeNode extends CommandTreeNode { if (args.length > 4 && args[4].equalsIgnoreCase("-reallocate")) { int points = 0; - for (AttributeInstance ins : data.getAttributes().getInstances()) { + for (PlayerAttributes.AttributeInstance ins : data.getAttributes().getInstances()) { points += ins.getBase(); ins.setBase(0); } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java index 9f453a35..4dc947bd 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java @@ -2,9 +2,9 @@ package net.Indyuce.mmocore.command.rpg.admin; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; +import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; import net.Indyuce.mmocore.command.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java index 99b0742d..2139d37f 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java @@ -2,12 +2,12 @@ package net.Indyuce.mmocore.command.rpg.booster; import java.util.Arrays; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.command.CommandSender; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.experience.Profession; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java index ecaba7d3..6c504fd0 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java @@ -1,10 +1,10 @@ package net.Indyuce.mmocore.command.rpg.booster; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import io.lumine.mythic.lib.MythicLib; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java index 03ce630f..4ee4186c 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java @@ -3,10 +3,10 @@ package net.Indyuce.mmocore.command.rpg.booster; import java.util.Iterator; import java.util.UUID; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.Booster; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java index 1556da28..c3731a6d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java @@ -1,43 +1,43 @@ -package net.Indyuce.mmocore.command.rpg.quest; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.quest.PlayerQuests; -import io.lumine.mythic.lib.command.api.CommandTreeNode; -import io.lumine.mythic.lib.command.api.Parameter; - -public class CancelCommandTreeNode extends CommandTreeNode { - public CancelCommandTreeNode(CommandTreeNode parent) { - super(parent, "cancel"); - - addParameter(Parameter.PLAYER); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - if (args.length < 3) - return CommandResult.THROW_USAGE; - - Player player = Bukkit.getPlayer(args[2]); - if (player == null) { - sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + "."); - return CommandResult.FAILURE; - } - - PlayerQuests quests = PlayerData.get(player).getQuestData(); - if (!quests.hasCurrent()) { - if (sender instanceof Player) - sender.sendMessage(ChatColor.RED + player.getName() + " has no ongoing quest."); - return CommandResult.SUCCESS; - } - - quests.start(null); - if (sender instanceof Player) - sender.sendMessage(ChatColor.YELLOW + player.getName() + " no longer has any ongoing quest."); - return CommandResult.SUCCESS; - } -} +package net.Indyuce.mmocore.command.rpg.quest; + +import net.Indyuce.mmocore.api.quest.PlayerQuests; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import net.Indyuce.mmocore.api.player.PlayerData; +import io.lumine.mythic.lib.command.api.CommandTreeNode; +import io.lumine.mythic.lib.command.api.Parameter; + +public class CancelCommandTreeNode extends CommandTreeNode { + public CancelCommandTreeNode(CommandTreeNode parent) { + super(parent, "cancel"); + + addParameter(Parameter.PLAYER); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + if (args.length < 3) + return CommandResult.THROW_USAGE; + + Player player = Bukkit.getPlayer(args[2]); + if (player == null) { + sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + "."); + return CommandResult.FAILURE; + } + + PlayerQuests quests = PlayerData.get(player).getQuestData(); + if (!quests.hasCurrent()) { + if (sender instanceof Player) + sender.sendMessage(ChatColor.RED + player.getName() + " has no ongoing quest."); + return CommandResult.SUCCESS; + } + + quests.start(null); + if (sender instanceof Player) + sender.sendMessage(ChatColor.YELLOW + player.getName() + " no longer has any ongoing quest."); + return CommandResult.SUCCESS; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java index 5514bfbb..779a918b 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.command.rpg.quest; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.PlayerQuests; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java index 866b6981..2cb909ad 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java @@ -1,21 +1,21 @@ -package net.Indyuce.mmocore.command.rpg.quest; - -import org.bukkit.command.CommandSender; - -import io.lumine.mythic.lib.command.api.CommandTreeNode; - -public class QuestCommandTreeNode extends CommandTreeNode { - - public QuestCommandTreeNode(CommandTreeNode parent) { - super(parent, "quest"); - - addChild(new StartCommandTreeNode(this)); - addChild(new CancelCommandTreeNode(this)); - addChild(new FinishCommandTreeNode(this)); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - return CommandResult.THROW_USAGE; - } -} +package net.Indyuce.mmocore.command.rpg.quest; + +import org.bukkit.command.CommandSender; + +import io.lumine.mythic.lib.command.api.CommandTreeNode; + +public class QuestCommandTreeNode extends CommandTreeNode { + + public QuestCommandTreeNode(CommandTreeNode parent) { + super(parent, "quest"); + + addChild(new StartCommandTreeNode(this)); + addChild(new CancelCommandTreeNode(this)); + addChild(new FinishCommandTreeNode(this)); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + return CommandResult.THROW_USAGE; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java index 079c262c..e2941ebc 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java @@ -1,55 +1,55 @@ -package net.Indyuce.mmocore.command.rpg.quest; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.quest.PlayerQuests; -import net.Indyuce.mmocore.api.quest.Quest; -import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; -import io.lumine.mythic.lib.command.api.CommandTreeNode; -import io.lumine.mythic.lib.command.api.Parameter; - -public class StartCommandTreeNode extends CommandTreeNode { - public StartCommandTreeNode(CommandTreeNode parent) { - super(parent, "start"); - - addParameter(Parameter.PLAYER); - addParameter(MMOCoreCommandTreeRoot.QUEST); - } - - @Override - public CommandResult execute(CommandSender sender, String[] args) { - if (args.length < 4) - return CommandResult.THROW_USAGE; - - Player player = Bukkit.getPlayer(args[2]); - if (player == null) { - sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + "."); - return CommandResult.FAILURE; - } - - Quest quest; - try { - quest = MMOCore.plugin.questManager.get(args[3].replace("_", "-").toLowerCase()); - } catch (Exception exception) { - sender.sendMessage(ChatColor.RED + "Could not find quest with ID " + args[3].replace("_", "-").toLowerCase() + "."); - return CommandResult.FAILURE; - } - - PlayerQuests quests = PlayerData.get(player).getQuestData(); - if (quests.hasCurrent()) { - if (sender instanceof Player) - sender.sendMessage(ChatColor.RED + player.getName() + " already has an ongoing quest."); - return CommandResult.SUCCESS; - } - - quests.start(quest); - if (sender instanceof Player) - sender.sendMessage(ChatColor.YELLOW + player.getName() + " successfully started " + quest.getName() + "."); - return CommandResult.SUCCESS; - } -} +package net.Indyuce.mmocore.command.rpg.quest; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.quest.PlayerQuests; +import net.Indyuce.mmocore.api.quest.Quest; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; +import io.lumine.mythic.lib.command.api.CommandTreeNode; +import io.lumine.mythic.lib.command.api.Parameter; + +public class StartCommandTreeNode extends CommandTreeNode { + public StartCommandTreeNode(CommandTreeNode parent) { + super(parent, "start"); + + addParameter(Parameter.PLAYER); + addParameter(MMOCoreCommandTreeRoot.QUEST); + } + + @Override + public CommandResult execute(CommandSender sender, String[] args) { + if (args.length < 4) + return CommandResult.THROW_USAGE; + + Player player = Bukkit.getPlayer(args[2]); + if (player == null) { + sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + "."); + return CommandResult.FAILURE; + } + + Quest quest; + try { + quest = MMOCore.plugin.questManager.get(args[3].replace("_", "-").toLowerCase()); + } catch (Exception exception) { + sender.sendMessage(ChatColor.RED + "Could not find quest with ID " + args[3].replace("_", "-").toLowerCase() + "."); + return CommandResult.FAILURE; + } + + PlayerQuests quests = PlayerData.get(player).getQuestData(); + if (quests.hasCurrent()) { + if (sender instanceof Player) + sender.sendMessage(ChatColor.RED + player.getName() + " already has an ongoing quest."); + return CommandResult.SUCCESS; + } + + quests.start(quest); + if (sender instanceof Player) + sender.sendMessage(ChatColor.YELLOW + player.getName() + " successfully started " + quest.getName() + "."); + return CommandResult.SUCCESS; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java index d66f5eac..a8279746 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java @@ -4,8 +4,8 @@ import io.lumine.mythic.lib.api.util.SmartGive; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.util.item.WaypointBookBuilder; import net.Indyuce.mmocore.waypoint.Waypoint; +import net.Indyuce.mmocore.util.item.WaypointBookBuilder; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java similarity index 87% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java index 84f1ac91..ec41723d 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.command.rpg.waypoint; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -27,7 +28,7 @@ public class OpenCommandTreeNode extends CommandTreeNode { return CommandResult.FAILURE; } - InventoryManager.WAYPOINTS.newInventory(net.Indyuce.mmocore.api.player.PlayerData.get(player)).open(); + InventoryManager.WAYPOINTS.newInventory(PlayerData.get(player)).open(); return CommandResult.SUCCESS; } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java index a33e7a30..94386fdb 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java @@ -1,12 +1,12 @@ package net.Indyuce.mmocore.command.rpg.waypoint; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.waypoint.Waypoint; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.waypoint.Waypoint; import net.Indyuce.mmocore.api.player.PlayerData; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java index bbcc4a53..e6d72660 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java @@ -4,11 +4,11 @@ import io.lumine.mythic.bukkit.MythicBukkit; import io.lumine.mythic.bukkit.events.MythicDropLoadEvent; import io.lumine.mythic.bukkit.events.MythicReloadedEvent; import io.lumine.mythic.core.skills.placeholders.Placeholder; +import net.Indyuce.mmocore.comp.mythicmobs.load.CurrencyItemDrop; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; -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.EventPriority; diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java index 8a197ee8..83f4aa1f 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java @@ -1,10 +1,10 @@ package net.Indyuce.mmocore.comp.mythicmobs; import io.lumine.mythic.lib.api.MMOLineConfig; +import net.Indyuce.mmocore.comp.mythicmobs.load.*; import net.Indyuce.mmocore.api.load.MMOLoader; import net.Indyuce.mmocore.api.quest.objective.Objective; import net.Indyuce.mmocore.api.quest.trigger.Trigger; -import net.Indyuce.mmocore.comp.mythicmobs.load.*; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java index b4c3fcba..90b59722 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java @@ -5,7 +5,6 @@ import io.lumine.mythic.api.mobs.GenericCaster; import io.lumine.mythic.api.skills.Skill; import io.lumine.mythic.api.skills.SkillCaster; import io.lumine.mythic.api.skills.SkillMetadata; -import io.lumine.mythic.api.skills.SkillTrigger; import io.lumine.mythic.bukkit.BukkitAdapter; import io.lumine.mythic.bukkit.MythicBukkit; import io.lumine.mythic.core.skills.SkillMetadataImpl; @@ -15,7 +14,6 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.trigger.Trigger; import org.apache.commons.lang.Validate; -import java.util.ArrayList; import java.util.HashSet; import java.util.Optional; diff --git a/src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java index ca6556eb..40307abd 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -4,9 +4,9 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.util.AltChar; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.player.stats.StatInfo; -import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.party.AbstractParty; @@ -37,7 +37,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { @Override public String getIdentifier() { - return "mmocore"; + return "net/Indyuce/mmocore"; } @Override diff --git a/src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java index 94b16b01..16fee03e 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.comp.vault; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.trigger.Trigger; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import io.lumine.mythic.lib.api.MMOLineConfig; diff --git a/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java index a9fe6a51..139e0e41 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java @@ -2,9 +2,9 @@ package net.Indyuce.mmocore.comp.vault; import java.util.logging.Level; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; -import net.Indyuce.mmocore.MMOCore; import net.milkbowl.vault.economy.Economy; public class VaultEconomy { diff --git a/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java index a77f69f7..1cadefc0 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java @@ -1,7 +1,7 @@ package net.Indyuce.mmocore.comp.vault; -import net.Indyuce.mmocore.api.load.MMOLoader; import net.Indyuce.mmocore.api.quest.trigger.Trigger; +import net.Indyuce.mmocore.api.load.MMOLoader; import io.lumine.mythic.lib.api.MMOLineConfig; public class VaultMMOLoader extends MMOLoader { diff --git a/src/main/java/net/Indyuce/mmocore/experience/Booster.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Booster.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/experience/Booster.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Booster.java index c15d6928..28f609a5 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Booster.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Booster.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.experience; +import net.Indyuce.mmocore.manager.social.BoosterManager; + import java.util.Objects; import java.util.UUID; @@ -14,7 +16,7 @@ public class Booster { * Length is not final because boosters can stacks. This allows to reduce * the amount of boosters displayed in the main player menu * - * See {@link net.Indyuce.mmocore.manager.social.BoosterManager#register(Booster)} + * See {@link BoosterManager#register(Booster)} */ private long length; diff --git a/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/EXPSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java index c14f0232..b51b1033 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java @@ -1,7 +1,7 @@ package net.Indyuce.mmocore.experience; -import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; +import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Profession.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/Profession.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Profession.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java similarity index 94% rename from src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java index 0d2af5f5..f5c1d2f8 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java @@ -1,8 +1,9 @@ package net.Indyuce.mmocore.experience.dispenser; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.experience.ExperienceObject; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Location; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -12,7 +13,7 @@ import org.jetbrains.annotations.Nullable; * experience given in a specific profession. Also being used to * monitor EXP holograms. * - * @deprecated Merged with {@link net.Indyuce.mmocore.experience.ExperienceObject} + * @deprecated Merged with {@link ExperienceObject} */ @Deprecated public interface ExperienceDispenser { diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index 31698af7..1504c000 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.experience.droptable; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.trigger.Trigger; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java index a0f6b5bf..8934ce22 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.api.player.PlayerData; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java index dd27e927..2563a746 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java @@ -6,11 +6,9 @@ import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.util.Vector; public class ClimbExperienceSource extends SpecificExperienceSource { //Can be Ladder,Vines,Twisting Vines,Weeping Vines. diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java index 55de061c..b53d6dd6 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java @@ -2,10 +2,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java index 7e1c91ac..5b31b7aa 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java @@ -4,13 +4,12 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.event.PlayerAttackEvent; import io.lumine.mythic.lib.damage.DamagePacket; import io.lumine.mythic.lib.damage.DamageType; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.event.EventHandler; -import scala.Enumeration; import java.util.Arrays; import java.util.Objects; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java index d361d3a4..aece97e4 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java @@ -1,12 +1,11 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import io.lumine.mythic.lib.damage.DamageType; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java index b6db5451..b312b5ac 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java @@ -1,10 +1,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang3.Validate; import org.bukkit.Material; import org.bukkit.OfflinePlayer; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java index 3a9c334d..679ec2e2 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java @@ -3,11 +3,11 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.enchantments.Enchantment; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java index 6bf23620..9a5f2184 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java @@ -3,8 +3,8 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Material; import org.bukkit.entity.Item; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java index 3596a77d..96c3a7be 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java @@ -3,11 +3,11 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.event.PlayerKillEntityEvent; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java index fcc457a4..b1442871 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java @@ -2,10 +2,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java index 66ae8959..6f94ee61 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java @@ -1,10 +1,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java index fcd19b70..d586609c 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java @@ -3,8 +3,8 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java index b2f49d62..e0a5a43d 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java @@ -2,10 +2,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java index c3ac3578..bc9d7995 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java @@ -2,10 +2,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.entity.Arrow; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java index 070e5e24..4615cf7a 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java @@ -5,8 +5,8 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java index d1e40e84..4ceec1ee 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java @@ -2,18 +2,14 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.event.EventHandler; -import java.util.Arrays; -import java.util.Objects; -import java.util.stream.Collectors; - public class ResourceExperienceSource extends SpecificExperienceSource { private final PlayerResource resource; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java index 9c9578ce..6841884f 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java @@ -1,12 +1,11 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java index 8993515d..0d745b5d 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java @@ -1,10 +1,10 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java index 83a455c6..4e2f10a6 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java @@ -1,11 +1,11 @@ package net.Indyuce.mmocore.experience.source; import io.lumine.mythic.lib.api.MMOLineConfig; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java index 66d3e7dd..96ca8e05 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.experience.source.type; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import net.Indyuce.mmocore.api.player.PlayerData; public abstract class ExperienceSource { private final ExperienceDispenser dispenser; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java index 05cf0b3d..e877be29 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java @@ -1,11 +1,10 @@ package net.Indyuce.mmocore.experience.source.type; import io.lumine.mythic.lib.api.MMOLineConfig; +import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/gui/AttributeView.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 058694a8..6898d5d8 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -1,18 +1,16 @@ package net.Indyuce.mmocore.gui; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.event.PlayerAttributeUseEvent; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; -import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance; -import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.PluginInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.manager.SoundManager; +import net.Indyuce.mmocore.api.SoundEvent; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.player.stats.StatInfo; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; @@ -119,7 +117,7 @@ public class AttributeView extends EditableInventory { return; } - AttributeInstance ins = playerData.getAttributes().getInstance(attribute); + PlayerAttributes.AttributeInstance ins = playerData.getAttributes().getInstance(attribute); if (attribute.hasMax() && ins.getBase() >= attribute.getMax()) { MMOCore.plugin.configManager.getSimpleMessage("attribute-max-points-hit").send(player); MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); diff --git a/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java index 6e6c65ad..dad42be6 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java @@ -1,18 +1,17 @@ package net.Indyuce.mmocore.gui; 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.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.PluginInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.manager.SoundManager; +import net.Indyuce.mmocore.api.SoundEvent; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java index dc62d6db..da5d505a 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java @@ -4,17 +4,16 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.NBTItem; 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.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; -import net.Indyuce.mmocore.manager.SoundManager; +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 org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 9f306d65..481c7267 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -5,17 +5,17 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; -import net.Indyuce.mmocore.player.stats.StatInfo; -import net.Indyuce.mmocore.api.util.math.format.DelayFormat; -import net.Indyuce.mmocore.experience.Booster; -import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.player.stats.StatInfo; +import net.Indyuce.mmocore.api.util.math.format.DelayFormat; +import net.Indyuce.mmocore.experience.Booster; +import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.party.AbstractParty; import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; diff --git a/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java index 66e2193d..8623599b 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java @@ -3,17 +3,16 @@ package net.Indyuce.mmocore.gui; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.NBTItem; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.SoundEvent; -import net.Indyuce.mmocore.experience.Profession; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.Quest; -import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.manager.SoundManager; +import net.Indyuce.mmocore.api.SoundEvent; +import net.Indyuce.mmocore.experience.Profession; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/Indyuce/mmocore/gui/SkillList.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/SkillList.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java index 1699f0ef..d547dd13 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SkillList.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java @@ -4,13 +4,13 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.NBTItem; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; +import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.api.player.PlayerData; 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.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; -import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import org.bukkit.ChatColor; diff --git a/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java index cd499e10..bc64667d 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java @@ -1,9 +1,7 @@ package net.Indyuce.mmocore.gui; 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.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; @@ -11,7 +9,8 @@ import net.Indyuce.mmocore.gui.api.PluginInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.manager.SoundManager; +import net.Indyuce.mmocore.api.SoundEvent; +import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java index d7080135..1e85268b 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java @@ -4,17 +4,16 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.NBTItem; 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.PlayerClass; -import net.Indyuce.mmocore.api.player.profess.Subclass; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; -import net.Indyuce.mmocore.manager.SoundManager; +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.Subclass; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java index 6dfbfb56..668c6b15 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java @@ -1,13 +1,13 @@ package net.Indyuce.mmocore.gui; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; +import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; -import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.waypoint.Waypoint; import net.Indyuce.mmocore.waypoint.WaypointPath; import org.apache.commons.lang.Validate; diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java index 85be0d26..163ae7f5 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.gui.api; import io.lumine.mythic.lib.MythicLib; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.gui.api.item.InventoryItem; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.gui.api.item.TriggerItem; import org.bukkit.Bukkit; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/PluginInventory.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/PluginInventory.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/api/PluginInventory.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/PluginInventory.java diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/item/SimplePlaceholderItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/SimplePlaceholderItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/api/item/SimplePlaceholderItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/SimplePlaceholderItem.java diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java similarity index 93% rename from src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java index 28c0df3b..78f0c65d 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java @@ -4,7 +4,6 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.PluginInventory; import org.bukkit.configuration.ConfigurationSection; public class TriggerItem extends InventoryItem { diff --git a/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java index 3260490c..f443e970 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.gui.eco; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.util.item.SimpleItemBuilder; import net.milkbowl.vault.economy.EconomyResponse; import org.bukkit.Bukkit; @@ -12,7 +13,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.gui.api.PluginInventory; import io.lumine.mythic.lib.api.item.NBTItem; diff --git a/src/main/java/net/Indyuce/mmocore/gui/eco/GoldPouch.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/eco/GoldPouch.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/eco/GoldPouch.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/eco/GoldPouch.java diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java index 040ff023..c222a255 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.gui.social.friend; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.gui.api.GeneratedInventory; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; +import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import net.Indyuce.mmocore.gui.api.EditableInventory; -import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; -import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java index 2ed26b27..e0ae0bea 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java @@ -1,11 +1,11 @@ package net.Indyuce.mmocore.gui.social.friend; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.gui.api.GeneratedInventory; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.api.player.OfflinePlayerData; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.gui.api.EditableInventory; -import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java index 33fca626..f3a7218e 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java @@ -1,14 +1,14 @@ package net.Indyuce.mmocore.gui.social.guild; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; -import net.Indyuce.mmocore.api.util.math.format.DelayFormat; -import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.api.util.input.PlayerInput; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.math.format.DelayFormat; +import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.gui.api.item.Placeholders; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.NamespacedKey; @@ -151,7 +151,7 @@ public class EditableGuildAdmin extends EditableInventory { return; } - MMOCore.plugin.configManager.newPlayerInput(player, InputType.GUILD_INVITE, (input) -> { + MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_INVITE, (input) -> { Player target = Bukkit.getPlayer(input); if (target == null) { MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player); diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java similarity index 92% rename from src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java index 83e936e7..ae6e78e8 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java @@ -1,12 +1,12 @@ package net.Indyuce.mmocore.gui.social.guild; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; -import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.api.util.input.PlayerInput; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.manager.data.GuildDataManager.GuildConfiguration.NamingRules; import org.bukkit.Sound; @@ -39,14 +39,14 @@ public class EditableGuildCreation extends EditableInventory { return; if (item.getFunction().equals("create")) { - MMOCore.plugin.configManager.newPlayerInput(player, InputType.GUILD_CREATION_TAG, (input) -> { + MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_CREATION_TAG, (input) -> { if(MMOCore.plugin.dataProvider.getGuildManager().getConfig().shouldUppercaseTags()) input = input.toUpperCase(); if(check(player, input, MMOCore.plugin.dataProvider.getGuildManager().getConfig().getTagRules())) { String tag = input; - MMOCore.plugin.configManager.newPlayerInput(player, InputType.GUILD_CREATION_NAME, (name) -> { + MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_CREATION_NAME, (name) -> { if(check(player, name, MMOCore.plugin.dataProvider.getGuildManager().getConfig().getNameRules())) { MMOCore.plugin.dataProvider.getGuildManager().newRegisteredGuild(playerData.getUniqueId(), name, tag); MMOCore.plugin.dataProvider.getGuildManager().getGuild(tag.toLowerCase()).addMember(playerData.getUniqueId()); diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java index 450c1228..3ae1ccd5 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.gui.social.guild; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.OfflinePlayerData; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; -import net.Indyuce.mmocore.api.util.math.format.DelayFormat; -import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.api.util.input.PlayerInput; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; +import net.Indyuce.mmocore.api.player.OfflinePlayerData; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.math.format.DelayFormat; +import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.gui.api.item.Placeholders; import org.apache.commons.lang.Validate; import org.bukkit.*; import org.bukkit.configuration.ConfigurationSection; @@ -200,7 +200,7 @@ public class EditableGuildView extends EditableInventory { * Sound.ENTITY_VILLAGER_NO, 1, 1); return; } */ - MMOCore.plugin.configManager.newPlayerInput(player, InputType.GUILD_INVITE, (input) -> { + MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_INVITE, (input) -> { Player target = Bukkit.getPlayer(input); if (target == null) { MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player); diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java index c1e9b2ed..5cfdb14f 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java @@ -1,11 +1,11 @@ package net.Indyuce.mmocore.gui.social.party; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; import org.bukkit.Sound; diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java index aa93e292..e15d038a 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java @@ -1,14 +1,14 @@ package net.Indyuce.mmocore.gui.social.party; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; -import net.Indyuce.mmocore.api.util.math.format.DelayFormat; -import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.api.util.input.PlayerInput; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.math.format.DelayFormat; +import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.party.provided.Party; import org.apache.commons.lang.Validate; import org.bukkit.*; @@ -148,7 +148,7 @@ public class EditablePartyView extends EditableInventory { return; } - MMOCore.plugin.configManager.newPlayerInput(player, InputType.PARTY_INVITE, (input) -> { + MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.PARTY_INVITE, (input) -> { Player target = Bukkit.getPlayer(input); if (target == null) { MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player); diff --git a/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/GuildModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/GuildModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/GuildModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/GuildModule.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java similarity index 94% rename from src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java index 33aefcab..a5d624dc 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/Guild.java @@ -1,13 +1,13 @@ package net.Indyuce.mmocore.guild.provided; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.gui.api.PluginInventory; +import net.Indyuce.mmocore.gui.social.guild.EditableGuildView; +import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.Request; -import net.Indyuce.mmocore.gui.api.PluginInventory; -import net.Indyuce.mmocore.gui.social.guild.EditableGuildView.GuildViewInventory; import net.Indyuce.mmocore.guild.AbstractGuild; -import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -63,7 +63,7 @@ public class Guild implements AbstractGuild { // Disband boolean is to prevent co-modification exception when disbanding a guild public void removeMember(UUID uuid, boolean disband) { PlayerData data = PlayerData.get(uuid); - if (data != null && data.isOnline() && data.getPlayer().getOpenInventory() != null && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof GuildViewInventory) + if (data != null && data.isOnline() && data.getPlayer().getOpenInventory() != null && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditableGuildView.GuildViewInventory) InventoryManager.GUILD_CREATION.newInventory(data).open(); if (!disband) @@ -103,7 +103,7 @@ public class Guild implements AbstractGuild { public void reopenInventories() { for (UUID uuid : members) { PlayerData member = PlayerData.get(uuid); - if (member != null && member.isOnline() && member.getPlayer().getOpenInventory() != null && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof GuildViewInventory) + if (member != null && member.isOnline() && member.getPlayer().getOpenInventory() != null && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditableGuildView.GuildViewInventory) ((PluginInventory) member.getPlayer().getOpenInventory().getTopInventory().getHolder()).open(); } } diff --git a/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java index 7c6a9a9b..f7a78108 100644 --- a/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java @@ -1,9 +1,9 @@ package net.Indyuce.mmocore.guild.provided; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.Request; -import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; public class GuildInvite extends Request { diff --git a/src/main/java/net/Indyuce/mmocore/guild/provided/MMOCoreGuildModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/MMOCoreGuildModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/guild/provided/MMOCoreGuildModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/guild/provided/MMOCoreGuildModule.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/listener/BlockListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java index 2ff6c505..aee6211b 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java @@ -4,7 +4,6 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.utils.Schedulers; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.block.BlockInfo; -import net.Indyuce.mmocore.api.block.BlockInfo.BlockInfoOption; import net.Indyuce.mmocore.api.block.VanillaBlockType; import net.Indyuce.mmocore.api.event.CustomBlockMineEvent; import net.Indyuce.mmocore.api.player.PlayerData; @@ -106,7 +105,7 @@ public class BlockListener implements Listener { * decreases the durability of the item * used to mine the block. */ - if (!info.getOption(BlockInfoOption.VANILLA_DROPS)) { + if (!info.getOption(BlockInfo.BlockInfoOption.VANILLA_DROPS)) { event.setCancelled(true); event.getBlock().setType(Material.AIR); MMOCoreUtils.decreaseDurability(player, EquipmentSlot.HAND, 1); diff --git a/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/GoldPouchesListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/GoldPouchesListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/GoldPouchesListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/GoldPouchesListener.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java similarity index 78% rename from src/main/java/net/Indyuce/mmocore/listener/GuildListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java index 43aaad9b..4e25df06 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/GuildListener.java @@ -1,5 +1,8 @@ package net.Indyuce.mmocore.listener; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.social.GuildChatEvent; +import net.Indyuce.mmocore.manager.ConfigManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -7,10 +10,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.event.social.GuildChatEvent; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.ConfigManager.SimpleMessage; public class GuildListener implements Listener { @EventHandler(priority = EventPriority.LOW) @@ -28,7 +28,7 @@ public class GuildListener implements Listener { * running it in a delayed task is recommended */ Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, () -> { - SimpleMessage format = MMOCore.plugin.configManager.getSimpleMessage("guild-chat", "player", data.getPlayer().getName(), "tag", data.getGuild().getTag(), "message", event.getMessage().substring(MMOCore.plugin.dataProvider.getGuildManager().getConfig().getPrefix().length())); + ConfigManager.SimpleMessage format = MMOCore.plugin.configManager.getSimpleMessage("guild-chat", "player", data.getPlayer().getName(), "tag", data.getGuild().getTag(), "message", event.getMessage().substring(MMOCore.plugin.dataProvider.getGuildManager().getConfig().getPrefix().length())); GuildChatEvent called = new GuildChatEvent(data, format.message()); Bukkit.getPluginManager().callEvent(called); if (!called.isCancelled()) diff --git a/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java index c703c607..d48ed573 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java @@ -2,12 +2,12 @@ package net.Indyuce.mmocore.listener; import io.lumine.mythic.lib.api.item.NBTItem; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.waypoint.Waypoint; +import net.Indyuce.mmocore.waypoint.WaypointOption; import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import net.Indyuce.mmocore.manager.InventoryManager; -import net.Indyuce.mmocore.waypoint.Waypoint; -import net.Indyuce.mmocore.waypoint.WaypointOption; import org.bukkit.Particle; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/event/PlayerPressKeyListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/event/PlayerPressKeyListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/event/PlayerPressKeyListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/event/PlayerPressKeyListener.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java index b6afa74d..410f8ee1 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java @@ -1,25 +1,25 @@ -package net.Indyuce.mmocore.listener.option; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigMessage; -import net.Indyuce.mmocore.api.player.PlayerData; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; - -public class DeathExperienceLoss implements Listener { - private final double loss = MMOCore.plugin.getConfig().getDouble("death-exp-loss.percent") / 100; - - @EventHandler(priority = EventPriority.HIGH) - public void a(PlayerDeathEvent event) { - if (!PlayerData.has(event.getEntity())) - return; - - PlayerData data = PlayerData.get(event.getEntity()); - int loss = (int) (data.getExperience() * this.loss); - data.setExperience(data.getExperience() - loss); - if (data.isOnline()) - new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer()); - } -} +package net.Indyuce.mmocore.listener.option; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.ConfigMessage; +import net.Indyuce.mmocore.api.player.PlayerData; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; + +public class DeathExperienceLoss implements Listener { + private final double loss = MMOCore.plugin.getConfig().getDouble("death-exp-loss.percent") / 100; + + @EventHandler(priority = EventPriority.HIGH) + public void a(PlayerDeathEvent event) { + if (!PlayerData.has(event.getEntity())) + return; + + PlayerData data = PlayerData.get(event.getEntity()); + int loss = (int) (data.getExperience() * this.loss); + data.setExperience(data.getExperience() - loss); + if (data.isOnline()) + new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer()); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java index 157c9211..6945b610 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.listener.option; import io.lumine.mythic.lib.UtilityMethods; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent; +import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.skill.cast.PlayerKey; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java index 192644f7..d5382c8c 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java @@ -1,17 +1,16 @@ -package net.Indyuce.mmocore.listener.option; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.metadata.FixedMetadataValue; - -import net.Indyuce.mmocore.MMOCore; - -public class NoSpawnerEXP implements Listener { - @EventHandler - public void a(CreatureSpawnEvent event) { - if(event.getSpawnReason() == SpawnReason.SPAWNER) - event.getEntity().setMetadata("spawner_spawned", new FixedMetadataValue(MMOCore.plugin, true)); - } -} +package net.Indyuce.mmocore.listener.option; + +import net.Indyuce.mmocore.MMOCore; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.metadata.FixedMetadataValue; + +public class NoSpawnerEXP implements Listener { + @EventHandler + public void a(CreatureSpawnEvent event) { + if(event.getSpawnReason() == SpawnReason.SPAWNER) + event.getEntity().setMetadata("spawner_spawned", new FixedMetadataValue(MMOCore.plugin, true)); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java index 49a19c45..68df53bd 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java @@ -1,23 +1,23 @@ -package net.Indyuce.mmocore.listener.option; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerExpChangeEvent; - -import net.Indyuce.mmocore.experience.EXPSource; -import net.Indyuce.mmocore.api.player.PlayerData; - -public class RedirectVanillaExp implements Listener { - private final double ratio; - - public RedirectVanillaExp(double ratio) { - this.ratio = ratio; - } - - @EventHandler - public void a(PlayerExpChangeEvent event) { - double a = (event.getAmount() * ratio); - if (a > 0) - PlayerData.get(event.getPlayer()).giveExperience(a, EXPSource.VANILLA); - } -} +package net.Indyuce.mmocore.listener.option; + +import net.Indyuce.mmocore.experience.EXPSource; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerExpChangeEvent; + +import net.Indyuce.mmocore.api.player.PlayerData; + +public class RedirectVanillaExp implements Listener { + private final double ratio; + + public RedirectVanillaExp(double ratio) { + this.ratio = ratio; + } + + @EventHandler + public void a(PlayerExpChangeEvent event) { + double a = (event.getAmount() * ratio); + if (a > 0) + PlayerData.get(event.getPlayer()).giveExperience(a, EXPSource.VANILLA); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java index 14b22c46..530390f7 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java @@ -1,35 +1,35 @@ -package net.Indyuce.mmocore.listener.option; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.enchantment.EnchantItemEvent; -import org.bukkit.event.player.PlayerExpChangeEvent; - -public class VanillaExperienceOverride implements Listener { - - /** - * When picking up exp orbs or any action like that - */ - @EventHandler(priority = EventPriority.HIGHEST) - public void a(PlayerExpChangeEvent event) { - event.setAmount(0); - } - - /** - * This event is not supported by the expChangeEvent. Since the event is - * actually called before applying the enchant and consuming levels, we must - * update the player level using a delayed task. - *

- * {@link EnchantItemEvent#setExpLevelCost(int)} does NOT work - */ - @EventHandler - public void b(EnchantItemEvent event) { - Player player = event.getEnchanter(); - Bukkit.getScheduler().runTask(MMOCore.plugin, () -> player.setLevel(PlayerData.get(player).getLevel())); - } -} +package net.Indyuce.mmocore.listener.option; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.enchantment.EnchantItemEvent; +import org.bukkit.event.player.PlayerExpChangeEvent; + +public class VanillaExperienceOverride implements Listener { + + /** + * When picking up exp orbs or any action like that + */ + @EventHandler(priority = EventPriority.HIGHEST) + public void a(PlayerExpChangeEvent event) { + event.setAmount(0); + } + + /** + * This event is not supported by the expChangeEvent. Since the event is + * actually called before applying the enchant and consuming levels, we must + * update the player level using a delayed task. + *

+ * {@link EnchantItemEvent#setExpLevelCost(int)} does NOT work + */ + @EventHandler + public void b(EnchantItemEvent event) { + Player player = event.getEnchanter(); + Bukkit.getScheduler().runTask(MMOCore.plugin, () -> player.setLevel(PlayerData.get(player).getLevel())); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java index 4f1e0588..43c927ec 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java @@ -3,9 +3,9 @@ package net.Indyuce.mmocore.listener.profession; import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.CustomPlayerFishEvent; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.MMOCoreUtils; -import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.loot.LootBuilder; import net.Indyuce.mmocore.loot.droptable.dropitem.fishing.FishingDropItem; import net.Indyuce.mmocore.manager.profession.FishingManager.FishingDropTable; diff --git a/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/LootBuilder.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/LootBuilder.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/LootBuilder.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/LootBuilder.java index b5a5ae7e..c23136ce 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/LootBuilder.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/LootBuilder.java @@ -3,9 +3,8 @@ package net.Indyuce.mmocore.loot; import java.util.ArrayList; import java.util.List; -import org.bukkit.inventory.ItemStack; - import net.Indyuce.mmocore.api.player.PlayerData; +import org.bukkit.inventory.ItemStack; public class LootBuilder { private final PlayerData player; diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/ChestAlgorithmOptions.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestAlgorithmOptions.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/ChestAlgorithmOptions.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestAlgorithmOptions.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java index de9ea2a3..3d33006a 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.loot.chest; import io.lumine.mythic.lib.api.math.ScalingFormula; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.loot.droptable.DropTable; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.loot.droptable.DropTable; import org.bukkit.configuration.ConfigurationSection; public class ChestTier { diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java index 1e25507b..5b5cf8de 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java @@ -2,6 +2,7 @@ package net.Indyuce.mmocore.loot.chest; import java.util.stream.Stream; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -9,8 +10,6 @@ import org.bukkit.World; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.api.player.PlayerData; - public class RegionBounds { private final World world; private final int x1, z1, x2, z2; diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java index cf80f6d5..d44be8b5 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java @@ -1,14 +1,13 @@ package net.Indyuce.mmocore.loot.chest; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.loot.chest.particle.ChestParticleEffect; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.loot.chest.particle.ChestParticleEffect; - public class TierEffect { private final ChestParticleEffect type; private final Particle particle; diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/BiomeCondition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/BiomeCondition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/BiomeCondition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/BiomeCondition.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/Condition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/Condition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/Condition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/Condition.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java index 1666ee8e..02629763 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java @@ -3,11 +3,10 @@ package net.Indyuce.mmocore.loot.chest.condition; import java.util.List; import java.util.stream.Stream; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Location; import org.bukkit.entity.Entity; -import net.Indyuce.mmocore.MMOCore; - public class ConditionInstance { private final Entity entity; private final Location applied; diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/DistanceCondition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/DistanceCondition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/DistanceCondition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/DistanceCondition.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/LevelCondition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/LevelCondition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/LevelCondition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/LevelCondition.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/PermissionCondition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/PermissionCondition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/PermissionCondition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/PermissionCondition.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/condition/WorldCondition.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/WorldCondition.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/condition/WorldCondition.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/condition/WorldCondition.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/CastingParticle.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/CastingParticle.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/chest/particle/CastingParticle.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/CastingParticle.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java index 00bb6c66..c66b5cd2 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java @@ -2,12 +2,11 @@ package net.Indyuce.mmocore.loot.chest.particle; import java.util.function.BiConsumer; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.MMOCore; - public enum ChestParticleEffect { HELIX((loc, particle) -> { diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java index a1615350..c53732bf 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java @@ -2,14 +2,13 @@ package net.Indyuce.mmocore.loot.chest.particle; import java.util.function.Consumer; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import net.Indyuce.mmocore.MMOCore; - public class ParabolicProjectile extends BukkitRunnable { private final Location target; private final Consumer display; diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java index 63a9343a..25d4e522 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java @@ -1,13 +1,12 @@ package net.Indyuce.mmocore.loot.chest.particle; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Color; import org.bukkit.Particle; import org.bukkit.entity.ThrownPotion; import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.MMOCore; - public class PotionParticles extends BukkitRunnable { private double r, g, b; private final ThrownPotion potion; diff --git a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java index 0b0cdef5..9502604c 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java @@ -1,12 +1,11 @@ package net.Indyuce.mmocore.loot.chest.particle; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.entity.Entity; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.MMOCore; - public class SmallParticleEffect extends BukkitRunnable { private final Location loc; private final Particle particle; diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java index c8588074..ffc90a61 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java @@ -5,14 +5,14 @@ import java.util.List; import java.util.Set; import java.util.logging.Level; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.loot.chest.condition.ConditionInstance; -import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.inventory.ItemStack; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.loot.LootBuilder; import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java index 8febb7bb..b84e5cc3 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java @@ -2,9 +2,9 @@ package net.Indyuce.mmocore.loot.droptable.dropitem; import java.util.Random; +import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.loot.LootBuilder; -import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import io.lumine.mythic.lib.api.MMOLineConfig; public abstract class DropItem { diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropTableDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropTableDropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropTableDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropTableDropItem.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/GoldDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/GoldDropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/GoldDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/GoldDropItem.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/NoteDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/NoteDropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/NoteDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/NoteDropItem.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/VanillaDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/VanillaDropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/VanillaDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/VanillaDropItem.java diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/AttributeManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/AttributeManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/AttributeManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/AttributeManager.java index ab85face..fc1a50b9 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/AttributeManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/AttributeManager.java @@ -6,8 +6,8 @@ import java.util.Map; import java.util.logging.Level; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; +import net.Indyuce.mmocore.api.ConfigFile; public class AttributeManager implements MMOCoreManager { private final Map map = new HashMap<>(); diff --git a/src/main/java/net/Indyuce/mmocore/manager/ClassManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ClassManager.java similarity index 98% rename from src/main/java/net/Indyuce/mmocore/manager/ClassManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ClassManager.java index e94bb005..8d0356c0 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ClassManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ClassManager.java @@ -1,9 +1,8 @@ package net.Indyuce.mmocore.manager; import net.Indyuce.mmocore.MMOCore; -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.player.profess.ClassOption; import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler; import net.Indyuce.mmocore.api.player.profess.event.trigger.*; import org.apache.commons.lang.Validate; diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java index 46439ec5..38d895ad 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.manager; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.util.item.ConfigItem; +import net.Indyuce.mmocore.api.ConfigFile; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/DropTableManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/DropTableManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/DropTableManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/DropTableManager.java index 00e21b48..4819eb72 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/DropTableManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/DropTableManager.java @@ -8,12 +8,12 @@ import java.util.Set; import java.util.logging.Level; import io.lumine.mythic.lib.api.util.PostLoadObject; +import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.loot.droptable.DropTable; public class DropTableManager implements MMOCoreManager { diff --git a/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java index 3f941a7b..c84ecbd1 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java @@ -1,110 +1,110 @@ -package net.Indyuce.mmocore.manager; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; -import net.Indyuce.mmocore.experience.ExpCurve; -import net.Indyuce.mmocore.experience.droptable.ExperienceTable; -import net.Indyuce.mmocore.experience.source.type.ExperienceSource; -import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.event.HandlerList; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.logging.Level; - -public class ExperienceManager implements MMOCoreManager { - private final Map expCurves = new HashMap<>(); - private final Map expTables = new HashMap<>(); - - /** - * Saves different experience sources based on experience source type. - */ - private final Map, ExperienceSourceManager> managers = new HashMap<>(); - - @SuppressWarnings("unchecked") - public ExperienceSourceManager getManager(Class t) { - return (ExperienceSourceManager) managers.get(t); - } - - @SuppressWarnings("unchecked") - public void registerSource(T source) { - Class path = (Class) source.getClass(); - - if (!managers.containsKey(path)) - managers.put(path, source.newManager()); - getManager(path).registerSource(source); - } - - public boolean hasCurve(String id) { - return expCurves.containsKey(id); - } - - public ExpCurve getCurveOrThrow(String id) { - Validate.isTrue(hasCurve(id), "Could not find exp curve with ID '" + id + "'"); - return expCurves.get(id); - } - - public boolean hasTable(String id) { - return expTables.containsKey(id); - } - - public ExperienceTable getTableOrThrow(String id) { - return Objects.requireNonNull(expTables.get(id), "Could not find exp table with ID '" + id + "'"); - } - - public ExperienceTable loadExperienceTable(Object obj) { - - if (obj instanceof ConfigurationSection) - return new ExperienceTable((ConfigurationSection) obj); - - if (obj instanceof String) - return MMOCore.plugin.experience.getTableOrThrow(obj.toString()); - - throw new IllegalArgumentException("Please provide either a string (exp table name) or a config section (locally define an exp table)"); - } - - public Collection getCurves() { - return expCurves.values(); - } - - public Collection getTables() { - return expTables.values(); - } - - @Override - public void initialize(boolean clearBefore) { - if (clearBefore) { - expCurves.clear(); - expTables.clear(); - - managers.values().forEach(HandlerList::unregisterAll); - managers.clear(); - } - - expCurves.clear(); - for (File file : new File(MMOCore.plugin.getDataFolder() + "/expcurves").listFiles()) - try { - ExpCurve curve = new ExpCurve(file); - expCurves.put(curve.getId(), curve); - } catch (IllegalArgumentException | IOException exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp curve '" + file.getName() + "': " + exception.getMessage()); - } - - expTables.clear(); - FileConfiguration expTablesConfig = new ConfigFile("exp-tables").getConfig(); - for (String key : expTablesConfig.getKeys(false)) - try { - ExperienceTable table = new ExperienceTable(expTablesConfig.getConfigurationSection(key)); - expTables.put(table.getId(), table); - } catch (RuntimeException exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp table '" + key + "': " + exception.getMessage()); - } - } -} +package net.Indyuce.mmocore.manager; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.experience.droptable.ExperienceTable; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.experience.ExpCurve; +import net.Indyuce.mmocore.experience.source.type.ExperienceSource; +import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; +import org.apache.commons.lang.Validate; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.event.HandlerList; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.logging.Level; + +public class ExperienceManager implements MMOCoreManager { + private final Map expCurves = new HashMap<>(); + private final Map expTables = new HashMap<>(); + + /** + * Saves different experience sources based on experience source type. + */ + private final Map, ExperienceSourceManager> managers = new HashMap<>(); + + @SuppressWarnings("unchecked") + public ExperienceSourceManager getManager(Class t) { + return (ExperienceSourceManager) managers.get(t); + } + + @SuppressWarnings("unchecked") + public void registerSource(T source) { + Class path = (Class) source.getClass(); + + if (!managers.containsKey(path)) + managers.put(path, source.newManager()); + getManager(path).registerSource(source); + } + + public boolean hasCurve(String id) { + return expCurves.containsKey(id); + } + + public ExpCurve getCurveOrThrow(String id) { + Validate.isTrue(hasCurve(id), "Could not find exp curve with ID '" + id + "'"); + return expCurves.get(id); + } + + public boolean hasTable(String id) { + return expTables.containsKey(id); + } + + public ExperienceTable getTableOrThrow(String id) { + return Objects.requireNonNull(expTables.get(id), "Could not find exp table with ID '" + id + "'"); + } + + public ExperienceTable loadExperienceTable(Object obj) { + + if (obj instanceof ConfigurationSection) + return new ExperienceTable((ConfigurationSection) obj); + + if (obj instanceof String) + return MMOCore.plugin.experience.getTableOrThrow(obj.toString()); + + throw new IllegalArgumentException("Please provide either a string (exp table name) or a config section (locally define an exp table)"); + } + + public Collection getCurves() { + return expCurves.values(); + } + + public Collection getTables() { + return expTables.values(); + } + + @Override + public void initialize(boolean clearBefore) { + if (clearBefore) { + expCurves.clear(); + expTables.clear(); + + managers.values().forEach(HandlerList::unregisterAll); + managers.clear(); + } + + expCurves.clear(); + for (File file : new File(MMOCore.plugin.getDataFolder() + "/expcurves").listFiles()) + try { + ExpCurve curve = new ExpCurve(file); + expCurves.put(curve.getId(), curve); + } catch (IllegalArgumentException | IOException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp curve '" + file.getName() + "': " + exception.getMessage()); + } + + expTables.clear(); + FileConfiguration expTablesConfig = new ConfigFile("exp-tables").getConfig(); + for (String key : expTablesConfig.getKeys(false)) + try { + ExperienceTable table = new ExperienceTable(expTablesConfig.getConfigurationSection(key)); + expTables.put(table.getId(), table); + } catch (RuntimeException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp table '" + key + "': " + exception.getMessage()); + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java index 46b9a8f6..a5a6beb0 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/InventoryManager.java @@ -5,23 +5,23 @@ import java.util.List; import java.util.logging.Level; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.gui.AttributeView; -import net.Indyuce.mmocore.gui.ClassConfirmation; -import net.Indyuce.mmocore.gui.ClassSelect; -import net.Indyuce.mmocore.gui.PlayerStats; -import net.Indyuce.mmocore.gui.QuestViewer; import net.Indyuce.mmocore.gui.SkillList; -import net.Indyuce.mmocore.gui.SubclassConfirmation; -import net.Indyuce.mmocore.gui.SubclassSelect; import net.Indyuce.mmocore.gui.WaypointViewer; -import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.social.friend.EditableFriendList; import net.Indyuce.mmocore.gui.social.friend.EditableFriendRemoval; import net.Indyuce.mmocore.gui.social.guild.EditableGuildCreation; import net.Indyuce.mmocore.gui.social.guild.EditableGuildView; import net.Indyuce.mmocore.gui.social.party.EditablePartyCreation; import net.Indyuce.mmocore.gui.social.party.EditablePartyView; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.gui.ClassConfirmation; +import net.Indyuce.mmocore.gui.ClassSelect; +import net.Indyuce.mmocore.gui.PlayerStats; +import net.Indyuce.mmocore.gui.QuestViewer; +import net.Indyuce.mmocore.gui.SubclassConfirmation; +import net.Indyuce.mmocore.gui.SubclassSelect; +import net.Indyuce.mmocore.gui.api.EditableInventory; public class InventoryManager { public static final PlayerStats PLAYER_STATS = new PlayerStats(); diff --git a/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java index 96317c16..090f188f 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/LootChestManager.java @@ -1,82 +1,82 @@ -package net.Indyuce.mmocore.manager; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; -import net.Indyuce.mmocore.loot.chest.LootChest; -import net.Indyuce.mmocore.loot.chest.LootChestRegion; -import net.Indyuce.mmocore.util.HashableLocation; -import org.bukkit.Location; -import org.bukkit.configuration.file.FileConfiguration; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.logging.Level; - -public class LootChestManager implements MMOCoreManager { - - /** - * Active loot chests in the server - */ - private final Map active = new HashMap<>(); - - /** - * Registered loot chest regions - */ - private final Map regions = new HashMap<>(); - - public boolean hasRegion(String id) { - return regions.containsKey(id); - } - - /** - * @return Region with specific identifier - * @throws NullPointerException if not found - */ - @NotNull - public LootChestRegion getRegion(String id) { - return Objects.requireNonNull(regions.get(id), "Could not find region with ID '" + id + "'"); - } - - public Collection getRegions() { - return regions.values(); - } - - public Collection getActive() { - return active.values(); - } - - public void register(LootChest chest) { - active.put(chest.getBlock().getLocation(), chest); - } - - public void unregister(LootChest chest) { - active.remove(chest.getBlock().getLocation()); - } - - @Nullable - public LootChest getChest(Location loc) { - return active.get(new HashableLocation(loc)); - } - - @Override - public void initialize(boolean clearBefore) { - if (clearBefore) { - regions.values().forEach(region -> region.getRunnable().cancel()); - regions.clear(); - } - - FileConfiguration config = new ConfigFile("loot-chests").getConfig(); - for (String key : config.getKeys(false)) - try { - LootChestRegion region = new LootChestRegion(config.getConfigurationSection(key)); - regions.put(region.getId(), region); - } catch (IllegalArgumentException exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, - "An error occured while trying to load loot chest region '" + key + "': " + exception.getMessage()); - } - } -} +package net.Indyuce.mmocore.manager; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.loot.chest.LootChest; +import net.Indyuce.mmocore.loot.chest.LootChestRegion; +import net.Indyuce.mmocore.util.HashableLocation; +import org.bukkit.Location; +import org.bukkit.configuration.file.FileConfiguration; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.logging.Level; + +public class LootChestManager implements MMOCoreManager { + + /** + * Active loot chests in the server + */ + private final Map active = new HashMap<>(); + + /** + * Registered loot chest regions + */ + private final Map regions = new HashMap<>(); + + public boolean hasRegion(String id) { + return regions.containsKey(id); + } + + /** + * @return Region with specific identifier + * @throws NullPointerException if not found + */ + @NotNull + public LootChestRegion getRegion(String id) { + return Objects.requireNonNull(regions.get(id), "Could not find region with ID '" + id + "'"); + } + + public Collection getRegions() { + return regions.values(); + } + + public Collection getActive() { + return active.values(); + } + + public void register(LootChest chest) { + active.put(chest.getBlock().getLocation(), chest); + } + + public void unregister(LootChest chest) { + active.remove(chest.getBlock().getLocation()); + } + + @Nullable + public LootChest getChest(Location loc) { + return active.get(new HashableLocation(loc)); + } + + @Override + public void initialize(boolean clearBefore) { + if (clearBefore) { + regions.values().forEach(region -> region.getRunnable().cancel()); + regions.clear(); + } + + FileConfiguration config = new ConfigFile("loot-chests").getConfig(); + for (String key : config.getKeys(false)) + try { + LootChestRegion region = new LootChestRegion(config.getConfigurationSection(key)); + regions.put(region.getId(), region); + } catch (IllegalArgumentException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, + "An error occured while trying to load loot chest region '" + key + "': " + exception.getMessage()); + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/MMOCoreManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/MMOCoreManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/MMOCoreManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/MMOCoreManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java index 30f506d4..15c49d03 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java @@ -4,20 +4,20 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Function; +import net.Indyuce.mmocore.api.block.BlockType; +import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; import com.google.gson.JsonParseException; -import net.Indyuce.mmocore.api.block.BlockType; import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.api.load.DefaultMMOLoader; import net.Indyuce.mmocore.api.load.MMOLoader; import net.Indyuce.mmocore.api.quest.objective.Objective; -import net.Indyuce.mmocore.api.quest.trigger.Trigger; import io.lumine.mythic.lib.api.MMOLineConfig; public class MMOLoadManager { diff --git a/src/main/java/net/Indyuce/mmocore/manager/QuestManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/QuestManager.java similarity index 99% rename from src/main/java/net/Indyuce/mmocore/manager/QuestManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/QuestManager.java index 31768d61..44ca127f 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/QuestManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/QuestManager.java @@ -7,11 +7,10 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.logging.Level; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.file.YamlConfiguration; - import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.quest.Quest; +import org.apache.commons.lang.Validate; +import org.bukkit.configuration.file.YamlConfiguration; public class QuestManager implements MMOCoreManager { private final Map quests = new LinkedHashMap<>(); diff --git a/src/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java index 503a2b95..4d06cdc6 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java @@ -5,8 +5,8 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.itemtype.ItemType; import io.lumine.mythic.lib.api.util.PostLoadObject; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.block.BlockType; +import net.Indyuce.mmocore.api.ConfigFile; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; diff --git a/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/SkillManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java index 25a6d67b..2f95fdb1 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SkillManager.java @@ -2,13 +2,13 @@ package net.Indyuce.mmocore.manager; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.skill.handler.SkillHandler; +import net.Indyuce.mmocore.skill.list.Sneaky_Picky; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.Indyuce.mmocore.skill.list.Ambers; import net.Indyuce.mmocore.skill.list.Neptune_Gift; -import net.Indyuce.mmocore.skill.list.Sneaky_Picky; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/Indyuce/mmocore/manager/SkillTreeManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SkillTreeManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/SkillTreeManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SkillTreeManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/SoundManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SoundManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/SoundManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/SoundManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/StatManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/StatManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/StatManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/StatManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java index 97bb5a00..5ae15590 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/WaypointManager.java @@ -1,8 +1,8 @@ package net.Indyuce.mmocore.manager; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.waypoint.Waypoint; +import net.Indyuce.mmocore.api.ConfigFile; import org.apache.commons.lang.Validate; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java index 1114a86a..e992a5cd 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java @@ -1,15 +1,15 @@ -package net.Indyuce.mmocore.manager.data; - -/** - * Used to separate MySQL data storage from YAML data storage. - *

- * There is one data provider per storage mecanism (one for YAML, one for MySQL). - * A data provider provides corresponding MMOManagers to correctly save and load - * data - */ -public interface DataProvider { - - PlayerDataManager getDataManager(); - - GuildDataManager getGuildManager(); -} +package net.Indyuce.mmocore.manager.data; + +/** + * Used to separate MySQL data storage from YAML data storage. + *

+ * There is one data provider per storage mecanism (one for YAML, one for MySQL). + * A data provider provides corresponding MMOManagers to correctly save and load + * data + */ +public interface DataProvider { + + PlayerDataManager getDataManager(); + + GuildDataManager getGuildManager(); +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java index 1c3a8f43..a8a6bfe6 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java @@ -1,127 +1,127 @@ -package net.Indyuce.mmocore.manager.data; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; - -import net.Indyuce.mmocore.api.ConfigFile; -import net.Indyuce.mmocore.guild.provided.Guild; - -public abstract class GuildDataManager { - protected final Map guilds = new HashMap<>(); - - public Guild newRegisteredGuild(UUID owner, String name, String tag) { - Guild guild = new Guild(owner, name, tag); - registerGuild(guild); - return guild; - } - - public void registerGuild(Guild guild) { - guilds.put(guild.getId(), guild); - } - - public boolean isRegistered(Guild guild) { - return guilds.containsValue(guild); - } - - public boolean isRegistered(String tag) { - return guilds.containsKey(tag); - } - - public void unregisterGuild(Guild guild) { - guild.forEachMember(member -> guild.removeMember(member, true)); - // guild.getMembers().clear(); - guilds.remove(guild.getId()); - delete(guild); - } - - public Guild getGuild(String guild) { - return guilds.get(guild); - } - - public Collection getAll() { - return guilds.values(); - } - - @Deprecated - public void reload() { - for (Guild guild : guilds.values()) - save(guild); - guilds.clear(); - load(); - config = new GuildConfiguration(); - } - - public abstract void save(Guild guild); - - // TODO move to constructor, useless to handle vie abstract method - public abstract void load(); - - public abstract void delete(Guild guild); - - // TODO fix this - // Shitty code for loading config values for guilds. - private GuildConfiguration config; - - public GuildConfiguration getConfig() { - return config == null ? config = new GuildConfiguration() : config; - } - - public static class GuildConfiguration { - private final String prefix; - private final boolean uppercaseTags; - private final NamingRules tagRules, nameRules; - - public GuildConfiguration() { - FileConfiguration config = new ConfigFile("guilds").getConfig(); - - this.prefix = config.getString("chat-prefix", "*"); - this.uppercaseTags = config.getBoolean("uppercase-tags", true); - this.tagRules = new NamingRules(config.getConfigurationSection("rules.tag")); - this.nameRules = new NamingRules(config.getConfigurationSection("rules.name")); - } - - public String getPrefix() { - return prefix; - } - - public boolean shouldUppercaseTags() { - return uppercaseTags; - } - - public NamingRules getTagRules() { - return tagRules; - } - - public NamingRules getNameRules() { - return nameRules; - } - - public static class NamingRules { - private final String regex; - private final int min, max; - - public NamingRules(ConfigurationSection config) { - regex = config.getString("matches", "[a-zA-Z-_!?]+"); - min = config.getInt("min-length", 3); - max = config.getInt("max-length", 5); - } - - public String getRegex() { - return regex; - } - - public int getMin() { - return min; - } - - public int getMax() { - return max; - } - } - } -} +package net.Indyuce.mmocore.manager.data; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; + +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.guild.provided.Guild; + +public abstract class GuildDataManager { + protected final Map guilds = new HashMap<>(); + + public Guild newRegisteredGuild(UUID owner, String name, String tag) { + Guild guild = new Guild(owner, name, tag); + registerGuild(guild); + return guild; + } + + public void registerGuild(Guild guild) { + guilds.put(guild.getId(), guild); + } + + public boolean isRegistered(Guild guild) { + return guilds.containsValue(guild); + } + + public boolean isRegistered(String tag) { + return guilds.containsKey(tag); + } + + public void unregisterGuild(Guild guild) { + guild.forEachMember(member -> guild.removeMember(member, true)); + // guild.getMembers().clear(); + guilds.remove(guild.getId()); + delete(guild); + } + + public Guild getGuild(String guild) { + return guilds.get(guild); + } + + public Collection getAll() { + return guilds.values(); + } + + @Deprecated + public void reload() { + for (Guild guild : guilds.values()) + save(guild); + guilds.clear(); + load(); + config = new GuildConfiguration(); + } + + public abstract void save(Guild guild); + + // TODO move to constructor, useless to handle vie abstract method + public abstract void load(); + + public abstract void delete(Guild guild); + + // TODO fix this + // Shitty code for loading config values for guilds. + private GuildConfiguration config; + + public GuildConfiguration getConfig() { + return config == null ? config = new GuildConfiguration() : config; + } + + public static class GuildConfiguration { + private final String prefix; + private final boolean uppercaseTags; + private final NamingRules tagRules, nameRules; + + public GuildConfiguration() { + FileConfiguration config = new ConfigFile("guilds").getConfig(); + + this.prefix = config.getString("chat-prefix", "*"); + this.uppercaseTags = config.getBoolean("uppercase-tags", true); + this.tagRules = new NamingRules(config.getConfigurationSection("rules.tag")); + this.nameRules = new NamingRules(config.getConfigurationSection("rules.name")); + } + + public String getPrefix() { + return prefix; + } + + public boolean shouldUppercaseTags() { + return uppercaseTags; + } + + public NamingRules getTagRules() { + return tagRules; + } + + public NamingRules getNameRules() { + return nameRules; + } + + public static class NamingRules { + private final String regex; + private final int min, max; + + public NamingRules(ConfigurationSection config) { + regex = config.getString("matches", "[a-zA-Z-_!?]+"); + min = config.getInt("min-length", 3); + max = config.getInt("max-length", 5); + } + + public String getRegex() { + return regex; + } + + public int getMin() { + return min; + } + + public int getMax() { + return max; + } + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java index bb5f148a..ef1745bd 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java @@ -1,255 +1,254 @@ -package net.Indyuce.mmocore.manager.data; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.api.player.MMOPlayerData; -import io.lumine.mythic.lib.player.TemporaryPlayerData; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.event.AsyncPlayerDataLoadEvent; -import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent; -import net.Indyuce.mmocore.api.player.OfflinePlayerData; -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.guild.provided.Guild; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.configuration.ConfigurationSection; -import org.jetbrains.annotations.NotNull; - -import java.util.*; -import java.util.logging.Level; - -public abstract class PlayerDataManager { - private final static Map data = Collections.synchronizedMap(new HashMap<>()); - - private DefaultPlayerData defaultData = new DefaultPlayerData(1, 0, 0, 0, 0); - - public PlayerData get(OfflinePlayer player) { - return get(player.getUniqueId()); - } - - /** - * Gets the player data, or throws an exception if not found. - * The player data should be loaded when the player logs in - * so it's really bad practice to setup the player data if it's not loaded. - * - * @param uuid Player UUID - * @return Player data, if it's loaded - */ - public PlayerData get(UUID uuid) { - return Objects.requireNonNull(data.get(uuid), "Player data is not loaded"); - } - - - public static void loadDataFromJson(PlayerData data, String json) { - JsonObject object = MythicLib.plugin.getJson().parse(json, JsonObject.class); - - data.setClassPoints(object.get("class_points").getAsInt()); - data.setSkillPoints(object.get("skill_points").getAsInt()); - data.setAttributePoints(object.get("attribute_points").getAsInt()); - data.setAttributeReallocationPoints(object.get("attribute_realloc_points").getAsInt()); - data.setLevel(object.get("level").getAsInt()); - data.setExperience(object.get("experience").getAsInt()); - if (object.has("class")) - data.setClass(MMOCore.plugin.classManager.get(object.get(("class")).getAsString())); - - if (object.has("times_claimed")) { - JsonObject timesClaimed =object.get(("times_claimed")).getAsJsonObject(); - timesClaimed.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); - } - - if (object.has(("guild"))) { - Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(object.get("guild").getAsString()); - data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); - } - if (object.has(("attributes"))) data.getAttributes().load(object.get("attributes").getAsString()); - if (object.has(("professions"))) - data.getCollectionSkills().load(object.get("professions").getAsString()); - if (object.has(("quests"))) data.getQuestData().load(object.get("quests").getAsString()); - data.getQuestData().updateBossBar(); - if (object.has(("waypoints"))) - data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(object.get("waypoints").getAsString())); - if (object.has(("friends"))) - MMOCoreUtils.jsonArrayToList(object.get("friends").getAsString()).forEach(str -> data.getFriends().add(UUID.fromString(str))) - ; - if (object.has(("skills"))) { - JsonObject skillsObject = object.get("skills").getAsJsonObject(); - for (Map.Entry entry : skillsObject.entrySet()) - data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); - } - if (object.has(("bound_skills"))) - for (String skill : MMOCoreUtils.jsonArrayToList(object.get("bound_skills").getAsString())) - if (data.getProfess().hasSkill(skill)) - data.getBoundSkills().add(data.getProfess().getSkill(skill)); - if (object.has(("class_info"))) { - JsonObject classObject = object.get("class_info").getAsJsonObject(); - for (Map.Entry entry : classObject.entrySet()) { - try { - PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); - Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); - data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); - } - } - } - - } - - - /** - * Safely unregisters the player data from the map. - * This saves the player data either through SQL or YAML, - * then closes the player data and clears it from the data map. - * - * @param playerData PLayer data to unregister - */ - public void unregisterSafe(PlayerData playerData) { - - // Save data async if required - if (playerData.isFullyLoaded()) - Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> { - saveData(playerData); - - // Unregister once the data was saved - playerData.close(); - data.remove(playerData.getUniqueId()); - }); - - // Just unregister data without saving - else { - playerData.close(); - data.remove(playerData.getUniqueId()); - } - } - - /** - * Offline player data is used to handle processes like friend removal - * which can still occur if one of the two players is offline. - *

- * Unlike {@link #get(UUID)} this method never returns a null instance - * - * @param uuid Player unique id - * @return Offline player data - */ - @NotNull - public abstract OfflinePlayerData getOffline(UUID uuid); - - /** - * Called when a player logs in, loading the player data inside the map. - *

- * For YAML configs or SQL databases, data is loaded as not to overload - * the main thread with SQL requests. Therefore, the player data returned - * by that method, when the player joined for the first time, is not - * fully loaded YET. - * - * @param uniqueId Player UUID - * @return The loaded player data. - */ - public PlayerData setup(UUID uniqueId) { - // Load player data if it does not exist - if (!data.containsKey(uniqueId)) { - PlayerData newData = TemporaryPlayerData.has(uniqueId) ? new PlayerData(MMOPlayerData.get(uniqueId), TemporaryPlayerData.get(uniqueId)) : new PlayerData(MMOPlayerData.get(uniqueId)); - - // Schedule async data loading - Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> { - loadData(newData); - newData.getStats().updateStats(); - Bukkit.getPluginManager().callEvent(new AsyncPlayerDataLoadEvent(newData)); - Bukkit.getScheduler().runTask(MMOCore.plugin, () -> Bukkit.getPluginManager().callEvent(new PlayerDataLoadEvent(newData))); - }); - - // Update data map - data.put(uniqueId, newData); - - return newData; - } - - return data.get(uniqueId); - } - - public DefaultPlayerData getDefaultData() { - return defaultData; - } - - public void loadDefaultData(ConfigurationSection config) { - defaultData = new DefaultPlayerData(config); - } - - public boolean isLoaded(UUID uuid) { - return data.containsKey(uuid); - } - - public Collection getLoaded() { - return data.values(); - } - - /** - * Called when player data must be loaded from database or config. - * - * @param data Player data to load - */ - public abstract void loadData(PlayerData data); - - /** - * Called when player data must be saved in configs or database. - * This method should always be called sync because it DOES register - * an async task in case MySQL storage is used. - * - * @param data Player data to save - */ - public abstract void saveData(PlayerData data); - - public class DefaultPlayerData { - private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints; - - public DefaultPlayerData(ConfigurationSection config) { - level = config.getInt("level", 1); - classPoints = config.getInt("class-points"); - skillPoints = config.getInt("skill-points"); - attributePoints = config.getInt("attribute-points"); - attrReallocPoints = config.getInt("attribute-realloc-points"); - } - - public DefaultPlayerData(int level, int classPoints, int skillPoints, int attributePoints, int attrReallocPoints) { - this.level = level; - this.classPoints = classPoints; - this.skillPoints = skillPoints; - this.attributePoints = attributePoints; - this.attrReallocPoints = attrReallocPoints; - } - - public int getLevel() { - return level; - } - - public int getSkillPoints() { - return skillPoints; - } - - public int getClassPoints() { - return classPoints; - } - - public int getAttrReallocPoints() { - return attrReallocPoints; - } - - public int getAttributePoints() { - return attributePoints; - } - - public void apply(PlayerData player) { - player.setLevel(level); - player.setClassPoints(classPoints); - player.setSkillPoints(skillPoints); - player.setAttributePoints(attributePoints); - player.setAttributeReallocationPoints(attrReallocPoints); - } - } -} +package net.Indyuce.mmocore.manager.data; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import io.lumine.mythic.lib.MythicLib; +import io.lumine.mythic.lib.api.player.MMOPlayerData; +import io.lumine.mythic.lib.player.TemporaryPlayerData; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.AsyncPlayerDataLoadEvent; +import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.player.OfflinePlayerData; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; +import net.Indyuce.mmocore.guild.provided.Guild; +import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.configuration.ConfigurationSection; +import org.jetbrains.annotations.NotNull; + +import java.util.*; +import java.util.logging.Level; + +public abstract class PlayerDataManager { + private final static Map data = Collections.synchronizedMap(new HashMap<>()); + + private DefaultPlayerData defaultData = new DefaultPlayerData(1, 0, 0, 0, 0); + + public PlayerData get(OfflinePlayer player) { + return get(player.getUniqueId()); + } + + /** + * Gets the player data, or throws an exception if not found. + * The player data should be loaded when the player logs in + * so it's really bad practice to setup the player data if it's not loaded. + * + * @param uuid Player UUID + * @return Player data, if it's loaded + */ + public PlayerData get(UUID uuid) { + return Objects.requireNonNull(data.get(uuid), "Player data is not loaded"); + } + + + public static void loadDataFromJson(PlayerData data, String json) { + JsonObject object = MythicLib.plugin.getJson().parse(json, JsonObject.class); + + data.setClassPoints(object.get("class_points").getAsInt()); + data.setSkillPoints(object.get("skill_points").getAsInt()); + data.setAttributePoints(object.get("attribute_points").getAsInt()); + data.setAttributeReallocationPoints(object.get("attribute_realloc_points").getAsInt()); + data.setLevel(object.get("level").getAsInt()); + data.setExperience(object.get("experience").getAsInt()); + if (object.has("class")) + data.setClass(MMOCore.plugin.classManager.get(object.get(("class")).getAsString())); + + if (object.has("times_claimed")) { + JsonObject timesClaimed =object.get(("times_claimed")).getAsJsonObject(); + timesClaimed.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); + } + + if (object.has(("guild"))) { + Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(object.get("guild").getAsString()); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); + } + if (object.has(("attributes"))) data.getAttributes().load(object.get("attributes").getAsString()); + if (object.has(("professions"))) + data.getCollectionSkills().load(object.get("professions").getAsString()); + if (object.has(("quests"))) data.getQuestData().load(object.get("quests").getAsString()); + data.getQuestData().updateBossBar(); + if (object.has(("waypoints"))) + data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(object.get("waypoints").getAsString())); + if (object.has(("friends"))) + MMOCoreUtils.jsonArrayToList(object.get("friends").getAsString()).forEach(str -> data.getFriends().add(UUID.fromString(str))) + ; + if (object.has(("skills"))) { + JsonObject skillsObject = object.get("skills").getAsJsonObject(); + for (Map.Entry entry : skillsObject.entrySet()) + data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); + } + if (object.has(("bound_skills"))) + for (String skill : MMOCoreUtils.jsonArrayToList(object.get("bound_skills").getAsString())) + if (data.getProfess().hasSkill(skill)) + data.getBoundSkills().add(data.getProfess().getSkill(skill)); + if (object.has(("class_info"))) { + JsonObject classObject = object.get("class_info").getAsJsonObject(); + for (Map.Entry entry : classObject.entrySet()) { + try { + PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); + Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); + data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); + } + } + } + + } + + + /** + * Safely unregisters the player data from the map. + * This saves the player data either through SQL or YAML, + * then closes the player data and clears it from the data map. + * + * @param playerData PLayer data to unregister + */ + public void unregisterSafe(PlayerData playerData) { + + // Save data async if required + if (playerData.isFullyLoaded()) + Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> { + saveData(playerData); + + // Unregister once the data was saved + playerData.close(); + data.remove(playerData.getUniqueId()); + }); + + // Just unregister data without saving + else { + playerData.close(); + data.remove(playerData.getUniqueId()); + } + } + + /** + * Offline player data is used to handle processes like friend removal + * which can still occur if one of the two players is offline. + *

+ * Unlike {@link #get(UUID)} this method never returns a null instance + * + * @param uuid Player unique id + * @return Offline player data + */ + @NotNull + public abstract OfflinePlayerData getOffline(UUID uuid); + + /** + * Called when a player logs in, loading the player data inside the map. + *

+ * For YAML configs or SQL databases, data is loaded as not to overload + * the main thread with SQL requests. Therefore, the player data returned + * by that method, when the player joined for the first time, is not + * fully loaded YET. + * + * @param uniqueId Player UUID + * @return The loaded player data. + */ + public PlayerData setup(UUID uniqueId) { + // Load player data if it does not exist + if (!data.containsKey(uniqueId)) { + PlayerData newData = TemporaryPlayerData.has(uniqueId) ? new PlayerData(MMOPlayerData.get(uniqueId), TemporaryPlayerData.get(uniqueId)) : new PlayerData(MMOPlayerData.get(uniqueId)); + + // Schedule async data loading + Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> { + loadData(newData); + newData.getStats().updateStats(); + Bukkit.getPluginManager().callEvent(new AsyncPlayerDataLoadEvent(newData)); + Bukkit.getScheduler().runTask(MMOCore.plugin, () -> Bukkit.getPluginManager().callEvent(new PlayerDataLoadEvent(newData))); + }); + + // Update data map + data.put(uniqueId, newData); + + return newData; + } + + return data.get(uniqueId); + } + + public DefaultPlayerData getDefaultData() { + return defaultData; + } + + public void loadDefaultData(ConfigurationSection config) { + defaultData = new DefaultPlayerData(config); + } + + public boolean isLoaded(UUID uuid) { + return data.containsKey(uuid); + } + + public Collection getLoaded() { + return data.values(); + } + + /** + * Called when player data must be loaded from database or config. + * + * @param data Player data to load + */ + public abstract void loadData(PlayerData data); + + /** + * Called when player data must be saved in configs or database. + * This method should always be called sync because it DOES register + * an async task in case MySQL storage is used. + * + * @param data Player data to save + */ + public abstract void saveData(PlayerData data); + + public class DefaultPlayerData { + private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints; + + public DefaultPlayerData(ConfigurationSection config) { + level = config.getInt("level", 1); + classPoints = config.getInt("class-points"); + skillPoints = config.getInt("skill-points"); + attributePoints = config.getInt("attribute-points"); + attrReallocPoints = config.getInt("attribute-realloc-points"); + } + + public DefaultPlayerData(int level, int classPoints, int skillPoints, int attributePoints, int attrReallocPoints) { + this.level = level; + this.classPoints = classPoints; + this.skillPoints = skillPoints; + this.attributePoints = attributePoints; + this.attrReallocPoints = attrReallocPoints; + } + + public int getLevel() { + return level; + } + + public int getSkillPoints() { + return skillPoints; + } + + public int getClassPoints() { + return classPoints; + } + + public int getAttrReallocPoints() { + return attrReallocPoints; + } + + public int getAttributePoints() { + return attributePoints; + } + + public void apply(PlayerData player) { + player.setLevel(level); + player.setClassPoints(classPoints); + player.setSkillPoints(skillPoints); + player.setAttributePoints(attributePoints); + player.setAttributeReallocationPoints(attrReallocPoints); + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java index 38597892..b4917974 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java @@ -1,57 +1,57 @@ -package net.Indyuce.mmocore.manager.data.mysql; - -import io.lumine.mythic.lib.sql.MMODataSource; -import net.Indyuce.mmocore.manager.data.DataProvider; -import net.Indyuce.mmocore.manager.data.GuildDataManager; -import net.Indyuce.mmocore.manager.data.PlayerDataManager; -import net.Indyuce.mmocore.manager.data.yaml.YAMLGuildDataManager; -import org.bukkit.configuration.file.FileConfiguration; - -public class MySQLDataProvider extends MMODataSource implements DataProvider { - private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this); - private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager(); - - public MySQLDataProvider(FileConfiguration config) { - this.setup(config); - } - - @Override - public void load() { - - - /*TODO - also move Debug function to mysql data provider - - String tableName = getPoolName(); -getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" +getPoolName()+ "' AND TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'times_claimed'", - result -> { - if (!result.next()) - executeUpdateAsync() - }): - executeUpdateAsync(); - - - if (!provider.prepareStatement("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" + provider.getDatabase() - + "' AND TABLE_NAME = '" + provider.getBountyDataTable() + "' AND COLUMN_NAME = 'last_updated'").executeQuery().next()) - provider.prepareStatement("ALTER TABLE " + provider.getBountyDataTable() + " ADD COLUMN last_updated BIGINT").execute();*/ - - executeUpdateAsync( - "CREATE TABLE IF NOT EXISTS mmocore_playerdata(uuid VARCHAR(36),class_points " - + "INT(11) DEFAULT 0,skill_points INT(11) DEFAULT 0,attribute_points INT(11) " - + "DEFAULT 0,attribute_realloc_points INT(11) DEFAULT 0,level INT(11) DEFAULT 1," - + "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG," - + "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT," - + "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT," - + "class_info LONGTEXT, PRIMARY KEY (uuid));"); - } - - @Override - public PlayerDataManager getDataManager() { - return playerManager; - } - - @Override - public GuildDataManager getGuildManager() { - return guildManager; - } -} +package net.Indyuce.mmocore.manager.data.mysql; + +import io.lumine.mythic.lib.sql.MMODataSource; +import net.Indyuce.mmocore.manager.data.DataProvider; +import net.Indyuce.mmocore.manager.data.GuildDataManager; +import net.Indyuce.mmocore.manager.data.PlayerDataManager; +import net.Indyuce.mmocore.manager.data.yaml.YAMLGuildDataManager; +import org.bukkit.configuration.file.FileConfiguration; + +public class MySQLDataProvider extends MMODataSource implements DataProvider { + private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this); + private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager(); + + public MySQLDataProvider(FileConfiguration config) { + this.setup(config); + } + + @Override + public void load() { + + + /*TODO + also move Debug function to mysql data provider + + String tableName = getPoolName(); +getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" +getPoolName()+ "' AND TABLE_NAME = 'mmocore_playerdata' AND COLUMN_NAME = 'times_claimed'", + result -> { + if (!result.next()) + executeUpdateAsync() + }): + executeUpdateAsync(); + + + if (!provider.prepareStatement("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" + provider.getDatabase() + + "' AND TABLE_NAME = '" + provider.getBountyDataTable() + "' AND COLUMN_NAME = 'last_updated'").executeQuery().next()) + provider.prepareStatement("ALTER TABLE " + provider.getBountyDataTable() + " ADD COLUMN last_updated BIGINT").execute();*/ + + executeUpdateAsync( + "CREATE TABLE IF NOT EXISTS mmocore_playerdata(uuid VARCHAR(36),class_points " + + "INT(11) DEFAULT 0,skill_points INT(11) DEFAULT 0,attribute_points INT(11) " + + "DEFAULT 0,attribute_realloc_points INT(11) DEFAULT 0,level INT(11) DEFAULT 1," + + "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG," + + "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT," + + "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT," + + "class_info LONGTEXT, PRIMARY KEY (uuid));"); + } + + @Override + public PlayerDataManager getDataManager() { + return playerManager; + } + + @Override + public GuildDataManager getGuildManager() { + return guildManager; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java similarity index 94% rename from src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 977b6784..f8d77bba 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -1,262 +1,260 @@ -package net.Indyuce.mmocore.manager.data.mysql; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import io.lumine.mythic.lib.MythicLib; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.OfflinePlayerData; -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.guild.provided.Guild; -import net.Indyuce.mmocore.manager.data.PlayerDataManager; -import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor.Table; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -import java.io.*; -import java.net.Socket; -import java.sql.SQLException; -import java.util.*; -import java.util.Map.Entry; -import java.util.logging.Level; -import java.util.stream.Collectors; - -import static net.Indyuce.mmocore.api.player.PlayerData.createClassInfoData; - -public class MySQLPlayerDataManager extends PlayerDataManager { - private final MySQLDataProvider provider; - - public MySQLPlayerDataManager(MySQLDataProvider provider) { - this.provider = provider; - } - - @Override - public void loadData(PlayerData data) { - provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + data.getUniqueId() + "';", (result) -> { - try { - MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); - - // Initialize custom resources - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat("MAX_MANA")); - data.setStamina(data.getStats().getStat("MAX_STAMINA")); - data.setStellium(data.getStats().getStat("MAX_STELLIUM")); - } - - if (!result.next()) { - data.setLevel(getDefaultData().getLevel()); - data.setClassPoints(getDefaultData().getClassPoints()); - data.setSkillPoints(getDefaultData().getSkillPoints()); - data.setAttributePoints(getDefaultData().getAttributePoints()); - data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints()); - data.setExperience(0); - data.getQuestData().updateBossBar(); - - data.setFullyLoaded(); - MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); - return; - } - - data.setClassPoints(result.getInt("class_points")); - data.setSkillPoints(result.getInt("skill_points")); - data.setAttributePoints(result.getInt("attribute_points")); - data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points")); - data.setLevel(result.getInt("level")); - data.setExperience(result.getInt("experience")); - if (!isEmpty(result.getString("class"))) - data.setClass(MMOCore.plugin.classManager.get(result.getString("class"))); - - if (!isEmpty(result.getString("times_claimed"))) { - JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); - json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); - } - - if (!isEmpty(result.getString("guild"))) { - Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild")); - data.setGuild(guild.getMembers().has(data.getUniqueId()) ? guild : null); - } - if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes")); - if (!isEmpty(result.getString("professions"))) - data.getCollectionSkills().load(result.getString("professions")); - if (!isEmpty(result.getString("quests"))) data.getQuestData().load(result.getString("quests")); - data.getQuestData().updateBossBar(); - if (!isEmpty(result.getString("waypoints"))) - data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(result.getString("waypoints"))); - if (!isEmpty(result.getString("friends"))) - MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); - if (!isEmpty(result.getString("skills"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); - for (Entry entry : object.entrySet()) - data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); - } - if (!isEmpty(result.getString("bound_skills"))) - for (String skill : MMOCoreUtils.jsonArrayToList(result.getString("bound_skills"))) - if (data.getProfess().hasSkill(skill)) - data.getBoundSkills().add(data.getProfess().getSkill(skill)); - if (!isEmpty(result.getString("class_info"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class); - for (Entry entry : object.entrySet()) { - try { - PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); - Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); - data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); - } - } - } - - //We now change the saved status to false because the data on SQL won't be the same as in the RAM - MySQLTableEditor sql = new MySQLTableEditor(Table.PLAYERDATA, data.getUniqueId()); - - - data.setFullyLoaded(); - MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!"); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - - private boolean isEmpty(String s) { - return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); - } - - @Override - public void saveData(PlayerData data) { - - if (MMOCore.plugin.hasBungee) { - //Initialize a connection with bungee using Sockets - try { - Socket socket=new Socket("localhost",25580); - BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); - writer.write("BONJOUR"); - } catch (IOException e) { - throw new RuntimeException(e); - } - - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - DataOutputStream outStream = new DataOutputStream(out); - try { - outStream.writeChars(data.toJson()); - } catch (IOException e) { - MMOCore.plugin.getLogger().log(Level.SEVERE, "Couldn't send the data to Bungee for player " + data.getPlayer().getName()); - return; - } - MMOCore.plugin.getLogger().log(Level.WARNING, "BUNGEE"+ Bukkit.getOnlinePlayers().size()); - - - MMOCore.sqlDebug("Sent data to bungee for: " + data.getUniqueId()); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - - - } else { - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); - MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); - - sql.updateData("class_points", data.getClassPoints()); - sql.updateData("skill_points", data.getSkillPoints()); - sql.updateData("attribute_points", data.getAttributePoints()); - sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); - sql.updateData("level", data.getLevel()); - sql.updateData("experience", data.getExperience()); - sql.updateData("class", data.getProfess().getId()); - sql.updateData("last_login", data.getLastLogin()); - sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); - - sql.updateJSONArray("waypoints", data.getWaypoints()); - sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); - sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); - - sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); - sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); - - sql.updateData("attributes", data.getAttributes().toJsonString()); - sql.updateData("professions", data.getCollectionSkills().toJsonString()); - sql.updateData("quests", data.getQuestData().toJsonString()); - - sql.updateData("class_info", createClassInfoData(data).toString()); - - - MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - - - } - } - - - @NotNull - @Override - public OfflinePlayerData getOffline(UUID uuid) { - return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); - } - - - public class MySQLOfflinePlayerData extends OfflinePlayerData { - private int level; - private long lastLogin; - private PlayerClass profess; - private List friends; - - public MySQLOfflinePlayerData(UUID uuid) { - super(uuid); - - provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { - try { - MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'."); - if (!result.next()) { - level = 0; - lastLogin = 0; - profess = MMOCore.plugin.classManager.getDefaultClass(); - friends = new ArrayList<>(); - MMOCore.sqlDebug("Default OFFLINE data loaded."); - } else { - level = result.getInt("level"); - lastLogin = result.getLong("last_login"); - profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class")); - if (!isEmpty(result.getString("friends"))) - MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str))); - else friends = new ArrayList<>(); - MMOCore.sqlDebug("Saved OFFLINE data loaded."); - } - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - - @Override - public void removeFriend(UUID uuid) { - friends.remove(uuid); - new MySQLTableEditor(Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); - } - - @Override - public boolean hasFriend(UUID uuid) { - return friends.contains(uuid); - } - - @Override - public PlayerClass getProfess() { - return profess; - } - - @Override - public int getLevel() { - return level; - } - - @Override - public long getLastLogin() { - return lastLogin; - } - } -} +package net.Indyuce.mmocore.manager.data.mysql; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.lumine.mythic.lib.MythicLib; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.OfflinePlayerData; +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.guild.provided.Guild; +import net.Indyuce.mmocore.manager.data.PlayerDataManager; +import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.jetbrains.annotations.NotNull; + +import java.io.*; +import java.net.Socket; +import java.sql.SQLException; +import java.util.*; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.stream.Collectors; + +import static net.Indyuce.mmocore.api.player.PlayerData.createClassInfoData; + +public class MySQLPlayerDataManager extends PlayerDataManager { + private final MySQLDataProvider provider; + + public MySQLPlayerDataManager(MySQLDataProvider provider) { + this.provider = provider; + } + + @Override + public void loadData(PlayerData data) { + provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + data.getUniqueId() + "';", (result) -> { + try { + MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); + + // Initialize custom resources + if (!data.hasUsedTemporaryData()) { + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); + } + + if (!result.next()) { + data.setLevel(getDefaultData().getLevel()); + data.setClassPoints(getDefaultData().getClassPoints()); + data.setSkillPoints(getDefaultData().getSkillPoints()); + data.setAttributePoints(getDefaultData().getAttributePoints()); + data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints()); + data.setExperience(0); + data.getQuestData().updateBossBar(); + + data.setFullyLoaded(); + MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); + return; + } + + data.setClassPoints(result.getInt("class_points")); + data.setSkillPoints(result.getInt("skill_points")); + data.setAttributePoints(result.getInt("attribute_points")); + data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points")); + data.setLevel(result.getInt("level")); + data.setExperience(result.getInt("experience")); + if (!isEmpty(result.getString("class"))) + data.setClass(MMOCore.plugin.classManager.get(result.getString("class"))); + + if (!isEmpty(result.getString("times_claimed"))) { + JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); + json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); + } + + if (!isEmpty(result.getString("guild"))) { + Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild")); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); + } + if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes")); + if (!isEmpty(result.getString("professions"))) + data.getCollectionSkills().load(result.getString("professions")); + if (!isEmpty(result.getString("quests"))) data.getQuestData().load(result.getString("quests")); + data.getQuestData().updateBossBar(); + if (!isEmpty(result.getString("waypoints"))) + data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(result.getString("waypoints"))); + if (!isEmpty(result.getString("friends"))) + MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); + if (!isEmpty(result.getString("skills"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); + for (Entry entry : object.entrySet()) + data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); + } + if (!isEmpty(result.getString("bound_skills"))) + for (String skill : MMOCoreUtils.jsonArrayToList(result.getString("bound_skills"))) + if (data.getProfess().hasSkill(skill)) + data.getBoundSkills().add(data.getProfess().getSkill(skill)); + if (!isEmpty(result.getString("class_info"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class); + for (Entry entry : object.entrySet()) { + try { + PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); + Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); + data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); + } + } + } + + //We now change the saved status to false because the data on SQL won't be the same as in the RAM + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + + + data.setFullyLoaded(); + MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!"); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } + + private boolean isEmpty(String s) { + return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); + } + + @Override + public void saveData(PlayerData data) { + + if (MMOCore.plugin.hasBungee) { + //Initialize a connection with bungee using Sockets + try { + Socket socket=new Socket("localhost",25580); + BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + writer.write("BONJOUR"); + } catch (IOException e) { + throw new RuntimeException(e); + } + + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + DataOutputStream outStream = new DataOutputStream(out); + try { + outStream.writeChars(data.toJson()); + } catch (IOException e) { + MMOCore.plugin.getLogger().log(Level.SEVERE, "Couldn't send the data to Bungee for player " + data.getPlayer().getName()); + return; + } + MMOCore.plugin.getLogger().log(Level.WARNING, "BUNGEE"+ Bukkit.getOnlinePlayers().size()); + + + MMOCore.sqlDebug("Sent data to bungee for: " + data.getUniqueId()); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + + + } else { + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); + + sql.updateData("class_points", data.getClassPoints()); + sql.updateData("skill_points", data.getSkillPoints()); + sql.updateData("attribute_points", data.getAttributePoints()); + sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); + sql.updateData("level", data.getLevel()); + sql.updateData("experience", data.getExperience()); + sql.updateData("class", data.getProfess().getId()); + sql.updateData("last_login", data.getLastLogin()); + sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); + + sql.updateJSONArray("waypoints", data.getWaypoints()); + sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); + sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); + + sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); + sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); + + sql.updateData("attributes", data.getAttributes().toJsonString()); + sql.updateData("professions", data.getCollectionSkills().toJsonString()); + sql.updateData("quests", data.getQuestData().toJsonString()); + + sql.updateData("class_info", createClassInfoData(data).toString()); + + + MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + + + } + } + + + @NotNull + @Override + public OfflinePlayerData getOffline(UUID uuid) { + return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); + } + + + public class MySQLOfflinePlayerData extends OfflinePlayerData { + private int level; + private long lastLogin; + private PlayerClass profess; + private List friends; + + public MySQLOfflinePlayerData(UUID uuid) { + super(uuid); + + provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { + try { + MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'."); + if (!result.next()) { + level = 0; + lastLogin = 0; + profess = MMOCore.plugin.classManager.getDefaultClass(); + friends = new ArrayList<>(); + MMOCore.sqlDebug("Default OFFLINE data loaded."); + } else { + level = result.getInt("level"); + lastLogin = result.getLong("last_login"); + profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class")); + if (!isEmpty(result.getString("friends"))) + MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str))); + else friends = new ArrayList<>(); + MMOCore.sqlDebug("Saved OFFLINE data loaded."); + } + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } + + @Override + public void removeFriend(UUID uuid) { + friends.remove(uuid); + new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); + } + + @Override + public boolean hasFriend(UUID uuid) { + return friends.contains(uuid); + } + + @Override + public PlayerClass getProfess() { + return profess; + } + + @Override + public int getLevel() { + return level; + } + + @Override + public long getLastLogin() { + return lastLogin; + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java index f6d1a7ad..8f5cbea7 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java @@ -1,55 +1,55 @@ -package net.Indyuce.mmocore.manager.data.mysql; - -import java.util.Collection; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; - -import net.Indyuce.mmocore.MMOCore; - -public class MySQLTableEditor { - private final Table table; - private final UUID uuid; - - public MySQLTableEditor(Table table, UUID uuid) { - this.table = table; - this.uuid = uuid; - } - - public void updateData(String key, Object value) { - ((MySQLDataProvider) MMOCore.plugin.dataProvider).executeUpdate("INSERT INTO " + table + "(uuid, " + key - + ") VALUES('" + uuid + "', '" + value + "') ON DUPLICATE KEY UPDATE " + key + "='" + value + "';"); - } - - public void updateJSONArray(String key, Collection collection) { - JsonArray json = new JsonArray(); - for (String s : collection) - json.add(s); - updateData(key, json.toString()); - } - - public void updateJSONObject(String key, Set> collection) { - JsonObject json = new JsonObject(); - for (Entry entry : collection) - json.addProperty(entry.getKey(), entry.getValue()); - updateData(key, json.toString()); - } - - public enum Table { - PLAYERDATA("mmocore_playerdata"), GUILDDATA("mmocore_guilddata"); - - final String tableName; - - Table(String tN) { - tableName = tN; - } - - @Override - public String toString() { - return tableName; - } - } -} +package net.Indyuce.mmocore.manager.data.mysql; + +import java.util.Collection; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + +import net.Indyuce.mmocore.MMOCore; + +public class MySQLTableEditor { + private final Table table; + private final UUID uuid; + + public MySQLTableEditor(Table table, UUID uuid) { + this.table = table; + this.uuid = uuid; + } + + public void updateData(String key, Object value) { + ((MySQLDataProvider) MMOCore.plugin.dataProvider).executeUpdate("INSERT INTO " + table + "(uuid, " + key + + ") VALUES('" + uuid + "', '" + value + "') ON DUPLICATE KEY UPDATE " + key + "='" + value + "';"); + } + + public void updateJSONArray(String key, Collection collection) { + JsonArray json = new JsonArray(); + for (String s : collection) + json.add(s); + updateData(key, json.toString()); + } + + public void updateJSONObject(String key, Set> collection) { + JsonObject json = new JsonObject(); + for (Entry entry : collection) + json.addProperty(entry.getKey(), entry.getValue()); + updateData(key, json.toString()); + } + + public enum Table { + PLAYERDATA("mmocore_playerdata"), GUILDDATA("mmocore_guilddata"); + + final String tableName; + + Table(String tN) { + tableName = tN; + } + + @Override + public String toString() { + return tableName; + } + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java index d6ea6a2b..39d20dd5 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java @@ -1,20 +1,20 @@ -package net.Indyuce.mmocore.manager.data.yaml; - -import net.Indyuce.mmocore.manager.data.DataProvider; -import net.Indyuce.mmocore.manager.data.GuildDataManager; -import net.Indyuce.mmocore.manager.data.PlayerDataManager; - -public class YAMLDataProvider implements DataProvider { - private final YAMLPlayerDataManager playerManager = new YAMLPlayerDataManager(this); - private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager(); - - @Override - public PlayerDataManager getDataManager() { - return playerManager; - } - - @Override - public GuildDataManager getGuildManager() { - return guildManager; - } -} +package net.Indyuce.mmocore.manager.data.yaml; + +import net.Indyuce.mmocore.manager.data.DataProvider; +import net.Indyuce.mmocore.manager.data.GuildDataManager; +import net.Indyuce.mmocore.manager.data.PlayerDataManager; + +public class YAMLDataProvider implements DataProvider { + private final YAMLPlayerDataManager playerManager = new YAMLPlayerDataManager(this); + private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager(); + + @Override + public PlayerDataManager getDataManager() { + return playerManager; + } + + @Override + public GuildDataManager getGuildManager() { + return guildManager; + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java index 15d9e65e..ab2557ce 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java @@ -1,50 +1,50 @@ -package net.Indyuce.mmocore.manager.data.yaml; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; -import net.Indyuce.mmocore.guild.provided.Guild; -import net.Indyuce.mmocore.manager.data.GuildDataManager; - -public class YAMLGuildDataManager extends GuildDataManager { - @Override - public void save(Guild guild) { - ConfigFile config = new ConfigFile(guild); - config.getConfig().set("name", guild.getName()); - config.getConfig().set("tag", guild.getTag()); - config.getConfig().set("owner", guild.getOwner().toString()); - - List memberList = new ArrayList<>(); - guild.forEachMember(uuid -> memberList.add(uuid.toString())); - config.getConfig().set("members", memberList); - - config.save(); - } - - @Override - public void load() { - File guildsFolder = new File(MMOCore.plugin.getDataFolder(), "guilds"); - if (!guildsFolder.exists()) - guildsFolder.mkdirs(); - for (File file : guildsFolder.listFiles()) { - if (!file.isDirectory() && file.getName().substring(file.getName().lastIndexOf('.')).equalsIgnoreCase(".yml")) { - FileConfiguration c = YamlConfiguration.loadConfiguration(file); - Guild guild = newRegisteredGuild(UUID.fromString(c.getString("owner")), c.getString("name"), c.getString("tag")); - for (String m : c.getStringList("members")) - guild.registerMember(UUID.fromString(m)); - } - } - } - - @Override - public void delete(Guild guild) { - new ConfigFile(guild).delete(); - } -} +package net.Indyuce.mmocore.manager.data.yaml; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import net.Indyuce.mmocore.MMOCore; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.manager.data.GuildDataManager; + +public class YAMLGuildDataManager extends GuildDataManager { + @Override + public void save(Guild guild) { + ConfigFile config = new ConfigFile(guild); + config.getConfig().set("name", guild.getName()); + config.getConfig().set("tag", guild.getTag()); + config.getConfig().set("owner", guild.getOwner().toString()); + + List memberList = new ArrayList<>(); + guild.forEachMember(uuid -> memberList.add(uuid.toString())); + config.getConfig().set("members", memberList); + + config.save(); + } + + @Override + public void load() { + File guildsFolder = new File(MMOCore.plugin.getDataFolder(), "guilds"); + if (!guildsFolder.exists()) + guildsFolder.mkdirs(); + for (File file : guildsFolder.listFiles()) { + if (!file.isDirectory() && file.getName().substring(file.getName().lastIndexOf('.')).equalsIgnoreCase(".yml")) { + FileConfiguration c = YamlConfiguration.loadConfiguration(file); + Guild guild = newRegisteredGuild(UUID.fromString(c.getString("owner")), c.getString("name"), c.getString("tag")); + for (String m : c.getStringList("members")) + guild.registerMember(UUID.fromString(m)); + } + } + } + + @Override + public void delete(Guild guild) { + new ConfigFile(guild).delete(); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java index c2eb4047..67de7675 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java @@ -1,51 +1,51 @@ -package net.Indyuce.mmocore.manager.data.yaml; - -import java.util.List; -import java.util.UUID; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; -import net.Indyuce.mmocore.api.player.OfflinePlayerData; -import net.Indyuce.mmocore.api.player.profess.PlayerClass; - -public class YAMLOfflinePlayerData extends OfflinePlayerData { - private final ConfigFile config; - - /** - * Supports offline player data operations like friend removals which can't - * be handled when their player data is not loaded in the data map. - */ - public YAMLOfflinePlayerData(UUID uuid) { - super(uuid); - - config = new ConfigFile(uuid); - } - - @Override - public void removeFriend(UUID uuid) { - List friends = config.getConfig().getStringList("friends"); - friends.remove(uuid.toString()); - config.getConfig().set("friends", friends); - config.save(); - } - - @Override - public boolean hasFriend(UUID uuid) { - return config.getConfig().getStringList("friends").contains(uuid.toString()); - } - - @Override - public PlayerClass getProfess() { - return config.getConfig().contains("class") ? MMOCore.plugin.classManager.get(config.getConfig().getString("class")) : MMOCore.plugin.classManager.getDefaultClass(); - } - - @Override - public int getLevel() { - return config.getConfig().getInt("level"); - } - - @Override - public long getLastLogin() { - return config.getConfig().getLong("last-login"); - } -} +package net.Indyuce.mmocore.manager.data.yaml; + +import java.util.List; +import java.util.UUID; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.api.player.OfflinePlayerData; + +public class YAMLOfflinePlayerData extends OfflinePlayerData { + private final ConfigFile config; + + /** + * Supports offline player data operations like friend removals which can't + * be handled when their player data is not loaded in the data map. + */ + public YAMLOfflinePlayerData(UUID uuid) { + super(uuid); + + config = new ConfigFile(uuid); + } + + @Override + public void removeFriend(UUID uuid) { + List friends = config.getConfig().getStringList("friends"); + friends.remove(uuid.toString()); + config.getConfig().set("friends", friends); + config.save(); + } + + @Override + public boolean hasFriend(UUID uuid) { + return config.getConfig().getStringList("friends").contains(uuid.toString()); + } + + @Override + public PlayerClass getProfess() { + return config.getConfig().contains("class") ? MMOCore.plugin.classManager.get(config.getConfig().getString("class")) : MMOCore.plugin.classManager.getDefaultClass(); + } + + @Override + public int getLevel() { + return config.getConfig().getInt("level"); + } + + @Override + public long getLastLogin() { + return config.getConfig().getLong("last-login"); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java index e9f6986d..37cc03f7 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java @@ -1,147 +1,147 @@ -package net.Indyuce.mmocore.manager.data.yaml; - -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigFile; -import net.Indyuce.mmocore.api.player.OfflinePlayerData; -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.guild.provided.Guild; -import net.Indyuce.mmocore.manager.data.DataProvider; -import net.Indyuce.mmocore.manager.data.PlayerDataManager; -import org.apache.commons.lang.Validate; -import org.bukkit.configuration.file.FileConfiguration; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.logging.Level; -import java.util.stream.Collectors; - -public class YAMLPlayerDataManager extends PlayerDataManager { - private final DataProvider provider; - - public YAMLPlayerDataManager(DataProvider provider) { - this.provider = provider; - } - - @Override - public void loadData(PlayerData data) { - FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig(); - - data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints())); - data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints())); - data.setAttributePoints(config.getInt("attribute-points", getDefaultData().getAttributePoints())); - data.setAttributeReallocationPoints(config.getInt("attribute-realloc-points", getDefaultData().getAttrReallocPoints())); - data.setLevel(config.getInt("level", getDefaultData().getLevel())); - data.setExperience(config.getInt("experience")); - if (config.contains("class")) - data.setClass(MMOCore.plugin.classManager.get(config.getString("class"))); - - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat("MAX_MANA")); - data.setStamina(data.getStats().getStat("MAX_STAMINA")); - data.setStellium(data.getStats().getStat("MAX_STELLIUM")); - } - - if (config.contains("guild")) { - Guild guild = provider.getGuildManager().getGuild(config.getString("guild")); - data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); - } - if (config.contains("attribute")) - data.getAttributes().load(config.getConfigurationSection("attribute")); - if (config.contains("profession")) - data.getCollectionSkills().load(config.getConfigurationSection("profession")); - if (config.contains("quest")) - data.getQuestData().load(config.getConfigurationSection("quest")); - data.getQuestData().updateBossBar(); - if (config.contains("waypoints")) - data.getWaypoints().addAll(config.getStringList("waypoints")); - if (config.contains("friends")) - config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str))); - if (config.contains("skill")) - config.getConfigurationSection("skill").getKeys(false).forEach(id -> data.setSkillLevel(id, config.getInt("skill." + id))); - if (config.contains("bound-skills")) - for (String id : config.getStringList("bound-skills")) - if (data.getProfess().hasSkill(id)) - data.getBoundSkills().add(data.getProfess().getSkill(id)); - - if (config.contains("times-claimed")) - for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) - data.getItemClaims().put(key, config.getInt("times-claimed." + key)); - - // Load class slots, use try so the player can log in. - if (config.contains("class-info")) - for (String key : config.getConfigurationSection("class-info").getKeys(false)) - try { - PlayerClass profess = MMOCore.plugin.classManager.get(key); - Validate.notNull(profess, "Could not find class '" + key + "'"); - data.applyClassInfo(profess, new SavedClassInformation(config.getConfigurationSection("class-info." + key))); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage()); - } - - data.setFullyLoaded(); - } - - @Override - public void saveData(PlayerData data) { - ConfigFile file = new ConfigFile(data.getUniqueId()); - FileConfiguration config = file.getConfig(); - - config.set("class-points", data.getClassPoints()); - config.set("skill-points", data.getSkillPoints()); - config.set("attribute-points", data.getAttributePoints()); - // config.set("skill-realloc-points", skillReallocationPoints); - config.set("attribute-realloc-points", data.getAttributeReallocationPoints()); - config.set("level", data.getLevel()); - config.set("experience", data.getExperience()); - config.set("class", data.getProfess().getId()); - config.set("waypoints", new ArrayList<>(data.getWaypoints())); - config.set("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); - config.set("last-login", data.getLastLogin()); - config.set("guild", data.hasGuild() ? data.getGuild().getId() : null); - - config.set("skill", null); - data.mapSkillLevels().forEach((key1, value) -> config.set("skill." + key1, value)); - data.getItemClaims().forEach((key, times) -> config.set("times-claimed." + key, times)); - - List boundSkills = new ArrayList<>(); - data.getBoundSkills().forEach(skill -> boundSkills.add(skill.getSkill().getHandler().getId())); - config.set("bound-skills", boundSkills); - - config.set("attribute", null); - config.createSection("attribute"); - data.getAttributes().save(config.getConfigurationSection("attribute")); - - config.set("profession", null); - config.createSection("profession"); - data.getCollectionSkills().save(config.getConfigurationSection("profession")); - - config.set("quest", null); - config.createSection("quest"); - data.getQuestData().save(config.getConfigurationSection("quest")); - - config.set("class-info", null); - for (String key : data.getSavedClasses()) { - SavedClassInformation info = data.getClassInfo(key); - config.set("class-info." + key + ".level", info.getLevel()); - config.set("class-info." + key + ".experience", info.getExperience()); - config.set("class-info." + key + ".skill-points", info.getSkillPoints()); - config.set("class-info." + key + ".attribute-points", info.getAttributePoints()); - config.set("class-info." + key + ".attribute-realloc-points", info.getAttributeReallocationPoints()); - info.getSkillKeys().forEach(skill -> config.set("class-info." + key + ".skill." + skill, info.getSkillLevel(skill))); - info.getAttributeKeys() - .forEach(attribute -> config.set("class-info." + key + ".attribute." + attribute, info.getAttributeLevel(attribute))); - } - - file.save(); - } - - @NotNull - @Override - public OfflinePlayerData getOffline(UUID uuid) { - return isLoaded(uuid) ? get(uuid) : new YAMLOfflinePlayerData(uuid); - } -} +package net.Indyuce.mmocore.manager.data.yaml; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.profess.PlayerClass; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.api.player.OfflinePlayerData; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; +import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.manager.data.DataProvider; +import net.Indyuce.mmocore.manager.data.PlayerDataManager; +import org.apache.commons.lang.Validate; +import org.bukkit.configuration.file.FileConfiguration; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.logging.Level; +import java.util.stream.Collectors; + +public class YAMLPlayerDataManager extends PlayerDataManager { + private final DataProvider provider; + + public YAMLPlayerDataManager(DataProvider provider) { + this.provider = provider; + } + + @Override + public void loadData(PlayerData data) { + FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig(); + + data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints())); + data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints())); + data.setAttributePoints(config.getInt("attribute-points", getDefaultData().getAttributePoints())); + data.setAttributeReallocationPoints(config.getInt("attribute-realloc-points", getDefaultData().getAttrReallocPoints())); + data.setLevel(config.getInt("level", getDefaultData().getLevel())); + data.setExperience(config.getInt("experience")); + if (config.contains("class")) + data.setClass(MMOCore.plugin.classManager.get(config.getString("class"))); + + if (!data.hasUsedTemporaryData()) { + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); + } + + if (config.contains("guild")) { + Guild guild = provider.getGuildManager().getGuild(config.getString("guild")); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); + } + if (config.contains("attribute")) + data.getAttributes().load(config.getConfigurationSection("attribute")); + if (config.contains("profession")) + data.getCollectionSkills().load(config.getConfigurationSection("profession")); + if (config.contains("quest")) + data.getQuestData().load(config.getConfigurationSection("quest")); + data.getQuestData().updateBossBar(); + if (config.contains("waypoints")) + data.getWaypoints().addAll(config.getStringList("waypoints")); + if (config.contains("friends")) + config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str))); + if (config.contains("skill")) + config.getConfigurationSection("skill").getKeys(false).forEach(id -> data.setSkillLevel(id, config.getInt("skill." + id))); + if (config.contains("bound-skills")) + for (String id : config.getStringList("bound-skills")) + if (data.getProfess().hasSkill(id)) + data.getBoundSkills().add(data.getProfess().getSkill(id)); + + if (config.contains("times-claimed")) + for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) + data.getItemClaims().put(key, config.getInt("times-claimed." + key)); + + // Load class slots, use try so the player can log in. + if (config.contains("class-info")) + for (String key : config.getConfigurationSection("class-info").getKeys(false)) + try { + PlayerClass profess = MMOCore.plugin.classManager.get(key); + Validate.notNull(profess, "Could not find class '" + key + "'"); + data.applyClassInfo(profess, new SavedClassInformation(config.getConfigurationSection("class-info." + key))); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage()); + } + + data.setFullyLoaded(); + } + + @Override + public void saveData(PlayerData data) { + ConfigFile file = new ConfigFile(data.getUniqueId()); + FileConfiguration config = file.getConfig(); + + config.set("class-points", data.getClassPoints()); + config.set("skill-points", data.getSkillPoints()); + config.set("attribute-points", data.getAttributePoints()); + // config.set("skill-realloc-points", skillReallocationPoints); + config.set("attribute-realloc-points", data.getAttributeReallocationPoints()); + config.set("level", data.getLevel()); + config.set("experience", data.getExperience()); + config.set("class", data.getProfess().getId()); + config.set("waypoints", new ArrayList<>(data.getWaypoints())); + config.set("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); + config.set("last-login", data.getLastLogin()); + config.set("guild", data.hasGuild() ? data.getGuild().getId() : null); + + config.set("skill", null); + data.mapSkillLevels().forEach((key1, value) -> config.set("skill." + key1, value)); + data.getItemClaims().forEach((key, times) -> config.set("times-claimed." + key, times)); + + List boundSkills = new ArrayList<>(); + data.getBoundSkills().forEach(skill -> boundSkills.add(skill.getSkill().getHandler().getId())); + config.set("bound-skills", boundSkills); + + config.set("attribute", null); + config.createSection("attribute"); + data.getAttributes().save(config.getConfigurationSection("attribute")); + + config.set("profession", null); + config.createSection("profession"); + data.getCollectionSkills().save(config.getConfigurationSection("profession")); + + config.set("quest", null); + config.createSection("quest"); + data.getQuestData().save(config.getConfigurationSection("quest")); + + config.set("class-info", null); + for (String key : data.getSavedClasses()) { + SavedClassInformation info = data.getClassInfo(key); + config.set("class-info." + key + ".level", info.getLevel()); + config.set("class-info." + key + ".experience", info.getExperience()); + config.set("class-info." + key + ".skill-points", info.getSkillPoints()); + config.set("class-info." + key + ".attribute-points", info.getAttributePoints()); + config.set("class-info." + key + ".attribute-realloc-points", info.getAttributeReallocationPoints()); + info.getSkillKeys().forEach(skill -> config.set("class-info." + key + ".skill." + skill, info.getSkillLevel(skill))); + info.getAttributeKeys() + .forEach(attribute -> config.set("class-info." + key + ".attribute." + attribute, info.getAttributeLevel(attribute))); + } + + file.save(); + } + + @NotNull + @Override + public OfflinePlayerData getOffline(UUID uuid) { + return isLoaded(uuid) ? get(uuid) : new YAMLOfflinePlayerData(uuid); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java similarity index 95% rename from src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java index 5b69846d..4f089d10 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java @@ -3,7 +3,6 @@ package net.Indyuce.mmocore.manager.profession; import io.papermc.lib.PaperLib; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.block.BlockInfo; -import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock; import net.Indyuce.mmocore.api.block.BlockType; import net.Indyuce.mmocore.api.block.SkullBlockType; import net.Indyuce.mmocore.api.block.VanillaBlockType; @@ -33,7 +32,7 @@ public class CustomBlockManager extends SpecificProfessionManager { * Blocks that are regenerating and that must be refreshed whenever the * server reloads or shuts down not to hurt the world map */ - private final Set active = new HashSet<>(); + private final Set active = new HashSet<>(); /** * Stores conditions which must be met to apply custom mining @@ -93,7 +92,7 @@ public class CustomBlockManager extends SpecificProfessionManager { * a "block chain", no regen should be scheduled as * there is already one */ - public void initialize(RegeneratingBlock info, boolean scheduleRegen) { + public void initialize(BlockInfo.RegeneratingBlock info, boolean scheduleRegen) { if (scheduleRegen) { active.add(info); Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> regen(info, false), info.getRegeneratingBlock().getRegenerationInfo().getTime()); @@ -112,7 +111,7 @@ public class CustomBlockManager extends SpecificProfessionManager { * the server shuts down, it iterates through active blocks. * This prevents any issue when editing lists being iterated */ - private void regen(RegeneratingBlock info, boolean shutdown) { + private void regen(BlockInfo.RegeneratingBlock info, boolean shutdown) { // Get the chunk and load it async if needed. PaperLib.getChunkAtAsync(info.getLocation()).whenComplete((chunk, ex) -> { @@ -138,7 +137,7 @@ public class CustomBlockManager extends SpecificProfessionManager { */ public boolean isTemporaryBlock(Block block) { Location loc = block.getLocation(); - for (RegeneratingBlock info : active) + for (BlockInfo.RegeneratingBlock info : active) if (info.getLocation().getBlockX() == loc.getBlockX() && info.getLocation().getBlockY() == loc.getBlockY() && info.getLocation().getBlockZ() == loc.getBlockZ()) return true; diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java diff --git a/src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java diff --git a/src/main/java/net/Indyuce/mmocore/party/AbstractParty.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/AbstractParty.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/AbstractParty.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/AbstractParty.java diff --git a/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java diff --git a/src/main/java/net/Indyuce/mmocore/party/PartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/PartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java diff --git a/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/Party.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/Party.java similarity index 96% rename from src/main/java/net/Indyuce/mmocore/party/provided/Party.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/Party.java index 218a830e..9bc6b2db 100644 --- a/src/main/java/net/Indyuce/mmocore/party/provided/Party.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/Party.java @@ -1,12 +1,12 @@ package net.Indyuce.mmocore.party.provided; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.gui.api.PluginInventory; +import net.Indyuce.mmocore.gui.social.party.EditablePartyView; +import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.Request; -import net.Indyuce.mmocore.gui.api.PluginInventory; -import net.Indyuce.mmocore.gui.social.party.EditablePartyView.PartyViewInventory; -import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.party.AbstractParty; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -107,7 +107,7 @@ public class Party implements AbstractParty { public void removeMember(PlayerData data, boolean notify) { if (data.isOnline() && data.getPlayer().getOpenInventory() != null - && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof PartyViewInventory) + && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditablePartyView.PartyViewInventory) InventoryManager.PARTY_CREATION.newInventory(data).open(); members.remove(data); @@ -146,7 +146,7 @@ public class Party implements AbstractParty { private void updateOpenInventories() { for (PlayerData member : members) if (member.isOnline() && member.getPlayer().getOpenInventory() != null - && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof PartyViewInventory) + && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditablePartyView.PartyViewInventory) ((PluginInventory) member.getPlayer().getOpenInventory().getTopInventory().getHolder()).open(); } diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java index 40d13a4c..e5010170 100644 --- a/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java @@ -1,9 +1,9 @@ package net.Indyuce.mmocore.party.provided; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.Request; -import net.Indyuce.mmocore.manager.InventoryManager; public class PartyInvite extends Request { private final Party party; diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java similarity index 87% rename from src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java index 10d0a69d..943aa556 100644 --- a/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.party.provided; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.social.PartyChatEvent; +import net.Indyuce.mmocore.manager.ConfigManager; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.ConfigManager.SimpleMessage; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -31,7 +31,7 @@ public class PartyListener implements Listener { // Running it in a delayed task is recommended Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, () -> { - SimpleMessage format = MMOCore.plugin.configManager.getSimpleMessage("party-chat", "player", data.getPlayer().getName(), "message", + ConfigManager.SimpleMessage format = MMOCore.plugin.configManager.getSimpleMessage("party-chat", "player", data.getPlayer().getName(), "message", event.getMessage().substring(MMOCore.plugin.configManager.partyChatPrefix.length())); PartyChatEvent called = new PartyChatEvent(party, data, format.message()); Bukkit.getPluginManager().callEvent(called); diff --git a/src/main/java/net/Indyuce/mmocore/player/Unlockable.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/Unlockable.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/player/Unlockable.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/player/Unlockable.java diff --git a/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java diff --git a/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java diff --git a/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java similarity index 93% rename from src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java index 1af7fdbc..7f97a26c 100644 --- a/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java @@ -8,7 +8,7 @@ import org.bukkit.entity.Player; public class MMOCoreQuestModule implements QuestModule { @Override public AbstractQuest getQuestOrThrow(String id) { - Quest quest=MMOCore.plugin.questManager.get(id); + Quest quest= MMOCore.plugin.questManager.get(id); if(quest==null) return null; return new MMOCoreQuest(quest); diff --git a/src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/TODO.txt b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/TODO.txt similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/TODO.txt rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/TODO.txt diff --git a/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java diff --git a/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java similarity index 97% rename from src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java index 97748824..f3813ac6 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java @@ -6,12 +6,10 @@ import io.lumine.mythic.lib.player.cooldown.CooldownInfo; import io.lumine.mythic.lib.skill.Skill; import io.lumine.mythic.lib.skill.SkillMetadata; import io.lumine.mythic.lib.skill.handler.SkillHandler; -import io.lumine.mythic.lib.skill.trigger.TriggerType; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerData; -import org.jetbrains.annotations.NotNull; public class CastableSkill extends Skill { private final ClassSkill skill; diff --git a/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java index 841c76a2..386cd07a 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java @@ -5,9 +5,9 @@ import io.lumine.mythic.lib.player.cooldown.CooldownObject; import io.lumine.mythic.lib.player.modifier.ModifierSource; import io.lumine.mythic.lib.player.skill.PassiveSkill; import io.lumine.mythic.lib.skill.custom.condition.Condition; -import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java index c33637e8..f59d888d 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java @@ -8,8 +8,8 @@ import io.lumine.mythic.lib.player.PlayerMetadata; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; import io.lumine.mythic.lib.skill.trigger.TriggerType; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.SoundObject; import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent; +import net.Indyuce.mmocore.api.SoundObject; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.skill.cast.KeyCombo; import net.Indyuce.mmocore.skill.cast.PlayerKey; diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java index 3db7938d..46bac2f1 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java @@ -5,8 +5,8 @@ import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.player.PlayerMetadata; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent; +import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.cast.PlayerKey; diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java index f9fdd078..43717196 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java @@ -4,8 +4,8 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.player.PlayerMetadata; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; -import net.Indyuce.mmocore.api.SoundObject; import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent; +import net.Indyuce.mmocore.api.SoundObject; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.skill.cast.PlayerKey; import net.Indyuce.mmocore.skill.cast.SkillCastingHandler; diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java diff --git a/src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java diff --git a/src/main/java/net/Indyuce/mmocore/tree/SkillTree.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTree.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/tree/SkillTree.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTree.java diff --git a/src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java diff --git a/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/HashableLocation.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java diff --git a/src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java diff --git a/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java diff --git a/src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java diff --git a/src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java diff --git a/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java diff --git a/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java similarity index 100% rename from src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java diff --git a/src/main/resources/config.yml b/spigot-plugin/src/main/resources/config.yml similarity index 100% rename from src/main/resources/config.yml rename to spigot-plugin/src/main/resources/config.yml diff --git a/src/main/resources/default/attributes.yml b/spigot-plugin/src/main/resources/default/attributes.yml similarity index 100% rename from src/main/resources/default/attributes.yml rename to spigot-plugin/src/main/resources/default/attributes.yml diff --git a/src/main/resources/default/classes/arcane-mage.yml b/spigot-plugin/src/main/resources/default/classes/arcane-mage.yml similarity index 100% rename from src/main/resources/default/classes/arcane-mage.yml rename to spigot-plugin/src/main/resources/default/classes/arcane-mage.yml diff --git a/src/main/resources/default/classes/human.yml b/spigot-plugin/src/main/resources/default/classes/human.yml similarity index 100% rename from src/main/resources/default/classes/human.yml rename to spigot-plugin/src/main/resources/default/classes/human.yml diff --git a/src/main/resources/default/classes/mage.yml b/spigot-plugin/src/main/resources/default/classes/mage.yml similarity index 100% rename from src/main/resources/default/classes/mage.yml rename to spigot-plugin/src/main/resources/default/classes/mage.yml diff --git a/src/main/resources/default/classes/marksman.yml b/spigot-plugin/src/main/resources/default/classes/marksman.yml similarity index 100% rename from src/main/resources/default/classes/marksman.yml rename to spigot-plugin/src/main/resources/default/classes/marksman.yml diff --git a/src/main/resources/default/classes/paladin.yml b/spigot-plugin/src/main/resources/default/classes/paladin.yml similarity index 100% rename from src/main/resources/default/classes/paladin.yml rename to spigot-plugin/src/main/resources/default/classes/paladin.yml diff --git a/src/main/resources/default/classes/rogue.yml b/spigot-plugin/src/main/resources/default/classes/rogue.yml similarity index 100% rename from src/main/resources/default/classes/rogue.yml rename to spigot-plugin/src/main/resources/default/classes/rogue.yml diff --git a/src/main/resources/default/classes/warrior.yml b/spigot-plugin/src/main/resources/default/classes/warrior.yml similarity index 100% rename from src/main/resources/default/classes/warrior.yml rename to spigot-plugin/src/main/resources/default/classes/warrior.yml diff --git a/src/main/resources/default/commands.yml b/spigot-plugin/src/main/resources/default/commands.yml similarity index 94% rename from src/main/resources/default/commands.yml rename to spigot-plugin/src/main/resources/default/commands.yml index b6ddec29..83f70cc7 100644 --- a/src/main/resources/default/commands.yml +++ b/spigot-plugin/src/main/resources/default/commands.yml @@ -1,33 +1,33 @@ -player: - main: "player" - aliases: ["p", "profile"] -attributes: - main: "attributes" - aliases: ["att", "stats"] -class: - main: "class" - aliases: ["c"] -waypoints: - main: "waypoints" - aliases: ["wp"] -quests: - main: "quests" - aliases: ["q", "journal"] -skills: - main: "skills" - aliases: ["s"] -friends: - main: "friends" - aliases: ["f"] -party: - main: "party" - aliases: [] -guild: - main: "guild" - aliases: [] -withdraw: - main: "withdraw" - aliases: ["w"] -deposit: - main: "deposit" +player: + main: "player" + aliases: ["p", "profile"] +attributes: + main: "attributes" + aliases: ["att", "stats"] +class: + main: "class" + aliases: ["c"] +waypoints: + main: "waypoints" + aliases: ["wp"] +quests: + main: "quests" + aliases: ["q", "journal"] +skills: + main: "skills" + aliases: ["s"] +friends: + main: "friends" + aliases: ["f"] +party: + main: "party" + aliases: [] +guild: + main: "guild" + aliases: [] +withdraw: + main: "withdraw" + aliases: ["w"] +deposit: + main: "deposit" aliases: ["d"] \ No newline at end of file diff --git a/src/main/resources/default/drop-tables/example-drop-tables.yml b/spigot-plugin/src/main/resources/default/drop-tables/example-drop-tables.yml similarity index 100% rename from src/main/resources/default/drop-tables/example-drop-tables.yml rename to spigot-plugin/src/main/resources/default/drop-tables/example-drop-tables.yml diff --git a/src/main/resources/default/exp-tables.yml b/spigot-plugin/src/main/resources/default/exp-tables.yml similarity index 100% rename from src/main/resources/default/exp-tables.yml rename to spigot-plugin/src/main/resources/default/exp-tables.yml diff --git a/src/main/resources/default/expcurves/levels.txt b/spigot-plugin/src/main/resources/default/expcurves/levels.txt similarity index 100% rename from src/main/resources/default/expcurves/levels.txt rename to spigot-plugin/src/main/resources/default/expcurves/levels.txt diff --git a/src/main/resources/default/expcurves/mining.txt b/spigot-plugin/src/main/resources/default/expcurves/mining.txt similarity index 100% rename from src/main/resources/default/expcurves/mining.txt rename to spigot-plugin/src/main/resources/default/expcurves/mining.txt diff --git a/src/main/resources/default/gui/attribute-view.yml b/spigot-plugin/src/main/resources/default/gui/attribute-view.yml similarity index 100% rename from src/main/resources/default/gui/attribute-view.yml rename to spigot-plugin/src/main/resources/default/gui/attribute-view.yml diff --git a/src/main/resources/default/gui/class-confirm.yml b/spigot-plugin/src/main/resources/default/gui/class-confirm.yml similarity index 100% rename from src/main/resources/default/gui/class-confirm.yml rename to spigot-plugin/src/main/resources/default/gui/class-confirm.yml diff --git a/src/main/resources/default/gui/class-select.yml b/spigot-plugin/src/main/resources/default/gui/class-select.yml similarity index 100% rename from src/main/resources/default/gui/class-select.yml rename to spigot-plugin/src/main/resources/default/gui/class-select.yml diff --git a/src/main/resources/default/gui/friend-list.yml b/spigot-plugin/src/main/resources/default/gui/friend-list.yml similarity index 100% rename from src/main/resources/default/gui/friend-list.yml rename to spigot-plugin/src/main/resources/default/gui/friend-list.yml diff --git a/src/main/resources/default/gui/friend-removal.yml b/spigot-plugin/src/main/resources/default/gui/friend-removal.yml similarity index 100% rename from src/main/resources/default/gui/friend-removal.yml rename to spigot-plugin/src/main/resources/default/gui/friend-removal.yml diff --git a/src/main/resources/default/gui/guild-creation.yml b/spigot-plugin/src/main/resources/default/gui/guild-creation.yml similarity index 100% rename from src/main/resources/default/gui/guild-creation.yml rename to spigot-plugin/src/main/resources/default/gui/guild-creation.yml diff --git a/src/main/resources/default/gui/guild-view.yml b/spigot-plugin/src/main/resources/default/gui/guild-view.yml similarity index 100% rename from src/main/resources/default/gui/guild-view.yml rename to spigot-plugin/src/main/resources/default/gui/guild-view.yml diff --git a/src/main/resources/default/gui/party-creation.yml b/spigot-plugin/src/main/resources/default/gui/party-creation.yml similarity index 100% rename from src/main/resources/default/gui/party-creation.yml rename to spigot-plugin/src/main/resources/default/gui/party-creation.yml diff --git a/src/main/resources/default/gui/party-view.yml b/spigot-plugin/src/main/resources/default/gui/party-view.yml similarity index 100% rename from src/main/resources/default/gui/party-view.yml rename to spigot-plugin/src/main/resources/default/gui/party-view.yml diff --git a/src/main/resources/default/gui/player-stats.yml b/spigot-plugin/src/main/resources/default/gui/player-stats.yml similarity index 100% rename from src/main/resources/default/gui/player-stats.yml rename to spigot-plugin/src/main/resources/default/gui/player-stats.yml diff --git a/src/main/resources/default/gui/quest-list.yml b/spigot-plugin/src/main/resources/default/gui/quest-list.yml similarity index 100% rename from src/main/resources/default/gui/quest-list.yml rename to spigot-plugin/src/main/resources/default/gui/quest-list.yml diff --git a/src/main/resources/default/gui/skill-list.yml b/spigot-plugin/src/main/resources/default/gui/skill-list.yml similarity index 100% rename from src/main/resources/default/gui/skill-list.yml rename to spigot-plugin/src/main/resources/default/gui/skill-list.yml diff --git a/src/main/resources/default/gui/subclass-confirm.yml b/spigot-plugin/src/main/resources/default/gui/subclass-confirm.yml similarity index 100% rename from src/main/resources/default/gui/subclass-confirm.yml rename to spigot-plugin/src/main/resources/default/gui/subclass-confirm.yml diff --git a/src/main/resources/default/gui/subclass-select.yml b/spigot-plugin/src/main/resources/default/gui/subclass-select.yml similarity index 100% rename from src/main/resources/default/gui/subclass-select.yml rename to spigot-plugin/src/main/resources/default/gui/subclass-select.yml diff --git a/src/main/resources/default/gui/waypoints.yml b/spigot-plugin/src/main/resources/default/gui/waypoints.yml similarity index 100% rename from src/main/resources/default/gui/waypoints.yml rename to spigot-plugin/src/main/resources/default/gui/waypoints.yml diff --git a/src/main/resources/default/guilds.yml b/spigot-plugin/src/main/resources/default/guilds.yml similarity index 96% rename from src/main/resources/default/guilds.yml rename to spigot-plugin/src/main/resources/default/guilds.yml index 77177910..7d50864c 100644 --- a/src/main/resources/default/guilds.yml +++ b/spigot-plugin/src/main/resources/default/guilds.yml @@ -1,41 +1,41 @@ -# WARNING! Please note that this file will be changed -# A LOT during the different phases of Guilds. -# The layout and settings displayed here are NOT final! - -# The prefix character needed for typing in the guild chat. -# Guild Chat format can be found in 'messages.yml' -chat-prefix: "*" - -# Set to true if guild tags should automatically be -# converted to Uppercase upon creation. -uppercase-tags: true -rules: - tag: - # The tag characters must match this RegEx string - # or the guild creation will fail. - # !!! If you don't know RegEx I wouldn't mess with this! - # You can always test your expression here: https://regexr.com/ - matches: "[a-zA-Z-_!?]+" - # Minimum and Maximum lengt of a tag - min-length: 3 - max-length: 4 - name: - # The name characters must match this RegEx string - # or the guild creation will fail. - # !!! If you don't know RegEx I wouldn't mess with this! - # You can always test your expression here: https://regexr.com/ - matches: "[a-zA-Z -_!?]+" - # Minimum and Maximum lengt of a tag - min-length: 3 - max-length: 14 - - - - - -# Max allowed members -max-size: 40 - -# "Guilds 1.0 doesn't have the max members feature -# A hotfix will be out before Christmas!" +# WARNING! Please note that this file will be changed +# A LOT during the different phases of Guilds. +# The layout and settings displayed here are NOT final! + +# The prefix character needed for typing in the guild chat. +# Guild Chat format can be found in 'messages.yml' +chat-prefix: "*" + +# Set to true if guild tags should automatically be +# converted to Uppercase upon creation. +uppercase-tags: true +rules: + tag: + # The tag characters must match this RegEx string + # or the guild creation will fail. + # !!! If you don't know RegEx I wouldn't mess with this! + # You can always test your expression here: https://regexr.com/ + matches: "[a-zA-Z-_!?]+" + # Minimum and Maximum lengt of a tag + min-length: 3 + max-length: 4 + name: + # The name characters must match this RegEx string + # or the guild creation will fail. + # !!! If you don't know RegEx I wouldn't mess with this! + # You can always test your expression here: https://regexr.com/ + matches: "[a-zA-Z -_!?]+" + # Minimum and Maximum lengt of a tag + min-length: 3 + max-length: 14 + + + + + +# Max allowed members +max-size: 40 + +# "Guilds 1.0 doesn't have the max members feature +# A hotfix will be out before Christmas!" # - Aria \ No newline at end of file diff --git a/src/main/resources/default/items.yml b/spigot-plugin/src/main/resources/default/items.yml similarity index 100% rename from src/main/resources/default/items.yml rename to spigot-plugin/src/main/resources/default/items.yml diff --git a/src/main/resources/default/loot-chests.yml b/spigot-plugin/src/main/resources/default/loot-chests.yml similarity index 100% rename from src/main/resources/default/loot-chests.yml rename to spigot-plugin/src/main/resources/default/loot-chests.yml diff --git a/src/main/resources/default/messages.yml b/spigot-plugin/src/main/resources/default/messages.yml similarity index 100% rename from src/main/resources/default/messages.yml rename to spigot-plugin/src/main/resources/default/messages.yml diff --git a/src/main/resources/default/professions/alchemy.yml b/spigot-plugin/src/main/resources/default/professions/alchemy.yml similarity index 100% rename from src/main/resources/default/professions/alchemy.yml rename to spigot-plugin/src/main/resources/default/professions/alchemy.yml diff --git a/src/main/resources/default/professions/enchanting.yml b/spigot-plugin/src/main/resources/default/professions/enchanting.yml similarity index 100% rename from src/main/resources/default/professions/enchanting.yml rename to spigot-plugin/src/main/resources/default/professions/enchanting.yml diff --git a/src/main/resources/default/professions/farming.yml b/spigot-plugin/src/main/resources/default/professions/farming.yml similarity index 100% rename from src/main/resources/default/professions/farming.yml rename to spigot-plugin/src/main/resources/default/professions/farming.yml diff --git a/src/main/resources/default/professions/fishing.yml b/spigot-plugin/src/main/resources/default/professions/fishing.yml similarity index 100% rename from src/main/resources/default/professions/fishing.yml rename to spigot-plugin/src/main/resources/default/professions/fishing.yml diff --git a/src/main/resources/default/professions/mining.yml b/spigot-plugin/src/main/resources/default/professions/mining.yml similarity index 100% rename from src/main/resources/default/professions/mining.yml rename to spigot-plugin/src/main/resources/default/professions/mining.yml diff --git a/src/main/resources/default/professions/smelting.yml b/spigot-plugin/src/main/resources/default/professions/smelting.yml similarity index 100% rename from src/main/resources/default/professions/smelting.yml rename to spigot-plugin/src/main/resources/default/professions/smelting.yml diff --git a/src/main/resources/default/professions/smithing.yml b/spigot-plugin/src/main/resources/default/professions/smithing.yml similarity index 100% rename from src/main/resources/default/professions/smithing.yml rename to spigot-plugin/src/main/resources/default/professions/smithing.yml diff --git a/src/main/resources/default/professions/woodcutting.yml b/spigot-plugin/src/main/resources/default/professions/woodcutting.yml similarity index 100% rename from src/main/resources/default/professions/woodcutting.yml rename to spigot-plugin/src/main/resources/default/professions/woodcutting.yml diff --git a/src/main/resources/default/quests/adv-begins.yml b/spigot-plugin/src/main/resources/default/quests/adv-begins.yml similarity index 100% rename from src/main/resources/default/quests/adv-begins.yml rename to spigot-plugin/src/main/resources/default/quests/adv-begins.yml diff --git a/src/main/resources/default/quests/fetch-mango.yml b/spigot-plugin/src/main/resources/default/quests/fetch-mango.yml similarity index 100% rename from src/main/resources/default/quests/fetch-mango.yml rename to spigot-plugin/src/main/resources/default/quests/fetch-mango.yml diff --git a/src/main/resources/default/quests/tutorial.yml b/spigot-plugin/src/main/resources/default/quests/tutorial.yml similarity index 100% rename from src/main/resources/default/quests/tutorial.yml rename to spigot-plugin/src/main/resources/default/quests/tutorial.yml diff --git a/src/main/resources/default/recipes/brewing.yml b/spigot-plugin/src/main/resources/default/recipes/brewing.yml similarity index 100% rename from src/main/resources/default/recipes/brewing.yml rename to spigot-plugin/src/main/resources/default/recipes/brewing.yml diff --git a/src/main/resources/default/recipes/furnace.yml b/spigot-plugin/src/main/resources/default/recipes/furnace.yml similarity index 100% rename from src/main/resources/default/recipes/furnace.yml rename to spigot-plugin/src/main/resources/default/recipes/furnace.yml diff --git a/src/main/resources/default/restrictions.yml b/spigot-plugin/src/main/resources/default/restrictions.yml similarity index 100% rename from src/main/resources/default/restrictions.yml rename to spigot-plugin/src/main/resources/default/restrictions.yml diff --git a/src/main/resources/default/skills/ambers.yml b/spigot-plugin/src/main/resources/default/skills/ambers.yml similarity index 100% rename from src/main/resources/default/skills/ambers.yml rename to spigot-plugin/src/main/resources/default/skills/ambers.yml diff --git a/src/main/resources/default/skills/backstab.yml b/spigot-plugin/src/main/resources/default/skills/backstab.yml similarity index 100% rename from src/main/resources/default/skills/backstab.yml rename to spigot-plugin/src/main/resources/default/skills/backstab.yml diff --git a/src/main/resources/default/skills/combo-attack.yml b/spigot-plugin/src/main/resources/default/skills/combo-attack.yml similarity index 100% rename from src/main/resources/default/skills/combo-attack.yml rename to spigot-plugin/src/main/resources/default/skills/combo-attack.yml diff --git a/src/main/resources/default/skills/control.yml b/spigot-plugin/src/main/resources/default/skills/control.yml similarity index 100% rename from src/main/resources/default/skills/control.yml rename to spigot-plugin/src/main/resources/default/skills/control.yml diff --git a/src/main/resources/default/skills/deep-wound.yml b/spigot-plugin/src/main/resources/default/skills/deep-wound.yml similarity index 100% rename from src/main/resources/default/skills/deep-wound.yml rename to spigot-plugin/src/main/resources/default/skills/deep-wound.yml diff --git a/src/main/resources/default/skills/empowered-attack.yml b/spigot-plugin/src/main/resources/default/skills/empowered-attack.yml similarity index 100% rename from src/main/resources/default/skills/empowered-attack.yml rename to spigot-plugin/src/main/resources/default/skills/empowered-attack.yml diff --git a/src/main/resources/default/skills/evade.yml b/spigot-plugin/src/main/resources/default/skills/evade.yml similarity index 100% rename from src/main/resources/default/skills/evade.yml rename to spigot-plugin/src/main/resources/default/skills/evade.yml diff --git a/src/main/resources/default/skills/fire-berserker.yml b/spigot-plugin/src/main/resources/default/skills/fire-berserker.yml similarity index 100% rename from src/main/resources/default/skills/fire-berserker.yml rename to spigot-plugin/src/main/resources/default/skills/fire-berserker.yml diff --git a/src/main/resources/default/skills/fire-rage.yml b/spigot-plugin/src/main/resources/default/skills/fire-rage.yml similarity index 100% rename from src/main/resources/default/skills/fire-rage.yml rename to spigot-plugin/src/main/resources/default/skills/fire-rage.yml diff --git a/src/main/resources/default/skills/fire-storm.yml b/spigot-plugin/src/main/resources/default/skills/fire-storm.yml similarity index 100% rename from src/main/resources/default/skills/fire-storm.yml rename to spigot-plugin/src/main/resources/default/skills/fire-storm.yml diff --git a/src/main/resources/default/skills/fireball.yml b/spigot-plugin/src/main/resources/default/skills/fireball.yml similarity index 100% rename from src/main/resources/default/skills/fireball.yml rename to spigot-plugin/src/main/resources/default/skills/fireball.yml diff --git a/src/main/resources/default/skills/furtive-strike.yml b/spigot-plugin/src/main/resources/default/skills/furtive-strike.yml similarity index 100% rename from src/main/resources/default/skills/furtive-strike.yml rename to spigot-plugin/src/main/resources/default/skills/furtive-strike.yml diff --git a/src/main/resources/default/skills/greater-healings.yml b/spigot-plugin/src/main/resources/default/skills/greater-healings.yml similarity index 100% rename from src/main/resources/default/skills/greater-healings.yml rename to spigot-plugin/src/main/resources/default/skills/greater-healings.yml diff --git a/src/main/resources/default/skills/human-shield.yml b/spigot-plugin/src/main/resources/default/skills/human-shield.yml similarity index 100% rename from src/main/resources/default/skills/human-shield.yml rename to spigot-plugin/src/main/resources/default/skills/human-shield.yml diff --git a/src/main/resources/default/skills/ice-spikes.yml b/spigot-plugin/src/main/resources/default/skills/ice-spikes.yml similarity index 100% rename from src/main/resources/default/skills/ice-spikes.yml rename to spigot-plugin/src/main/resources/default/skills/ice-spikes.yml diff --git a/src/main/resources/default/skills/minor-healings.yml b/spigot-plugin/src/main/resources/default/skills/minor-healings.yml similarity index 100% rename from src/main/resources/default/skills/minor-healings.yml rename to spigot-plugin/src/main/resources/default/skills/minor-healings.yml diff --git a/src/main/resources/default/skills/neptune-gift.yml b/spigot-plugin/src/main/resources/default/skills/neptune-gift.yml similarity index 100% rename from src/main/resources/default/skills/neptune-gift.yml rename to spigot-plugin/src/main/resources/default/skills/neptune-gift.yml diff --git a/src/main/resources/default/skills/power-mark.yml b/spigot-plugin/src/main/resources/default/skills/power-mark.yml similarity index 100% rename from src/main/resources/default/skills/power-mark.yml rename to spigot-plugin/src/main/resources/default/skills/power-mark.yml diff --git a/src/main/resources/default/skills/sneaky-picky.yml b/spigot-plugin/src/main/resources/default/skills/sneaky-picky.yml similarity index 100% rename from src/main/resources/default/skills/sneaky-picky.yml rename to spigot-plugin/src/main/resources/default/skills/sneaky-picky.yml diff --git a/src/main/resources/default/skills/telekinesy.yml b/spigot-plugin/src/main/resources/default/skills/telekinesy.yml similarity index 100% rename from src/main/resources/default/skills/telekinesy.yml rename to spigot-plugin/src/main/resources/default/skills/telekinesy.yml diff --git a/src/main/resources/default/skills/warp.yml b/spigot-plugin/src/main/resources/default/skills/warp.yml similarity index 100% rename from src/main/resources/default/skills/warp.yml rename to spigot-plugin/src/main/resources/default/skills/warp.yml diff --git a/src/main/resources/default/skills/weaken.yml b/spigot-plugin/src/main/resources/default/skills/weaken.yml similarity index 100% rename from src/main/resources/default/skills/weaken.yml rename to spigot-plugin/src/main/resources/default/skills/weaken.yml diff --git a/src/main/resources/default/sounds.yml b/spigot-plugin/src/main/resources/default/sounds.yml similarity index 100% rename from src/main/resources/default/sounds.yml rename to spigot-plugin/src/main/resources/default/sounds.yml diff --git a/src/main/resources/default/stats.yml b/spigot-plugin/src/main/resources/default/stats.yml similarity index 100% rename from src/main/resources/default/stats.yml rename to spigot-plugin/src/main/resources/default/stats.yml diff --git a/src/main/resources/default/waypoints.yml b/spigot-plugin/src/main/resources/default/waypoints.yml similarity index 100% rename from src/main/resources/default/waypoints.yml rename to spigot-plugin/src/main/resources/default/waypoints.yml diff --git a/src/main/resources/plugin.yml b/spigot-plugin/src/main/resources/plugin.yml similarity index 100% rename from src/main/resources/plugin.yml rename to spigot-plugin/src/main/resources/plugin.yml diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml deleted file mode 100644 index 1495d76a..00000000 --- a/src/main/resources/bungee.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: MMOCore -main: net.Indyuce.mmocore.bungee.Bungee -author: Ka0rX From 203728ca505430d3c69a9c1fa795a4f81f8a95b8 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 20 Jun 2022 10:52:46 +0200 Subject: [PATCH 38/91] Fixed command map initialization --- .../java/net/Indyuce/mmocore/MMOCore.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java index 38c7df42..99a62ed3 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -322,37 +322,37 @@ public class MMOCore extends LuminePlugin { FileConfiguration config = new ConfigFile("commands").getConfig(); if (config.contains("player")) - commandMap.register("net/Indyuce/mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); + commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); if (config.contains("attributes")) - commandMap.register("net/Indyuce/mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); + commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); if (config.contains("class")) - commandMap.register("net/Indyuce/mmocore", new ClassCommand(config.getConfigurationSection("class"))); + commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class"))); if (config.contains("waypoints")) - commandMap.register("net/Indyuce/mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); + commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); if (config.contains("quests")) - commandMap.register("net/Indyuce/mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); + commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); if (config.contains("skills")) - commandMap.register("net/Indyuce/mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); + commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); if (config.contains("friends")) - commandMap.register("net/Indyuce/mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); + commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); if (config.contains("party")) - commandMap.register("net/Indyuce/mmocore", new PartyCommand(config.getConfigurationSection("party"))); + commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party"))); if (config.contains("guild")) - commandMap.register("net/Indyuce/mmocore", new GuildCommand(config.getConfigurationSection("guild"))); + commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild"))); if (hasEconomy() && economy.isValid()) { if (config.contains("withdraw")) - commandMap.register("net/Indyuce/mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); + commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); if (config.contains("deposit")) - commandMap.register("net/Indyuce/mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); + commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); } } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) { ex.printStackTrace(); } MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); - getCommand("net/Indyuce/mmocore").setExecutor(mmoCoreCommand); - getCommand("net/Indyuce/mmocore").setTabCompleter(mmoCoreCommand); + getCommand("mmocore").setExecutor(mmoCoreCommand); + getCommand("mmocore").setTabCompleter(mmoCoreCommand); if (getConfig().getBoolean("auto-save.enabled")) { int autosave = getConfig().getInt("auto-save.interval") * 20; From 44a70b587860197f2da582c76fca0aa4fa4af419 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 20 Jun 2022 11:48:40 +0200 Subject: [PATCH 39/91] Fixed fishing drops, new config option to change the chance stat --- .../listener/profession/FishingListener.java | 2 +- .../mmocore/loot/RandomWeightedRoll.java | 79 +++++++++++++++++++ .../net/Indyuce/mmocore/loot/Weighted.java | 6 ++ .../Indyuce/mmocore/loot/chest/ChestTier.java | 8 +- .../mmocore/loot/chest/LootChestRegion.java | 28 +------ .../fishing/FishingDropItem.java | 11 +-- .../mmocore/manager/ConfigManager.java | 3 +- .../manager/profession/FishingManager.java | 22 +----- spigot-plugin/src/main/resources/config.yml | 1 + 9 files changed, 108 insertions(+), 52 deletions(-) create mode 100644 spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/RandomWeightedRoll.java create mode 100644 spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/Weighted.java rename spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/{droptable/dropitem => }/fishing/FishingDropItem.java (86%) diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java index 43c927ec..87719b7a 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java @@ -7,7 +7,7 @@ import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.loot.LootBuilder; -import net.Indyuce.mmocore.loot.droptable.dropitem.fishing.FishingDropItem; +import net.Indyuce.mmocore.loot.fishing.FishingDropItem; import net.Indyuce.mmocore.manager.profession.FishingManager.FishingDropTable; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/RandomWeightedRoll.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/RandomWeightedRoll.java new file mode 100644 index 00000000..53e3fae2 --- /dev/null +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/RandomWeightedRoll.java @@ -0,0 +1,79 @@ +package net.Indyuce.mmocore.loot; + +import net.Indyuce.mmocore.api.player.PlayerData; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; +import java.util.Random; + +/** + * Used whenever the chance stat appears in MMOCore + * + * @param Any weighted object, currently either fishing drop + * items or loot chest tiers. + */ +public class RandomWeightedRoll { + private final Collection collection; + private final T rolled; + + private static final Random RANDOM = new Random(); + + public RandomWeightedRoll(PlayerData player, Collection collection, double chanceWeight) { + this.collection = collection; + + double partialSum = 0; + final double randomCoefficient = RANDOM.nextDouble(), chance = chanceWeight * player.getStats().getStat("CHANCE"), sum = weightedSum(chance); + + for (T item : collection) { + partialSum += computeRealWeight(item, chance); + if (partialSum > randomCoefficient * sum) { + rolled = item; + return; + } + } + + throw new RuntimeException("Could not roll item"); + } + + /** + * The chance stat will make low weight items more + * likely to be chosen by the algorithm. + * + * @return Randomly computed item + */ + @NotNull + public T rollItem() { + return rolled; + } + + private double weightedSum(double chance) { + double sum = 0; + for (T item : collection) + sum += computeRealWeight(item, chance); + return sum; + } + + private static final double CHANCE_COEFFICIENT = 7. / 100; + + /** + * chance = 0 | tier chances are unchanged + * chance = +inf | uniform law for any drop item + * chance = 100 | all tier chances are taken their square root + * + * @return The real weight of an item considering the player's chance stat. + */ + private double computeRealWeight(T item, double chance) { + return Math.pow(item.getWeight(), 1 / Math.pow(1 + CHANCE_COEFFICIENT * chance, 1 / 3)); + } + + /* + Should this be used + private double getTierCoefficient(double initialTierChance, double chance) { + /** + * - Chance = 0 | tier coefficient is left unchanged. + * - Chance -> +oo | all tier coefficients are the same (1) + * - Chance = 50 | coefficients become their square roots + * + return Math.pow(initialTierChance, 1 / Math.pow(1 + CHANCE_COEF * chance, 1 / 3)); + }*/ +} diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/Weighted.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/Weighted.java new file mode 100644 index 00000000..4845b7a4 --- /dev/null +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/Weighted.java @@ -0,0 +1,6 @@ +package net.Indyuce.mmocore.loot; + +public interface Weighted { + + public double getWeight(); +} diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java index 3d33006a..0e82e44d 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java @@ -3,10 +3,11 @@ package net.Indyuce.mmocore.loot.chest; import io.lumine.mythic.lib.api.math.ScalingFormula; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.loot.Weighted; import net.Indyuce.mmocore.loot.droptable.DropTable; import org.bukkit.configuration.ConfigurationSection; -public class ChestTier { +public class ChestTier implements Weighted { private final TierEffect effect; private final ScalingFormula capacity; private final DropTable table; @@ -27,6 +28,11 @@ public class ChestTier { return chance; } + @Override + public double getWeight() { + return chance; + } + public DropTable getDropTable() { return table; } diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java index 8b39522e..07ccc933 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java @@ -5,6 +5,7 @@ import net.Indyuce.mmocore.api.event.LootChestSpawnEvent; import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.loot.LootBuilder; +import net.Indyuce.mmocore.loot.RandomWeightedRoll; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -124,32 +125,7 @@ public class LootChestRegion { */ @NotNull public ChestTier rollTier(PlayerData player) { - double chance = player.getStats().getStat("CHANCE") * MMOCore.plugin.configManager.lootChestsChanceWeight; - - double sum = 0; - for (ChestTier tier : tiers) - sum += getTierCoefficient(tier.getChance(), chance); - Validate.isTrue(sum > 0, "No chest tier was found"); - - double cummulated = 0; - for (ChestTier tier : tiers) { - cummulated += getTierCoefficient(tier.getChance(), chance); - if (RANDOM.nextDouble() < cummulated / sum) - return tier; - } - - throw new RuntimeException("Could not roll chest tier"); - } - - private static final double CHANCE_COEF = 7 / 100; - - /** - * - Chance = 0 | tier coefficient is left unchanged. - * - Chance -> +oo | all tier coefficients are the same (1) - * - Chance = 50 | coefficients become their square roots - */ - private double getTierCoefficient(double initialTierChance, double chance) { - return Math.pow(initialTierChance, 1 / Math.pow(1 + CHANCE_COEF * chance, 1 / 3)); + return new RandomWeightedRoll<>(player, tiers, MMOCore.plugin.configManager.lootChestsChanceWeight).rollItem(); } public Location getRandomLocation(Location center) { diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java similarity index 86% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java rename to spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java index 7762aa7b..b7ef45f4 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/loot/fishing/FishingDropItem.java @@ -1,15 +1,16 @@ -package net.Indyuce.mmocore.loot.droptable.dropitem.fishing; +package net.Indyuce.mmocore.loot.fishing; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.util.math.formula.RandomAmount; import net.Indyuce.mmocore.loot.LootBuilder; +import net.Indyuce.mmocore.loot.Weighted; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import org.apache.commons.lang.Validate; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.Nullable; -public class FishingDropItem { +public class FishingDropItem implements Weighted { private final RandomAmount experience, tugs; private final DropItem dropItem; @@ -23,9 +24,9 @@ public class FishingDropItem { Validate.isTrue(dropItem.getWeight() > 0, "A fishing drop table item must have a strictly positive weight"); } - @Deprecated - public int getWeight() { - return (int) Math.floor(getItem().getWeight()); + @Override + public double getWeight() { + return dropItem.getWeight(); } public DropItem getItem() { diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index bbf3ce55..c9ca4bbf 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -27,7 +27,7 @@ public class ConfigManager { public String partyChatPrefix, noSkillBoundPlaceholder; public ChatColor staminaFull, staminaHalf, staminaEmpty; public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; - public double lootChestsChanceWeight; + public double lootChestsChanceWeight, fishingDropsChanceWeight; public int maxPartyLevelDifference; private final FileConfiguration messages; @@ -100,6 +100,7 @@ public class ConfigManager { globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50; noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message(); lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests"); + fishingDropsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.fishing-drops"); maxPartyLevelDifference = MMOCore.plugin.getConfig().getInt("party.max-level-difference"); staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java index e794c9e3..aad6403d 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java @@ -3,9 +3,10 @@ package net.Indyuce.mmocore.manager.profession; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.loot.RandomWeightedRoll; import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.loot.chest.condition.ConditionInstance; -import net.Indyuce.mmocore.loot.droptable.dropitem.fishing.FishingDropItem; +import net.Indyuce.mmocore.loot.fishing.FishingDropItem; import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Entity; @@ -16,8 +17,6 @@ import java.util.logging.Level; public class FishingManager extends SpecificProfessionManager { private final Set tables = new LinkedHashSet<>(); - private static final Random RANDOM = new Random(); - public FishingManager() { super("on-fish"); } @@ -96,25 +95,12 @@ public class FishingManager extends SpecificProfessionManager { /** * The chance stat will make low weight items more - * likely to be chosen by the algorithm + * likely to be chosen by the algorithm. * * @return Randomly computed fishing drop item */ public FishingDropItem getRandomItem(PlayerData player) { - double chance = player.getStats().getStat("CHANCE"); - - //chance=0 ->the tier.chance remains the same - //chance ->+inf -> the tier.chance becomes the same for everyone, uniform law - //chance=8-> tierChance=sqrt(tierChance) - double sum = 0; - double randomCoefficient=RANDOM.nextDouble(); - for (FishingDropItem item : items) { - sum += Math.pow(item.getItem().getWeight(), 1 / Math.log(1 + chance)); - if(sum(player, items, MMOCore.plugin.configManager.fishingDropsChanceWeight).rollItem(); } } diff --git a/spigot-plugin/src/main/resources/config.yml b/spigot-plugin/src/main/resources/config.yml index 141b310d..93027bb8 100644 --- a/spigot-plugin/src/main/resources/config.yml +++ b/spigot-plugin/src/main/resources/config.yml @@ -85,6 +85,7 @@ guild-plugin: mmocore # all set to 1 by default, this option is really server specific chance-stat-weight: loot-chests: 1 + fishing-drops: 1 # Whether blocks generated with a "cobblegenerator" should # provide the player with experience points or not From b76127e904dfd34c206468eaa2ebc101d296806d Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Fri, 1 Jul 2022 15:00:03 +0200 Subject: [PATCH 40/91] SQL Update +debug trigger --- .m2/settings.xml | 1 + bungee-plugin/pom.xml | 40 --- .../fr/phoenix/mmocore/bungee/Bungee.java | 50 --- .../phoenix/mmocore/bungee/CacheManager.java | 24 -- .../mmocore/bungee/MessageListener.java | 60 ---- bungee-plugin/src/main/resources/bungee.yml | 3 - dist/pom.xml | 98 ------ pom.xml | 318 +++++++++++++++--- spigot-plugin/pom.xml | 255 -------------- .../data/mysql/MySQLPlayerDataManager.java | 260 -------------- .../java/net/Indyuce/mmocore/MMOCore.java | 4 +- .../net/Indyuce/mmocore/api/ConfigFile.java | 0 .../Indyuce/mmocore/api/ConfigMessage.java | 0 .../net/Indyuce/mmocore/api/MMOCoreAPI.java | 0 .../Indyuce/mmocore/api/PlayerActionBar.java | 0 .../net/Indyuce/mmocore/api/SoundEvent.java | 0 .../net/Indyuce/mmocore/api/SoundObject.java | 0 .../Indyuce/mmocore/api/block/BlockInfo.java | 0 .../Indyuce/mmocore/api/block/BlockType.java | 0 .../Indyuce/mmocore/api/block/RegenInfo.java | 0 .../mmocore/api/block/SkullBlockType.java | 0 .../mmocore/api/block/VanillaBlockType.java | 0 .../net/Indyuce/mmocore/api/eco/Withdraw.java | 0 .../api/event/AsyncPlayerDataEvent.java | 0 .../api/event/AsyncPlayerDataLoadEvent.java | 0 .../api/event/CustomBlockMineEvent.java | 0 .../api/event/CustomPlayerFishEvent.java | 0 .../api/event/LootChestSpawnEvent.java | 0 .../mmocore/api/event/MMOCommandEvent.java | 0 .../api/event/PlayerAttributeUseEvent.java | 0 .../api/event/PlayerChangeClassEvent.java | 0 .../mmocore/api/event/PlayerCombatEvent.java | 0 .../mmocore/api/event/PlayerDataEvent.java | 0 .../api/event/PlayerDataLoadEvent.java | 0 .../api/event/PlayerExperienceGainEvent.java | 0 .../api/event/PlayerKeyPressEvent.java | 0 .../mmocore/api/event/PlayerLevelUpEvent.java | 0 .../api/event/PlayerResourceUpdateEvent.java | 0 .../api/event/social/GuildChatEvent.java | 0 .../api/event/social/PartyChatEvent.java | 0 .../mmocore/api/load/DefaultMMOLoader.java | 0 .../Indyuce/mmocore/api/load/MMOLoader.java | 0 .../mmocore/api/player/CombatRunnable.java | 0 .../mmocore/api/player/OfflinePlayerData.java | 0 .../mmocore/api/player/PlayerActivity.java | 0 .../mmocore/api/player/PlayerData.java | 7 +- .../player/attribute/AttributeModifier.java | 0 .../api/player/attribute/PlayerAttribute.java | 0 .../player/attribute/PlayerAttributes.java | 0 .../api/player/profess/ClassOption.java | 0 .../api/player/profess/PlayerClass.java | 0 .../player/profess/SavedClassInformation.java | 0 .../mmocore/api/player/profess/Subclass.java | 0 .../player/profess/event/EventTrigger.java | 0 .../profess/event/EventTriggerHandler.java | 0 .../event/trigger/AttackEventTrigger.java | 0 .../event/trigger/BlockBrokenTrigger.java | 0 .../event/trigger/BlockPlacedTrigger.java | 0 .../trigger/ClassChosenEventTrigger.java | 0 .../event/trigger/LevelUpEventTrigger.java | 0 .../trigger/MultipleLevelUpEventTrigger.java | 0 .../profess/resource/ManaDisplayOptions.java | 0 .../profess/resource/PlayerResource.java | 0 .../resource/ResourceRegeneration.java | 0 .../api/player/social/FriendRequest.java | 0 .../mmocore/api/player/social/Request.java | 0 .../mmocore/api/player/stats/PlayerStats.java | 0 .../mmocore/api/player/stats/StatType.java | 0 .../mmocore/api/quest/ObjectiveProgress.java | 0 .../mmocore/api/quest/PlayerQuests.java | 0 .../net/Indyuce/mmocore/api/quest/Quest.java | 0 .../mmocore/api/quest/QuestProgress.java | 0 .../api/quest/objective/ClickonObjective.java | 0 .../api/quest/objective/GoToObjective.java | 0 .../api/quest/objective/KillMobObjective.java | 0 .../quest/objective/MineBlockObjective.java | 0 .../api/quest/objective/Objective.java | 0 .../api/quest/trigger/CommandTrigger.java | 0 .../api/quest/trigger/ExperienceTrigger.java | 0 .../api/quest/trigger/ItemTrigger.java | 0 .../api/quest/trigger/ManaTrigger.java | 0 .../api/quest/trigger/MessageTrigger.java | 0 .../api/quest/trigger/SoundTrigger.java | 0 .../api/quest/trigger/StaminaTrigger.java | 0 .../api/quest/trigger/StelliumTrigger.java | 0 .../mmocore/api/quest/trigger/Trigger.java | 0 .../Indyuce/mmocore/api/util/Closable.java | 0 .../mmocore/api/util/MMOCoreUtils.java | 0 .../api/util/debug/ActionBarRunnable.java | 0 .../mmocore/api/util/debug/DebugMode.java | 0 .../mmocore/api/util/input/AnvilGUI.java | 0 .../mmocore/api/util/input/ChatInput.java | 0 .../mmocore/api/util/input/PlayerInput.java | 0 .../Indyuce/mmocore/api/util/math/Line3D.java | 0 .../mmocore/api/util/math/VectorRotation.java | 0 .../api/util/math/format/DelayFormat.java | 0 .../util/math/formula/IntegerLinearValue.java | 0 .../api/util/math/formula/LinearValue.java | 0 .../api/util/math/formula/RandomAmount.java | 0 .../mmocore/command/AttributesCommand.java | 0 .../Indyuce/mmocore/command/ClassCommand.java | 0 .../mmocore/command/CommandVerbose.java | 0 .../mmocore/command/DepositCommand.java | 0 .../mmocore/command/FriendsCommand.java | 0 .../Indyuce/mmocore/command/GuildCommand.java | 0 .../command/MMOCoreCommandTreeRoot.java | 0 .../Indyuce/mmocore/command/PartyCommand.java | 0 .../mmocore/command/PlayerStatsCommand.java | 0 .../mmocore/command/QuestsCommand.java | 0 .../mmocore/command/SkillsCommand.java | 0 .../mmocore/command/WaypointsCommand.java | 0 .../mmocore/command/WithdrawCommand.java | 0 .../command/rpg/CoinsCommandTreeNode.java | 0 .../command/rpg/NoteCommandTreeNode.java | 0 .../command/rpg/ReloadCommandTreeNode.java | 0 .../rpg/admin/AdminCommandTreeNode.java | 0 .../rpg/admin/AttributeCommandTreeNode.java | 0 .../rpg/admin/ClassCommandTreeNode.java | 0 .../rpg/admin/ExperienceCommandTreeNode.java | 0 .../rpg/admin/ForceClassCommandTreeNode.java | 0 .../admin/HideActionBarCommandTreeNode.java | 0 .../rpg/admin/InfoCommandTreeNode.java | 0 .../rpg/admin/LevelCommandTreeNode.java | 0 .../rpg/admin/NoCooldownCommandTreeNode.java | 0 .../rpg/admin/PointsCommandTreeNode.java | 0 .../rpg/admin/ResetCommandTreeNode.java | 0 .../rpg/admin/ResourceCommandTreeNode.java | 0 .../rpg/booster/BoosterCommandTreeNode.java | 0 .../rpg/booster/CreateCommandTreeNode.java | 0 .../rpg/booster/ListCommandTreeNode.java | 0 .../rpg/booster/RemoveCommandTreeNode.java | 0 .../rpg/debug/DebugCommandTreeNode.java | 0 .../debug/StatModifiersCommandTreeNode.java | 0 .../rpg/debug/StatValueCommandTreeNode.java | 0 .../rpg/quest/CancelCommandTreeNode.java | 0 .../rpg/quest/FinishCommandTreeNode.java | 0 .../rpg/quest/QuestCommandTreeNode.java | 0 .../rpg/quest/StartCommandTreeNode.java | 0 .../rpg/waypoint/ItemCommandTreeNode.java | 0 .../rpg/waypoint/OpenCommandTreeNode.java | 0 .../rpg/waypoint/TeleportCommandTreeNode.java | 0 .../rpg/waypoint/UnlockCommandTreeNode.java | 0 .../waypoint/WaypointsCommandTreeNode.java | 0 .../comp/citizens/CitizenInteractEvent.java | 0 .../CitizenInteractEventListener.java | 0 .../comp/citizens/CitizensMMOLoader.java | 0 .../comp/citizens/GetItemObjective.java | 0 .../comp/citizens/TalktoCitizenObjective.java | 0 .../mmocore/comp/mythicmobs/MythicHook.java | 0 .../comp/mythicmobs/MythicMobsMMOLoader.java | 0 .../mythicmobs/load/CurrencyItemDrop.java | 0 .../comp/mythicmobs/load/GoldPouchDrop.java | 0 .../KillMythicFactionExperienceSource.java | 0 .../load/KillMythicFactionObjective.java | 0 .../load/KillMythicMobExperienceSource.java | 0 .../load/KillMythicMobObjective.java | 0 .../mythicmobs/load/MMDropTableDropItem.java | 0 .../mythicmobs/load/MythicSkillTrigger.java | 0 .../comp/placeholder/DefaultParser.java | 0 .../placeholder/PlaceholderAPIParser.java | 0 .../comp/placeholder/PlaceholderParser.java | 0 .../comp/placeholder/RPGPlaceholders.java | 0 .../comp/region/DefaultRegionHandler.java | 0 .../mmocore/comp/region/RegionCondition.java | 0 .../mmocore/comp/region/RegionHandler.java | 0 .../comp/region/WorldGuardMMOLoader.java | 0 .../comp/region/WorldGuardRegionHandler.java | 0 .../mmocore/comp/vault/MoneyTrigger.java | 0 .../mmocore/comp/vault/VaultEconomy.java | 0 .../mmocore/comp/vault/VaultMMOLoader.java | 0 .../Indyuce/mmocore/experience/Booster.java | 0 .../Indyuce/mmocore/experience/EXPSource.java | 0 .../Indyuce/mmocore/experience/ExpCurve.java | 0 .../mmocore/experience/ExperienceObject.java | 0 .../experience/ExperienceTableClaimer.java | 0 .../mmocore/experience/PlayerProfessions.java | 9 +- .../mmocore/experience/Profession.java | 0 .../experience/SimpleExperienceObject.java | 0 .../dispenser/ExperienceDispenser.java | 0 .../experience/droptable/ExperienceItem.java | 0 .../experience/droptable/ExperienceTable.java | 0 .../source/BrewPotionExperienceSource.java | 0 .../source/ClimbExperienceSource.java | 0 .../source/CraftItemExperienceSource.java | 0 .../source/DamageDealtExperienceSource.java | 0 .../source/DamageTakenExperienceSource.java | 6 +- .../source/EatExperienceSource.java | 0 .../source/EnchantItemExperienceSource.java | 0 .../source/FishItemExperienceSource.java | 0 .../source/KillMobExperienceSource.java | 0 .../source/MineBlockExperienceSource.java | 0 .../source/MoveExperienceSource.java | 0 .../source/PlaceBlockExperienceSource.java | 0 .../source/PlayExperienceSource.java | 0 .../source/ProjectileExperienceSource.java | 0 .../source/RepairItemExperienceSource.java | 0 .../source/ResourceExperienceSource.java | 6 +- .../source/RideExperienceSource.java | 0 .../source/SmeltItemExperienceSource.java | 0 .../source/TameExperienceSource.java | 0 .../source/type/ExperienceSource.java | 0 .../source/type/SpecificExperienceSource.java | 0 .../Indyuce/mmocore/gui/AttributeView.java | 0 .../mmocore/gui/ClassConfirmation.java | 0 .../net/Indyuce/mmocore/gui/ClassSelect.java | 0 .../net/Indyuce/mmocore/gui/PlayerStats.java | 0 .../net/Indyuce/mmocore/gui/QuestViewer.java | 0 .../net/Indyuce/mmocore/gui/SkillList.java | 0 .../mmocore/gui/SubclassConfirmation.java | 0 .../Indyuce/mmocore/gui/SubclassSelect.java | 0 .../Indyuce/mmocore/gui/WaypointViewer.java | 0 .../mmocore/gui/api/EditableInventory.java | 0 .../mmocore/gui/api/GeneratedInventory.java | 0 .../mmocore/gui/api/PluginInventory.java | 0 .../mmocore/gui/api/item/InventoryItem.java | 0 .../mmocore/gui/api/item/Placeholders.java | 0 .../gui/api/item/SimplePlaceholderItem.java | 0 .../mmocore/gui/api/item/TriggerItem.java | 0 .../Indyuce/mmocore/gui/eco/DepositMenu.java | 0 .../Indyuce/mmocore/gui/eco/GoldPouch.java | 0 .../gui/social/friend/EditableFriendList.java | 0 .../social/friend/EditableFriendRemoval.java | 0 .../gui/social/guild/EditableGuildAdmin.java | 0 .../social/guild/EditableGuildCreation.java | 0 .../gui/social/guild/EditableGuildView.java | 0 .../social/party/EditablePartyCreation.java | 0 .../gui/social/party/EditablePartyView.java | 0 .../Indyuce/mmocore/guild/AbstractGuild.java | 0 .../Indyuce/mmocore/guild/GuildModule.java | 0 .../mmocore/guild/GuildModuleType.java | 0 .../guild/compat/FactionsGuildModule.java | 0 .../guild/compat/GuildsGuildModule.java | 0 .../guild/compat/KingdomsXGuildModule.java | 0 .../compat/UltimateClansGuildModule.java | 0 .../Indyuce/mmocore/guild/provided/Guild.java | 0 .../mmocore/guild/provided/GuildInvite.java | 0 .../guild/provided/MMOCoreGuildModule.java | 0 .../mmocore/listener/BlockListener.java | 0 .../mmocore/listener/ClassTriggers.java | 0 .../mmocore/listener/GoldPouchesListener.java | 0 .../mmocore/listener/GuildListener.java | 0 .../listener/LootableChestsListener.java | 0 .../mmocore/listener/PlayerListener.java | 0 .../mmocore/listener/WaypointsListener.java | 0 .../bungee/GetMMOCorePlayerListener.java | 0 .../event/PlayerPressKeyListener.java | 0 .../listener/option/DeathExperienceLoss.java | 0 .../mmocore/listener/option/HotbarSwap.java | 0 .../mmocore/listener/option/NoSpawnerEXP.java | 0 .../listener/option/PlayerProfileCheck.java | 0 .../listener/option/RedirectVanillaExp.java | 0 .../option/VanillaExperienceOverride.java | 0 .../listener/profession/FishingListener.java | 0 .../profession/PlayerCollectStats.java | 0 .../net/Indyuce/mmocore/loot/LootBuilder.java | 0 .../loot/chest/ChestAlgorithmOptions.java | 0 .../Indyuce/mmocore/loot/chest/ChestTier.java | 0 .../Indyuce/mmocore/loot/chest/LootChest.java | 0 .../mmocore/loot/chest/LootChestRegion.java | 0 .../mmocore/loot/chest/RegionBounds.java | 0 .../mmocore/loot/chest/TierEffect.java | 0 .../loot/chest/condition/BiomeCondition.java | 0 .../loot/chest/condition/Condition.java | 0 .../chest/condition/ConditionInstance.java | 0 .../chest/condition/DistanceCondition.java | 0 .../loot/chest/condition/LevelCondition.java | 0 .../chest/condition/PermissionCondition.java | 0 .../loot/chest/condition/WorldCondition.java | 0 .../loot/chest/particle/CastingParticle.java | 0 .../chest/particle/ChestParticleEffect.java | 0 .../chest/particle/ParabolicProjectile.java | 0 .../loot/chest/particle/PotionParticles.java | 0 .../chest/particle/SmallParticleEffect.java | 0 .../mmocore/loot/droptable/DropTable.java | 0 .../loot/droptable/dropitem/DropItem.java | 0 .../droptable/dropitem/DropTableDropItem.java | 0 .../loot/droptable/dropitem/GoldDropItem.java | 0 .../loot/droptable/dropitem/NoteDropItem.java | 0 .../droptable/dropitem/VanillaDropItem.java | 0 .../dropitem/fishing/FishingDropItem.java | 0 .../mmocore/manager/AttributeManager.java | 0 .../Indyuce/mmocore/manager/ClassManager.java | 0 .../mmocore/manager/ConfigItemManager.java | 0 .../mmocore/manager/ConfigManager.java | 0 .../mmocore/manager/DropTableManager.java | 0 .../mmocore/manager/ExperienceManager.java | 0 .../mmocore/manager/InventoryManager.java | 0 .../mmocore/manager/LootChestManager.java | 0 .../mmocore/manager/MMOCoreManager.java | 0 .../mmocore/manager/MMOLoadManager.java | 0 .../Indyuce/mmocore/manager/QuestManager.java | 0 .../mmocore/manager/RestrictionManager.java | 0 .../Indyuce/mmocore/manager/SkillManager.java | 0 .../mmocore/manager/SkillTreeManager.java | 0 .../Indyuce/mmocore/manager/SoundManager.java | 0 .../Indyuce/mmocore/manager/StatManager.java | 0 .../mmocore/manager/WaypointManager.java | 0 .../mmocore/manager/data/DataProvider.java | 0 .../manager/data/GuildDataManager.java | 0 .../manager/data/PlayerDataManager.java | 0 .../manager/data/mysql/MySQLDataProvider.java | 2 +- .../data/mysql/MySQLPlayerDataManager.java | 260 ++++++++++++++ .../manager/data/mysql/MySQLTableEditor.java | 0 .../manager/data/yaml/YAMLDataProvider.java | 0 .../data/yaml/YAMLGuildDataManager.java | 0 .../data/yaml/YAMLOfflinePlayerData.java | 0 .../data/yaml/YAMLPlayerDataManager.java | 0 .../manager/profession/AlchemyManager.java | 0 .../profession/CustomBlockManager.java | 0 .../manager/profession/EnchantManager.java | 0 .../profession/ExperienceSourceManager.java | 0 .../manager/profession/FishingManager.java | 0 .../manager/profession/ProfessionManager.java | 0 .../manager/profession/SmithingManager.java | 0 .../profession/SpecificProfessionManager.java | 0 .../manager/registry/MMOCoreRegister.java | 0 .../manager/registry/RegisterObject.java | 0 .../manager/social/BoosterManager.java | 0 .../mmocore/manager/social/PartyManager.java | 0 .../manager/social/RequestManager.java | 0 .../Indyuce/mmocore/party/AbstractParty.java | 0 .../party/MMOCoreTargetRestriction.java | 0 .../Indyuce/mmocore/party/PartyModule.java | 0 .../mmocore/party/PartyModuleType.java | 0 .../party/compat/DungeonsPartyModule.java | 0 .../party/compat/DungeonsXLPartyModule.java | 0 .../party/compat/McMMOPartyModule.java | 0 .../mmocore/party/compat/PAFPartyModule.java | 0 .../party/compat/PartiesPartyModule.java | 0 .../party/provided/MMOCorePartyModule.java | 0 .../Indyuce/mmocore/party/provided/Party.java | 0 .../mmocore/party/provided/PartyInvite.java | 0 .../mmocore/party/provided/PartyListener.java | 0 .../Indyuce/mmocore/player/Unlockable.java | 0 .../player/playerclass/ClassTrigger.java | 0 .../player/playerclass/ClassTriggerType.java | 0 .../mmocore/player/stats/StatInfo.java | 0 .../Indyuce/mmocore/quest/AbstractQuest.java | 0 .../mmocore/quest/MMOCoreQuestModule.java | 0 .../mmocore/quest/PlayerQuestData.java | 0 .../mmocore/quest/QuestModuleType.java | 0 .../java/net/Indyuce/mmocore/quest/TODO.txt | 0 .../quest/compat/BeautyQuestsModule.java | 0 .../quest/compat/BlackVeinQuestsModule.java | 0 .../quest/compat/QuestCreatorModule.java | 0 .../mmocore/quest/compat/QuestModule.java | 0 .../Indyuce/mmocore/skill/CastableSkill.java | 0 .../net/Indyuce/mmocore/skill/ClassSkill.java | 0 .../mmocore/skill/RegisteredSkill.java | 0 .../Indyuce/mmocore/skill/cast/KeyCombo.java | 0 .../Indyuce/mmocore/skill/cast/PlayerKey.java | 0 .../skill/cast/SkillCastingHandler.java | 0 .../mmocore/skill/cast/SkillCastingMode.java | 0 .../skill/cast/listener/KeyCombos.java | 0 .../mmocore/skill/cast/listener/SkillBar.java | 0 .../skill/cast/listener/SkillScroller.java | 0 .../skill/custom/mechanic/ManaMechanic.java | 0 .../custom/mechanic/StaminaMechanic.java | 0 .../custom/mechanic/StelliumMechanic.java | 0 .../Indyuce/mmocore/skill/list/Ambers.java | 0 .../mmocore/skill/list/Neptune_Gift.java | 0 .../mmocore/skill/list/Sneaky_Picky.java | 0 .../mmocore/tree/IntegerCoordinates.java | 0 .../net/Indyuce/mmocore/tree/SkillTree.java | 0 .../Indyuce/mmocore/tree/SkillTreeNode.java | 0 .../tree/modifier/UnlockSkillModifier.java | 0 .../mmocore/util/HashableLocation.java | 0 .../util/item/AbstractItemBuilder.java | 0 .../Indyuce/mmocore/util/item/ConfigItem.java | 0 .../util/item/CurrencyItemBuilder.java | 0 .../mmocore/util/item/SimpleItemBuilder.java | 0 .../mmocore/util/item/SkillBookBuilder.java | 0 .../util/item/WaypointBookBuilder.java | 0 .../Indyuce/mmocore/waypoint/Waypoint.java | 0 .../mmocore/waypoint/WaypointOption.java | 0 .../mmocore/waypoint/WaypointPath.java | 0 .../src => src}/main/resources/config.yml | 0 .../main/resources/default/attributes.yml | 0 .../resources/default/classes/arcane-mage.yml | 0 .../main/resources/default/classes/human.yml | 0 .../main/resources/default/classes/mage.yml | 0 .../resources/default/classes/marksman.yml | 0 .../resources/default/classes/paladin.yml | 0 .../main/resources/default/classes/rogue.yml | 0 .../resources/default/classes/warrior.yml | 0 .../main/resources/default/commands.yml | 0 .../drop-tables/example-drop-tables.yml | 0 .../main/resources/default/exp-tables.yml | 0 .../resources/default/expcurves/levels.txt | 0 .../resources/default/expcurves/mining.txt | 0 .../resources/default/gui/attribute-view.yml | 0 .../resources/default/gui/class-confirm.yml | 0 .../resources/default/gui/class-select.yml | 0 .../resources/default/gui/friend-list.yml | 0 .../resources/default/gui/friend-removal.yml | 0 .../resources/default/gui/guild-creation.yml | 0 .../main/resources/default/gui/guild-view.yml | 0 .../resources/default/gui/party-creation.yml | 0 .../main/resources/default/gui/party-view.yml | 0 .../resources/default/gui/player-stats.yml | 0 .../main/resources/default/gui/quest-list.yml | 0 .../main/resources/default/gui/skill-list.yml | 0 .../default/gui/subclass-confirm.yml | 0 .../resources/default/gui/subclass-select.yml | 0 .../main/resources/default/gui/waypoints.yml | 0 .../main/resources/default/guilds.yml | 0 .../main/resources/default/items.yml | 0 .../main/resources/default/loot-chests.yml | 0 .../main/resources/default/messages.yml | 0 .../resources/default/professions/alchemy.yml | 0 .../default/professions/enchanting.yml | 0 .../resources/default/professions/farming.yml | 0 .../resources/default/professions/fishing.yml | 0 .../resources/default/professions/mining.yml | 0 .../default/professions/smelting.yml | 0 .../default/professions/smithing.yml | 0 .../default/professions/woodcutting.yml | 0 .../resources/default/quests/adv-begins.yml | 0 .../resources/default/quests/fetch-mango.yml | 0 .../resources/default/quests/tutorial.yml | 0 .../resources/default/recipes/brewing.yml | 0 .../resources/default/recipes/furnace.yml | 0 .../main/resources/default/restrictions.yml | 0 .../main/resources/default/skills/ambers.yml | 0 .../resources/default/skills/backstab.yml | 0 .../resources/default/skills/combo-attack.yml | 0 .../main/resources/default/skills/control.yml | 0 .../resources/default/skills/deep-wound.yml | 0 .../default/skills/empowered-attack.yml | 0 .../main/resources/default/skills/evade.yml | 0 .../default/skills/fire-berserker.yml | 0 .../resources/default/skills/fire-rage.yml | 0 .../resources/default/skills/fire-storm.yml | 0 .../resources/default/skills/fireball.yml | 0 .../default/skills/furtive-strike.yml | 0 .../default/skills/greater-healings.yml | 0 .../resources/default/skills/human-shield.yml | 0 .../resources/default/skills/ice-spikes.yml | 0 .../default/skills/minor-healings.yml | 0 .../resources/default/skills/neptune-gift.yml | 0 .../resources/default/skills/power-mark.yml | 0 .../resources/default/skills/sneaky-picky.yml | 0 .../resources/default/skills/telekinesy.yml | 0 .../main/resources/default/skills/warp.yml | 0 .../main/resources/default/skills/weaken.yml | 0 .../main/resources/default/sounds.yml | 0 .../main/resources/default/stats.yml | 0 .../main/resources/default/waypoints.yml | 0 .../src => src}/main/resources/plugin.yml | 0 449 files changed, 559 insertions(+), 844 deletions(-) delete mode 100644 bungee-plugin/pom.xml delete mode 100644 bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java delete mode 100644 bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java delete mode 100644 bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java delete mode 100644 bungee-plugin/src/main/resources/bungee.yml delete mode 100644 dist/pom.xml delete mode 100644 spigot-plugin/pom.xml delete mode 100644 spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/MMOCore.java (99%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/ConfigFile.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/ConfigMessage.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/SoundEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/SoundObject.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/block/BlockType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/PlayerData.java (99%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/social/Request.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/Quest.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/Closable.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/AttributesCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/ClassCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/CommandVerbose.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/DepositCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/FriendsCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/GuildCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/PartyCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/QuestsCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/SkillsCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/Booster.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/EXPSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/ExpCurve.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java (99%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/Profession.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java (92%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/MoveExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/PlaceBlockExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/PlayExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/ProjectileExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/ResourceExperienceSource.java (90%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/RideExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/type/ExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/experience/source/type/SpecificExperienceSource.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/AttributeView.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/ClassSelect.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/PlayerStats.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/QuestViewer.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/SkillList.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/WaypointViewer.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/PluginInventory.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/item/InventoryItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/item/SimplePlaceholderItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/eco/GoldPouch.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendRemoval.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildAdmin.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildCreation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/guild/EditableGuildView.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyCreation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/AbstractGuild.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/GuildModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/GuildModuleType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/compat/FactionsGuildModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/compat/GuildsGuildModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/compat/KingdomsXGuildModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/compat/UltimateClansGuildModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/provided/Guild.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/provided/GuildInvite.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/guild/provided/MMOCoreGuildModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/BlockListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/ClassTriggers.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/GoldPouchesListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/GuildListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/LootableChestsListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/PlayerListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/WaypointsListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/bungee/GetMMOCorePlayerListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/event/PlayerPressKeyListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/option/DeathExperienceLoss.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/option/HotbarSwap.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/option/VanillaExperienceOverride.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/listener/profession/PlayerCollectStats.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/LootBuilder.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/ChestAlgorithmOptions.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/ChestTier.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/LootChest.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/LootChestRegion.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/TierEffect.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/BiomeCondition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/Condition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/ConditionInstance.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/DistanceCondition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/LevelCondition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/PermissionCondition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/condition/WorldCondition.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/particle/CastingParticle.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/particle/ChestParticleEffect.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/particle/ParabolicProjectile.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/particle/PotionParticles.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/chest/particle/SmallParticleEffect.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropTableDropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/GoldDropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/NoteDropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/VanillaDropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/fishing/FishingDropItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/AttributeManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/ClassManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/ConfigItemManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/ConfigManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/DropTableManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/ExperienceManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/InventoryManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/LootChestManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/MMOCoreManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/QuestManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/RestrictionManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/SkillManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/SkillTreeManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/SoundManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/StatManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/WaypointManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/DataProvider.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/GuildDataManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java (97%) create mode 100644 src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/AbstractParty.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/PartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/PartyModuleType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/provided/Party.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/player/Unlockable.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/TODO.txt (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/CastableSkill.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/ClassSkill.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/list/Ambers.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/tree/SkillTree.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/HashableLocation.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java (100%) rename {spigot-plugin/src => src}/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java (100%) rename {spigot-plugin/src => src}/main/resources/config.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/attributes.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/arcane-mage.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/human.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/mage.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/marksman.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/paladin.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/rogue.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/classes/warrior.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/commands.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/drop-tables/example-drop-tables.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/exp-tables.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/expcurves/levels.txt (100%) rename {spigot-plugin/src => src}/main/resources/default/expcurves/mining.txt (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/attribute-view.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/class-confirm.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/class-select.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/friend-list.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/friend-removal.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/guild-creation.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/guild-view.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/party-creation.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/party-view.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/player-stats.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/quest-list.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/skill-list.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/subclass-confirm.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/subclass-select.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/gui/waypoints.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/guilds.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/items.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/loot-chests.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/messages.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/alchemy.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/enchanting.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/farming.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/fishing.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/mining.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/smelting.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/smithing.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/professions/woodcutting.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/quests/adv-begins.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/quests/fetch-mango.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/quests/tutorial.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/recipes/brewing.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/recipes/furnace.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/restrictions.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/ambers.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/backstab.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/combo-attack.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/control.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/deep-wound.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/empowered-attack.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/evade.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/fire-berserker.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/fire-rage.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/fire-storm.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/fireball.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/furtive-strike.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/greater-healings.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/human-shield.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/ice-spikes.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/minor-healings.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/neptune-gift.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/power-mark.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/sneaky-picky.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/telekinesy.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/warp.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/skills/weaken.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/sounds.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/stats.yml (100%) rename {spigot-plugin/src => src}/main/resources/default/waypoints.yml (100%) rename {spigot-plugin/src => src}/main/resources/plugin.yml (100%) diff --git a/.m2/settings.xml b/.m2/settings.xml index 84a53514..e962f923 100644 --- a/.m2/settings.xml +++ b/.m2/settings.xml @@ -4,6 +4,7 @@ nexus ${env.M2_REPO_USER} ${env.M2_REPO_PASS} + false lumine diff --git a/bungee-plugin/pom.xml b/bungee-plugin/pom.xml deleted file mode 100644 index 9cb7151a..00000000 --- a/bungee-plugin/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - MMOCore - net.Indyuce - ${revision} - - 4.0.0 - - bungee-plugin - - - 16 - 16 - - - - - - bungeecord-repo - https://oss.sonatype.org/content/repositories/snapshots - - - - - - - net.md-5 - bungeecord-api - 1.19-R0.1-SNAPSHOT - jar - provided - - - - - - \ No newline at end of file diff --git a/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java deleted file mode 100644 index 42e7daf2..00000000 --- a/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/Bungee.java +++ /dev/null @@ -1,50 +0,0 @@ -package fr.phoenix.mmocore.bungee; - -import net.md_5.bungee.api.plugin.Plugin; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.logging.Level; - -public class Bungee extends Plugin { - public static Bungee plugin; - public CacheManager cacheManager = new CacheManager(); - - @Override - public void onEnable() { - //Register a new communication channel - getProxy().registerChannel("give_mmocore_player"); - getProxy().registerChannel("get_mmocore_player"); - getProxy().getPluginManager().registerListener(this, new MessageListener()); - - - try { - getProxy().getLogger().log(Level.WARNING,"enabling socket"); - ServerSocket serverSocket= new ServerSocket(25580); - Socket clientSocket=serverSocket.accept(); - getProxy().getLogger().log(Level.WARNING,"port: "+clientSocket.getPort()); - - BufferedReader bufferedReader= new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); - String line; - while((line=bufferedReader.readLine())!=null) { - getProxy().getLogger().log(Level.WARNING,line); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - - } - - @Override - public void onDisable() { - - } - - @Override - public void onLoad() { - plugin = this; - } -} diff --git a/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java deleted file mode 100644 index c2c5e5b2..00000000 --- a/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/CacheManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.phoenix.mmocore.bungee; - -import java.util.HashMap; -import java.util.UUID; - -public class CacheManager { - private final HashMap cachedPlayers= new HashMap<>(); - - - public String getCachedPlayer(UUID uuid) { - return cachedPlayers.get(uuid); - } - public boolean hasCachedPlayer(UUID uuid) { - return cachedPlayers.containsKey(uuid); - } - - public void addCachedPlayer(UUID uuid,String playerData) { - cachedPlayers.put(uuid,playerData); - } - - - public void save() { - } -} diff --git a/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java b/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java deleted file mode 100644 index 67ff585c..00000000 --- a/bungee-plugin/src/main/java/fr/phoenix/mmocore/bungee/MessageListener.java +++ /dev/null @@ -1,60 +0,0 @@ -package fr.phoenix.mmocore.bungee; - -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.PluginMessageEvent; -import net.md_5.bungee.api.plugin.Listener; -import net.md_5.bungee.event.EventHandler; - -import java.io.*; -import java.util.UUID; - -public class MessageListener implements Listener { - - /** - * Used to register in the cached Players the data that is sent - */ - @EventHandler - public void onPluginMessage(PluginMessageEvent e) throws IOException { - - //When a server gives the player data - if (e.getTag().equals("give_mmocore_player")) { - - byte[] data = e.getData(); - ByteArrayInputStream in = new ByteArrayInputStream(e.getData()); - DataInputStream inputStream = new DataInputStream(in); - - UUID uuid = UUID.fromString(inputStream.readUTF()); - String jsonMsg = inputStream.readUTF(); - - //We put this data into the CacheManager - Bungee.plugin.cacheManager.addCachedPlayer(uuid,jsonMsg); - } - - - //When a server asks for the player data - if (e.getTag().equals("get_mmocore_player")) { - byte[] data = e.getData(); - ByteArrayInputStream in = new ByteArrayInputStream(e.getData()); - DataInputStream inputStream = new DataInputStream(in); - UUID uuid = UUID.fromString(inputStream.readUTF()); - - - - String response=Bungee.plugin.cacheManager.hasCachedPlayer(uuid)? - Bungee.plugin.cacheManager.getCachedPlayer(uuid):"{}"; - //We format the data corresponding to the player - ByteArrayOutputStream out=new ByteArrayOutputStream(); - DataOutputStream outputStream= new DataOutputStream(out); - outputStream.writeChars(response); - - //We get the corresponding player - ProxiedPlayer proxiedPlayer= Bungee.plugin.getProxy().getPlayer(uuid); - //We send the answer - proxiedPlayer.getServer().getInfo().sendData("get_mmocore_player",out.toByteArray()); - - - } - - } -} - diff --git a/bungee-plugin/src/main/resources/bungee.yml b/bungee-plugin/src/main/resources/bungee.yml deleted file mode 100644 index f7b9ea21..00000000 --- a/bungee-plugin/src/main/resources/bungee.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: MMOCore -main: fr.phoenix.mmocore.bungee.Bungee -author: PhoenixDevelopment diff --git a/dist/pom.xml b/dist/pom.xml deleted file mode 100644 index ffadb113..00000000 --- a/dist/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - MMOCore - net.Indyuce - ${revision} - - 4.0.0 - - dist - - - 16 - 16 - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - MMOCore-${revision} - ../target - - - - - - org.codehaus.mojo - flatten-maven-plugin - 1.2.2 - - true - - - - flatten - package - - flatten - - - - flatten.clean - clean - - clean - - - - - - - - - - - - net.Indyuce - bungee-plugin - ${revision} - - - - net.Indyuce - spigot-plugin - ${revision} - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 00718dc4..88c9f1ee 100644 --- a/pom.xml +++ b/pom.xml @@ -1,44 +1,286 @@ - 4.0.0 - net.Indyuce - MMOCore - pom - ${revision} - - bungee-plugin - spigot-plugin - dist - - MMOCore - Offer your players a brand new RPG experience!! + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + net.Indyuce + MMOCore + 1.9.3 + MMOCore + Offer your players a brand new RPG experience!! - - 1.9.3 - false - false - UTF-8 - UTF-8 - + + false + false + UTF-8 + UTF-8 + - - - - maven-clean-plugin - 3.1.0 - - - auto-clean - initialize - - clean - - - - - - + + + nexus + Lumine Releases + https://mvn.lumine.io/repository/maven-releases/ + + + nexus + Lumine Snapshots + https://mvn.lumine.io/repository/maven-snapshots/ + + + + + + ${project.name}-${project.version} + + + true + ${basedir}/src/main/resources/ + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + 9 + 9 + UTF-8 + -proc:none + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + false + + + + package + + shade + + + + + + + + + + + + lumine + https://mvn.lumine.io/repository/maven/ + + + + placeholderapi + https://repo.extendedclip.com/content/repositories/placeholderapi/ + + + + jitpack.io + https://jitpack.io + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + sk89q-repo + https://maven.enginehub.org/repo/ + + + + papermc + https://papermc.io/repo/repository/maven-public/ + + + + + + + + + org.spigotmc + spigot-1.17.1 + dev + provided + + + + + org.jetbrains + annotations + 19.0.0 + provided + + + + io.papermc + paperlib + 1.0.5 + + + + org.projectlombok + lombok + 1.18.20 + provided + + + + + io.lumine + MythicLib-dist + 1.3.1 + provided + + + + io.lumine + Mythic-Dist + 5.0.1 + provided + + + + me.clip + placeholderapi + 2.9.2 + provided + + + + com.github.MilkBowl + VaultAPI + 1.7 + provided + + + + com.sk89q.worldguard + worldguard-bukkit + 7.0.2-SNAPSHOT + provided + + + + net.citizensnpcs + Citizens + 2.0.25 + provided + + + + + de.simonsator + PartyAndFriends + 1.0.65 + provided + + + + com.alessiodp + Parties + 3.1.14 + provided + + + + com.gmail.nossr50 + mcMMO + 2.1.209 + provided + + + + de.erethon + DungeonsXL + 0.18-PRE-02 + provided + + + + org.denizen + Dungeons + 1.0 + provided + + + + + me.blackvein + Quests + 4.4.1-b340 + provided + + + fr.skytasul.quests + BeautyQuests + 0.19.5 + provided + + + com.guillaumevdn + QuestCreator + 6.39.0 + provided + + + com.guillaumevdn + GCore + 8.39.0 + provided + + + + + + com.massivecraft + Factions + 1.6.9.5-2.9.8-RC + provided + + + + me.ulrich + UltimateClans + 4.2.0 + provided + + + + me.glaremasters + Guilds + 3.5.6.0 + provided + + + + org.kingdoms.main + Kingdoms + 1.11.15.0.0.0.1.1 + provided + + + + + diff --git a/spigot-plugin/pom.xml b/spigot-plugin/pom.xml deleted file mode 100644 index 1798aa26..00000000 --- a/spigot-plugin/pom.xml +++ /dev/null @@ -1,255 +0,0 @@ - - - - MMOCore - net.Indyuce - ${revision} - - 4.0.0 - - spigot-plugin - - - 16 - 16 - - - - - - . - true - ${basedir}/src/main/resources/ - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - - 9 - 9 - UTF-8 - -proc:none - - - - - - - - - - phoenix - http://la-grange-evasion.pro.dns-orange.fr:8081/repository/maven-public/ - - - - nexus - https://mvn.lumine.io/repository/maven-public/ - - - - jitpack.io - https://jitpack.io - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - - sk89q-repo - https://maven.enginehub.org/repo/ - - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - - - - - - - org.spigotmc - spigot-1.17.1 - dev - provided - - - - - org.jetbrains - annotations - 19.0.0 - provided - - - - io.papermc - paperlib - 1.0.5 - - - - org.projectlombok - lombok - 1.18.20 - provided - - - - - io.lumine - MythicLib-dist - 1.3.1 - provided - - - - io.lumine - Mythic-Dist - 5.0.1 - provided - - - - me.clip - PlaceholderAPI - 2.11.1 - provided - - - - com.github.MilkBowl - VaultAPI - 1.7 - provided - - - - com.sk89q.worldguard - worldguard-bukkit - 7.0.2-SNAPSHOT - provided - - - - net.citizensnpcs - Citizens - 2.0.30-b2571 - provided - - - - - de.simonsator - PartyAndFriends - 1.0.65 - provided - - - - com.alessiodp - Parties - 3.1.14 - provided - - - - com.gmail.nossr50 - mcMMO - 2.1.209 - provided - - - - de.erethon - DungeonsXL - 0.18-PRE-02 - provided - - - - org.denizen - Dungeons - 1.0 - provided - - - - - me.blackvein - Quests - 4.4.1-b340 - provided - - - fr.skytasul.quests - BeautyQuests - 0.19.5 - provided - - - com.guillaumevdn - QuestCreator - 6.39.0 - provided - - - com.guillaumevdn - GCore - 8.39.0 - provided - - - - - - com.massivecraft - Factions - 1.6.9.5-2.9.8-RC - provided - - - - me.ulrich - UltimateClans - 4.2.0 - provided - - - - me.glaremasters - Guilds - 3.5.6.0 - provided - - - - org.kingdoms.main - Kingdoms - 1.11.15.0.0.0.1.1 - provided - - - - - - - \ No newline at end of file diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java deleted file mode 100644 index f8d77bba..00000000 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ /dev/null @@ -1,260 +0,0 @@ -package net.Indyuce.mmocore.manager.data.mysql; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import io.lumine.mythic.lib.MythicLib; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.OfflinePlayerData; -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.guild.provided.Guild; -import net.Indyuce.mmocore.manager.data.PlayerDataManager; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -import java.io.*; -import java.net.Socket; -import java.sql.SQLException; -import java.util.*; -import java.util.Map.Entry; -import java.util.logging.Level; -import java.util.stream.Collectors; - -import static net.Indyuce.mmocore.api.player.PlayerData.createClassInfoData; - -public class MySQLPlayerDataManager extends PlayerDataManager { - private final MySQLDataProvider provider; - - public MySQLPlayerDataManager(MySQLDataProvider provider) { - this.provider = provider; - } - - @Override - public void loadData(PlayerData data) { - provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + data.getUniqueId() + "';", (result) -> { - try { - MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); - - // Initialize custom resources - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat("MAX_MANA")); - data.setStamina(data.getStats().getStat("MAX_STAMINA")); - data.setStellium(data.getStats().getStat("MAX_STELLIUM")); - } - - if (!result.next()) { - data.setLevel(getDefaultData().getLevel()); - data.setClassPoints(getDefaultData().getClassPoints()); - data.setSkillPoints(getDefaultData().getSkillPoints()); - data.setAttributePoints(getDefaultData().getAttributePoints()); - data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints()); - data.setExperience(0); - data.getQuestData().updateBossBar(); - - data.setFullyLoaded(); - MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); - return; - } - - data.setClassPoints(result.getInt("class_points")); - data.setSkillPoints(result.getInt("skill_points")); - data.setAttributePoints(result.getInt("attribute_points")); - data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points")); - data.setLevel(result.getInt("level")); - data.setExperience(result.getInt("experience")); - if (!isEmpty(result.getString("class"))) - data.setClass(MMOCore.plugin.classManager.get(result.getString("class"))); - - if (!isEmpty(result.getString("times_claimed"))) { - JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); - json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); - } - - if (!isEmpty(result.getString("guild"))) { - Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild")); - data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); - } - if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes")); - if (!isEmpty(result.getString("professions"))) - data.getCollectionSkills().load(result.getString("professions")); - if (!isEmpty(result.getString("quests"))) data.getQuestData().load(result.getString("quests")); - data.getQuestData().updateBossBar(); - if (!isEmpty(result.getString("waypoints"))) - data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(result.getString("waypoints"))); - if (!isEmpty(result.getString("friends"))) - MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); - if (!isEmpty(result.getString("skills"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); - for (Entry entry : object.entrySet()) - data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); - } - if (!isEmpty(result.getString("bound_skills"))) - for (String skill : MMOCoreUtils.jsonArrayToList(result.getString("bound_skills"))) - if (data.getProfess().hasSkill(skill)) - data.getBoundSkills().add(data.getProfess().getSkill(skill)); - if (!isEmpty(result.getString("class_info"))) { - JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class); - for (Entry entry : object.entrySet()) { - try { - PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); - Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); - data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); - } - } - } - - //We now change the saved status to false because the data on SQL won't be the same as in the RAM - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); - - - data.setFullyLoaded(); - MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!"); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - - private boolean isEmpty(String s) { - return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); - } - - @Override - public void saveData(PlayerData data) { - - if (MMOCore.plugin.hasBungee) { - //Initialize a connection with bungee using Sockets - try { - Socket socket=new Socket("localhost",25580); - BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); - writer.write("BONJOUR"); - } catch (IOException e) { - throw new RuntimeException(e); - } - - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - DataOutputStream outStream = new DataOutputStream(out); - try { - outStream.writeChars(data.toJson()); - } catch (IOException e) { - MMOCore.plugin.getLogger().log(Level.SEVERE, "Couldn't send the data to Bungee for player " + data.getPlayer().getName()); - return; - } - MMOCore.plugin.getLogger().log(Level.WARNING, "BUNGEE"+ Bukkit.getOnlinePlayers().size()); - - - MMOCore.sqlDebug("Sent data to bungee for: " + data.getUniqueId()); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - - - } else { - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); - MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); - - sql.updateData("class_points", data.getClassPoints()); - sql.updateData("skill_points", data.getSkillPoints()); - sql.updateData("attribute_points", data.getAttributePoints()); - sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); - sql.updateData("level", data.getLevel()); - sql.updateData("experience", data.getExperience()); - sql.updateData("class", data.getProfess().getId()); - sql.updateData("last_login", data.getLastLogin()); - sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); - - sql.updateJSONArray("waypoints", data.getWaypoints()); - sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); - sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); - - sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); - sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); - - sql.updateData("attributes", data.getAttributes().toJsonString()); - sql.updateData("professions", data.getCollectionSkills().toJsonString()); - sql.updateData("quests", data.getQuestData().toJsonString()); - - sql.updateData("class_info", createClassInfoData(data).toString()); - - - MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); - - - } - } - - - @NotNull - @Override - public OfflinePlayerData getOffline(UUID uuid) { - return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); - } - - - public class MySQLOfflinePlayerData extends OfflinePlayerData { - private int level; - private long lastLogin; - private PlayerClass profess; - private List friends; - - public MySQLOfflinePlayerData(UUID uuid) { - super(uuid); - - provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { - try { - MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'."); - if (!result.next()) { - level = 0; - lastLogin = 0; - profess = MMOCore.plugin.classManager.getDefaultClass(); - friends = new ArrayList<>(); - MMOCore.sqlDebug("Default OFFLINE data loaded."); - } else { - level = result.getInt("level"); - lastLogin = result.getLong("last_login"); - profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class")); - if (!isEmpty(result.getString("friends"))) - MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str))); - else friends = new ArrayList<>(); - MMOCore.sqlDebug("Saved OFFLINE data loaded."); - } - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - - @Override - public void removeFriend(UUID uuid) { - friends.remove(uuid); - new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); - } - - @Override - public boolean hasFriend(UUID uuid) { - return friends.contains(uuid); - } - - @Override - public PlayerClass getProfess() { - return profess; - } - - @Override - public int getLevel() { - return level; - } - - @Override - public long getLastLogin() { - return lastLogin; - } - } -} diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java similarity index 99% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java rename to src/main/java/net/Indyuce/mmocore/MMOCore.java index 38c7df42..640aa437 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -351,8 +351,8 @@ public class MMOCore extends LuminePlugin { } MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); - getCommand("net/Indyuce/mmocore").setExecutor(mmoCoreCommand); - getCommand("net/Indyuce/mmocore").setTabCompleter(mmoCoreCommand); + getCommand("mmocore").setExecutor(mmoCoreCommand); + getCommand("mmocore").setTabCompleter(mmoCoreCommand); if (getConfig().getBoolean("auto-save.enabled")) { int autosave = getConfig().getInt("auto-save.interval") * 20; diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java b/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigFile.java rename to src/main/java/net/Indyuce/mmocore/api/ConfigFile.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java b/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java rename to src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java b/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java rename to src/main/java/net/Indyuce/mmocore/api/MMOCoreAPI.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java b/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java rename to src/main/java/net/Indyuce/mmocore/api/PlayerActionBar.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundEvent.java b/src/main/java/net/Indyuce/mmocore/api/SoundEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundEvent.java rename to src/main/java/net/Indyuce/mmocore/api/SoundEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundObject.java b/src/main/java/net/Indyuce/mmocore/api/SoundObject.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/SoundObject.java rename to src/main/java/net/Indyuce/mmocore/api/SoundObject.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java b/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java rename to src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java b/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/BlockType.java rename to src/main/java/net/Indyuce/mmocore/api/block/BlockType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java b/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java rename to src/main/java/net/Indyuce/mmocore/api/block/RegenInfo.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java b/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java rename to src/main/java/net/Indyuce/mmocore/api/block/SkullBlockType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java b/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java rename to src/main/java/net/Indyuce/mmocore/api/block/VanillaBlockType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java b/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java rename to src/main/java/net/Indyuce/mmocore/api/eco/Withdraw.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/AsyncPlayerDataLoadEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/LootChestSpawnEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/MMOCommandEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerAttributeUseEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerChangeClassEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerCombatEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerDataEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerDataLoadEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerExperienceGainEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerKeyPressEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerLevelUpEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/PlayerResourceUpdateEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/social/GuildChatEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java rename to src/main/java/net/Indyuce/mmocore/api/event/social/PartyChatEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java rename to src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java rename to src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java b/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java rename to src/main/java/net/Indyuce/mmocore/api/player/CombatRunnable.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java rename to src/main/java/net/Indyuce/mmocore/api/player/OfflinePlayerData.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java rename to src/main/java/net/Indyuce/mmocore/api/player/PlayerActivity.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java similarity index 99% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java rename to src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 52210361..7be781b5 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -637,6 +637,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc experience -= needed; level = getLevel() + 1; + + // Apply class experience table + if (getProfess().hasExperienceTable()) + getProfess().getExperienceTable().claim(this, level, getProfess()); } if (level > oldLevel) { @@ -648,9 +652,6 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc } getStats().updateStats(); - // Apply class experience table - if (getProfess().hasExperienceTable()) - getProfess().getExperienceTable().claim(this, level, getProfess()); } refreshVanillaExp(); diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java rename to src/main/java/net/Indyuce/mmocore/api/player/attribute/AttributeModifier.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java rename to src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttribute.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java rename to src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/SavedClassInformation.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/Subclass.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTriggerHandler.java diff --git a/spigot-plugin/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 similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/AttackEventTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockBrokenTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/BlockPlacedTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/ClassChosenEventTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/MultipleLevelUpEventTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ManaDisplayOptions.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/resource/PlayerResource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java rename to src/main/java/net/Indyuce/mmocore/api/player/profess/resource/ResourceRegeneration.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java b/src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java rename to src/main/java/net/Indyuce/mmocore/api/player/social/FriendRequest.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/Request.java b/src/main/java/net/Indyuce/mmocore/api/player/social/Request.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/social/Request.java rename to src/main/java/net/Indyuce/mmocore/api/player/social/Request.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java rename to src/main/java/net/Indyuce/mmocore/api/player/stats/PlayerStats.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java b/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java rename to src/main/java/net/Indyuce/mmocore/api/player/stats/StatType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java b/src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java rename to src/main/java/net/Indyuce/mmocore/api/quest/ObjectiveProgress.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java b/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java rename to src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/Quest.java b/src/main/java/net/Indyuce/mmocore/api/quest/Quest.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/Quest.java rename to src/main/java/net/Indyuce/mmocore/api/quest/Quest.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java b/src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java rename to src/main/java/net/Indyuce/mmocore/api/quest/QuestProgress.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java b/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java rename to src/main/java/net/Indyuce/mmocore/api/quest/objective/ClickonObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java b/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java rename to src/main/java/net/Indyuce/mmocore/api/quest/objective/GoToObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java b/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java rename to src/main/java/net/Indyuce/mmocore/api/quest/objective/KillMobObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java b/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java rename to src/main/java/net/Indyuce/mmocore/api/quest/objective/MineBlockObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java b/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java rename to src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/CommandTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/ExperienceTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/ItemTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/ManaTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/MessageTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/SoundTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/StaminaTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/StelliumTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java b/src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java rename to src/main/java/net/Indyuce/mmocore/api/quest/trigger/Trigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/Closable.java b/src/main/java/net/Indyuce/mmocore/api/util/Closable.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/Closable.java rename to src/main/java/net/Indyuce/mmocore/api/util/Closable.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java rename to src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java b/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java rename to src/main/java/net/Indyuce/mmocore/api/util/debug/ActionBarRunnable.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java b/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java rename to src/main/java/net/Indyuce/mmocore/api/util/debug/DebugMode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java b/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java rename to src/main/java/net/Indyuce/mmocore/api/util/input/AnvilGUI.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java b/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java rename to src/main/java/net/Indyuce/mmocore/api/util/input/ChatInput.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java b/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java rename to src/main/java/net/Indyuce/mmocore/api/util/input/PlayerInput.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java b/src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java rename to src/main/java/net/Indyuce/mmocore/api/util/math/Line3D.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java b/src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java rename to src/main/java/net/Indyuce/mmocore/api/util/math/VectorRotation.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java b/src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java rename to src/main/java/net/Indyuce/mmocore/api/util/math/format/DelayFormat.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java b/src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java rename to src/main/java/net/Indyuce/mmocore/api/util/math/formula/IntegerLinearValue.java diff --git a/spigot-plugin/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 similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java rename to src/main/java/net/Indyuce/mmocore/api/util/math/formula/LinearValue.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java b/src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java rename to src/main/java/net/Indyuce/mmocore/api/util/math/formula/RandomAmount.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java b/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java rename to src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java b/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java rename to src/main/java/net/Indyuce/mmocore/command/ClassCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java b/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java rename to src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java b/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java rename to src/main/java/net/Indyuce/mmocore/command/DepositCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java b/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java rename to src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java b/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java rename to src/main/java/net/Indyuce/mmocore/command/GuildCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java rename to src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java b/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java rename to src/main/java/net/Indyuce/mmocore/command/PartyCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java b/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java rename to src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java b/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java rename to src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java b/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java rename to src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java b/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java rename to src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java b/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java rename to src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/CoinsCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/NoteCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/ReloadCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/HideActionBarCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/InfoCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/BoosterCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/CreateCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/ListCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/booster/RemoveCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/debug/DebugCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatModifiersCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/debug/StatValueCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/quest/CancelCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/quest/FinishCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/quest/QuestCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/quest/StartCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/ItemCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/OpenCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/TeleportCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/UnlockCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/WaypointsCommandTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java b/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java rename to src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEvent.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java b/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java rename to src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java rename to src/main/java/net/Indyuce/mmocore/comp/citizens/CitizensMMOLoader.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java b/src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java rename to src/main/java/net/Indyuce/mmocore/comp/citizens/GetItemObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java b/src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java rename to src/main/java/net/Indyuce/mmocore/comp/citizens/TalktoCitizenObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionExperienceSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicFactionObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobObjective.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MMDropTableDropItem.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java rename to src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/MythicSkillTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java b/src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java rename to src/main/java/net/Indyuce/mmocore/comp/placeholder/DefaultParser.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java b/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java rename to src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderAPIParser.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java b/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java rename to src/main/java/net/Indyuce/mmocore/comp/placeholder/PlaceholderParser.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java rename to src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java b/src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java rename to src/main/java/net/Indyuce/mmocore/comp/region/DefaultRegionHandler.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java b/src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java rename to src/main/java/net/Indyuce/mmocore/comp/region/RegionCondition.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java b/src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java rename to src/main/java/net/Indyuce/mmocore/comp/region/RegionHandler.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java rename to src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java b/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java rename to src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardRegionHandler.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java b/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java rename to src/main/java/net/Indyuce/mmocore/comp/vault/MoneyTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java b/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java rename to src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java rename to src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Booster.java b/src/main/java/net/Indyuce/mmocore/experience/Booster.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Booster.java rename to src/main/java/net/Indyuce/mmocore/experience/Booster.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java b/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/EXPSource.java rename to src/main/java/net/Indyuce/mmocore/experience/EXPSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java b/src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java rename to src/main/java/net/Indyuce/mmocore/experience/ExpCurve.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java rename to src/main/java/net/Indyuce/mmocore/experience/ExperienceObject.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java rename to src/main/java/net/Indyuce/mmocore/experience/ExperienceTableClaimer.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java similarity index 99% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java rename to src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 9a364586..27015da0 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -209,6 +209,11 @@ public class PlayerProfessions { this.level.put(profession.getId(), level + 1); check = true; playerData.giveExperience(profession.getExperience().calculate(level), null); + + // Apply profession experience table + if (profession.hasExperienceTable()) + profession.getExperienceTable().claim(playerData, level, profession); + } if (check) { @@ -218,10 +223,6 @@ public class PlayerProfessions { .send(playerData.getPlayer()); MMOCore.plugin.soundManager.getSound(SoundEvent.LEVEL_UP).playTo(playerData.getPlayer()); playerData.getStats().updateStats(); - - // Apply profession experience table - if (profession.hasExperienceTable()) - profession.getExperienceTable().claim(playerData, level, profession); } StringBuilder bar = new StringBuilder("" + ChatColor.BOLD); diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/Profession.java rename to src/main/java/net/Indyuce/mmocore/experience/Profession.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java b/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java rename to src/main/java/net/Indyuce/mmocore/experience/SimpleExperienceObject.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java b/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java rename to src/main/java/net/Indyuce/mmocore/experience/dispenser/ExperienceDispenser.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java rename to src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java rename to src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/experience/source/ClimbExperienceSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/experience/source/CraftItemExperienceSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java similarity index 92% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java rename to src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java index aece97e4..538cfaa4 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/DamageTakenExperienceSource.java @@ -21,15 +21,15 @@ public class DamageTakenExperienceSource extends SpecificExperienceSource { + try { + if (result.next()) { + + //If the data couldn't be loaded for more than 2 seconds its probably due to a server crash and we load the old data + //If it the status is is_saved we load the data + if (System.currentTimeMillis() - startTime > 2000 || result.getInt("is_saved") == 1) { + MMOCore.sqlDebug("Time waited: " + (System.currentTimeMillis() - startTime)); + MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'..."); + + // Initialize custom resources + if (!data.hasUsedTemporaryData()) { + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); + } + + data.setClassPoints(result.getInt("class_points")); + data.setSkillPoints(result.getInt("skill_points")); + data.setAttributePoints(result.getInt("attribute_points")); + data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points")); + data.setLevel(result.getInt("level")); + data.setExperience(result.getInt("experience")); + if (!isEmpty(result.getString("class"))) + data.setClass(MMOCore.plugin.classManager.get(result.getString("class"))); + + if (!isEmpty(result.getString("times_claimed"))) { + JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); + json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt())); + } + + if (!isEmpty(result.getString("guild"))) { + Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild")); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); + } + if (!isEmpty(result.getString("attributes"))) + data.getAttributes().load(result.getString("attributes")); + if (!isEmpty(result.getString("professions"))) + data.getCollectionSkills().load(result.getString("professions")); + if (!isEmpty(result.getString("quests"))) + data.getQuestData().load(result.getString("quests")); + data.getQuestData().updateBossBar(); + if (!isEmpty(result.getString("waypoints"))) + data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(result.getString("waypoints"))); + if (!isEmpty(result.getString("friends"))) + MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str))); + if (!isEmpty(result.getString("skills"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); + for (Entry entry : object.entrySet()) + data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt()); + } + if (!isEmpty(result.getString("bound_skills"))) + for (String skill : MMOCoreUtils.jsonArrayToList(result.getString("bound_skills"))) + if (data.getProfess().hasSkill(skill)) + data.getBoundSkills().add(data.getProfess().getSkill(skill)); + if (!isEmpty(result.getString("class_info"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class); + for (Entry entry : object.entrySet()) { + try { + PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey()); + Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'"); + data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject())); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); + } + } + } + + //We now change the saved status to false because the data on SQL won't be the same as in the RAM + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + + //We set the saved status to false + sql.updateData("is_saved", 0); + this.cancel(); + data.setFullyLoaded(); + MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!"); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + } else { + MMOCore.sqlDebug("Failed to load data because is_saved is false."); + } + + } else { + data.setLevel(getDefaultData().getLevel()); + data.setClassPoints(getDefaultData().getClassPoints()); + data.setSkillPoints(getDefaultData().getSkillPoints()); + data.setAttributePoints(getDefaultData().getAttributePoints()); + data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints()); + data.setExperience(0); + data.getQuestData().updateBossBar(); + + data.setFullyLoaded(); + this.cancel(); + MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found."); + return; + } + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } + }; + + runnable.runTaskTimerAsynchronously(MMOCore.plugin, 0L, 10L); + + } + + + private boolean isEmpty(String s) { + return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); + } + + @Override + public void saveData(PlayerData data) { + + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); + + sql.updateData("class_points", data.getClassPoints()); + sql.updateData("skill_points", data.getSkillPoints()); + sql.updateData("attribute_points", data.getAttributePoints()); + sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); + sql.updateData("level", data.getLevel()); + sql.updateData("experience", data.getExperience()); + sql.updateData("class", data.getProfess().getId()); + sql.updateData("last_login", data.getLastLogin()); + sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); + + sql.updateJSONArray("waypoints", data.getWaypoints()); + sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); + sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); + + sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); + sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); + + sql.updateData("attributes", data.getAttributes().toJsonString()); + sql.updateData("professions", data.getCollectionSkills().toJsonString()); + sql.updateData("quests", data.getQuestData().toJsonString()); + + sql.updateData("class_info", createClassInfoData(data).toString()); + sql.updateData("is_saved", 1); + + MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + + + } + + + @NotNull + @Override + public OfflinePlayerData getOffline(UUID uuid) { + return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); + } + + + public class MySQLOfflinePlayerData extends OfflinePlayerData { + private int level; + private long lastLogin; + private PlayerClass profess; + private List friends; + + public MySQLOfflinePlayerData(UUID uuid) { + super(uuid); + + provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { + try { + MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'."); + if (!result.next()) { + level = 0; + lastLogin = 0; + profess = MMOCore.plugin.classManager.getDefaultClass(); + friends = new ArrayList<>(); + MMOCore.sqlDebug("Default OFFLINE data loaded."); + } else { + level = result.getInt("level"); + lastLogin = result.getLong("last_login"); + profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class")); + if (!isEmpty(result.getString("friends"))) + MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str))); + else friends = new ArrayList<>(); + MMOCore.sqlDebug("Saved OFFLINE data loaded."); + } + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } + + @Override + public void removeFriend(UUID uuid) { + friends.remove(uuid); + new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); + } + + @Override + public boolean hasFriend(UUID uuid) { + return friends.contains(uuid); + } + + @Override + public PlayerClass getProfess() { + return profess; + } + + @Override + public int getLevel() { + return level; + } + + @Override + public long getLastLogin() { + return lastLogin; + } + } +} + + diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java rename to src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java rename to src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLDataProvider.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java rename to src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLGuildDataManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java rename to src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLOfflinePlayerData.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java rename to src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/AlchemyManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/EnchantManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/ExperienceSourceManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/ProfessionManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/SmithingManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java rename to src/main/java/net/Indyuce/mmocore/manager/profession/SpecificProfessionManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java b/src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java rename to src/main/java/net/Indyuce/mmocore/manager/registry/MMOCoreRegister.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java b/src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java rename to src/main/java/net/Indyuce/mmocore/manager/registry/RegisterObject.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java rename to src/main/java/net/Indyuce/mmocore/manager/social/BoosterManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java rename to src/main/java/net/Indyuce/mmocore/manager/social/PartyManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java b/src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java rename to src/main/java/net/Indyuce/mmocore/manager/social/RequestManager.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/AbstractParty.java b/src/main/java/net/Indyuce/mmocore/party/AbstractParty.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/AbstractParty.java rename to src/main/java/net/Indyuce/mmocore/party/AbstractParty.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java b/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java rename to src/main/java/net/Indyuce/mmocore/party/MMOCoreTargetRestriction.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModule.java b/src/main/java/net/Indyuce/mmocore/party/PartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/PartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java b/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java rename to src/main/java/net/Indyuce/mmocore/party/PartyModuleType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java b/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/compat/DungeonsPartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java b/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/compat/DungeonsXLPartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java b/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/compat/McMMOPartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java b/src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/compat/PAFPartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java b/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/compat/PartiesPartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java b/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java rename to src/main/java/net/Indyuce/mmocore/party/provided/MMOCorePartyModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/Party.java b/src/main/java/net/Indyuce/mmocore/party/provided/Party.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/Party.java rename to src/main/java/net/Indyuce/mmocore/party/provided/Party.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java b/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java rename to src/main/java/net/Indyuce/mmocore/party/provided/PartyInvite.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java b/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java rename to src/main/java/net/Indyuce/mmocore/party/provided/PartyListener.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/Unlockable.java b/src/main/java/net/Indyuce/mmocore/player/Unlockable.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/player/Unlockable.java rename to src/main/java/net/Indyuce/mmocore/player/Unlockable.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java b/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java rename to src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java b/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java rename to src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTriggerType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java b/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java rename to src/main/java/net/Indyuce/mmocore/player/stats/StatInfo.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java b/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java rename to src/main/java/net/Indyuce/mmocore/quest/AbstractQuest.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java b/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java rename to src/main/java/net/Indyuce/mmocore/quest/MMOCoreQuestModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java b/src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java rename to src/main/java/net/Indyuce/mmocore/quest/PlayerQuestData.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java b/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java rename to src/main/java/net/Indyuce/mmocore/quest/QuestModuleType.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/TODO.txt b/src/main/java/net/Indyuce/mmocore/quest/TODO.txt similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/TODO.txt rename to src/main/java/net/Indyuce/mmocore/quest/TODO.txt diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java b/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java rename to src/main/java/net/Indyuce/mmocore/quest/compat/BeautyQuestsModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java b/src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java rename to src/main/java/net/Indyuce/mmocore/quest/compat/BlackVeinQuestsModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java b/src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java rename to src/main/java/net/Indyuce/mmocore/quest/compat/QuestCreatorModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java b/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java rename to src/main/java/net/Indyuce/mmocore/quest/compat/QuestModule.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java b/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java rename to src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java b/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java rename to src/main/java/net/Indyuce/mmocore/skill/ClassSkill.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java b/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java rename to src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java b/src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/KeyCombo.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java b/src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/PlayerKey.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java b/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingHandler.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java b/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/SkillCastingMode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/listener/KeyCombos.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java rename to src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java rename to src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java rename to src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java rename to src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java b/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java rename to src/main/java/net/Indyuce/mmocore/skill/list/Ambers.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java b/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java rename to src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java b/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java rename to src/main/java/net/Indyuce/mmocore/skill/list/Sneaky_Picky.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java b/src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java rename to src/main/java/net/Indyuce/mmocore/tree/IntegerCoordinates.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTree.java b/src/main/java/net/Indyuce/mmocore/tree/SkillTree.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTree.java rename to src/main/java/net/Indyuce/mmocore/tree/SkillTree.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java b/src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java rename to src/main/java/net/Indyuce/mmocore/tree/SkillTreeNode.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java b/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java rename to src/main/java/net/Indyuce/mmocore/tree/modifier/UnlockSkillModifier.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java b/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java rename to src/main/java/net/Indyuce/mmocore/util/HashableLocation.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java rename to src/main/java/net/Indyuce/mmocore/util/item/AbstractItemBuilder.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java b/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java rename to src/main/java/net/Indyuce/mmocore/util/item/ConfigItem.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java rename to src/main/java/net/Indyuce/mmocore/util/item/CurrencyItemBuilder.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java rename to src/main/java/net/Indyuce/mmocore/util/item/SimpleItemBuilder.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java rename to src/main/java/net/Indyuce/mmocore/util/item/SkillBookBuilder.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java b/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java rename to src/main/java/net/Indyuce/mmocore/util/item/WaypointBookBuilder.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java rename to src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java b/src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java rename to src/main/java/net/Indyuce/mmocore/waypoint/WaypointOption.java diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java b/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java similarity index 100% rename from spigot-plugin/src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java rename to src/main/java/net/Indyuce/mmocore/waypoint/WaypointPath.java diff --git a/spigot-plugin/src/main/resources/config.yml b/src/main/resources/config.yml similarity index 100% rename from spigot-plugin/src/main/resources/config.yml rename to src/main/resources/config.yml diff --git a/spigot-plugin/src/main/resources/default/attributes.yml b/src/main/resources/default/attributes.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/attributes.yml rename to src/main/resources/default/attributes.yml diff --git a/spigot-plugin/src/main/resources/default/classes/arcane-mage.yml b/src/main/resources/default/classes/arcane-mage.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/arcane-mage.yml rename to src/main/resources/default/classes/arcane-mage.yml diff --git a/spigot-plugin/src/main/resources/default/classes/human.yml b/src/main/resources/default/classes/human.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/human.yml rename to src/main/resources/default/classes/human.yml diff --git a/spigot-plugin/src/main/resources/default/classes/mage.yml b/src/main/resources/default/classes/mage.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/mage.yml rename to src/main/resources/default/classes/mage.yml diff --git a/spigot-plugin/src/main/resources/default/classes/marksman.yml b/src/main/resources/default/classes/marksman.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/marksman.yml rename to src/main/resources/default/classes/marksman.yml diff --git a/spigot-plugin/src/main/resources/default/classes/paladin.yml b/src/main/resources/default/classes/paladin.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/paladin.yml rename to src/main/resources/default/classes/paladin.yml diff --git a/spigot-plugin/src/main/resources/default/classes/rogue.yml b/src/main/resources/default/classes/rogue.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/rogue.yml rename to src/main/resources/default/classes/rogue.yml diff --git a/spigot-plugin/src/main/resources/default/classes/warrior.yml b/src/main/resources/default/classes/warrior.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/classes/warrior.yml rename to src/main/resources/default/classes/warrior.yml diff --git a/spigot-plugin/src/main/resources/default/commands.yml b/src/main/resources/default/commands.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/commands.yml rename to src/main/resources/default/commands.yml diff --git a/spigot-plugin/src/main/resources/default/drop-tables/example-drop-tables.yml b/src/main/resources/default/drop-tables/example-drop-tables.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/drop-tables/example-drop-tables.yml rename to src/main/resources/default/drop-tables/example-drop-tables.yml diff --git a/spigot-plugin/src/main/resources/default/exp-tables.yml b/src/main/resources/default/exp-tables.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/exp-tables.yml rename to src/main/resources/default/exp-tables.yml diff --git a/spigot-plugin/src/main/resources/default/expcurves/levels.txt b/src/main/resources/default/expcurves/levels.txt similarity index 100% rename from spigot-plugin/src/main/resources/default/expcurves/levels.txt rename to src/main/resources/default/expcurves/levels.txt diff --git a/spigot-plugin/src/main/resources/default/expcurves/mining.txt b/src/main/resources/default/expcurves/mining.txt similarity index 100% rename from spigot-plugin/src/main/resources/default/expcurves/mining.txt rename to src/main/resources/default/expcurves/mining.txt diff --git a/spigot-plugin/src/main/resources/default/gui/attribute-view.yml b/src/main/resources/default/gui/attribute-view.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/attribute-view.yml rename to src/main/resources/default/gui/attribute-view.yml diff --git a/spigot-plugin/src/main/resources/default/gui/class-confirm.yml b/src/main/resources/default/gui/class-confirm.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/class-confirm.yml rename to src/main/resources/default/gui/class-confirm.yml diff --git a/spigot-plugin/src/main/resources/default/gui/class-select.yml b/src/main/resources/default/gui/class-select.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/class-select.yml rename to src/main/resources/default/gui/class-select.yml diff --git a/spigot-plugin/src/main/resources/default/gui/friend-list.yml b/src/main/resources/default/gui/friend-list.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/friend-list.yml rename to src/main/resources/default/gui/friend-list.yml diff --git a/spigot-plugin/src/main/resources/default/gui/friend-removal.yml b/src/main/resources/default/gui/friend-removal.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/friend-removal.yml rename to src/main/resources/default/gui/friend-removal.yml diff --git a/spigot-plugin/src/main/resources/default/gui/guild-creation.yml b/src/main/resources/default/gui/guild-creation.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/guild-creation.yml rename to src/main/resources/default/gui/guild-creation.yml diff --git a/spigot-plugin/src/main/resources/default/gui/guild-view.yml b/src/main/resources/default/gui/guild-view.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/guild-view.yml rename to src/main/resources/default/gui/guild-view.yml diff --git a/spigot-plugin/src/main/resources/default/gui/party-creation.yml b/src/main/resources/default/gui/party-creation.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/party-creation.yml rename to src/main/resources/default/gui/party-creation.yml diff --git a/spigot-plugin/src/main/resources/default/gui/party-view.yml b/src/main/resources/default/gui/party-view.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/party-view.yml rename to src/main/resources/default/gui/party-view.yml diff --git a/spigot-plugin/src/main/resources/default/gui/player-stats.yml b/src/main/resources/default/gui/player-stats.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/player-stats.yml rename to src/main/resources/default/gui/player-stats.yml diff --git a/spigot-plugin/src/main/resources/default/gui/quest-list.yml b/src/main/resources/default/gui/quest-list.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/quest-list.yml rename to src/main/resources/default/gui/quest-list.yml diff --git a/spigot-plugin/src/main/resources/default/gui/skill-list.yml b/src/main/resources/default/gui/skill-list.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/skill-list.yml rename to src/main/resources/default/gui/skill-list.yml diff --git a/spigot-plugin/src/main/resources/default/gui/subclass-confirm.yml b/src/main/resources/default/gui/subclass-confirm.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/subclass-confirm.yml rename to src/main/resources/default/gui/subclass-confirm.yml diff --git a/spigot-plugin/src/main/resources/default/gui/subclass-select.yml b/src/main/resources/default/gui/subclass-select.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/subclass-select.yml rename to src/main/resources/default/gui/subclass-select.yml diff --git a/spigot-plugin/src/main/resources/default/gui/waypoints.yml b/src/main/resources/default/gui/waypoints.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/gui/waypoints.yml rename to src/main/resources/default/gui/waypoints.yml diff --git a/spigot-plugin/src/main/resources/default/guilds.yml b/src/main/resources/default/guilds.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/guilds.yml rename to src/main/resources/default/guilds.yml diff --git a/spigot-plugin/src/main/resources/default/items.yml b/src/main/resources/default/items.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/items.yml rename to src/main/resources/default/items.yml diff --git a/spigot-plugin/src/main/resources/default/loot-chests.yml b/src/main/resources/default/loot-chests.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/loot-chests.yml rename to src/main/resources/default/loot-chests.yml diff --git a/spigot-plugin/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/messages.yml rename to src/main/resources/default/messages.yml diff --git a/spigot-plugin/src/main/resources/default/professions/alchemy.yml b/src/main/resources/default/professions/alchemy.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/alchemy.yml rename to src/main/resources/default/professions/alchemy.yml diff --git a/spigot-plugin/src/main/resources/default/professions/enchanting.yml b/src/main/resources/default/professions/enchanting.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/enchanting.yml rename to src/main/resources/default/professions/enchanting.yml diff --git a/spigot-plugin/src/main/resources/default/professions/farming.yml b/src/main/resources/default/professions/farming.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/farming.yml rename to src/main/resources/default/professions/farming.yml diff --git a/spigot-plugin/src/main/resources/default/professions/fishing.yml b/src/main/resources/default/professions/fishing.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/fishing.yml rename to src/main/resources/default/professions/fishing.yml diff --git a/spigot-plugin/src/main/resources/default/professions/mining.yml b/src/main/resources/default/professions/mining.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/mining.yml rename to src/main/resources/default/professions/mining.yml diff --git a/spigot-plugin/src/main/resources/default/professions/smelting.yml b/src/main/resources/default/professions/smelting.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/smelting.yml rename to src/main/resources/default/professions/smelting.yml diff --git a/spigot-plugin/src/main/resources/default/professions/smithing.yml b/src/main/resources/default/professions/smithing.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/smithing.yml rename to src/main/resources/default/professions/smithing.yml diff --git a/spigot-plugin/src/main/resources/default/professions/woodcutting.yml b/src/main/resources/default/professions/woodcutting.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/professions/woodcutting.yml rename to src/main/resources/default/professions/woodcutting.yml diff --git a/spigot-plugin/src/main/resources/default/quests/adv-begins.yml b/src/main/resources/default/quests/adv-begins.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/quests/adv-begins.yml rename to src/main/resources/default/quests/adv-begins.yml diff --git a/spigot-plugin/src/main/resources/default/quests/fetch-mango.yml b/src/main/resources/default/quests/fetch-mango.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/quests/fetch-mango.yml rename to src/main/resources/default/quests/fetch-mango.yml diff --git a/spigot-plugin/src/main/resources/default/quests/tutorial.yml b/src/main/resources/default/quests/tutorial.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/quests/tutorial.yml rename to src/main/resources/default/quests/tutorial.yml diff --git a/spigot-plugin/src/main/resources/default/recipes/brewing.yml b/src/main/resources/default/recipes/brewing.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/recipes/brewing.yml rename to src/main/resources/default/recipes/brewing.yml diff --git a/spigot-plugin/src/main/resources/default/recipes/furnace.yml b/src/main/resources/default/recipes/furnace.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/recipes/furnace.yml rename to src/main/resources/default/recipes/furnace.yml diff --git a/spigot-plugin/src/main/resources/default/restrictions.yml b/src/main/resources/default/restrictions.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/restrictions.yml rename to src/main/resources/default/restrictions.yml diff --git a/spigot-plugin/src/main/resources/default/skills/ambers.yml b/src/main/resources/default/skills/ambers.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/ambers.yml rename to src/main/resources/default/skills/ambers.yml diff --git a/spigot-plugin/src/main/resources/default/skills/backstab.yml b/src/main/resources/default/skills/backstab.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/backstab.yml rename to src/main/resources/default/skills/backstab.yml diff --git a/spigot-plugin/src/main/resources/default/skills/combo-attack.yml b/src/main/resources/default/skills/combo-attack.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/combo-attack.yml rename to src/main/resources/default/skills/combo-attack.yml diff --git a/spigot-plugin/src/main/resources/default/skills/control.yml b/src/main/resources/default/skills/control.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/control.yml rename to src/main/resources/default/skills/control.yml diff --git a/spigot-plugin/src/main/resources/default/skills/deep-wound.yml b/src/main/resources/default/skills/deep-wound.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/deep-wound.yml rename to src/main/resources/default/skills/deep-wound.yml diff --git a/spigot-plugin/src/main/resources/default/skills/empowered-attack.yml b/src/main/resources/default/skills/empowered-attack.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/empowered-attack.yml rename to src/main/resources/default/skills/empowered-attack.yml diff --git a/spigot-plugin/src/main/resources/default/skills/evade.yml b/src/main/resources/default/skills/evade.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/evade.yml rename to src/main/resources/default/skills/evade.yml diff --git a/spigot-plugin/src/main/resources/default/skills/fire-berserker.yml b/src/main/resources/default/skills/fire-berserker.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/fire-berserker.yml rename to src/main/resources/default/skills/fire-berserker.yml diff --git a/spigot-plugin/src/main/resources/default/skills/fire-rage.yml b/src/main/resources/default/skills/fire-rage.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/fire-rage.yml rename to src/main/resources/default/skills/fire-rage.yml diff --git a/spigot-plugin/src/main/resources/default/skills/fire-storm.yml b/src/main/resources/default/skills/fire-storm.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/fire-storm.yml rename to src/main/resources/default/skills/fire-storm.yml diff --git a/spigot-plugin/src/main/resources/default/skills/fireball.yml b/src/main/resources/default/skills/fireball.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/fireball.yml rename to src/main/resources/default/skills/fireball.yml diff --git a/spigot-plugin/src/main/resources/default/skills/furtive-strike.yml b/src/main/resources/default/skills/furtive-strike.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/furtive-strike.yml rename to src/main/resources/default/skills/furtive-strike.yml diff --git a/spigot-plugin/src/main/resources/default/skills/greater-healings.yml b/src/main/resources/default/skills/greater-healings.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/greater-healings.yml rename to src/main/resources/default/skills/greater-healings.yml diff --git a/spigot-plugin/src/main/resources/default/skills/human-shield.yml b/src/main/resources/default/skills/human-shield.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/human-shield.yml rename to src/main/resources/default/skills/human-shield.yml diff --git a/spigot-plugin/src/main/resources/default/skills/ice-spikes.yml b/src/main/resources/default/skills/ice-spikes.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/ice-spikes.yml rename to src/main/resources/default/skills/ice-spikes.yml diff --git a/spigot-plugin/src/main/resources/default/skills/minor-healings.yml b/src/main/resources/default/skills/minor-healings.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/minor-healings.yml rename to src/main/resources/default/skills/minor-healings.yml diff --git a/spigot-plugin/src/main/resources/default/skills/neptune-gift.yml b/src/main/resources/default/skills/neptune-gift.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/neptune-gift.yml rename to src/main/resources/default/skills/neptune-gift.yml diff --git a/spigot-plugin/src/main/resources/default/skills/power-mark.yml b/src/main/resources/default/skills/power-mark.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/power-mark.yml rename to src/main/resources/default/skills/power-mark.yml diff --git a/spigot-plugin/src/main/resources/default/skills/sneaky-picky.yml b/src/main/resources/default/skills/sneaky-picky.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/sneaky-picky.yml rename to src/main/resources/default/skills/sneaky-picky.yml diff --git a/spigot-plugin/src/main/resources/default/skills/telekinesy.yml b/src/main/resources/default/skills/telekinesy.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/telekinesy.yml rename to src/main/resources/default/skills/telekinesy.yml diff --git a/spigot-plugin/src/main/resources/default/skills/warp.yml b/src/main/resources/default/skills/warp.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/warp.yml rename to src/main/resources/default/skills/warp.yml diff --git a/spigot-plugin/src/main/resources/default/skills/weaken.yml b/src/main/resources/default/skills/weaken.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/skills/weaken.yml rename to src/main/resources/default/skills/weaken.yml diff --git a/spigot-plugin/src/main/resources/default/sounds.yml b/src/main/resources/default/sounds.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/sounds.yml rename to src/main/resources/default/sounds.yml diff --git a/spigot-plugin/src/main/resources/default/stats.yml b/src/main/resources/default/stats.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/stats.yml rename to src/main/resources/default/stats.yml diff --git a/spigot-plugin/src/main/resources/default/waypoints.yml b/src/main/resources/default/waypoints.yml similarity index 100% rename from spigot-plugin/src/main/resources/default/waypoints.yml rename to src/main/resources/default/waypoints.yml diff --git a/spigot-plugin/src/main/resources/plugin.yml b/src/main/resources/plugin.yml similarity index 100% rename from spigot-plugin/src/main/resources/plugin.yml rename to src/main/resources/plugin.yml From f8f51e0f29d878e329b93e12ee83c89cbeeaf368 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sat, 2 Jul 2022 08:25:28 +0200 Subject: [PATCH 41/91] Shift Click Attribute View --- .../java/net/Indyuce/mmocore/gui/AttributeView.java | 12 +++++++----- .../java/net/Indyuce/mmocore/gui/SkillList.java | 13 +++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 63a356eb..4cd7409f 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -47,17 +47,19 @@ public class AttributeView extends EditableInventory { public static class AttributeItem extends InventoryItem { private final PlayerAttribute attribute; - private int shiftCost; + private int shiftCost=1; public AttributeItem(String function, ConfigurationSection config) { super(config); attribute = MMOCore.plugin.attributeManager .get(function.substring("attribute_".length()).toLowerCase().replace(" ", "-").replace("_", "-")); - shiftCost = config.getInt("shift-cost"); - if (shiftCost < 1) { - MMOCore.log(Level.WARNING, "Level up points cost must not be less than 1. Using default value: 1"); - shiftCost = 1; + if(config.contains("shift-cost")) { + shiftCost = config.getInt("shift-cost"); + if (shiftCost < 1) { + MMOCore.log(Level.WARNING, "Level up points cost must not be less than 1. Using default value: 1"); + shiftCost = 1; + } } } diff --git a/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java index 03507694..ee4393ea 100644 --- a/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java +++ b/spigot-plugin/src/main/java/net/Indyuce/mmocore/gui/SkillList.java @@ -225,15 +225,16 @@ public class SkillList extends EditableInventory { } public class UpgradeItem extends InventoryItem { - private int shiftCost; + private int shiftCost=1; public UpgradeItem(ConfigurationSection config) { super(config); - - this.shiftCost = config.getInt("shift-cost"); - if (shiftCost < 1) { - MMOCore.log(Level.WARNING, "Upgrade shift-cost cannot be less than 1. Using default value: 1"); - shiftCost = 1; + if(config.contains("shift-cost")) { + this.shiftCost = config.getInt("shift-cost"); + if (shiftCost < 1) { + MMOCore.log(Level.WARNING, "Upgrade shift-cost cannot be less than 1. Using default value: 1"); + shiftCost = 1; + } } } From e018836a6d390e967fd6fe73f07df3bc1efda91a Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 3 Jul 2022 10:10:11 +0200 Subject: [PATCH 42/91] Debug ExperienceTable --- src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java | 2 +- .../Indyuce/mmocore/experience/droptable/ExperienceItem.java | 5 +++-- .../mmocore/experience/droptable/ExperienceTable.java | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) 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 7be781b5..5b770865 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -936,7 +936,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 */ public boolean canChooseSubclass() { for (Subclass subclass : getProfess().getSubclasses()) diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index 1504c000..768dd678 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -5,6 +5,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import java.util.ArrayList; @@ -50,7 +51,7 @@ public class ExperienceItem { Validate.isTrue(config.contains("triggers")); id = config.getName(); - period = config.getInt("period", 0); + period = config.getInt("period", 1); firstTrigger = config.getInt("first-trigger", period); claimChance = config.getDouble("chance", 100) / 100; failReduction = config.getDouble("fail-reduction", 80) / 100; @@ -71,7 +72,7 @@ public class ExperienceItem { * account the randomness factor from the 'chance' parameter */ public boolean roll(int professionLevel, int timesCollected) { - int claimsRequired = professionLevel + 1 - (firstTrigger - timesCollected * period); + int claimsRequired = (professionLevel + 1 - (firstTrigger + (timesCollected) * period)); if (claimsRequired < 1) return false; diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java index e4dbd0d3..0866aa29 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceTable.java @@ -4,6 +4,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.ExperienceObject; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import java.util.ArrayList; @@ -44,6 +45,7 @@ public class ExperienceTable { */ public void claim(PlayerData levelingUp, int professionLevel, ExperienceObject object) { for (ExperienceItem item : items) { + int timesClaimed = levelingUp.getClaims(object, this, item); if (!item.roll(professionLevel, timesClaimed)) continue; From 7585ba243bd6e03b858594e10dc8498d0e7aa9b9 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 3 Jul 2022 10:48:05 +0200 Subject: [PATCH 43/91] PAPI support for Action Bar --- src/main/java/net/Indyuce/mmocore/gui/AttributeView.java | 5 +++++ .../java/net/Indyuce/mmocore/gui/api/EditableInventory.java | 1 + .../net/Indyuce/mmocore/skill/cast/listener/SkillBar.java | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 4cd7409f..6c041919 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -79,14 +79,19 @@ public class AttributeView extends EditableInventory { StatInfo info = StatInfo.valueOf(buff.getStat()); holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue())); + Bukkit.broadcastMessage(info.format(0.34)); + Bukkit.broadcastMessage((new DecimalFormat(null)==null)+""); }); + return holders; } } public class AttributeViewerInventory extends GeneratedInventory { + public AttributeViewerInventory(PlayerData playerData, EditableInventory editable) { super(playerData, editable); + } @Override 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 f650ba9d..5660ded8 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java @@ -40,6 +40,7 @@ public abstract class EditableInventory { this.slots = Math.min(Math.max(9, config.getInt("slots")), 54); Validate.isTrue((slots % 9) == 0, "Slots must be a multiple of 9"); + items.clear(); if (config.contains("items")) { Validate.notNull(config.getConfigurationSection("items"), "Could not load item list"); diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java index 46bac2f1..99329793 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java +++ b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java @@ -105,8 +105,7 @@ public class SkillBar implements Listener { "" + (j + 1 + (data.getPlayer().getInventory().getHeldItemSlot() <= j ? 1 : 0))) .replace("{skill}", data.getBoundSkill(j).getSkill().getName())); } - - return str.toString(); + return MMOCore.plugin.placeholderParser.parse(data.getPlayer(),str.toString()); } /** From aa51da55b259532c8f3dc7c796e7c2541c44edd1 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 3 Jul 2022 23:48:46 +0200 Subject: [PATCH 44/91] bon gros message de debug samer --- src/main/java/net/Indyuce/mmocore/gui/AttributeView.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 6c041919..88259091 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -79,8 +79,6 @@ public class AttributeView extends EditableInventory { StatInfo info = StatInfo.valueOf(buff.getStat()); holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue())); - Bukkit.broadcastMessage(info.format(0.34)); - Bukkit.broadcastMessage((new DecimalFormat(null)==null)+""); }); return holders; From b2ac30100a145314e0239e00b82a9cb0f5a54ff3 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 3 Jul 2022 23:55:14 +0200 Subject: [PATCH 45/91] Fixed an issue with global skill cd --- src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java b/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java index f3813ac6..dacfabe9 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java +++ b/src/main/java/net/Indyuce/mmocore/skill/CastableSkill.java @@ -82,7 +82,8 @@ public class CastableSkill extends Skill { casterData.giveStamina(-getModifier("stamina"), PlayerResourceUpdateEvent.UpdateReason.SKILL_COST); } - casterData.setLastActivity(PlayerActivity.CAST_SKILL); + if (!getTrigger().isPassive()) + casterData.setLastActivity(PlayerActivity.CAST_SKILL); } @Override From a4c0597dfa407f203a1429a6a7459e26e696f45a Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 4 Jul 2022 10:44:05 +0200 Subject: [PATCH 46/91] Small changes --- .../api/player/profess/PlayerClass.java | 29 +++++-------------- .../gui/social/party/EditablePartyView.java | 15 +++++----- .../mmocore/manager/ConfigManager.java | 4 +-- .../mmocore/skill/list/Neptune_Gift.java | 2 -- .../mmocore/util/HashableLocation.java | 3 +- src/main/resources/default/messages.yml | 2 +- 6 files changed, 21 insertions(+), 34 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 48246532..765b54e5 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -8,9 +8,6 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.util.PostLoadObject; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.experience.EXPSource; -import net.Indyuce.mmocore.skill.list.Ambers; -import net.Indyuce.mmocore.skill.list.Neptune_Gift; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.event.EventTrigger; import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions; @@ -18,6 +15,7 @@ import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.ExpCurve; import net.Indyuce.mmocore.experience.ExperienceObject; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; @@ -188,11 +186,12 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { } /** - * Used to generate the default Human class if no one is - * specified after loading all the player classes. This is - * a very basic class that will make sure MMOCore can still - * continue to run without having to stop the server because - * some option was not provided + * Used to generate the default Human class if no one is specified + * after loading all the player classes. + *

+ * This is a very basic class that will make sure MMOCore can still + * continue to run without having to stop the server because some + * option was not provided. */ public PlayerClass(String id, String name, Material material) { super(null); @@ -371,19 +370,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return getSkill(skill.getHandler().getId()); } - /** - * Reduces map checkups when skills are being checked on events that are - * commonly called like EntityDamageEvent or regen events. - *

- * Examples: - * - {@link Neptune_Gift} - * - {@link Ambers} - */ - public Optional findSkill(RegisteredSkill skill) { - ClassSkill found = skills.get(skill.getHandler().getId()); - return found == null ? Optional.empty() : Optional.of(found); - } - @Nullable public ClassSkill getSkill(String id) { return skills.get(id); @@ -404,6 +390,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return obj instanceof PlayerClass && ((PlayerClass) obj).id.equals(id); } + @Nullable public String getActionBar() { return actionBarFormat; } diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java b/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java index e15d038a..ec740dcd 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/social/party/EditablePartyView.java @@ -1,14 +1,14 @@ package net.Indyuce.mmocore.gui.social.party; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.util.input.PlayerInput; -import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.input.PlayerInput; import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.gui.api.GeneratedInventory; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.party.provided.Party; import org.apache.commons.lang.Validate; import org.bukkit.*; @@ -148,7 +148,7 @@ public class EditablePartyView extends EditableInventory { return; } - MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.PARTY_INVITE, (input) -> { + MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.PARTY_INVITE, input -> { Player target = Bukkit.getPlayer(input); if (target == null) { MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player); @@ -172,8 +172,9 @@ public class EditablePartyView extends EditableInventory { return; } - if (Math.abs(targetData.getLevel() - party.getLevel()) > MMOCore.plugin.configManager.maxPartyLevelDifference) { - MMOCore.plugin.configManager.getSimpleMessage("high-level-difference", "player", target.getName()).send(player); + int levelDifference = Math.abs(targetData.getLevel() - party.getLevel()); + if (levelDifference > MMOCore.plugin.configManager.maxPartyLevelDifference) { + MMOCore.plugin.configManager.getSimpleMessage("high-level-difference", "player", target.getName(), "diff", String.valueOf(levelDifference)).send(player); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); open(); return; diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index c9ca4bbf..4cf47a9f 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -92,7 +92,7 @@ public class ConfigManager { commandVerbose.reload(MMOCore.plugin.getConfig().getConfigurationSection("command-verbose")); messages = new ConfigFile("messages").getConfig(); - chatInput = MMOCore.plugin.getConfig().getBoolean("use-chat-input"); + chatInput = true; // MMOCore.plugin.getConfig().getBoolean("use-chat-input") partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix"); combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer") * 1000L; lootChestExpireTime = Math.max(MMOCore.plugin.getConfig().getInt("loot-chests.chest-expire-time"), 1) * 20; @@ -147,7 +147,7 @@ public class ConfigManager { } public SimpleMessage getSimpleMessage(String key, String... placeholders) { - String format = messages.getString(key, ""); + String format = messages.getString(key, "{MessageNotFound:\"" + key + "\"}"); for (int j = 0; j < placeholders.length - 1; j += 2) format = format.replace("{" + placeholders[j] + "}", placeholders[j + 1]); return new SimpleMessage(MythicLib.plugin.parseColors(format)); diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java b/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java index bf45e0f4..71c036f3 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java +++ b/src/main/java/net/Indyuce/mmocore/skill/list/Neptune_Gift.java @@ -5,7 +5,6 @@ import io.lumine.mythic.lib.skill.SkillMetadata; import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.result.def.SimpleSkillResult; import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent; -import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -29,7 +28,6 @@ public class Neptune_Gift extends SkillHandler implements Lis @EventHandler public void a(PlayerResourceUpdateEvent event) { - PlayerData data = event.getData(); if (event.getPlayer().getLocation().getBlock().getType() == Material.WATER) { PassiveSkill skill = event.getData().getMMOPlayerData().getPassiveSkillMap().getSkill(this); if (skill == null) diff --git a/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java b/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java index 0ef2336e..1bc63bd6 100644 --- a/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java +++ b/src/main/java/net/Indyuce/mmocore/util/HashableLocation.java @@ -2,6 +2,7 @@ package net.Indyuce.mmocore.util; import org.bukkit.Location; import org.bukkit.World; +import org.jetbrains.annotations.NotNull; import java.util.Objects; @@ -9,7 +10,7 @@ public class HashableLocation { private final World world; private final int x, y, z; - public HashableLocation(Location loc) { + public HashableLocation(@NotNull Location loc) { this.world = loc.getWorld(); this.x = loc.getBlockX(); this.y = loc.getBlockY(); diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index 5ff5d69a..aed2994b 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -118,7 +118,7 @@ party-joined-other: '&6{player}&e joined your party!' transfer-party-ownership: '&eYou were transfered the party ownership.' kick-from-party: '&eYou successfully kicked &6{player}&e.' party-invite-cooldown: '&cPlease wait {cooldown} before inviting {player}.' -high-level-difference: '&cYou cannot invite {player} as the level difference is too high.' +high-level-difference: '&cYou cannot invite {player} as the level difference is too high ({diff}).' # Guilds guild-chat: '&a[{tag}] {player}: {message}' From 2f85b39083c6fb05f4f75da8927e5f59d5cefed0 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 4 Jul 2022 12:11:50 +0200 Subject: [PATCH 47/91] Fixed default messages --- src/main/resources/default/messages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index aed2994b..f15c0711 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -110,7 +110,7 @@ already-in-party: '&c{player} is already in your party.' party-invite: - '{"text":""}' - '{"text":"&6{player} &ehas invited you to their party!"}' -- '[{"text":" ","hoverEvent":{}},{"text":"&8[&a&lACCEPT&8]","clickEvent":{"action":"run_command","value":"/party accept {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to accept!"}},{"text":"&r ","hoverEvent":{}},{"text":"&8[&c&lDENY&8]","clickEvent":{"action":"run_command","value":"/party deny {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to deny."}}]' +- '[{"text":" "},{"text":"&8[&a&lACCEPT&8]","clickEvent":{"action":"run_command","value":"/party accept {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to accept!"}},{"text":"&r "},{"text":"&8[&c&lDENY&8]","clickEvent":{"action":"run_command","value":"/party deny {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to deny."}}]' - '{"text":""}' party-is-full: '&cSorry, your party is full.' party-joined: '&eYou successfully joined &6{owner}&e''s party.' @@ -127,7 +127,7 @@ already-in-guild: '&c{player} is already in your guild.' guild-invite: - '{"text":""}' - '{"text":"&6{player} &ehas invited you to their guild!"}' -- '[{"text":" ","hoverEvent":{}},{"text":"&8[&a&lACCEPT&8]","clickEvent":{"action":"run_command","value":"/guild accept {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to accept!"}},{"text":"&r ","hoverEvent":{}},{"text":"&8[&c&lDENY&8]","clickEvent":{"action":"run_command","value":"/guild deny {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to deny."}}]' +- '[{"text":" "},{"text":"&8[&a&lACCEPT&8]","clickEvent":{"action":"run_command","value":"/guild accept {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to accept!"}},{"text":"&r "},{"text":"&8[&c&lDENY&8]","clickEvent":{"action":"run_command","value":"/guild deny {uuid}"},"hoverEvent":{"action":"show_text","value":"&eClick to deny."}}]' - '{"text":""}' #guild-is-full: '&cSorry, your guild is full.' -Unused right now guild-joined: '&eYou successfully joined &6{owner}&e''s guild.' From 80b0455fedb379e1cd9c0bba6d87fb394e86c24b Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 4 Jul 2022 12:32:13 +0200 Subject: [PATCH 48/91] Fixed basalt generators --- pom.xml | 2 +- src/main/java/net/Indyuce/mmocore/MMOCore.java | 2 +- .../java/net/Indyuce/mmocore/listener/BlockListener.java | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 88c9f1ee..33a0560b 100644 --- a/pom.xml +++ b/pom.xml @@ -149,7 +149,7 @@ io.lumine MythicLib-dist - 1.3.1 + 1.3.3 provided diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 99a62ed3..6445637d 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -107,7 +107,7 @@ public class MMOCore extends LuminePlugin { public boolean shouldDebugSQL, hasBungee; - private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7; + private static final int MYTHICLIB_COMPATIBILITY_INDEX = 8; public MMOCore() { plugin = this; diff --git a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java index aee6211b..3b8d720c 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.listener; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.utils.Schedulers; import net.Indyuce.mmocore.MMOCore; @@ -184,9 +185,9 @@ public class BlockListener implements Listener { } } - /* - * Allows to mark cobblestone generated by cobblestone generators so that - * exp is not gained by these blocks + /** + * Allows to mark cobblestone generated by cobblestone generators + * so that experience is not gained by these blocks */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void cobblestoneGeneratorHandling(BlockFormEvent event) { @@ -195,7 +196,7 @@ public class BlockListener implements Listener { if (MMOCore.plugin.configManager.cobbleGeneratorXP) return; if (event.getBlock().getType() == Material.WATER || event.getBlock().getType() == Material.LAVA) - if (event.getNewState().getType() == Material.COBBLESTONE || event.getNewState().getType() == Material.OBSIDIAN) + if (MythicLib.plugin.getVersion().getWrapper().isGeneratorOutput(event.getNewState().getType())) event.getNewState().setMetadata("player_placed", new FixedMetadataValue(MMOCore.plugin, true)); } From f679551b9955990f121c0115c9a12ae313be7382 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 4 Jul 2022 12:55:05 +0200 Subject: [PATCH 49/91] Fixed shift click profile check --- .../net/Indyuce/mmocore/gui/PlayerStats.java | 513 +++++++++--------- .../mmocore/gui/api/GeneratedInventory.java | 2 +- .../listener/option/PlayerProfileCheck.java | 11 +- 3 files changed, 265 insertions(+), 261 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 481c7267..16bbd451 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -5,18 +5,18 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; +import net.Indyuce.mmocore.api.util.math.format.DelayFormat; +import net.Indyuce.mmocore.experience.Booster; +import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.player.stats.StatInfo; -import net.Indyuce.mmocore.api.util.math.format.DelayFormat; -import net.Indyuce.mmocore.experience.Booster; -import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.party.AbstractParty; +import net.Indyuce.mmocore.player.stats.StatInfo; import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.configuration.ConfigurationSection; @@ -28,310 +28,323 @@ import org.bukkit.inventory.meta.SkullMeta; import java.util.Objects; public class PlayerStats extends EditableInventory { - public PlayerStats() { - super("player-stats"); - } + public PlayerStats() { + super("player-stats"); + } - @Override - public InventoryItem load(String function, ConfigurationSection config) { + @Override + public InventoryItem load(String function, ConfigurationSection config) { - if (function.equals("boost")) - return new BoostItem(config); + if (function.equals("boost")) + return new BoostItem(config); - if (function.equals("boost-next")) - return new SimplePlaceholderItem(config) { + if (function.equals("boost-next")) + return new SimplePlaceholderItem(config) { - @Override - public boolean hasDifferentDisplay() { - return true; - } + @Override + public boolean hasDifferentDisplay() { + return true; + } - @Override - public boolean canDisplay(PlayerStatsInventory inv) { - InventoryItem boost = inv.getByFunction("boost"); - return boost != null && inv.boostOffset + boost.getSlots().size() < MMOCore.plugin.boosterManager.getActive().size(); - } - }; + @Override + public boolean canDisplay(PlayerStatsInventory inv) { + InventoryItem boost = inv.getByFunction("boost"); + return boost != null && inv.boostOffset + boost.getSlots().size() < MMOCore.plugin.boosterManager.getActive().size(); + } + }; - if (function.equals("boost-previous")) - return new SimplePlaceholderItem(config) { + if (function.equals("boost-previous")) + return new SimplePlaceholderItem(config) { - @Override - public boolean canDisplay(PlayerStatsInventory inv) { - return inv.boostOffset > 0; - } - }; + @Override + public boolean canDisplay(PlayerStatsInventory inv) { + return inv.boostOffset > 0; + } + }; - if (function.equals("party")) - return new PartyMoraleItem(config); + if (function.equals("party")) + return new PartyMoraleItem(config); - if (function.startsWith("profession_")) { - String id = function.substring("profession_".length()).toLowerCase(); - Validate.isTrue(MMOCore.plugin.professionManager.has(id)); - Profession profession = MMOCore.plugin.professionManager.get(id); + if (function.startsWith("profession_")) { + String id = function.substring("profession_".length()).toLowerCase(); + Validate.isTrue(MMOCore.plugin.professionManager.has(id)); + Profession profession = MMOCore.plugin.professionManager.get(id); - return new InventoryItem(config) { + return new InventoryItem(config) { - @Override - public boolean hasDifferentDisplay() { - return true; - } + @Override + public boolean hasDifferentDisplay() { + return true; + } - @Override - public Placeholders getPlaceholders(GeneratedInventory inv, int n) { + @Override + public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { - Placeholders holders = new Placeholders(); - net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.getPlayerData().getStats(); + Placeholders holders = new Placeholders(); + net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.target.getStats(); - double ratio = inv.getPlayerData().getCollectionSkills().getExperience(profession) - / (double) inv.getPlayerData().getCollectionSkills().getLevelUpExperience(profession); + double ratio = inv.target.getCollectionSkills().getExperience(profession) + / (double) inv.target.getCollectionSkills().getLevelUpExperience(profession); - String bar = "" + ChatColor.BOLD; - int chars = (int) (ratio * 20); - for (int j = 0; j < 20; j++) - bar += (j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "") + "|"; + String bar = "" + ChatColor.BOLD; + int chars = (int) (ratio * 20); + for (int j = 0; j < 20; j++) + bar += (j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "") + "|"; - // holders.register("profession", type.getName()); - holders.register("progress", bar); - holders.register("level", "" + inv.getPlayerData().getCollectionSkills().getLevel(profession)); - holders.register("xp", inv.getPlayerData().getCollectionSkills().getExperience(profession)); - holders.register("percent", decimal.format(ratio * 100)); - for (StatInfo stat : MMOCore.plugin.statManager.getLoaded()) - if (Objects.equals(stat.profession, profession)) - holders.register(stat.name.toLowerCase(), stat.format(stats.getStat(stat.name))); + // holders.register("profession", type.getName()); + holders.register("progress", bar); + holders.register("level", "" + inv.target.getCollectionSkills().getLevel(profession)); + holders.register("xp", inv.target.getCollectionSkills().getExperience(profession)); + holders.register("percent", decimal.format(ratio * 100)); + for (StatInfo stat : MMOCore.plugin.statManager.getLoaded()) + if (Objects.equals(stat.profession, profession)) + holders.register(stat.name.toLowerCase(), stat.format(stats.getStat(stat.name))); - return holders; - } - }; - } + return holders; + } + }; + } - if (function.equals("profile")) - return new PlayerProfileItem(config); + if (function.equals("profile")) + return new PlayerProfileItem(config); - if (function.equals("stats")) - return new InventoryItem(config) { + if (function.equals("stats")) + return new InventoryItem(config) { - @Override - public boolean hasDifferentDisplay() { - return true; - } + @Override + public boolean hasDifferentDisplay() { + return true; + } - @Override - public Placeholders getPlaceholders(GeneratedInventory inv, int n) { - return new Placeholders() { - final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.getPlayerData().getStats(); + @Override + public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { + return new Placeholders() { + final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.target.getStats(); - public String apply(Player player, String str) { - while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { - String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); - String replaced; + public String apply(Player player, String str) { + while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { + String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); + String replaced; - if (holder.endsWith("_base")) { - StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); - replaced = info.format(stats.getBase(info.name)); - } else if (holder.endsWith("_extra")) { - StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); - replaced = info.format(stats.getStat(info.name) - stats.getBase(info.name)); - } else if (holder.startsWith("attribute_")) { - PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase()); - replaced = String.valueOf(inv.getPlayerData().getAttributes().getAttribute(attr)); - } else { - StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder)); - replaced = info.format(stats.getStat(info.name)); - } + if (holder.endsWith("_base")) { + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); + replaced = info.format(stats.getBase(info.name)); + } else if (holder.endsWith("_extra")) { + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); + replaced = info.format(stats.getStat(info.name) - stats.getBase(info.name)); + } else if (holder.startsWith("attribute_")) { + PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase()); + replaced = String.valueOf(inv.target.getAttributes().getAttribute(attr)); + } else { + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder)); + replaced = info.format(stats.getStat(info.name)); + } - str = str.replace("{" + holder + "}", replaced); - } + str = str.replace("{" + holder + "}", replaced); + } - // External placeholders - return MMOCore.plugin.placeholderParser.parse(player, str); - } - }; - } - }; + // External placeholders + return MMOCore.plugin.placeholderParser.parse(player, str); + } + }; + } + }; - return new SimplePlaceholderItem(config); - } + return new SimplePlaceholderItem(config); + } - public PlayerStatsInventory newInventory(PlayerData data) { - return new PlayerStatsInventory(data, this); - } + public PlayerStatsInventory newInventory(PlayerData invTarget, PlayerData opening) { + return new PlayerStatsInventory(invTarget, opening, this); + } - public class PlayerStatsInventory extends GeneratedInventory { - private int boostOffset; + public PlayerStatsInventory newInventory(PlayerData player) { + return new PlayerStatsInventory(player, player, this); + } - public PlayerStatsInventory(PlayerData playerData, EditableInventory editable) { - super(playerData, editable); - } + public class PlayerStatsInventory extends GeneratedInventory { + private final PlayerData target; - @Override - public String calculateName() { - return getName(); - } + private int boostOffset; - @Override - public void whenClicked(InventoryClickEvent event, InventoryItem item) { - if (item.hasFunction()) - if (item.getFunction().equals("boost-next")) { - boostOffset++; - open(); + /** + * @param invTarget Target player + * @param opening Player opening the inventory + * @param inv Corresponding editable inventory + */ + public PlayerStatsInventory(PlayerData invTarget, PlayerData opening, EditableInventory inv) { + super(opening, inv); - } else if (item.getFunction().equals("boost-previous")) { - boostOffset--; - open(); - } - } - } + this.target = invTarget; + } - private ItemStack amount(ItemStack item, int amount) { - item.setAmount(amount); - return item; - } + @Override + public String calculateName() { + return getName(); + } - public static class PartyMoraleItem extends InventoryItem { - public PartyMoraleItem(ConfigurationSection config) { - super(config); - } + @Override + public void whenClicked(InventoryClickEvent event, InventoryItem item) { + if (item.hasFunction()) + if (item.getFunction().equals("boost-next")) { + boostOffset++; + open(); - @Override - public Placeholders getPlaceholders(GeneratedInventory inv, int n) { - Placeholders holders = new Placeholders(); + } else if (item.getFunction().equals("boost-previous")) { + boostOffset--; + open(); + } + } + } - int count = inv.getPlayerData().getParty().getOnlineMembers().size(); - holders.register("count", "" + count); - for (StatModifier buff : MMOCore.plugin.partyManager.getBonuses()) - holders.register("buff_" + buff.getStat().toLowerCase(), buff.multiply(count - 1).toString()); + private ItemStack amount(ItemStack item, int amount) { + item.setAmount(amount); + return item; + } - return holders; - } + public static class PartyMoraleItem extends InventoryItem { + public PartyMoraleItem(ConfigurationSection config) { + super(config); + } - @Override - public boolean canDisplay(GeneratedInventory inv) { - AbstractParty party = inv.getPlayerData().getParty(); - return party != null && party.getOnlineMembers().size() > 1; - } - } + @Override + public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { + Placeholders holders = new Placeholders(); - public static class PlayerProfileItem extends InventoryItem { - public PlayerProfileItem(ConfigurationSection config) { - super(config); - } + int count = inv.target.getParty().getOnlineMembers().size(); + holders.register("count", "" + count); + for (StatModifier buff : MMOCore.plugin.partyManager.getBonuses()) + holders.register("buff_" + buff.getStat().toLowerCase(), buff.multiply(count - 1).toString()); - @Override - public ItemStack display(GeneratedInventory inv, int n) { - ItemStack disp = super.display(inv, n); - if (disp.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) { - SkullMeta meta = (SkullMeta) disp.getItemMeta(); - inv.dynamicallyUpdateItem(this, n, disp, current -> { - meta.setOwningPlayer(inv.getPlayer()); - current.setItemMeta(meta); - }); - } - return disp; - } + return holders; + } - @Override - public Placeholders getPlaceholders(GeneratedInventory inv, int n) { - PlayerData data = inv.getPlayerData(); - Placeholders holders = new Placeholders(); + @Override + public boolean canDisplay(PlayerStatsInventory inv) { + AbstractParty party = inv.target.getParty(); + return party != null && party.getOnlineMembers().size() > 1; + } + } - int nextLevelExp = inv.getPlayerData().getLevelUpExperience(); - double ratio = (double) data.getExperience() / (double) nextLevelExp; + public static class PlayerProfileItem extends InventoryItem { + public PlayerProfileItem(ConfigurationSection config) { + super(config); + } - StringBuilder bar = new StringBuilder("" + ChatColor.BOLD); - int chars = (int) (ratio * 20); - for (int j = 0; j < 20; j++) - bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|"); + @Override + public ItemStack display(PlayerStatsInventory inv, int n) { + ItemStack disp = super.display(inv, n); + if (disp.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) { + SkullMeta meta = (SkullMeta) disp.getItemMeta(); + inv.dynamicallyUpdateItem(this, n, disp, current -> { + meta.setOwningPlayer(inv.target.getPlayer()); + current.setItemMeta(meta); + }); + } + return disp; + } - holders.register("percent", decimal.format(ratio * 100)); - holders.register("exp", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience())); - holders.register("level", "" + data.getLevel()); - holders.register("class_points", "" + data.getClassPoints()); - holders.register("skill_points", "" + data.getSkillPoints()); - holders.register("attribute_points", "" + data.getAttributePoints()); - holders.register("progress", bar.toString()); - holders.register("next_level", "" + nextLevelExp); - if (data.isOnline()) - holders.register("player", "" + data.getPlayer().getName()); - holders.register("class", "" + data.getProfess().getName()); + @Override + public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { + PlayerData data = inv.target; + Placeholders holders = new Placeholders(); - return holders; - } - } + int nextLevelExp = inv.target.getLevelUpExperience(); + double ratio = (double) data.getExperience() / (double) nextLevelExp; - public class BoostItem extends SimplePlaceholderItem { - private final InventoryItem noBoost, mainLevel, profession; + StringBuilder bar = new StringBuilder("" + ChatColor.BOLD); + int chars = (int) (ratio * 20); + for (int j = 0; j < 20; j++) + bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|"); - public BoostItem(ConfigurationSection config) { - super(config); + holders.register("percent", decimal.format(ratio * 100)); + holders.register("exp", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience())); + holders.register("level", "" + data.getLevel()); + holders.register("class_points", "" + data.getClassPoints()); + holders.register("skill_points", "" + data.getSkillPoints()); + holders.register("attribute_points", "" + data.getAttributePoints()); + holders.register("progress", bar.toString()); + holders.register("next_level", "" + nextLevelExp); + if (data.isOnline()) + holders.register("player", "" + data.getPlayer().getName()); + holders.register("class", "" + data.getProfess().getName()); - ConfigurationSection noBoost = config.getConfigurationSection("no-boost"); - Validate.notNull(noBoost, "Could not load 'no-boost' config"); - this.noBoost = new SimplePlaceholderItem(noBoost); + return holders; + } + } - ConfigurationSection mainLevel = config.getConfigurationSection("main-level"); - Validate.notNull(mainLevel, "Could not load 'main-level' config"); - this.mainLevel = new InventoryItem(mainLevel) { + public class BoostItem extends SimplePlaceholderItem { + private final InventoryItem noBoost, mainLevel, profession; - @Override - public boolean hasDifferentDisplay() { - return true; - } + public BoostItem(ConfigurationSection config) { + super(config); - @Override - public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { - Placeholders holders = new Placeholders(); - Booster boost = MMOCore.plugin.boosterManager.get(inv.boostOffset + n); + ConfigurationSection noBoost = config.getConfigurationSection("no-boost"); + Validate.notNull(noBoost, "Could not load 'no-boost' config"); + this.noBoost = new SimplePlaceholderItem(noBoost); - holders.register("author", boost.hasAuthor() ? boost.getAuthor() : "Server"); - holders.register("value", (int) (boost.getExtra() * 100)); - holders.register("left", boost.isTimedOut() ? - MMOCore.plugin.configManager.getSimpleMessage("booster-expired").message() - : new DelayFormat(2).format(boost.getLeft())); + ConfigurationSection mainLevel = config.getConfigurationSection("main-level"); + Validate.notNull(mainLevel, "Could not load 'main-level' config"); + this.mainLevel = new InventoryItem(mainLevel) { - return holders; - } - }; + @Override + public boolean hasDifferentDisplay() { + return true; + } - ConfigurationSection profession = config.getConfigurationSection("profession"); - Validate.notNull(profession, "Could not load 'profession' config"); - this.profession = new InventoryItem(profession) { + @Override + public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { + Placeholders holders = new Placeholders(); + Booster boost = MMOCore.plugin.boosterManager.get(inv.boostOffset + n); - @Override - public boolean hasDifferentDisplay() { - return true; - } + holders.register("author", boost.hasAuthor() ? boost.getAuthor() : "Server"); + holders.register("value", (int) (boost.getExtra() * 100)); + holders.register("left", boost.isTimedOut() ? + MMOCore.plugin.configManager.getSimpleMessage("booster-expired").message() + : new DelayFormat(2).format(boost.getLeft())); - @Override - public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { - Placeholders holders = new Placeholders(); - Booster boost = MMOCore.plugin.boosterManager.get(inv.boostOffset + n); + return holders; + } + }; - holders.register("author", boost.hasAuthor() ? boost.getAuthor() : "Server"); - holders.register("profession", boost.getProfession().getName()); - holders.register("value", (int) (boost.getExtra() * 100)); - holders.register("left", boost.isTimedOut() ? - MMOCore.plugin.configManager.getSimpleMessage("booster-expired").message() - : new DelayFormat(2).format(boost.getLeft())); + ConfigurationSection profession = config.getConfigurationSection("profession"); + Validate.notNull(profession, "Could not load 'profession' config"); + this.profession = new InventoryItem(profession) { - return holders; - } - }; - } + @Override + public boolean hasDifferentDisplay() { + return true; + } - @Override - public boolean hasDifferentDisplay() { - return true; - } + @Override + public Placeholders getPlaceholders(PlayerStatsInventory inv, int n) { + Placeholders holders = new Placeholders(); + Booster boost = MMOCore.plugin.boosterManager.get(inv.boostOffset + n); - @Override - public ItemStack display(PlayerStatsInventory inv, int n) { - int offset = inv.boostOffset; - if (n + offset >= MMOCore.plugin.boosterManager.getActive().size()) - return noBoost.display(inv, n); + holders.register("author", boost.hasAuthor() ? boost.getAuthor() : "Server"); + holders.register("profession", boost.getProfession().getName()); + holders.register("value", (int) (boost.getExtra() * 100)); + holders.register("left", boost.isTimedOut() ? + MMOCore.plugin.configManager.getSimpleMessage("booster-expired").message() + : new DelayFormat(2).format(boost.getLeft())); - Booster boost = MMOCore.plugin.boosterManager.get(inv.boostOffset + n); - return amount(boost.hasProfession() ? profession.display(inv, n) : mainLevel.display(inv, n), n + offset + 1); - } - } + return holders; + } + }; + } + + @Override + public boolean hasDifferentDisplay() { + return true; + } + + @Override + public ItemStack display(PlayerStatsInventory inv, int n) { + int offset = inv.boostOffset; + if (n + offset >= MMOCore.plugin.boosterManager.getActive().size()) + return noBoost.display(inv, n); + + Booster boost = MMOCore.plugin.boosterManager.get(inv.boostOffset + n); + return amount(boost.hasProfession() ? profession.display(inv, n) : mainLevel.display(inv, n), n + offset + 1); + } + } } diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java b/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java index 163ae7f5..85be0d26 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java @@ -2,8 +2,8 @@ package net.Indyuce.mmocore.gui.api; import io.lumine.mythic.lib.MythicLib; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.TriggerItem; import org.bukkit.Bukkit; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java b/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java index eab9afe3..5ff87df0 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java +++ b/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.inventory.Inventory; public class PlayerProfileCheck implements Listener { @@ -17,14 +16,6 @@ public class PlayerProfileCheck implements Listener { if (event.getRightClicked().getType() != EntityType.PLAYER || !event.getPlayer().isSneaking() || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION)) return; - /* - * This works because the PlayerStats class DOES NOT utilize - * at all the player instance saved in the InventoryClickEvent - * - * Opening inventories like that to other players does NOT - * necessarily works for any other custom inventory. - * */ - Inventory inv = InventoryManager.PLAYER_STATS.newInventory(PlayerData.get(event.getRightClicked().getUniqueId())).getInventory(); - event.getPlayer().openInventory(inv); + InventoryManager.PLAYER_STATS.newInventory(PlayerData.get(event.getRightClicked().getUniqueId()), PlayerData.get(event.getPlayer())).open(); } } From 12e8146d34b6d750c4fbb12c3db2f7e1cc5bd973 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 4 Jul 2022 13:21:55 +0200 Subject: [PATCH 50/91] Add column SQL --- .../net/Indyuce/mmocore/gui/AttributeView.java | 3 +-- .../net/Indyuce/mmocore/gui/PlayerStats.java | 2 ++ .../manager/data/mysql/MySQLDataProvider.java | 17 ++++++++++++++++- .../Indyuce/mmocore/party/provided/Party.java | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 6c041919..b63c7f22 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -79,8 +79,7 @@ public class AttributeView extends EditableInventory { StatInfo info = StatInfo.valueOf(buff.getStat()); holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue())); - Bukkit.broadcastMessage(info.format(0.34)); - Bukkit.broadcastMessage((new DecimalFormat(null)==null)+""); + }); return holders; diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 481c7267..54518f13 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -18,6 +18,7 @@ import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.party.AbstractParty; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; @@ -222,6 +223,7 @@ public class PlayerStats extends EditableInventory { ItemStack disp = super.display(inv, n); if (disp.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) { SkullMeta meta = (SkullMeta) disp.getItemMeta(); + inv.dynamicallyUpdateItem(this, n, disp, current -> { meta.setOwningPlayer(inv.getPlayer()); current.setItemMeta(meta); diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java index f314f318..58766a11 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java @@ -7,6 +7,9 @@ import net.Indyuce.mmocore.manager.data.PlayerDataManager; import net.Indyuce.mmocore.manager.data.yaml.YAMLGuildDataManager; import org.bukkit.configuration.file.FileConfiguration; +import java.sql.SQLException; +import java.util.concurrent.CompletableFuture; + public class MySQLDataProvider extends MMODataSource implements DataProvider { private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this); private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager(); @@ -42,7 +45,19 @@ getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" + "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG," + "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT," + "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT," - + "class_info LONGTEXT,is_saved INT(1), PRIMARY KEY (uuid));"); + + "class_info LONGTEXT, PRIMARY KEY (uuid));");//TODO + + + getResult("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata'" + + " AND COLUMN_NAME = 'is_saved'",(result)-> { + try { + if(!result.next()) + executeUpdate("ALTER TABLE mmocore_playerdata ADD is_saved TINYINT"); + } catch (SQLException e) { + throw new RuntimeException(e); + } + + }); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/party/provided/Party.java b/src/main/java/net/Indyuce/mmocore/party/provided/Party.java index 9bc6b2db..1bceebd8 100644 --- a/src/main/java/net/Indyuce/mmocore/party/provided/Party.java +++ b/src/main/java/net/Indyuce/mmocore/party/provided/Party.java @@ -160,6 +160,7 @@ public class Party implements AbstractParty { Request request = new PartyInvite(this, inviter, target); new ConfigMessage("party-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString()) .sendAsJSon(target.getPlayer()); + MMOCore.plugin.requestManager.registerRequest(request); } From 2a4d419398822dfda5ef1d63fee8bcab4e20779d Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 4 Jul 2022 13:27:58 +0200 Subject: [PATCH 51/91] Add column SQL --- .../Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java index 58766a11..84645801 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java @@ -45,14 +45,14 @@ getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" + "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG," + "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT," + "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT," - + "class_info LONGTEXT, PRIMARY KEY (uuid));");//TODO + + "class_info LONGTEXT, is_saved TINYINT, PRIMARY KEY (uuid));"); getResult("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata'" + " AND COLUMN_NAME = 'is_saved'",(result)-> { try { if(!result.next()) - executeUpdate("ALTER TABLE mmocore_playerdata ADD is_saved TINYINT"); + executeUpdate("ALTER TABLE mmocore_playerdata ADD COLUMN is_saved TINYINT"); } catch (SQLException e) { throw new RuntimeException(e); } From 8b99da0c23dbdbd4900c224f81d23b7dc5a94bc6 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 4 Jul 2022 14:25:37 +0200 Subject: [PATCH 52/91] Removed compatibility indexes --- pom.xml | 2 +- src/main/java/net/Indyuce/mmocore/MMOCore.java | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 33a0560b..ac34c689 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.Indyuce MMOCore - 1.9.3 + 1.9.4 MMOCore Offer your players a brand new RPG experience!! diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 6445637d..0bcdeb1c 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -107,26 +107,16 @@ public class MMOCore extends LuminePlugin { public boolean shouldDebugSQL, hasBungee; - private static final int MYTHICLIB_COMPATIBILITY_INDEX = 8; - public MMOCore() { plugin = this; } public void load() { - // Check if the ML build matches - if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOCORE_COMPATIBILITY_INDEX) { - getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOCore do not match. Make sure you are using the latest builds of both plugins"); - disable(); - return; - } - // Register MMOCore-specific objects MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); - // Register extra objective, drop items... if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) loadManager.registerLoader(new WorldGuardMMOLoader()); From 4b33433790442b3e1158449295738e7e10bab3cf Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 5 Jul 2022 13:13:06 +0200 Subject: [PATCH 53/91] Fixed issue with friends list --- .../mmocore/gui/social/friend/EditableFriendList.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java b/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java index c222a255..fbb4f953 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java +++ b/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.gui.social.friend; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.gui.api.GeneratedInventory; -import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.api.player.PlayerActivity; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import net.Indyuce.mmocore.gui.api.EditableInventory; +import net.Indyuce.mmocore.gui.api.GeneratedInventory; +import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; @@ -130,8 +130,8 @@ public class EditableFriendList extends EditableInventory { if (inv.getPlayerData().getFriends().size() <= n) return super.display(inv, n); - ItemStack disp = Bukkit.getOfflinePlayer(inv.getPlayerData().getFriends().get(n)).isOnline() ? online.display(inv, n) : offline.display(inv, n); - Player friend = Bukkit.getPlayer(inv.getPlayerData().getFriends().get(n)); + final OfflinePlayer friend = Bukkit.getOfflinePlayer(inv.getPlayerData().getFriends().get(n)); + ItemStack disp = (friend.isOnline() ? online : offline).display(inv, n); ItemMeta meta = disp.getItemMeta(); meta.getPersistentDataContainer().set(UUID_NAMESPACEDKEY, PersistentDataType.STRING, friend.getUniqueId().toString()); From b7cced56cf76c6fbeeeccccc71affd06ffa3e032 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 5 Jul 2022 14:33:30 +0200 Subject: [PATCH 54/91] Fixed PAPI placeholders --- .../net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 40307abd..134848b6 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -37,7 +37,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { @Override public String getIdentifier() { - return "net/Indyuce/mmocore"; + return "mmocore"; } @Override From e84fe13e579f122a1807a5cb54ecd74dfd3e4c02 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 00:39:43 +0200 Subject: [PATCH 55/91] Fixed exp table period --- .../Indyuce/mmocore/experience/droptable/ExperienceItem.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index 768dd678..0b01350f 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -51,7 +51,8 @@ public class ExperienceItem { Validate.isTrue(config.contains("triggers")); id = config.getName(); - period = config.getInt("period", 1); + final int periodOption = config.getInt("period", 1); + period = periodOption == 0 ? Integer.MAX_VALUE : periodOption; firstTrigger = config.getInt("first-trigger", period); claimChance = config.getDouble("chance", 100) / 100; failReduction = config.getDouble("fail-reduction", 80) / 100; @@ -72,7 +73,7 @@ public class ExperienceItem { * account the randomness factor from the 'chance' parameter */ public boolean roll(int professionLevel, int timesCollected) { - int claimsRequired = (professionLevel + 1 - (firstTrigger + (timesCollected) * period)); + int claimsRequired = (professionLevel + 1 - (firstTrigger + timesCollected * period)); if (claimsRequired < 1) return false; From c84b30bc6da4164e1f7fb14b0aad0f96564a5845 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 01:02:26 +0200 Subject: [PATCH 56/91] Added an option for profession exp splitting --- .../java/net/Indyuce/mmocore/experience/PlayerProfessions.java | 2 +- src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java | 3 ++- src/main/resources/config.yml | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 27015da0..2295a281 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -169,7 +169,7 @@ public class PlayerProfessions { // Splitting exp through party members AbstractParty party; - if (splitExp && (party = playerData.getParty()) != null) { + if (splitExp && (party = playerData.getParty()) != null && MMOCore.plugin.configManager.splitProfessionExp) { List onlineMembers = party.getOnlineMembers(); value /= onlineMembers.size(); for (PlayerData member : onlineMembers) diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 4cf47a9f..fb990c21 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -23,7 +23,7 @@ import java.util.logging.Level; public class ConfigManager { public final CommandVerbose commandVerbose = new CommandVerbose(); - public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo; + public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp; public String partyChatPrefix, noSkillBoundPlaceholder; public ChatColor staminaFull, staminaHalf, staminaEmpty; public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown; @@ -102,6 +102,7 @@ public class ConfigManager { lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests"); fishingDropsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.fishing-drops"); maxPartyLevelDifference = MMOCore.plugin.getConfig().getInt("party.max-level-difference"); + splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split"); staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN); staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 93027bb8..d7eb3cdb 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -159,6 +159,9 @@ party: # that feature. max-level-difference: 3 + # When enabled, being in a party also splits profession exp + profession-exp-split: false + # Redirects vanilla experience obtained to MMOCore # class experience. You can define the % of the vanilla # experience that is being transfered as MMOCore exp. From bf4df777e50d0224846a31fde142b1ad19b998dc Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 12:57:39 +0200 Subject: [PATCH 57/91] Fixed default attributes GUI --- src/main/resources/default/gui/attribute-view.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/default/gui/attribute-view.yml b/src/main/resources/default/gui/attribute-view.yml index a93b8d6b..444a33e2 100644 --- a/src/main/resources/default/gui/attribute-view.yml +++ b/src/main/resources/default/gui/attribute-view.yml @@ -32,7 +32,7 @@ items: - '' - '&8When Leveled Up:' - '&7 +{buff_weapon_damage}% Weapon Damage (&a+{total_weapon_damage}%&7)' - - '&7 +{buff_max_health}% Max Health (&a+{total_max_health}&7)' + - '&7 +{buff_max_health}% Max Health (&a+{total_max_health}%&7)' - '' - '&eClick to level up for 1 attribute point.' - '&eShift-Click to level up for {shift_points} attribute points.' From c788a88a823b086013a3a400c6e1796a72cc9e7e Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 13:07:51 +0200 Subject: [PATCH 58/91] Fixed attribute exp tables not claiming the right amount of times when shift clicking --- .../mmocore/api/player/attribute/PlayerAttributes.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java index 769e34ea..d71c3d88 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java @@ -136,10 +136,13 @@ public class PlayerAttributes { * @param value Amount of attribute points spent in the attribute */ public void addBase(int value) { - PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); setBase(spent + value); + + // Apply exp table as many times as required + final PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); if (attribute.hasExperienceTable()) - attribute.getExperienceTable().claim(data, spent, attribute); + while (value-- > 0) + attribute.getExperienceTable().claim(data, spent, attribute); } /* From 23f6854f79e0bcf52443c7126fa2952918463f76 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 13:12:01 +0200 Subject: [PATCH 59/91] Small code factorization --- .../player/attribute/PlayerAttributes.java | 12 ------- .../Indyuce/mmocore/gui/AttributeView.java | 33 +++++++++++-------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java index d71c3d88..82eae2ce 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/attribute/PlayerAttributes.java @@ -129,20 +129,8 @@ public class PlayerAttributes { update(); } - /** - * Adds X points to the base of the player attribute AND applies - * the attribute experience table. - * - * @param value Amount of attribute points spent in the attribute - */ public void addBase(int value) { setBase(spent + value); - - // Apply exp table as many times as required - final PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id); - if (attribute.hasExperienceTable()) - while (value-- > 0) - attribute.getExperienceTable().claim(data, spent, attribute); } /* diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 88259091..ebd108e7 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -1,16 +1,16 @@ package net.Indyuce.mmocore.gui; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.SoundEvent; import net.Indyuce.mmocore.api.event.PlayerAttributeUseEvent; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; +import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; -import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; -import net.Indyuce.mmocore.api.SoundEvent; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.player.stats.StatInfo; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; @@ -138,22 +138,29 @@ public class AttributeView extends EditableInventory { MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); return; } - + + // Amount of points spent + int pointsSpent = 1; + if (event.isShiftClick()) { if (playerData.getAttributePoints() < shiftCost) { MMOCore.plugin.configManager.getSimpleMessage("not-attribute-point-shift", "shift_points", "" + shiftCost).send(player); MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); return; } - - ins.addBase(shiftCost); - playerData.giveAttributePoints(-shiftCost); - } else { - ins.addBase(1); - playerData.giveAttributePoints(-1); + + pointsSpent = shiftCost; } - - MMOCore.plugin.configManager.getSimpleMessage("attribute-level-up", "attribute", attribute.getName(), "level", "" + ins.getBase()).send(player); + + ins.addBase(pointsSpent); + playerData.giveAttributePoints(-pointsSpent); + + // Apply exp table as many times as required + if (attribute.hasExperienceTable()) + while (pointsSpent-- > 0) + attribute.getExperienceTable().claim(playerData, ins.getBase(), attribute); + + MMOCore.plugin.configManager.getSimpleMessage("attribute-level-up", "attribute", attribute.getName(), "level", String.valueOf(ins.getBase())).send(player); MMOCore.plugin.soundManager.getSound(SoundEvent.LEVEL_ATTRIBUTE).playTo(getPlayer()); PlayerAttributeUseEvent playerAttributeUseEvent = new PlayerAttributeUseEvent(playerData, attribute); From 2300a7fc1307cb3ea853b8f5d81980a2592262ca Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 15:05:37 +0200 Subject: [PATCH 60/91] Improved implementation of deposit menu updates --- .../Indyuce/mmocore/gui/eco/DepositMenu.java | 177 +++++++++--------- 1 file changed, 90 insertions(+), 87 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java b/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java index f443e970..cc1f64e8 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java +++ b/src/main/java/net/Indyuce/mmocore/gui/eco/DepositMenu.java @@ -1,6 +1,10 @@ package net.Indyuce.mmocore.gui.eco; +import io.lumine.mythic.lib.api.item.NBTItem; +import io.lumine.mythic.lib.api.util.SmartGive; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; +import net.Indyuce.mmocore.gui.api.PluginInventory; import net.Indyuce.mmocore.util.item.SimpleItemBuilder; import net.milkbowl.vault.economy.EconomyResponse; import org.bukkit.Bukkit; @@ -13,108 +17,107 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; -import net.Indyuce.mmocore.api.util.MMOCoreUtils; -import net.Indyuce.mmocore.gui.api.PluginInventory; -import io.lumine.mythic.lib.api.item.NBTItem; -import io.lumine.mythic.lib.api.util.SmartGive; - public class DepositMenu extends PluginInventory { - private ItemStack depositItem; - private int deposit; + private ItemStack depositItem; + private int deposit; - public DepositMenu(Player player) { - super(player); - } + /** + * Every time an item is clicked in the inventory, an inventory + * update is scheduled. If nothing happens for the next 10 ticks + * then the update is processed. If another item is clicked within + * this delay the task is cancelled and scheduled for later + */ + private BukkitRunnable updateRunnable; - @Override - public Inventory getInventory() { - Inventory inv = Bukkit.createInventory(this, 27, "Deposit"); + public DepositMenu(Player player) { + super(player); + } - inv.setItem(26, depositItem = new SimpleItemBuilder("DEPOSIT_ITEM").addPlaceholders("worth", "0").build()); + @Override + public Inventory getInventory() { + Inventory inv = Bukkit.createInventory(this, 27, "Deposit"); + updateDeposit(inv); + return inv; + } - new BukkitRunnable() { + @Override + public void whenClicked(InventoryClickEvent event) { + if (event.getCurrentItem() == null || event.getCurrentItem().getType() == Material.AIR) + return; - @Override - public void run() { - if (inv.getViewers().size() < 1) { - cancel(); - return; - } + if (event.getCurrentItem().isSimilar(depositItem)) { + event.setCancelled(true); - updateDeposit(inv); - } - }.runTaskTimer(MMOCore.plugin, 0, 20); - return inv; - } + updateDeposit(event.getInventory()); + if (deposit <= 0) + return; - @Override - public void whenClicked(InventoryClickEvent event) { - // event.setCancelled(true); - if (event.getCurrentItem() == null || event.getCurrentItem().getType() == Material.AIR) - return; + EconomyResponse response = MMOCore.plugin.economy.getEconomy().depositPlayer(player, deposit); + if (!response.transactionSuccess()) + return; - if (event.getCurrentItem().isSimilar(depositItem)) { - event.setCancelled(true); + event.getInventory().clear(); + player.closeInventory(); + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2); + MMOCore.plugin.configManager.getSimpleMessage("deposit", "worth", String.valueOf(deposit)).send(player); + return; + } - updateDeposit(event.getInventory()); - if (deposit <= 0) - return; + int worth = NBTItem.get(event.getCurrentItem()).getInteger("RpgWorth"); + if (worth < 1) + event.setCancelled(true); + else + scheduleUpdate(event.getInventory()); + } - EconomyResponse response = MMOCore.plugin.economy.getEconomy().depositPlayer(player, deposit); - if (!response.transactionSuccess()) - return; + @Override + public void whenClosed(InventoryCloseEvent event) { - event.getInventory().clear(); - player.closeInventory(); - player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2); - MMOCore.plugin.configManager.getSimpleMessage("deposit", "worth", "" + deposit).send(player); - return; - } + // Cancel runnable + if (updateRunnable != null) + updateRunnable.cancel(); - int worth = NBTItem.get(event.getCurrentItem()).getInteger("RpgWorth"); - if (worth < 1) { - event.setCancelled(true); - } + // Give all items back + SmartGive smart = new SmartGive(player); + for (int j = 0; j < 26; j++) { + ItemStack item = event.getInventory().getItem(j); + if (item != null) + smart.give(item); + } + } - // in deposit menu - // if (event.getRawSlot() < 27) { - // int empty = player.getInventory().firstEmpty(); - // if (empty < 0) - // return; - // - // player.playSound(player.getLocation(), Sound.ENTITY_SHULKER_TELEPORT, - // 1, 2); - // player.getInventory().addItem(event.getCurrentItem()); - // event.setCurrentItem(null); - // updateDeposit(event.getInventory()); - // return; - // } + private BukkitRunnable newUpdateRunnable(Inventory inv) { + return new BukkitRunnable() { - // in player inventory - // int empty = event.getInventory().firstEmpty(); - // if (empty < 0) - // return; - // - // player.playSound(player.getLocation(), - // Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2); - // event.getInventory().addItem(event.getCurrentItem()); - // event.setCurrentItem(null); - // updateDeposit(event.getInventory()); - // return; - } + @Override + public void run() { + updateDeposit(inv); + } + }; + } - @Override - public void whenClosed(InventoryCloseEvent event) { - SmartGive smart = new SmartGive(player); - for (int j = 0; j < 26; j++) { - ItemStack item = event.getInventory().getItem(j); - if (item != null) - smart.give(item); - } - } + private void scheduleUpdate(Inventory inv) { + if (updateRunnable != null) + updateRunnable.cancel(); - private void updateDeposit(Inventory inv) { - deposit = MMOCoreUtils.getWorth(inv.getContents()); - inv.setItem(26, depositItem = new SimpleItemBuilder("DEPOSIT_ITEM").addPlaceholders("worth", "" + deposit).build()); - } + updateRunnable = new BukkitRunnable() { + + @Override + public void run() { + updateRunnable = null; + updateDeposit(inv); + } + }; + updateRunnable.runTaskLater(MMOCore.plugin, 10); + } + + private void updateDeposit(Inventory inv) { + if (updateRunnable != null) { + updateRunnable.cancel(); + updateRunnable = null; + } + + deposit = MMOCoreUtils.getWorth(inv.getContents()); + inv.setItem(26, depositItem = new SimpleItemBuilder("DEPOSIT_ITEM").addPlaceholders("worth", String.valueOf(deposit)).build()); + } } From 315ff4b64097e0944322a0759e4a644f31165c2a Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 7 Jul 2022 15:14:54 +0200 Subject: [PATCH 61/91] Fixed gold coins and pouches --- .../comp/mythicmobs/load/CurrencyItemDrop.java | 14 +++++--------- .../comp/mythicmobs/load/GoldPouchDrop.java | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java index ccba02f2..4285eca5 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/CurrencyItemDrop.java @@ -1,17 +1,16 @@ package net.Indyuce.mmocore.comp.mythicmobs.load; +import io.lumine.mythic.api.adapters.AbstractItemStack; import io.lumine.mythic.api.config.MythicLineConfig; import io.lumine.mythic.api.drops.DropMetadata; -import io.lumine.mythic.api.drops.IMultiDrop; +import io.lumine.mythic.api.drops.IItemDrop; import io.lumine.mythic.bukkit.adapters.BukkitItemStack; import io.lumine.mythic.core.drops.Drop; -import io.lumine.mythic.core.drops.LootBag; -import io.lumine.mythic.core.drops.droppables.ItemDrop; import net.Indyuce.mmocore.util.item.CurrencyItemBuilder; import java.util.Random; -public class CurrencyItemDrop extends Drop implements IMultiDrop { +public class CurrencyItemDrop extends Drop implements IItemDrop { private final String key; private final int minw; private final int maxw; @@ -26,12 +25,9 @@ public class CurrencyItemDrop extends Drop implements IMultiDrop { maxw = config.getInteger("maxw", 1); } - @SuppressWarnings("deprecation") @Override - public LootBag get(DropMetadata metadata) { - LootBag loot = new LootBag(metadata); - loot.add(new ItemDrop(this.getLine(), this.getConfig(), new BukkitItemStack(new CurrencyItemBuilder(key, random(minw, maxw)).build()))); - return loot; + public AbstractItemStack getDrop(DropMetadata dropMetadata, double v) { + return new BukkitItemStack(new CurrencyItemBuilder(key, random(minw, maxw)).build()); } private int random(int a, int b) { diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java index 65c4123a..7d952e26 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/GoldPouchDrop.java @@ -1,12 +1,11 @@ package net.Indyuce.mmocore.comp.mythicmobs.load; +import io.lumine.mythic.api.adapters.AbstractItemStack; import io.lumine.mythic.api.config.MythicLineConfig; import io.lumine.mythic.api.drops.DropMetadata; -import io.lumine.mythic.api.drops.IMultiDrop; +import io.lumine.mythic.api.drops.IItemDrop; import io.lumine.mythic.bukkit.adapters.BukkitItemStack; import io.lumine.mythic.core.drops.Drop; -import io.lumine.mythic.core.drops.LootBag; -import io.lumine.mythic.core.drops.droppables.ItemDrop; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.NBTItem; import net.Indyuce.mmocore.api.util.MMOCoreUtils; @@ -17,7 +16,7 @@ import org.bukkit.inventory.ItemStack; import java.util.Random; -public class GoldPouchDrop extends Drop implements IMultiDrop { +public class GoldPouchDrop extends Drop implements IItemDrop { private final int min; private final int max; @@ -30,10 +29,8 @@ public class GoldPouchDrop extends Drop implements IMultiDrop { max = config.getInteger("max", 10); } - @SuppressWarnings("deprecation") @Override - public LootBag get(DropMetadata metadata) { - LootBag loot = new LootBag(metadata); + public AbstractItemStack getDrop(DropMetadata dropMetadata, double v) { NBTItem nbt = NBTItem.get(new SimpleItemBuilder("MOB_GOLD_POUCH").build()); ItemStack[] content = new ItemStack[18]; @@ -52,8 +49,7 @@ public class GoldPouchDrop extends Drop implements IMultiDrop { } nbt.addTag(new ItemTag("RpgPouchSize", 18), new ItemTag("RpgPouchMob", true), new ItemTag("RpgPouchInventory", MMOCoreUtils.toBase64(content))); - loot.add(new ItemDrop(this.getLine(), this.getConfig(), new BukkitItemStack(nbt.toItem()))); - return loot; + return new BukkitItemStack(nbt.toItem()); } private ItemStack setAmount(ItemStack item, int amount) { From add8b00609f6e89607b3a27d821d72a5914004ac Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 9 Jul 2022 13:56:45 +0200 Subject: [PATCH 62/91] Added 'last-trigger' option to exp tables --- .../experience/droptable/ExperienceItem.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index 0b01350f..e9a6035a 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -2,10 +2,9 @@ package net.Indyuce.mmocore.experience.droptable; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.quest.trigger.Trigger; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import java.util.ArrayList; @@ -15,19 +14,23 @@ import java.util.Random; public class ExperienceItem { private final String id; - //A period of 0 means the item will only trigger one time. - private final int period; - private final int firstTrigger; + private final int period, firstTrigger, lastTrigger; private final double claimChance, failReduction; private final List triggers; private static final Random random = new Random(); + @Deprecated + public ExperienceItem(String id, int period, int firstTrigger, double claimChance, double failReduction, List triggers) { + this(id, period, firstTrigger, Integer.MAX_VALUE, claimChance, failReduction, triggers); + } + /** * One item for an experience table * * @param period The experience item is claimed every X level ups * @param firstTrigger The experience item if claimed for the first time at X level ups. + * @param lastTrigger The last level at which the item can be claimed. * @param claimChance Chance for that item to be claimed every X level ups * @param failReduction Between 0 and 1, by how much the fail chance is reduced * every time the item is not claimed when leveling up. @@ -37,13 +40,14 @@ public class ExperienceItem { * where n is the amount of successive claiming fails * @param triggers Actions cast when the exp item is claimed */ - public ExperienceItem(String id, int period, int firstTrigger, double claimChance, double failReduction, List triggers) { + public ExperienceItem(String id, int period, int firstTrigger, int lastTrigger, double claimChance, double failReduction, List triggers) { this.id = id; this.period = period; this.claimChance = claimChance; this.failReduction = failReduction; this.triggers = triggers; this.firstTrigger = firstTrigger; + this.lastTrigger = lastTrigger; } public ExperienceItem(ConfigurationSection config) { @@ -52,8 +56,10 @@ public class ExperienceItem { id = config.getName(); final int periodOption = config.getInt("period", 1); + // A period of 0 means the item will only trigger once period = periodOption == 0 ? Integer.MAX_VALUE : periodOption; firstTrigger = config.getInt("first-trigger", period); + lastTrigger = config.getInt("last-trigger", Integer.MAX_VALUE); claimChance = config.getDouble("chance", 100) / 100; failReduction = config.getDouble("fail-reduction", 80) / 100; triggers = new ArrayList<>(); @@ -73,6 +79,9 @@ public class ExperienceItem { * account the randomness factor from the 'chance' parameter */ public boolean roll(int professionLevel, int timesCollected) { + if (professionLevel > lastTrigger) + return false; + int claimsRequired = (professionLevel + 1 - (firstTrigger + timesCollected * period)); if (claimsRequired < 1) return false; From 7efdf5b017c2867a5c8effc46bc76e2e5e817031 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 9 Jul 2022 13:58:56 +0200 Subject: [PATCH 63/91] new scripting items --- .../java/net/Indyuce/mmocore/MMOCore.java | 10 ++++ .../custom/mechanic/ExperienceMechanic.java | 46 +++++++++++++++++++ .../skill/custom/mechanic/ManaMechanic.java | 9 +++- .../skill/custom/mechanic/Operation.java | 7 +++ .../custom/mechanic/StaminaMechanic.java | 9 +++- .../custom/mechanic/StelliumMechanic.java | 9 +++- 6 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ExperienceMechanic.java create mode 100644 src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/Operation.java diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 0bcdeb1c..5e5c987c 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -48,6 +48,10 @@ import net.Indyuce.mmocore.party.PartyModule; import net.Indyuce.mmocore.party.PartyModuleType; import net.Indyuce.mmocore.party.provided.MMOCorePartyModule; import net.Indyuce.mmocore.skill.cast.SkillCastingMode; +import net.Indyuce.mmocore.skill.custom.mechanic.ExperienceMechanic; +import net.Indyuce.mmocore.skill.custom.mechanic.ManaMechanic; +import net.Indyuce.mmocore.skill.custom.mechanic.StaminaMechanic; +import net.Indyuce.mmocore.skill.custom.mechanic.StelliumMechanic; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -117,6 +121,12 @@ public class MMOCore extends LuminePlugin { MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject)); + // Skill creation + MythicLib.plugin.getSkills().registerMechanic("mana", config -> new ManaMechanic(config)); + MythicLib.plugin.getSkills().registerMechanic("stamina", config -> new StaminaMechanic(config)); + MythicLib.plugin.getSkills().registerMechanic("stellium", config -> new StelliumMechanic(config)); + MythicLib.plugin.getSkills().registerMechanic("experience", config -> new ExperienceMechanic(config)); + // Register extra objective, drop items... if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) loadManager.registerLoader(new WorldGuardMMOLoader()); diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ExperienceMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ExperienceMechanic.java new file mode 100644 index 00000000..61ae176e --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ExperienceMechanic.java @@ -0,0 +1,46 @@ +package net.Indyuce.mmocore.skill.custom.mechanic; + +import io.lumine.mythic.lib.skill.SkillMetadata; +import io.lumine.mythic.lib.skill.custom.mechanic.type.TargetMechanic; +import io.lumine.mythic.lib.util.DoubleFormula; +import io.lumine.mythic.lib.util.configobject.ConfigObject; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.experience.EXPSource; +import net.Indyuce.mmocore.experience.SimpleExperienceObject; +import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; +import org.apache.commons.lang.Validate; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class ExperienceMechanic extends TargetMechanic { + @NotNull + private final DoubleFormula amount; + @NotNull + private final EXPSource source; + @NotNull + private final ExperienceDispenser dispenser; + + public ExperienceMechanic(ConfigObject config) { + super(config); + + config.validateKeys("amount"); + amount = config.getDoubleFormula("amount"); + + if (config.contains("profession")) { + String id = config.getString("profession").toLowerCase().replace("_", "-"); + Validate.isTrue(MMOCore.plugin.professionManager.has(id), "Could not find profession"); + dispenser = MMOCore.plugin.professionManager.get(id); + } else + dispenser = new SimpleExperienceObject(); + source = config.contains("source") ? EXPSource.valueOf(config.getString("source").toUpperCase()) : EXPSource.QUEST; + } + + @Override + public void cast(SkillMetadata meta, Entity target) { + Validate.isTrue(target instanceof Player, "Target is not a player"); + PlayerData targetData = PlayerData.get(target.getUniqueId()); + dispenser.giveExperience(targetData, amount.evaluate(meta), null, source); + } +} diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java index ebd6e8b6..49f93831 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java +++ b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/ManaMechanic.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; public class ManaMechanic extends TargetMechanic { private final DoubleFormula amount; + private final Operation operation; private final PlayerResourceUpdateEvent.UpdateReason reason; public ManaMechanic(ConfigObject config) { @@ -22,12 +23,18 @@ public class ManaMechanic extends TargetMechanic { amount = new DoubleFormula(config.getString("amount")); reason = PlayerResourceUpdateEvent.UpdateReason.valueOf(UtilityMethods.enumName(config.getString("reason", "CUSTOM"))); + operation = config.contains("operation") ? Operation.valueOf(config.getString("operation").toUpperCase()) : Operation.GIVE; } @Override public void cast(SkillMetadata meta, Entity target) { Validate.isTrue(target instanceof Player, "Target is not a player"); PlayerData targetData = PlayerData.get(target.getUniqueId()); - targetData.giveMana(amount.evaluate(meta), reason); + if (operation == Operation.GIVE) + targetData.giveMana(amount.evaluate(meta), reason); + else if (operation == Operation.SET) + targetData.setMana(amount.evaluate(meta)); + else if (operation == Operation.TAKE) + targetData.giveMana(-amount.evaluate(meta), reason); } } diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/Operation.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/Operation.java new file mode 100644 index 00000000..ea05f52c --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/Operation.java @@ -0,0 +1,7 @@ +package net.Indyuce.mmocore.skill.custom.mechanic; + +public enum Operation { + GIVE, + SET, + TAKE +} \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java index 3d6e4bd8..88f28384 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java +++ b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StaminaMechanic.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; public class StaminaMechanic extends TargetMechanic { private final DoubleFormula amount; + private final Operation operation; private final PlayerResourceUpdateEvent.UpdateReason reason; public StaminaMechanic(ConfigObject config) { @@ -22,12 +23,18 @@ public class StaminaMechanic extends TargetMechanic { amount = new DoubleFormula(config.getString("amount")); reason = PlayerResourceUpdateEvent.UpdateReason.valueOf(UtilityMethods.enumName(config.getString("reason", "CUSTOM"))); + operation = config.contains("operation") ? Operation.valueOf(config.getString("operation").toUpperCase()) : Operation.GIVE; } @Override public void cast(SkillMetadata meta, Entity target) { Validate.isTrue(target instanceof Player, "Target is not a player"); PlayerData targetData = PlayerData.get(target.getUniqueId()); - targetData.giveStamina(amount.evaluate(meta), reason); + if (operation == Operation.GIVE) + targetData.giveStamina(amount.evaluate(meta), reason); + else if (operation == Operation.SET) + targetData.setStamina(amount.evaluate(meta)); + else if (operation == Operation.TAKE) + targetData.giveStamina(-amount.evaluate(meta), reason); } } diff --git a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java index 92ecb179..e104bbcb 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java +++ b/src/main/java/net/Indyuce/mmocore/skill/custom/mechanic/StelliumMechanic.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; public class StelliumMechanic extends TargetMechanic { private final DoubleFormula amount; + private final Operation operation; private final PlayerResourceUpdateEvent.UpdateReason reason; public StelliumMechanic(ConfigObject config) { @@ -22,12 +23,18 @@ public class StelliumMechanic extends TargetMechanic { amount = new DoubleFormula(config.getString("amount")); reason = PlayerResourceUpdateEvent.UpdateReason.valueOf(UtilityMethods.enumName(config.getString("reason", "CUSTOM"))); + operation = config.contains("operation") ? Operation.valueOf(config.getString("operation").toUpperCase()) : Operation.GIVE; } @Override public void cast(SkillMetadata meta, Entity target) { Validate.isTrue(target instanceof Player, "Target is not a player"); PlayerData targetData = PlayerData.get(target.getUniqueId()); - targetData.giveStellium(amount.evaluate(meta), reason); + if (operation == Operation.GIVE) + targetData.giveStellium(amount.evaluate(meta), reason); + else if (operation == Operation.SET) + targetData.setStellium(amount.evaluate(meta)); + else if (operation == Operation.TAKE) + targetData.giveStellium(-amount.evaluate(meta), reason); } } From 5d6dcf6304608c0d84482e62c2d1b37ad102a928 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 9 Jul 2022 20:03:36 +0200 Subject: [PATCH 64/91] Small changes --- .../mmocore/api/player/PlayerData.java | 10 ++++----- .../listener/option/RedirectVanillaExp.java | 21 ++++++++----------- .../player/playerclass/ClassTrigger.java | 3 +-- 3 files changed, 15 insertions(+), 19 deletions(-) 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 5b770865..20db1fb1 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -24,9 +24,12 @@ import net.Indyuce.mmocore.api.util.Closable; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.ExperienceObject; +import net.Indyuce.mmocore.experience.ExperienceTableClaimer; +import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.droptable.ExperienceItem; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor; import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.provided.Party; @@ -36,9 +39,6 @@ import net.Indyuce.mmocore.skill.RegisteredSkill; import net.Indyuce.mmocore.skill.cast.SkillCastingHandler; import net.Indyuce.mmocore.waypoint.Waypoint; import net.Indyuce.mmocore.waypoint.WaypointOption; -import net.Indyuce.mmocore.experience.ExperienceTableClaimer; -import net.Indyuce.mmocore.experience.PlayerProfessions; -import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.apache.commons.lang.Validate; @@ -589,8 +589,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc * * @param value Experience to give the player * @param source How the player earned experience - * @param hologramLocation Location used to display the hologram. If it's null, no - * hologram will be displayed + * @param hologramLocation Location used to display the hologram. + * If it's null, no hologram will be displayed * @param splitExp Should the exp be split among party members */ public void giveExperience(double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) { diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java b/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java index 68df53bd..b7d37027 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java +++ b/src/main/java/net/Indyuce/mmocore/listener/option/RedirectVanillaExp.java @@ -1,23 +1,20 @@ package net.Indyuce.mmocore.listener.option; +import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.EXPSource; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerExpChangeEvent; -import net.Indyuce.mmocore.api.player.PlayerData; - public class RedirectVanillaExp implements Listener { - private final double ratio; + private final double ratio; - public RedirectVanillaExp(double ratio) { - this.ratio = ratio; - } + public RedirectVanillaExp(double ratio) { + this.ratio = ratio; + } - @EventHandler - public void a(PlayerExpChangeEvent event) { - double a = (event.getAmount() * ratio); - if (a > 0) - PlayerData.get(event.getPlayer()).giveExperience(a, EXPSource.VANILLA); - } + @EventHandler + public void a(PlayerExpChangeEvent event) { + PlayerData.get(event.getPlayer()).giveExperience(event.getAmount() * ratio, EXPSource.VANILLA); + } } diff --git a/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java b/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java index a18649f8..4d5183f2 100644 --- a/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java @@ -12,7 +12,6 @@ import io.lumine.mythic.lib.skill.result.SkillResult; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; import io.lumine.mythic.lib.skill.trigger.TriggerType; import io.lumine.mythic.lib.util.configobject.ConfigObject; -import io.lumine.mythic.lib.util.configobject.LineConfigObject; import net.Indyuce.mmocore.listener.ClassTriggers; import org.apache.commons.lang.Validate; @@ -43,7 +42,7 @@ public class ClassTrigger { type = ClassTriggerType.valueOf(UtilityMethods.enumName(triggerTypeString)); for (String key : mechanicStringList) { - ConfigObject config = new LineConfigObject(new MMOLineConfig(key)); + ConfigObject config = new MMOLineConfig(key); Mechanic mechanic = MythicLib.plugin.getSkills().loadMechanic(config); skill.getMechanics().add(mechanic); } From e4aaf1351a8f4919cd24361ea1ce11bdf555597f Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 9 Jul 2022 20:19:13 +0200 Subject: [PATCH 65/91] Fixed an issue with exp holos and the killmythicmob exp source --- .../comp/mythicmobs/load/KillMythicMobExperienceSource.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java index bf161320..f81621fc 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/load/KillMythicMobExperienceSource.java @@ -4,6 +4,7 @@ import io.lumine.mythic.bukkit.events.MythicMobDeathEvent; import io.lumine.mythic.lib.api.MMOLineConfig; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; @@ -33,7 +34,7 @@ public class KillMythicMobExperienceSource extends SpecificExperienceSource Date: Mon, 11 Jul 2022 18:41:10 +0200 Subject: [PATCH 66/91] support for mythiclib 1.3.4 --- pom.xml | 10 ++-------- src/main/java/net/Indyuce/mmocore/MMOCore.java | 12 +++++++----- .../net/Indyuce/mmocore/api/util/MMOCoreUtils.java | 6 ++---- .../experience/source/EatExperienceSource.java | 2 +- .../net/Indyuce/mmocore/listener/BlockListener.java | 3 +-- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index ac34c689..e4040879 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.Indyuce MMOCore - 1.9.4 + 1.9.5 MMOCore Offer your players a brand new RPG experience!! @@ -125,12 +125,6 @@ - - org.jetbrains - annotations - 19.0.0 - provided - io.papermc @@ -149,7 +143,7 @@ io.lumine MythicLib-dist - 1.3.3 + 1.3.4 provided diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 5e5c987c..57d664ce 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -2,9 +2,8 @@ package net.Indyuce.mmocore; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; -import io.lumine.mythic.lib.comp.Metrics; +import io.lumine.mythic.lib.metrics.bukkit.Metrics; import io.lumine.mythic.lib.version.SpigotPlugin; -import io.lumine.mythic.utils.plugin.LuminePlugin; import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader; import net.Indyuce.mmocore.comp.mythicmobs.MythicHook; @@ -57,6 +56,7 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandMap; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; import org.spigotmc.SpigotConfig; @@ -65,7 +65,7 @@ import java.io.File; import java.lang.reflect.Field; import java.util.logging.Level; -public class MMOCore extends LuminePlugin { +public class MMOCore extends JavaPlugin { public static MMOCore plugin; public final WaypointManager waypointManager = new WaypointManager(); @@ -115,7 +115,8 @@ public class MMOCore extends LuminePlugin { plugin = this; } - public void load() { + @Override + public void onLoad() { // Register MMOCore-specific objects MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); @@ -140,7 +141,8 @@ public class MMOCore extends LuminePlugin { loadManager.registerLoader(new MythicMobsMMOLoader()); } - public void enable() { + @Override + public void onEnable() { new SpigotPlugin(70575, this).checkForUpdate(); new Metrics(this); saveDefaultConfig(); diff --git a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java index bd3b4050..2c57d437 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java +++ b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java @@ -3,9 +3,8 @@ package net.Indyuce.mmocore.api.util; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import io.lumine.mythic.lib.MythicLib; +import io.lumine.mythic.lib.hologram.Hologram; import io.lumine.mythic.lib.version.VersionMaterial; -import io.lumine.mythic.utils.holograms.Hologram; -import io.lumine.mythic.utils.serialize.Position; import net.Indyuce.mmocore.MMOCore; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -64,8 +63,7 @@ public class MMOCoreUtils { * @param message Message to display */ public static void displayIndicator(Location loc, String message) { - Hologram holo = Hologram.create(Position.of(loc), Arrays.asList(message)); - holo.spawn(); + Hologram holo = Hologram.create(loc, Arrays.asList(message)); Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> holo.despawn(), 20); } diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java index b312b5ac..505396aa 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/EatExperienceSource.java @@ -5,7 +5,7 @@ import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import net.Indyuce.mmocore.api.player.PlayerData; -import org.apache.commons.lang3.Validate; +import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; diff --git a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java index 3b8d720c..70d6a3d5 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java @@ -2,7 +2,6 @@ package net.Indyuce.mmocore.listener; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; -import io.lumine.mythic.utils.Schedulers; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.block.BlockInfo; import net.Indyuce.mmocore.api.block.VanillaBlockType; @@ -137,7 +136,7 @@ public class BlockListener implements Listener { * Finally enable block regen. */ if (info.hasRegen()) - Schedulers.sync().runLater(() -> MMOCore.plugin.mineManager.initialize(info.startRegeneration(Bukkit.createBlockData(savedData), block.getLocation()), !temporaryBlock), 1); + Bukkit.getScheduler().runTaskLater(MythicLib.plugin, () -> MMOCore.plugin.mineManager.initialize(info.startRegeneration(Bukkit.createBlockData(savedData), block.getLocation()), !temporaryBlock), 1); } /** From 3487fa8264f1b362f29f9fad21c8e105fbf72459 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Tue, 12 Jul 2022 15:29:22 +0200 Subject: [PATCH 67/91] change /mmocore help --- .../net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java index 49806a5d..dcefd387 100644 --- a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java +++ b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java @@ -23,7 +23,7 @@ public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandEx (explorer, list) -> MMOCore.plugin.questManager.getAll().forEach(quest -> list.add(quest.getId()))); public MMOCoreCommandTreeRoot() { - super("net/Indyuce/mmocore", "mmocore.admin"); + super("mmocore", "mmocore.admin"); addChild(new ReloadCommandTreeNode(this)); addChild(new CoinsCommandTreeNode(this)); From e5c3670e0d011c303fc38b0fca077b06a1e4be1a Mon Sep 17 00:00:00 2001 From: Indyuce Date: Fri, 15 Jul 2022 10:47:22 +0200 Subject: [PATCH 68/91] framework for guild target restrictions --- .../Indyuce/mmocore/guild/RelationType.java | 19 +++++++++++++++++++ src/main/resources/config.yml | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/main/java/net/Indyuce/mmocore/guild/RelationType.java diff --git a/src/main/java/net/Indyuce/mmocore/guild/RelationType.java b/src/main/java/net/Indyuce/mmocore/guild/RelationType.java new file mode 100644 index 00000000..1277296c --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/guild/RelationType.java @@ -0,0 +1,19 @@ +package net.Indyuce.mmocore.guild; + +public enum RelationType { + + /** + * In the same guild + */ + ALLY, + + /** + * One of the two players has no guild + */ + NEUTRAL, + + /** + * + */ + ENEMY; +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d7eb3cdb..1985a826 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -211,6 +211,14 @@ can-creative-cast: false # This replaces anvil inputs by chat inputs. use-chat-input: true +ability-targeting-options: + + # Prevent heals/buffs on players in a different guild + cant-heal-enemies: true + + # Prevent heals/buffs UNLESS the player is in your party/guild + cant-heal-neutrals: false + # Prevents mobs spawned from spawners from giving XP points. prevent-spawner-xp: true From a6594687754ee156c4aef51e5c156463276dbc60 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 24 Jul 2022 21:25:26 +0200 Subject: [PATCH 69/91] Fixed period of 0 for exp items --- .../experience/droptable/ExperienceItem.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index e9a6035a..27045351 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -55,9 +55,7 @@ public class ExperienceItem { Validate.isTrue(config.contains("triggers")); id = config.getName(); - final int periodOption = config.getInt("period", 1); - // A period of 0 means the item will only trigger once - period = periodOption == 0 ? Integer.MAX_VALUE : periodOption; + period = config.getInt("period", 1); firstTrigger = config.getInt("first-trigger", period); lastTrigger = config.getInt("last-trigger", Integer.MAX_VALUE); claimChance = config.getDouble("chance", 100) / 100; @@ -79,10 +77,17 @@ public class ExperienceItem { * account the randomness factor from the 'chance' parameter */ public boolean roll(int professionLevel, int timesCollected) { + + // Check for the last triggering level if (professionLevel > lastTrigger) return false; - int claimsRequired = (professionLevel + 1 - (firstTrigger + timesCollected * period)); + // A period of 0 means the item only triggers once + if (period == 0 && timesCollected > 0) + return false; + + // Basic formula + final int claimsRequired = (professionLevel + 1 - (firstTrigger + timesCollected * period)); if (claimsRequired < 1) return false; From 55d1a3cf13bddd4bb3804ba4790b7e6f6826d170 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 24 Jul 2022 21:58:57 +0200 Subject: [PATCH 70/91] Fixed an issue with 'Skill Scroller' casting mode --- .../net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java index 43717196..c7189bcf 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java +++ b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillScroller.java @@ -107,6 +107,9 @@ public class SkillScroller implements Listener { CustomSkillCastingHandler casting = (CustomSkillCastingHandler) playerData.getSkillCasting(); casting.index = mod(casting.index + change, playerData.getBoundSkills().size()); casting.onTick(); + + if (changeSound != null) + changeSound.playTo(event.getPlayer()); } private int mod(int x, int n) { From 1ac652e4598025d002be7524c7f39fb27b32862d Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sun, 24 Jul 2022 22:36:38 +0200 Subject: [PATCH 71/91] Fixed attributes points spending overflow --- .../mmocore/api/player/PlayerData.java | 4 +-- .../Indyuce/mmocore/gui/AttributeView.java | 30 +++++++------------ src/main/resources/default/messages.yml | 4 +-- 3 files changed, 13 insertions(+), 25 deletions(-) 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 20db1fb1..c98a805e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -804,12 +804,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc Validate.isTrue(isCasting(), "Player not in casting mode"); skillCasting.close(); this.skillCasting = null; + setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar } public void displayActionBar(String message) { - if (!isOnline()) - return; - setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE); getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); } diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index ebd108e7..21dd9065 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -16,8 +16,6 @@ import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; -import java.util.logging.Level; - public class AttributeView extends EditableInventory { public AttributeView() { super("attribute-view"); @@ -47,20 +45,14 @@ public class AttributeView extends EditableInventory { public static class AttributeItem extends InventoryItem { private final PlayerAttribute attribute; - private int shiftCost=1; + private final int shiftCost; public AttributeItem(String function, ConfigurationSection config) { super(config); attribute = MMOCore.plugin.attributeManager .get(function.substring("attribute_".length()).toLowerCase().replace(" ", "-").replace("_", "-")); - if(config.contains("shift-cost")) { - shiftCost = config.getInt("shift-cost"); - if (shiftCost < 1) { - MMOCore.log(Level.WARNING, "Level up points cost must not be less than 1. Using default value: 1"); - shiftCost = 1; - } - } + shiftCost = Math.max(config.getInt("shift-cost"), 1); } @Override @@ -124,7 +116,6 @@ public class AttributeView extends EditableInventory { if (item.getFunction().startsWith("attribute_")) { PlayerAttribute attribute = ((AttributeItem) item).attribute; - int shiftCost = ((AttributeItem) item).shiftCost; if (playerData.getAttributePoints() < 1) { MMOCore.plugin.configManager.getSimpleMessage("not-attribute-point").send(player); @@ -140,16 +131,15 @@ public class AttributeView extends EditableInventory { } // Amount of points spent - int pointsSpent = 1; + final boolean shiftClick = event.isShiftClick(); + int pointsSpent = shiftClick ? ((AttributeItem) item).shiftCost : 1; + if (attribute.hasMax()) + pointsSpent = Math.min(pointsSpent, attribute.getMax() - ins.getBase()); - if (event.isShiftClick()) { - if (playerData.getAttributePoints() < shiftCost) { - MMOCore.plugin.configManager.getSimpleMessage("not-attribute-point-shift", "shift_points", "" + shiftCost).send(player); - MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); - return; - } - - pointsSpent = shiftCost; + if (shiftClick && playerData.getAttributePoints() < pointsSpent) { + MMOCore.plugin.configManager.getSimpleMessage("not-attribute-point-shift", "shift_points", String.valueOf(pointsSpent)).send(player); + MMOCore.plugin.soundManager.getSound(SoundEvent.NOT_ENOUGH_POINTS).playTo(getPlayer()); + return; } ins.addBase(pointsSpent); diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index f15c0711..ee0499a6 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -156,8 +156,8 @@ cant-choose-new-class: # Attributes no-attribute-points-spent: '&cYou have not spent any attribute points.' not-attribute-reallocation-point: '&cYou do not have 1 reallocation point.' -not-attribute-point: '&cYou do not have 1 attribute point.' -not-attribute-point-shift: '&cYou do not have &4{shift_points} &cattribute points.' +not-attribute-point: '&cYou have no attribute point.' +not-attribute-point-shift: '&cYou must have &4{shift_points} &cattribute points.' attribute-points-reallocated: '&eYou successfully reset your attributes. You now have &6{points} &eattribute points.' attribute-max-points-hit: '&cYou cannot level up this attribute anymore.' attribute-level-up: '&eYou successfully leveled up your &6{attribute}&e.' # {level} From e502960a13f8fb0950296c3d0078f35ea4bd0078 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 25 Jul 2022 10:19:13 +0200 Subject: [PATCH 72/91] Debug profession & chance stat --- pom.xml | 6 +++++- .../experience/source/KillMobExperienceSource.java | 9 ++++++--- .../Indyuce/mmocore/listener/option/NoSpawnerEXP.java | 3 +++ .../mmocore/loot/droptable/dropitem/DropItem.java | 11 ++++++++++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index e4040879..94ffa2ac 100644 --- a/pom.xml +++ b/pom.xml @@ -81,6 +81,10 @@ + + phoenix + http://la-grange-evasion.pro.dns-orange.fr:8081/ + lumine @@ -143,7 +147,7 @@ io.lumine MythicLib-dist - 1.3.4 + 1.3.4 provided diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java index 96c3a7be..a1c28452 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.experience.source; +import com.guillaumevdn.questcreator.lib.event.PlayerKillEntityEvent; import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.event.PlayerKillEntityEvent; import net.Indyuce.mmocore.MMOCore; @@ -9,10 +10,12 @@ import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import net.Indyuce.mmocore.api.player.PlayerData; import org.bukkit.Bukkit; +import org.bukkit.NamespacedKey; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.persistence.PersistentDataType; public class KillMobExperienceSource extends SpecificExperienceSource { public final EntityType type; @@ -30,12 +33,12 @@ public class KillMobExperienceSource extends SpecificExperienceSource { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void a(PlayerKillEntityEvent event) { Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> { - if (event.getTarget().isDead() && !event.getTarget().hasMetadata("spawner_spawned")) { + if (event.getKilled().isDead() && !event.getKilled().getPersistentDataContainer().has(new NamespacedKey(MMOCore.plugin,"spawner_spawned"),PersistentDataType.STRING)) { PlayerData data = PlayerData.get(event.getPlayer()); for (KillMobExperienceSource source : getSources()) - if (source.matches(data, event.getTarget())) - source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getTarget())); + if (source.matches(data, event.getKilled())) + source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getKilled())); } }, 2); } diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java b/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java index d5382c8c..e819b9ba 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java +++ b/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java @@ -1,16 +1,19 @@ package net.Indyuce.mmocore.listener.option; import net.Indyuce.mmocore.MMOCore; +import org.bukkit.NamespacedKey; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.persistence.PersistentDataType; public class NoSpawnerEXP implements Listener { @EventHandler public void a(CreatureSpawnEvent event) { if(event.getSpawnReason() == SpawnReason.SPAWNER) + event.getEntity().getPersistentDataContainer().set(new NamespacedKey(MMOCore.plugin,"spawner_spawned"), PersistentDataType.STRING,"true"); event.getEntity().setMetadata("spawner_spawned", new FixedMetadataValue(MMOCore.plugin, true)); } } diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java b/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java index b84e5cc3..17f10cb6 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java +++ b/src/main/java/net/Indyuce/mmocore/loot/droptable/dropitem/DropItem.java @@ -10,6 +10,7 @@ import io.lumine.mythic.lib.api.MMOLineConfig; public abstract class DropItem { protected static final Random random = new Random(); + private static final double CHANCE_COEFFICIENT = 7. / 100; private final double chance, weight; private final RandomAmount amount; @@ -35,11 +36,19 @@ public abstract class DropItem { return amount.calculateInt(); } + /** + * CHANCE stat = 0 | tier chances are unchanged + * CHANCE stat = +inf | uniform law for any drop item + * CHANCE stat = 100 | all tier chances are taken their square root + * + * @return The real weight of an item considering the player's CHANCE stat. + */ /** * If the player chance is 0 the random value will remain the same. When he get lucks the chance gets closer to one. */ public boolean rollChance(PlayerData player) { - return Math.pow(random.nextDouble(), 1 / Math.log(1 + player.getStats().getStat("CHANCE"))) < chance; + double value=random.nextDouble(); + return value< Math.pow(chance, 1 / Math.pow(1 + CHANCE_COEFFICIENT * player.getStats().getStat("CHANCE"), 1.0 / 3.0)); } public abstract void collect(LootBuilder builder); From dc2efdea9912332c1d86a4da4c1c04138846d060 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 25 Jul 2022 16:39:38 +0200 Subject: [PATCH 73/91] Debug profession & chance stat --- src/main/java/net/Indyuce/mmocore/MMOCore.java | 3 ++- .../mmocore/experience/source/KillMobExperienceSource.java | 7 +++---- .../net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java | 7 ++++--- src/main/resources/config.yml | 3 ++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 57d664ce..267de06e 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -284,8 +284,9 @@ public class MMOCore extends JavaPlugin { getLogger().log(Level.WARNING, "Could not load hotbar swapping: " + exception.getMessage()); } - if (getConfig().getBoolean("prevent-spawner-xp")) + if (getConfig().getBoolean("prevent-spawner-xp")) { Bukkit.getPluginManager().registerEvents(new NoSpawnerEXP(), this); + } if (getConfig().getBoolean("death-exp-loss.enabled")) Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this); diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java index a1c28452..07adb354 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/KillMobExperienceSource.java @@ -1,6 +1,5 @@ package net.Indyuce.mmocore.experience.source; -import com.guillaumevdn.questcreator.lib.event.PlayerKillEntityEvent; import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.event.PlayerKillEntityEvent; import net.Indyuce.mmocore.MMOCore; @@ -33,12 +32,12 @@ public class KillMobExperienceSource extends SpecificExperienceSource { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void a(PlayerKillEntityEvent event) { Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> { - if (event.getKilled().isDead() && !event.getKilled().getPersistentDataContainer().has(new NamespacedKey(MMOCore.plugin,"spawner_spawned"),PersistentDataType.STRING)) { + if (event.getTarget().isDead() && !event.getTarget().getPersistentDataContainer().has(new NamespacedKey(MMOCore.plugin,"spawner_spawned"),PersistentDataType.STRING)) { PlayerData data = PlayerData.get(event.getPlayer()); for (KillMobExperienceSource source : getSources()) - if (source.matches(data, event.getKilled())) - source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getKilled())); + if (source.matches(data, event.getTarget())) + source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getTarget())); } }, 2); } diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java b/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java index e819b9ba..6a03f24d 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java +++ b/src/main/java/net/Indyuce/mmocore/listener/option/NoSpawnerEXP.java @@ -1,6 +1,7 @@ package net.Indyuce.mmocore.listener.option; import net.Indyuce.mmocore.MMOCore; +import org.bukkit.Bukkit; import org.bukkit.NamespacedKey; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -11,9 +12,9 @@ import org.bukkit.persistence.PersistentDataType; public class NoSpawnerEXP implements Listener { @EventHandler - public void a(CreatureSpawnEvent event) { - if(event.getSpawnReason() == SpawnReason.SPAWNER) + public void onSpawn(CreatureSpawnEvent event) { + if(event.getSpawnReason() == SpawnReason.SPAWNER) { event.getEntity().getPersistentDataContainer().set(new NamespacedKey(MMOCore.plugin,"spawner_spawned"), PersistentDataType.STRING,"true"); - event.getEntity().setMetadata("spawner_spawned", new FixedMetadataValue(MMOCore.plugin, true)); + } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1985a826..a33fa61f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -219,9 +219,10 @@ ability-targeting-options: # Prevent heals/buffs UNLESS the player is in your party/guild cant-heal-neutrals: false -# Prevents mobs spawned from spawners from giving XP points. +# Prevents mobs spawned from spawners from giving MMO XP points. prevent-spawner-xp: true + # Timer for combat log to expire (in seconds) combat-log: timer: 10 From 6df4b2e9f76aa033c17deb1b13f2af4687af9af1 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Mon, 25 Jul 2022 17:18:20 +0200 Subject: [PATCH 74/91] Permissions for classes --- .../mmocore/api/player/profess/PlayerClass.java | 10 +++++++++- src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java | 7 +++++++ src/main/resources/default/classes/arcane-mage.yml | 3 +++ src/main/resources/default/classes/human.yml | 5 +++++ src/main/resources/default/classes/mage.yml | 5 +++++ src/main/resources/default/classes/marksman.yml | 5 +++++ src/main/resources/default/classes/paladin.yml | 5 +++++ src/main/resources/default/classes/rogue.yml | 5 +++++ src/main/resources/default/classes/warrior.yml | 4 ++++ src/main/resources/default/messages.yml | 3 ++- 10 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 765b54e5..5be54c20 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -60,6 +60,8 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { private final Map resourceHandlers = new HashMap<>(); + private final boolean needsPermission; + @Deprecated private final Map eventTriggers = new HashMap<>(); @@ -166,6 +168,8 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { } } + needsPermission =config.contains("needs-permission")?config.getBoolean("needs-permission"):false; + /* * Must make sure all the resourceHandlers are registered * when the placer class is initialized. @@ -205,7 +209,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { expTable = null; castParticle = new CastingParticle(Particle.SPELL_INSTANT); actionBarFormat = ""; - + needsPermission =false; this.icon = new ItemStack(material); setOption(ClassOption.DISPLAY, false); setOption(ClassOption.DEFAULT, false); @@ -275,6 +279,10 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return expTable != null; } + public boolean needsPermission() { + return needsPermission; + } + public ItemStack getIcon() { return icon.clone(); } diff --git a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java b/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java index da5d505a..80ffed86 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java +++ b/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java @@ -82,6 +82,7 @@ public class ClassSelect extends EditableInventory { lore.add(index + j, profess.getAttributeDescription().get(j)); } + meta.setLore(lore); item.setItemMeta(meta); return NBTItem.get(item).addTag(new ItemTag("classId", profess.getId())).toItem(); @@ -115,6 +116,12 @@ public class ClassSelect extends EditableInventory { } PlayerClass profess = MMOCore.plugin.classManager.get(tag); + if(profess.needsPermission()&&!player.hasPermission("mmocore.class."+profess.getName().toLowerCase())) { + MMOCore.plugin.soundManager.getSound(SoundEvent.CANT_SELECT_CLASS).playTo(player); + new ConfigMessage("no-permission-for-class").send(player); + return; + } + if (profess.equals(playerData.getProfess())) { MMOCore.plugin.soundManager.getSound(SoundEvent.CANT_SELECT_CLASS).playTo(player); MMOCore.plugin.configManager.getSimpleMessage("already-on-class", "class", profess.getName()).send(player); diff --git a/src/main/resources/default/classes/arcane-mage.yml b/src/main/resources/default/classes/arcane-mage.yml index 2ecd420a..1236f2c5 100644 --- a/src/main/resources/default/classes/arcane-mage.yml +++ b/src/main/resources/default/classes/arcane-mage.yml @@ -99,6 +99,9 @@ skills: level: 15 max-level: 30 +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/human.yml b/src/main/resources/default/classes/human.yml index dc27e6d8..a570a890 100644 --- a/src/main/resources/default/classes/human.yml +++ b/src/main/resources/default/classes/human.yml @@ -19,6 +19,11 @@ options: # Must match an existing exp curve filename from the 'expcurves' folder exp-curve: levels + +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/mage.yml b/src/main/resources/default/classes/mage.yml index 40de28fa..25448b53 100644 --- a/src/main/resources/default/classes/mage.yml +++ b/src/main/resources/default/classes/mage.yml @@ -139,6 +139,11 @@ skills: level: 15 max-level: 30 + +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/marksman.yml b/src/main/resources/default/classes/marksman.yml index 53c174bb..6839af0f 100644 --- a/src/main/resources/default/classes/marksman.yml +++ b/src/main/resources/default/classes/marksman.yml @@ -85,6 +85,11 @@ attributes: base: .105 per-level: 0 + +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/paladin.yml b/src/main/resources/default/classes/paladin.yml index 1914e23b..b60418f6 100644 --- a/src/main/resources/default/classes/paladin.yml +++ b/src/main/resources/default/classes/paladin.yml @@ -75,6 +75,11 @@ attributes: base: .095 per-level: 0 + +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/rogue.yml b/src/main/resources/default/classes/rogue.yml index d22d3ce1..62f23276 100644 --- a/src/main/resources/default/classes/rogue.yml +++ b/src/main/resources/default/classes/rogue.yml @@ -78,6 +78,11 @@ attributes: base: .105 per-level: 0 + + +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/warrior.yml b/src/main/resources/default/classes/warrior.yml index bf127b0f..12e8a92d 100644 --- a/src/main/resources/default/classes/warrior.yml +++ b/src/main/resources/default/classes/warrior.yml @@ -115,6 +115,10 @@ attributes: base: 4.2 per-level: 0.05 + +#If true the player will need to have the mmocore.class.{class_name} permission +needs-permission: false + # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index ee0499a6..0da94fa8 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -152,7 +152,8 @@ start-quest: '&eYou successfully started &6{quest}&e.' cant-choose-new-class: - '&cYou need one class point to perform this action.' - +no-permission-for-class: +- "&cYou don't have the permission to choose this class." # Attributes no-attribute-points-spent: '&cYou have not spent any attribute points.' not-attribute-reallocation-point: '&cYou do not have 1 reallocation point.' From d30dcfe77e9cd1b7f9e6b9e40c39d67758fae081 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 25 Jul 2022 17:53:10 +0200 Subject: [PATCH 75/91] Fixed attribute-based stats displayed in /p --- src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 16bbd451..5cdfa0a3 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -2,6 +2,7 @@ package net.Indyuce.mmocore.gui; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; +import io.lumine.mythic.lib.api.stat.handler.StatHandler; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; @@ -131,13 +132,13 @@ public class PlayerStats extends EditableInventory { replaced = info.format(stats.getBase(info.name)); } else if (holder.endsWith("_extra")) { StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); - replaced = info.format(stats.getStat(info.name) - stats.getBase(info.name)); + replaced = info.format(MythicLib.plugin.getStats().getTotalValue(info.name, stats.getMap()) - stats.getBase(info.name)); } else if (holder.startsWith("attribute_")) { PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase()); replaced = String.valueOf(inv.target.getAttributes().getAttribute(attr)); } else { StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder)); - replaced = info.format(stats.getStat(info.name)); + replaced = info.format(MythicLib.plugin.getStats().getTotalValue(info.name, stats.getMap())); } str = str.replace("{" + holder + "}", replaced); From 33b9841182c0c0548343d5d01d7c9fe736e8a1e4 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 25 Jul 2022 17:57:46 +0200 Subject: [PATCH 76/91] Fixed an issue with PAPI math expansion in GUIs --- .../java/net/Indyuce/mmocore/gui/api/item/Placeholders.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java b/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java index e6572908..48bc03ba 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/item/Placeholders.java @@ -2,6 +2,7 @@ package net.Indyuce.mmocore.gui.api.item; import net.Indyuce.mmocore.MMOCore; import org.bukkit.entity.Player; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; @@ -21,7 +22,9 @@ public class Placeholders { // Internal placeholders while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); - str = str.replace("{" + holder + "}", placeholders.getOrDefault(holder, "Error")); + @Nullable String found = placeholders.get(holder); + if (found != null) + str = str.replace("{" + holder + "}", found); } // External placeholders From fd1064754670b45cab91c1b754722d62ee9da7de Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Tue, 26 Jul 2022 10:25:10 +0200 Subject: [PATCH 77/91] Creatin of /mmocore transferdata to transfer sql data to yml and yml to sql --- .../java/net/Indyuce/mmocore/MMOCore.java | 5 +- .../mmocore/api/player/PlayerData.java | 3 +- .../command/MMOCoreCommandTreeRoot.java | 2 + .../command/rpg/TransferDataTreeNode.java | 71 +++++++++++++++++++ .../data/mysql/MySQLPlayerDataManager.java | 6 +- .../manager/data/mysql/MySQLTableEditor.java | 7 +- 6 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 267de06e..2c8e784f 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -374,9 +374,8 @@ public class MMOCore extends JavaPlugin { }.runTaskTimerAsynchronously(MMOCore.plugin, autosave, autosave); } } - - public void disable() { - + @Override + public void onDisable() { // Save player data for (PlayerData data : PlayerData.getAll()) if (data.isFullyLoaded()) { 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 c98a805e..cc8bb1e0 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -514,9 +514,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public String toJson() { - //We create the JSON correspondign to player Data + //We create the JSON corresponding to player Data JsonObject jsonObject = new JsonObject(); - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, getUniqueId()); MMOCore.sqlDebug("Saving data for: '" + getUniqueId() + "'..."); jsonObject.addProperty("class_points", getClassPoints()); diff --git a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java index dcefd387..11466232 100644 --- a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java +++ b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java @@ -6,6 +6,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode; import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode; import net.Indyuce.mmocore.command.rpg.ReloadCommandTreeNode; +import net.Indyuce.mmocore.command.rpg.TransferDataTreeNode; import net.Indyuce.mmocore.command.rpg.admin.AdminCommandTreeNode; import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandTreeNode; import net.Indyuce.mmocore.command.rpg.debug.DebugCommandTreeNode; @@ -26,6 +27,7 @@ public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandEx super("mmocore", "mmocore.admin"); addChild(new ReloadCommandTreeNode(this)); + addChild(new TransferDataTreeNode(this)); addChild(new CoinsCommandTreeNode(this)); addChild(new NoteCommandTreeNode(this)); addChild(new AdminCommandTreeNode(this)); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java new file mode 100644 index 00000000..e7d8f9ad --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java @@ -0,0 +1,71 @@ +package net.Indyuce.mmocore.command.rpg; + +import io.lumine.mythic.lib.command.api.CommandTreeNode; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.guild.provided.Guild; +import net.Indyuce.mmocore.manager.data.DataProvider; +import net.Indyuce.mmocore.manager.data.mysql.MySQLDataProvider; +import net.Indyuce.mmocore.manager.data.yaml.YAMLDataProvider; +import org.bukkit.command.CommandSender; +import org.bukkit.scheduler.BukkitRunnable; + + +/** + * This command allows to transfer data from your actual datatype (yaml or sql) to the other one to make a change + * in the data storage type. + */ +public class TransferDataTreeNode extends CommandTreeNode { + + + public TransferDataTreeNode(CommandTreeNode parent) { + super(parent, "transferdata"); + } + + @Override + public CommandResult execute(CommandSender commandSender, String[] strings) { + DataProvider provider=null; + + try { + + if (MMOCore.plugin.dataProvider instanceof YAMLDataProvider) { + provider = new MySQLDataProvider(MMOCore.plugin.getConfig()); + ((MySQLDataProvider) provider).load(); + } else { + provider = new YAMLDataProvider(); + } + + // Save player data + for (PlayerData data : PlayerData.getAll()) + if (data.isFullyLoaded()) + provider.getDataManager().saveData(data); + + // Save guild info + for (Guild guild : provider.getGuildManager().getAll()) + provider.getGuildManager().save(guild); + } catch (Exception e) { + commandSender.sendMessage("Couldn't transfer properly the data."); + e.printStackTrace(); + if(provider!=null&&provider instanceof MySQLDataProvider) { + ((MySQLDataProvider) provider).close(); + } + return CommandResult.FAILURE; + } + DataProvider finalProvider = provider; + + //We close the connection 10 s later to avoid memory leaks. + new BukkitRunnable() { + + @Override + public void run() { + if(finalProvider !=null&& finalProvider instanceof MySQLDataProvider) { + ((MySQLDataProvider) finalProvider).close(); + } + } + }.runTaskLater(MMOCore.plugin,200); + + + return CommandResult.SUCCESS; + + } +} diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 34432b56..d9c696eb 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -110,7 +110,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { } //We now change the saved status to false because the data on SQL won't be the same as in the RAM - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId(),provider); //We set the saved status to false sql.updateData("is_saved", 0); @@ -155,7 +155,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { @Override public void saveData(PlayerData data) { - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId()); + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId(),provider); MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); sql.updateData("class_points", data.getClassPoints()); @@ -232,7 +232,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { @Override public void removeFriend(UUID uuid) { friends.remove(uuid); - new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); + new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid,provider).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java index 8f5cbea7..16f387ac 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLTableEditor.java @@ -14,13 +14,16 @@ public class MySQLTableEditor { private final Table table; private final UUID uuid; - public MySQLTableEditor(Table table, UUID uuid) { + private final MySQLDataProvider provider; + + public MySQLTableEditor(Table table, UUID uuid,MySQLDataProvider provider) { this.table = table; this.uuid = uuid; + this.provider=provider; } public void updateData(String key, Object value) { - ((MySQLDataProvider) MMOCore.plugin.dataProvider).executeUpdate("INSERT INTO " + table + "(uuid, " + key + provider.executeUpdate("INSERT INTO " + table + "(uuid, " + key + ") VALUES('" + uuid + "', '" + value + "') ON DUPLICATE KEY UPDATE " + key + "='" + value + "';"); } From b125dac15513e1b5240accec657d3026d07bcef7 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 26 Jul 2022 12:41:01 +0200 Subject: [PATCH 78/91] Fixed attribute stats display --- src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java | 5 ++--- src/main/resources/default/classes/marksman.yml | 4 ++-- src/main/resources/default/classes/paladin.yml | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java index 5cdfa0a3..f24730c4 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java +++ b/src/main/java/net/Indyuce/mmocore/gui/PlayerStats.java @@ -2,7 +2,6 @@ package net.Indyuce.mmocore.gui; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; -import io.lumine.mythic.lib.api.stat.handler.StatHandler; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.version.VersionMaterial; import net.Indyuce.mmocore.MMOCore; @@ -124,14 +123,14 @@ public class PlayerStats extends EditableInventory { public String apply(Player player, String str) { while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) { - String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); + final String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}")); String replaced; if (holder.endsWith("_base")) { StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); replaced = info.format(stats.getBase(info.name)); } else if (holder.endsWith("_extra")) { - StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 5))); + StatInfo info = StatInfo.valueOf(UtilityMethods.enumName(holder.substring(0, holder.length() - 6))); replaced = info.format(MythicLib.plugin.getStats().getTotalValue(info.name, stats.getMap()) - stats.getBase(info.name)); } else if (holder.startsWith("attribute_")) { PlayerAttribute attr = MMOCore.plugin.attributeManager.get(holder.substring(10).replace("_", "-").toLowerCase()); diff --git a/src/main/resources/default/classes/marksman.yml b/src/main/resources/default/classes/marksman.yml index 6839af0f..06421f86 100644 --- a/src/main/resources/default/classes/marksman.yml +++ b/src/main/resources/default/classes/marksman.yml @@ -73,8 +73,8 @@ skills: attributes: knockback-resistance: - base: 15 - per-level: 1 + base: .15 + per-level: .01 speed-malus-reduction: base: 10 per-level: 2 diff --git a/src/main/resources/default/classes/paladin.yml b/src/main/resources/default/classes/paladin.yml index b60418f6..5ce9fb64 100644 --- a/src/main/resources/default/classes/paladin.yml +++ b/src/main/resources/default/classes/paladin.yml @@ -60,8 +60,8 @@ skills: attributes: knockback-resistance: - base: 30 - per-level: 1 + base: .3 + per-level: .01 speed-malus-reduction: base: 30 per-level: 2 From 7d2d8a59b2689fd6402b18451b4cee4816c1072a Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 26 Jul 2022 15:20:13 +0200 Subject: [PATCH 79/91] Class option for class permission --- .../api/player/profess/ClassOption.java | 80 ++++++++++--------- .../api/player/profess/PlayerClass.java | 11 +-- .../net/Indyuce/mmocore/gui/ClassSelect.java | 10 +-- 3 files changed, 49 insertions(+), 52 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java index d0f6a72a..22978d97 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/ClassOption.java @@ -2,51 +2,57 @@ package net.Indyuce.mmocore.api.player.profess; public enum ClassOption { - /** - * If the class should be applied to newcomers - */ - DEFAULT, + /** + * If the class should be applied to newcomers + */ + DEFAULT, - /** - * If the class should in the /class GUI - */ - DISPLAY(true), + /** + * When set to true any player has to have the + * mmocore.class.lower_case_name permission to use the class + */ + NEEDS_PERMISSION, - /** - * Health only regens when out of combat - */ - OFF_COMBAT_HEALTH_REGEN, + /** + * If the class should in the /class GUI + */ + DISPLAY(true), - /** - * Mana only regens when out of combat - */ - OFF_COMBAT_MANA_REGEN, + /** + * Health only regens when out of combat + */ + OFF_COMBAT_HEALTH_REGEN, - /** - * Stamina only regens when out of combat - */ - OFF_COMBAT_STAMINA_REGEN, + /** + * Mana only regens when out of combat + */ + OFF_COMBAT_MANA_REGEN, - /** - * Stellium only regens when out of combat - */ - OFF_COMBAT_STELLIUM_REGEN; + /** + * Stamina only regens when out of combat + */ + OFF_COMBAT_STAMINA_REGEN, - private final boolean def; + /** + * Stellium only regens when out of combat + */ + OFF_COMBAT_STELLIUM_REGEN; - ClassOption() { - this(false); - } + private final boolean def; - ClassOption(boolean def) { - this.def = def; - } + ClassOption() { + this(false); + } - public boolean getDefault() { - return def; - } + ClassOption(boolean def) { + this.def = def; + } - public String getPath() { - return name().toLowerCase().replace("_", "-"); - } + public boolean getDefault() { + return def; + } + + public String getPath() { + return name().toLowerCase().replace("_", "-"); + } } \ No newline at end of file diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 5be54c20..320fdea3 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -60,8 +60,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { private final Map resourceHandlers = new HashMap<>(); - private final boolean needsPermission; - @Deprecated private final Map eventTriggers = new HashMap<>(); @@ -168,8 +166,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { } } - needsPermission =config.contains("needs-permission")?config.getBoolean("needs-permission"):false; - /* * Must make sure all the resourceHandlers are registered * when the placer class is initialized. @@ -209,7 +205,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { expTable = null; castParticle = new CastingParticle(Particle.SPELL_INSTANT); actionBarFormat = ""; - needsPermission =false; this.icon = new ItemStack(material); setOption(ClassOption.DISPLAY, false); setOption(ClassOption.DEFAULT, false); @@ -279,10 +274,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return expTable != null; } - public boolean needsPermission() { - return needsPermission; - } - public ItemStack getIcon() { return icon.clone(); } @@ -304,7 +295,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { } public boolean hasOption(ClassOption option) { - return options.containsKey(option) ? options.get(option) : option.getDefault(); + return options.getOrDefault(option, option.getDefault()); } @Override diff --git a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java b/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java index 80ffed86..dea606ac 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java +++ b/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java @@ -4,16 +4,16 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.item.ItemTag; import io.lumine.mythic.lib.api.item.NBTItem; 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.gui.api.EditableInventory; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; -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 org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; @@ -116,7 +116,7 @@ public class ClassSelect extends EditableInventory { } PlayerClass profess = MMOCore.plugin.classManager.get(tag); - if(profess.needsPermission()&&!player.hasPermission("mmocore.class."+profess.getName().toLowerCase())) { + 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); return; From a7e2773ff7774a32e8c7aed3d3427dc016bafc23 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 26 Jul 2022 15:22:47 +0200 Subject: [PATCH 80/91] Default class configs fixed --- src/main/resources/default/classes/arcane-mage.yml | 4 +--- src/main/resources/default/classes/human.yml | 6 +----- src/main/resources/default/classes/mage.yml | 6 +----- src/main/resources/default/classes/marksman.yml | 5 ----- src/main/resources/default/classes/paladin.yml | 5 ----- src/main/resources/default/classes/rogue.yml | 7 ++----- src/main/resources/default/classes/warrior.yml | 5 +---- 7 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/main/resources/default/classes/arcane-mage.yml b/src/main/resources/default/classes/arcane-mage.yml index 1236f2c5..7dd9fa9b 100644 --- a/src/main/resources/default/classes/arcane-mage.yml +++ b/src/main/resources/default/classes/arcane-mage.yml @@ -38,6 +38,7 @@ max-level: 100 # because it is a subclass of mage options: display: false + needs-permission: false exp-table: class_exp_table @@ -99,9 +100,6 @@ skills: level: 15 max-level: 30 -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/human.yml b/src/main/resources/default/classes/human.yml index a570a890..804904be 100644 --- a/src/main/resources/default/classes/human.yml +++ b/src/main/resources/default/classes/human.yml @@ -11,6 +11,7 @@ display: options: default: true display: false + needs-permission: false # False by default # Only regens when out of combat off-combat-health-regen: false @@ -19,11 +20,6 @@ options: # Must match an existing exp curve filename from the 'expcurves' folder exp-curve: levels - -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/mage.yml b/src/main/resources/default/classes/mage.yml index 25448b53..322efc2b 100644 --- a/src/main/resources/default/classes/mage.yml +++ b/src/main/resources/default/classes/mage.yml @@ -75,6 +75,7 @@ resource: options: off-combat-health-regen: true + needs-permission: false attributes: max-health: @@ -139,11 +140,6 @@ skills: level: 15 max-level: 30 - -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/marksman.yml b/src/main/resources/default/classes/marksman.yml index 06421f86..64c6d2b4 100644 --- a/src/main/resources/default/classes/marksman.yml +++ b/src/main/resources/default/classes/marksman.yml @@ -85,11 +85,6 @@ attributes: base: .105 per-level: 0 - -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/paladin.yml b/src/main/resources/default/classes/paladin.yml index 5ce9fb64..952f90f4 100644 --- a/src/main/resources/default/classes/paladin.yml +++ b/src/main/resources/default/classes/paladin.yml @@ -75,11 +75,6 @@ attributes: base: .095 per-level: 0 - -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/rogue.yml b/src/main/resources/default/classes/rogue.yml index 62f23276..85070e3e 100644 --- a/src/main/resources/default/classes/rogue.yml +++ b/src/main/resources/default/classes/rogue.yml @@ -38,6 +38,8 @@ options: off-combat-mana-regen: true off-combat-health-regen: true + needs-permission: false + cast-particle: particle: SPELL_WITCH @@ -78,11 +80,6 @@ attributes: base: .105 per-level: 0 - - -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' diff --git a/src/main/resources/default/classes/warrior.yml b/src/main/resources/default/classes/warrior.yml index 12e8a92d..dd10fb90 100644 --- a/src/main/resources/default/classes/warrior.yml +++ b/src/main/resources/default/classes/warrior.yml @@ -72,6 +72,7 @@ cast-particle: # Rage only decays when out of combat options: off-combat-mana-regen: true + needs-permission: false skills: DEEP_WOUND: @@ -115,10 +116,6 @@ attributes: base: 4.2 per-level: 0.05 - -#If true the player will need to have the mmocore.class.{class_name} permission -needs-permission: false - # Experience sources for main class experience. main-exp-sources: - 'killmob{type=ZOMBIE;amount=1-3}' From 7c79f9cee3fb436a0342f3aa833e385e6b236140 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Tue, 26 Jul 2022 15:33:23 +0200 Subject: [PATCH 81/91] Moved /mmocore admin transferdata --- .../command/MMOCoreCommandTreeRoot.java | 36 +++++++++---------- .../rpg/admin/AdminCommandTreeNode.java | 1 + .../rpg/{ => admin}/TransferDataTreeNode.java | 18 ++++------ .../manager/data/mysql/MySQLDataProvider.java | 1 - 4 files changed, 25 insertions(+), 31 deletions(-) rename src/main/java/net/Indyuce/mmocore/command/rpg/{ => admin}/TransferDataTreeNode.java (82%) diff --git a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java index 11466232..048ffb48 100644 --- a/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java +++ b/src/main/java/net/Indyuce/mmocore/command/MMOCoreCommandTreeRoot.java @@ -6,7 +6,6 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode; import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode; import net.Indyuce.mmocore.command.rpg.ReloadCommandTreeNode; -import net.Indyuce.mmocore.command.rpg.TransferDataTreeNode; import net.Indyuce.mmocore.command.rpg.admin.AdminCommandTreeNode; import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandTreeNode; import net.Indyuce.mmocore.command.rpg.debug.DebugCommandTreeNode; @@ -16,24 +15,23 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.TabCompleter; public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandExecutor, TabCompleter { - public static final Parameter PROFESSION = new Parameter("", (explorer, list) -> { - MMOCore.plugin.professionManager.getAll().forEach(profession -> list.add(profession.getId())); - list.add("main"); - }); - public static final Parameter QUEST = new Parameter("", - (explorer, list) -> MMOCore.plugin.questManager.getAll().forEach(quest -> list.add(quest.getId()))); + public static final Parameter PROFESSION = new Parameter("", (explorer, list) -> { + MMOCore.plugin.professionManager.getAll().forEach(profession -> list.add(profession.getId())); + list.add("main"); + }); + public static final Parameter QUEST = new Parameter("", + (explorer, list) -> MMOCore.plugin.questManager.getAll().forEach(quest -> list.add(quest.getId()))); - public MMOCoreCommandTreeRoot() { - super("mmocore", "mmocore.admin"); + public MMOCoreCommandTreeRoot() { + super("mmocore", "mmocore.admin"); - addChild(new ReloadCommandTreeNode(this)); - addChild(new TransferDataTreeNode(this)); - addChild(new CoinsCommandTreeNode(this)); - addChild(new NoteCommandTreeNode(this)); - addChild(new AdminCommandTreeNode(this)); - addChild(new DebugCommandTreeNode(this)); - addChild(new BoosterCommandTreeNode(this)); - addChild(new WaypointsCommandTreeNode(this)); - addChild(new QuestCommandTreeNode(this)); - } + addChild(new ReloadCommandTreeNode(this)); + addChild(new CoinsCommandTreeNode(this)); + addChild(new NoteCommandTreeNode(this)); + addChild(new AdminCommandTreeNode(this)); + addChild(new DebugCommandTreeNode(this)); + addChild(new BoosterCommandTreeNode(this)); + addChild(new WaypointsCommandTreeNode(this)); + addChild(new QuestCommandTreeNode(this)); + } } diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java index 6065fce1..6d8ad6bf 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AdminCommandTreeNode.java @@ -15,6 +15,7 @@ public class AdminCommandTreeNode extends CommandTreeNode { addChild(new InfoCommandTreeNode(this)); addChild(new ClassCommandTreeNode(this)); addChild(new ForceClassCommandTreeNode(this)); + addChild(new TransferDataTreeNode(this)); addChild(new ExperienceCommandTreeNode(this)); addChild(new LevelCommandTreeNode(this)); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java similarity index 82% rename from src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java rename to src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java index e7d8f9ad..c5760a9c 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/TransferDataTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java @@ -1,4 +1,4 @@ -package net.Indyuce.mmocore.command.rpg; +package net.Indyuce.mmocore.command.rpg.admin; import io.lumine.mythic.lib.command.api.CommandTreeNode; import net.Indyuce.mmocore.MMOCore; @@ -12,19 +12,17 @@ import org.bukkit.scheduler.BukkitRunnable; /** - * This command allows to transfer data from your actual datatype (yaml or sql) to the other one to make a change - * in the data storage type. + * This command allows to transfer data from your actual storage type + * to the other one which lets the user switch between storage types. */ public class TransferDataTreeNode extends CommandTreeNode { - - public TransferDataTreeNode(CommandTreeNode parent) { super(parent, "transferdata"); } @Override public CommandResult execute(CommandSender commandSender, String[] strings) { - DataProvider provider=null; + DataProvider provider = null; try { @@ -46,7 +44,7 @@ public class TransferDataTreeNode extends CommandTreeNode { } catch (Exception e) { commandSender.sendMessage("Couldn't transfer properly the data."); e.printStackTrace(); - if(provider!=null&&provider instanceof MySQLDataProvider) { + if (provider != null && provider instanceof MySQLDataProvider) { ((MySQLDataProvider) provider).close(); } return CommandResult.FAILURE; @@ -58,14 +56,12 @@ public class TransferDataTreeNode extends CommandTreeNode { @Override public void run() { - if(finalProvider !=null&& finalProvider instanceof MySQLDataProvider) { + if (finalProvider != null && finalProvider instanceof MySQLDataProvider) { ((MySQLDataProvider) finalProvider).close(); } } - }.runTaskLater(MMOCore.plugin,200); - + }.runTaskLater(MMOCore.plugin, 200); return CommandResult.SUCCESS; - } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java index 84645801..f4fcb651 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLDataProvider.java @@ -8,7 +8,6 @@ import net.Indyuce.mmocore.manager.data.yaml.YAMLGuildDataManager; import org.bukkit.configuration.file.FileConfiguration; import java.sql.SQLException; -import java.util.concurrent.CompletableFuture; public class MySQLDataProvider extends MMODataSource implements DataProvider { private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this); From 2d05bd770bd325a9c3333bbef35f7ca06d8971e6 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Tue, 26 Jul 2022 16:48:23 +0200 Subject: [PATCH 82/91] Debug Experience Sources --- .../mmocore/api/load/DefaultMMOLoader.java | 4 ++++ .../Indyuce/mmocore/api/player/PlayerData.java | 2 +- .../mmocore/api/player/profess/PlayerClass.java | 1 + .../source/DamageDealtExperienceSource.java | 11 +++++++++-- .../experience/source/EatExperienceSource.java | 15 ++++++++------- .../source/MineBlockExperienceSource.java | 6 +++++- .../experience/source/MoveExperienceSource.java | 4 +++- .../java/net/Indyuce/mmocore/gui/PlayerStats.java | 1 - 8 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index da0ec28f..03054204 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -124,6 +124,10 @@ public class DefaultMMOLoader extends MMOLoader { if (config.getKey().equals("climb")) return new ClimbExperienceSource(dispenser, config); + if (config.getKey().equals("eat")) { + return new EatExperienceSource(dispenser, config); + } + if (config.getKey().equals("damagedealt")) return new DamageDealtExperienceSource(dispenser, config); 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 cc8bb1e0..739ca613 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -338,7 +338,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public void refreshVanillaExp() { if (!isOnline() || !MMOCore.plugin.configManager.overrideVanillaExp) return; - + getPlayer().sendExperienceChange(0.01f); getPlayer().setLevel(getLevel()); getPlayer().setExp(Math.max(0, Math.min(1, (float) experience / (float) getLevelUpExperience()))); } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 5be54c20..ca9f2627 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -27,6 +27,7 @@ import net.Indyuce.mmocore.player.stats.StatInfo; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.md_5.bungee.api.ChatColor; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java index 5b31b7aa..b290b8a6 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/DamageDealtExperienceSource.java @@ -4,15 +4,18 @@ import io.lumine.mythic.lib.api.MMOLineConfig; import io.lumine.mythic.lib.api.event.PlayerAttackEvent; import io.lumine.mythic.lib.damage.DamagePacket; import io.lumine.mythic.lib.damage.DamageType; +import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import net.Indyuce.mmocore.api.player.PlayerData; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import java.util.Arrays; import java.util.Objects; +import java.util.logging.Level; import java.util.stream.Collectors; public class DamageDealtExperienceSource extends SpecificExperienceSource { @@ -43,6 +46,7 @@ public class DamageDealtExperienceSource extends SpecificExperienceSource() { @EventHandler public void onDamageDealt(PlayerAttackEvent e) { + PlayerData playerData = PlayerData.get(e.getPlayer()); for (DamageDealtExperienceSource source : getSources()) { double value = 0; @@ -62,10 +66,13 @@ public class DamageDealtExperienceSource extends SpecificExperienceSource { @@ -36,13 +37,13 @@ public class EatExperienceSource extends SpecificExperienceSource { return new ExperienceSourceManager() { @EventHandler - public void a(FoodLevelChangeEvent e) { - if (!(e.getEntity() instanceof Player) || e.getEntity().hasMetadata("NPC")) - return; - PlayerData playerData = PlayerData.get((OfflinePlayer) e.getEntity()); - for (EatExperienceSource source : getSources()) { - if (source.matchesParameter(playerData, e.getItem())) - source.giveExperience(playerData, e.getFoodLevel(), null); + public void a(PlayerItemConsumeEvent e) { + if(!e.getPlayer().hasMetadata("NPC")) { + PlayerData playerData = PlayerData.get(e.getPlayer()); + for (EatExperienceSource source : getSources()) { + if (source.matchesParameter(playerData, e.getItem())) + source.giveExperience(playerData, 1, null); + } } } }; diff --git a/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java b/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java index b1442871..eaa280f0 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java +++ b/src/main/java/net/Indyuce/mmocore/experience/source/MineBlockExperienceSource.java @@ -6,6 +6,7 @@ import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource; import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager; import net.Indyuce.mmocore.api.player.PlayerData; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -39,7 +40,8 @@ public class MineBlockExperienceSource extends SpecificExperienceSource newManager() { - return new ExperienceSourceManager() { + return + new ExperienceSourceManager() { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void a(BlockBreakEvent event) { if (event.getPlayer().getGameMode() != GameMode.SURVIVAL) @@ -63,11 +65,13 @@ public class MineBlockExperienceSource extends SpecificExperienceSource Date: Wed, 27 Jul 2022 10:53:21 +0200 Subject: [PATCH 83/91] SavingPlayerData. Object to store all the data of an offline player. Restructuration for /mmocore admin transferdata --- pom.xml | 4 +- .../mmocore/api/player/PlayerData.java | 30 ++ .../mmocore/api/player/SavingPlayerData.java | 42 +++ .../mmocore/api/quest/PlayerQuests.java | 1 + .../rpg/admin/TransferDataTreeNode.java | 93 +++-- .../manager/data/PlayerDataManager.java | 15 +- .../data/mysql/MySQLPlayerDataManager.java | 113 ++++-- .../data/yaml/YAMLPlayerDataManager.java | 333 ++++++++++++------ 8 files changed, 461 insertions(+), 170 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/api/player/SavingPlayerData.java diff --git a/pom.xml b/pom.xml index 94ffa2ac..4e572fc0 100644 --- a/pom.xml +++ b/pom.xml @@ -53,8 +53,8 @@ 3.8.1 - 9 - 9 + 16 + 16 UTF-8 -proc:none 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 739ca613..0f67dceb 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -656,6 +656,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc refreshVanillaExp(); } + + public double getExperience() { return experience; } @@ -953,6 +955,34 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc combat = new CombatRunnable(this); } + /** + * @return The savingPlayerData object corresponding to the playerData + */ + public SavingPlayerData getSavingPlayerData() { + return new SavingPlayerData( + getUniqueId(), + getClassPoints(), + getSkillPoints(), + getAttributePoints(), + getAttributeReallocationPoints(), + getLevel(), + getExperience(), + getProfess().getId(), + getLastLogin(), + hasGuild() ? getGuild().getId() : null, + getWaypoints(), + getFriends(), + getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).toList(), + mapSkillLevels(), + getItemClaims(), + getAttributes().toJsonString(), + getCollectionSkills().toJsonString(), + getQuestData().toJsonString(), + createClassInfoData(this).toString()); + } + + + @Override public int hashCode() { return mmoData.hashCode(); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/SavingPlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/SavingPlayerData.java new file mode 100644 index 00000000..a0e6a443 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/api/player/SavingPlayerData.java @@ -0,0 +1,42 @@ +package net.Indyuce.mmocore.api.player; + +import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; +import net.Indyuce.mmocore.api.quest.PlayerQuests; +import net.Indyuce.mmocore.experience.PlayerProfessions; +import net.Indyuce.mmocore.skill.ClassSkill; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +/** + * Just a container holding the basic playerData information that are needed to save it in a database. + */ +public record SavingPlayerData( + UUID uuid, + int classPoints, + int skillPoints, + int attributePoints, + int attributeReallocationPoints, + int level, + double experience, + String classId, + long lastLogin, + String guildId, + Set waypoints, + List friends, + List boundSkills, + Map skills, + Map itemClaims, + String attributes, + String collectionsSkills, + String questData, + String classInfoData) +{ + + + + + +} diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java b/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java index 5a3d54ab..7929032c 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java +++ b/src/main/java/net/Indyuce/mmocore/api/quest/PlayerQuests.java @@ -100,6 +100,7 @@ public class PlayerQuests implements Closable { } } + if (jo.has("finished")) for (Entry entry : jo.getAsJsonObject("finished").entrySet()) finished.put(entry.getKey(), entry.getValue().getAsLong()); diff --git a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java index c5760a9c..7e523fea 100644 --- a/src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java +++ b/src/main/java/net/Indyuce/mmocore/command/rpg/admin/TransferDataTreeNode.java @@ -3,6 +3,7 @@ package net.Indyuce.mmocore.command.rpg.admin; import io.lumine.mythic.lib.command.api.CommandTreeNode; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.SavingPlayerData; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.mysql.MySQLDataProvider; @@ -10,6 +11,14 @@ import net.Indyuce.mmocore.manager.data.yaml.YAMLDataProvider; import org.bukkit.command.CommandSender; import org.bukkit.scheduler.BukkitRunnable; +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + /** * This command allows to transfer data from your actual storage type @@ -22,42 +31,74 @@ public class TransferDataTreeNode extends CommandTreeNode { @Override public CommandResult execute(CommandSender commandSender, String[] strings) { - DataProvider provider = null; - try { + final List playerUUIDs = new ArrayList<>(); + if (MMOCore.plugin.dataProvider instanceof YAMLDataProvider) { + File folder = new File(MMOCore.plugin.getDataFolder() + "/userdata"); + playerUUIDs.addAll(Arrays.stream(folder.listFiles()) + .map(file -> UUID.fromString(file.getName().replace(".yml", ""))) + .collect(Collectors.toList())); + } else { + ((MySQLDataProvider) MMOCore.plugin.dataProvider).getResult( + "SELECT uuid from mmocore_playerdata", (result) -> { + try { - if (MMOCore.plugin.dataProvider instanceof YAMLDataProvider) { - provider = new MySQLDataProvider(MMOCore.plugin.getConfig()); - ((MySQLDataProvider) provider).load(); - } else { - provider = new YAMLDataProvider(); - } + while (result.next()) { + playerUUIDs.add(UUID.fromString(result.getString("uuid"))); - // Save player data - for (PlayerData data : PlayerData.getAll()) - if (data.isFullyLoaded()) - provider.getDataManager().saveData(data); - - // Save guild info - for (Guild guild : provider.getGuildManager().getAll()) - provider.getGuildManager().save(guild); - } catch (Exception e) { - commandSender.sendMessage("Couldn't transfer properly the data."); - e.printStackTrace(); - if (provider != null && provider instanceof MySQLDataProvider) { - ((MySQLDataProvider) provider).close(); - } - return CommandResult.FAILURE; + } + } catch (SQLException e) { + e.printStackTrace(); + } + }); } - DataProvider finalProvider = provider; + + List savingPlayerDataList = new ArrayList<>(); + for (UUID uuid : playerUUIDs) { + MMOCore.plugin.dataProvider.getDataManager().loadSavingPlayerData(uuid, savingPlayerDataList); + } + + + final DataProvider provider; + if (MMOCore.plugin.dataProvider instanceof YAMLDataProvider) { + provider = new MySQLDataProvider(MMOCore.plugin.getConfig()); + ((MySQLDataProvider) provider).load(); + } else { + provider = new YAMLDataProvider(); + } + + + //5 seconds later we put all this data into the other data storage. + new BukkitRunnable() { + + @Override + public void run() { + try { + // Save player data + for (SavingPlayerData data : savingPlayerDataList) + provider.getDataManager().saveData(data); + + // Save guild info + for (Guild guild : provider.getGuildManager().getAll()) + provider.getGuildManager().save(guild); + } catch (Exception e) { + commandSender.sendMessage("Couldn't transfer properly the data."); + e.printStackTrace(); + if (provider != null && provider instanceof MySQLDataProvider) { + ((MySQLDataProvider) provider).close(); + } + } + } + }.runTaskLater(MMOCore.plugin, 100L); + //We close the connection 10 s later to avoid memory leaks. new BukkitRunnable() { @Override public void run() { - if (finalProvider != null && finalProvider instanceof MySQLDataProvider) { - ((MySQLDataProvider) finalProvider).close(); + if (provider != null && provider instanceof MySQLDataProvider) { + ((MySQLDataProvider) provider).close(); } } }.runTaskLater(MMOCore.plugin, 200); 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 ef1745bd..978f41e3 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/PlayerDataManager.java @@ -8,6 +8,7 @@ import io.lumine.mythic.lib.player.TemporaryPlayerData; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.AsyncPlayerDataLoadEvent; import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent; +import net.Indyuce.mmocore.api.player.SavingPlayerData; import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.api.player.OfflinePlayerData; import net.Indyuce.mmocore.api.player.PlayerData; @@ -45,7 +46,7 @@ public abstract class PlayerDataManager { } - public static void loadDataFromJson(PlayerData data, String json) { + public static void loadDataFromJson(@NotNull PlayerData data, String json) { JsonObject object = MythicLib.plugin.getJson().parse(json, JsonObject.class); data.setClassPoints(object.get("class_points").getAsInt()); @@ -191,8 +192,12 @@ public abstract class PlayerDataManager { /** * Called when player data must be loaded from database or config. * - * @param data Player data to load + * @param uuid The uuid to load + * @param savingPlayerDataList the list where the data will be added. */ + public abstract void loadSavingPlayerData(UUID uuid,List savingPlayerDataList); + + public abstract void loadData(PlayerData data); /** @@ -202,7 +207,11 @@ public abstract class PlayerDataManager { * * @param data Player data to save */ - public abstract void saveData(PlayerData data); + public void saveData(PlayerData data) { + saveData(data.getSavingPlayerData()); + } + + public abstract void saveData(SavingPlayerData data); public class DefaultPlayerData { private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints; diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index d9c696eb..42a475c2 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -7,26 +7,23 @@ import io.lumine.mythic.lib.MythicLib; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.OfflinePlayerData; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.SavingPlayerData; 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.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.PlayerDataManager; import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; -import java.io.*; -import java.net.Socket; import java.sql.SQLException; import java.util.*; import java.util.Map.Entry; +import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Level; import java.util.stream.Collectors; -import static net.Indyuce.mmocore.api.player.PlayerData.createClassInfoData; - public class MySQLPlayerDataManager extends PlayerDataManager { private final MySQLDataProvider provider; @@ -110,7 +107,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { } //We now change the saved status to false because the data on SQL won't be the same as in the RAM - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId(),provider); + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId(), provider); //We set the saved status to false sql.updateData("is_saved", 0); @@ -152,38 +149,39 @@ public class MySQLPlayerDataManager extends PlayerDataManager { return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase(""); } + @Override - public void saveData(PlayerData data) { + public void saveData(SavingPlayerData data) { - MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId(),provider); - MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'..."); + MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.uuid(), provider); + MMOCore.sqlDebug("Saving data for: '" + data.uuid() + "'..."); - sql.updateData("class_points", data.getClassPoints()); - sql.updateData("skill_points", data.getSkillPoints()); - sql.updateData("attribute_points", data.getAttributePoints()); - sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints()); - sql.updateData("level", data.getLevel()); - sql.updateData("experience", data.getExperience()); - sql.updateData("class", data.getProfess().getId()); - sql.updateData("last_login", data.getLastLogin()); - sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null); + sql.updateData("class_points", data.classPoints()); + sql.updateData("skill_points", data.skillPoints()); + sql.updateData("attribute_points", data.attributePoints()); + sql.updateData("attribute_realloc_points", data.attributeReallocationPoints()); + sql.updateData("level", data.level()); + sql.updateData("experience", data.experience()); + sql.updateData("class", data.classId()); + sql.updateData("last_login", data.lastLogin()); + sql.updateData("guild", data.guildId()); - sql.updateJSONArray("waypoints", data.getWaypoints()); - sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); - sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())); + sql.updateJSONArray("waypoints", data.waypoints()); + sql.updateJSONArray("friends", data.friends().stream().map(UUID::toString).collect(Collectors.toList())); + sql.updateJSONArray("bound_skills", data.boundSkills()); - sql.updateJSONObject("skills", data.mapSkillLevels().entrySet()); - sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet()); + sql.updateJSONObject("skills", data.skills().entrySet()); + sql.updateJSONObject("times_claimed", data.itemClaims().entrySet()); - sql.updateData("attributes", data.getAttributes().toJsonString()); - sql.updateData("professions", data.getCollectionSkills().toJsonString()); - sql.updateData("quests", data.getQuestData().toJsonString()); + sql.updateData("attributes", data.attributes()); + sql.updateData("professions", data.collectionsSkills()); + sql.updateData("quests", data.questData()); - sql.updateData("class_info", createClassInfoData(data).toString()); + sql.updateData("class_info", data.classInfoData()); sql.updateData("is_saved", 1); - MMOCore.sqlDebug("Saved data for: " + data.getUniqueId()); - MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel())); + MMOCore.sqlDebug("Saved data for: " + data.uuid()); + MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.classId(), data.level())); } @@ -195,6 +193,60 @@ public class MySQLPlayerDataManager extends PlayerDataManager { return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid); } + @Override + public void loadSavingPlayerData(UUID uuid, List savingPlayerDataList) { + + provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> { + try { + + + if (result.next()) { + Map skills = new HashMap<>(); + Map itemClaims = new HashMap<>(); + + if (!isEmpty(result.getString("skills"))) { + JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class); + for (Entry entry : object.entrySet()) + skills.put(entry.getKey(), entry.getValue().getAsInt()); + } + + if (!isEmpty(result.getString("times_claimed"))) { + JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject(); + json.entrySet().forEach(entry -> itemClaims.put(entry.getKey(), entry.getValue().getAsInt())); + } + + + SavingPlayerData data = new SavingPlayerData( + uuid, + result.getInt("class_points"), + result.getInt("skill_points"), + result.getInt("attribute_points"), + result.getInt("attribute_realloc_points"), + result.getInt("level"), + result.getInt("experience"), + result.getString("class"), + result.getLong("last_login"), + result.getString("guild"), + MMOCoreUtils.jsonArrayToList(result.getString("waypoints")).stream().collect(Collectors.toSet()), + MMOCoreUtils.jsonArrayToList(result.getString("friends")).stream().map(str -> UUID.fromString(str)).toList(), + MMOCoreUtils.jsonArrayToList(result.getString("bound_skills")).stream().toList(), + skills, + itemClaims, + result.getString("attributes"), + result.getString("professions"), + result.getString("quests"), + result.getString("class_info")); + + savingPlayerDataList.add(data); + + } + } catch (SQLException e) { + e.printStackTrace(); + } + + }); + } + public class MySQLOfflinePlayerData extends OfflinePlayerData { private int level; @@ -232,7 +284,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager { @Override public void removeFriend(UUID uuid) { friends.remove(uuid); - new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid,provider).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); + new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid, provider).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList())); } @Override @@ -258,3 +310,4 @@ public class MySQLPlayerDataManager extends PlayerDataManager { } + 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 37cc03f7..eb39e481 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 @@ -1,6 +1,14 @@ package net.Indyuce.mmocore.manager.data.yaml; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.lumine.mythic.lib.MythicLib; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.player.SavingPlayerData; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; +import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.player.OfflinePlayerData; @@ -10,138 +18,245 @@ import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.PlayerDataManager; import org.apache.commons.lang.Validate; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.logging.Level; import java.util.stream.Collectors; public class YAMLPlayerDataManager extends PlayerDataManager { - private final DataProvider provider; + private final DataProvider provider; - public YAMLPlayerDataManager(DataProvider provider) { - this.provider = provider; - } + public YAMLPlayerDataManager(DataProvider provider) { + this.provider = provider; + } - @Override - public void loadData(PlayerData data) { - FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig(); + @Override + public void loadData(PlayerData data) { + FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig(); - data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints())); - data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints())); - data.setAttributePoints(config.getInt("attribute-points", getDefaultData().getAttributePoints())); - data.setAttributeReallocationPoints(config.getInt("attribute-realloc-points", getDefaultData().getAttrReallocPoints())); - data.setLevel(config.getInt("level", getDefaultData().getLevel())); - data.setExperience(config.getInt("experience")); - if (config.contains("class")) - data.setClass(MMOCore.plugin.classManager.get(config.getString("class"))); + data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints())); + data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints())); + data.setAttributePoints(config.getInt("attribute-points", getDefaultData().getAttributePoints())); + data.setAttributeReallocationPoints(config.getInt("attribute-realloc-points", getDefaultData().getAttrReallocPoints())); + data.setLevel(config.getInt("level", getDefaultData().getLevel())); + data.setExperience(config.getInt("experience")); + if (config.contains("class")) + data.setClass(MMOCore.plugin.classManager.get(config.getString("class"))); - if (!data.hasUsedTemporaryData()) { - data.setMana(data.getStats().getStat("MAX_MANA")); - data.setStamina(data.getStats().getStat("MAX_STAMINA")); - data.setStellium(data.getStats().getStat("MAX_STELLIUM")); - } + if (!data.hasUsedTemporaryData()) { + data.setMana(data.getStats().getStat("MAX_MANA")); + data.setStamina(data.getStats().getStat("MAX_STAMINA")); + data.setStellium(data.getStats().getStat("MAX_STELLIUM")); + } - if (config.contains("guild")) { - Guild guild = provider.getGuildManager().getGuild(config.getString("guild")); - data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); - } - if (config.contains("attribute")) - data.getAttributes().load(config.getConfigurationSection("attribute")); - if (config.contains("profession")) - data.getCollectionSkills().load(config.getConfigurationSection("profession")); - if (config.contains("quest")) - data.getQuestData().load(config.getConfigurationSection("quest")); - data.getQuestData().updateBossBar(); - if (config.contains("waypoints")) - data.getWaypoints().addAll(config.getStringList("waypoints")); - if (config.contains("friends")) - config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str))); - if (config.contains("skill")) - config.getConfigurationSection("skill").getKeys(false).forEach(id -> data.setSkillLevel(id, config.getInt("skill." + id))); - if (config.contains("bound-skills")) - for (String id : config.getStringList("bound-skills")) - if (data.getProfess().hasSkill(id)) - data.getBoundSkills().add(data.getProfess().getSkill(id)); + if (config.contains("guild")) { + Guild guild = provider.getGuildManager().getGuild(config.getString("guild")); + data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null); + } + if (config.contains("attribute")) + data.getAttributes().load(config.getConfigurationSection("attribute")); + if (config.contains("profession")) + data.getCollectionSkills().load(config.getConfigurationSection("profession")); + if (config.contains("quest")) + data.getQuestData().load(config.getConfigurationSection("quest")); + data.getQuestData().updateBossBar(); + if (config.contains("waypoints")) + data.getWaypoints().addAll(config.getStringList("waypoints")); + if (config.contains("friends")) + config.getStringList("friends").forEach(str -> data.getFriends().add(UUID.fromString(str))); + if (config.contains("skill")) + config.getConfigurationSection("skill").getKeys(false).forEach(id -> data.setSkillLevel(id, config.getInt("skill." + id))); + if (config.contains("bound-skills")) + for (String id : config.getStringList("bound-skills")) + if (data.getProfess().hasSkill(id)) + data.getBoundSkills().add(data.getProfess().getSkill(id)); - if (config.contains("times-claimed")) - for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) - data.getItemClaims().put(key, config.getInt("times-claimed." + key)); + if (config.contains("times-claimed")) + for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) + data.getItemClaims().put(key, config.getInt("times-claimed." + key)); - // Load class slots, use try so the player can log in. - if (config.contains("class-info")) - for (String key : config.getConfigurationSection("class-info").getKeys(false)) - try { - PlayerClass profess = MMOCore.plugin.classManager.get(key); - Validate.notNull(profess, "Could not find class '" + key + "'"); - data.applyClassInfo(profess, new SavedClassInformation(config.getConfigurationSection("class-info." + key))); - } catch (IllegalArgumentException exception) { - MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage()); - } + // Load class slots, use try so the player can log in. + if (config.contains("class-info")) + for (String key : config.getConfigurationSection("class-info").getKeys(false)) + try { + PlayerClass profess = MMOCore.plugin.classManager.get(key); + Validate.notNull(profess, "Could not find class '" + key + "'"); + data.applyClassInfo(profess, new SavedClassInformation(config.getConfigurationSection("class-info." + key))); + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage()); + } - data.setFullyLoaded(); - } + data.setFullyLoaded(); + } - @Override - public void saveData(PlayerData data) { - ConfigFile file = new ConfigFile(data.getUniqueId()); - FileConfiguration config = file.getConfig(); + @Override + public void saveData(PlayerData data) { + ConfigFile file = new ConfigFile(data.getUniqueId()); + FileConfiguration config = file.getConfig(); - config.set("class-points", data.getClassPoints()); - config.set("skill-points", data.getSkillPoints()); - config.set("attribute-points", data.getAttributePoints()); - // config.set("skill-realloc-points", skillReallocationPoints); - config.set("attribute-realloc-points", data.getAttributeReallocationPoints()); - config.set("level", data.getLevel()); - config.set("experience", data.getExperience()); - config.set("class", data.getProfess().getId()); - config.set("waypoints", new ArrayList<>(data.getWaypoints())); - config.set("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); - config.set("last-login", data.getLastLogin()); - config.set("guild", data.hasGuild() ? data.getGuild().getId() : null); + config.set("class-points", data.getClassPoints()); + config.set("skill-points", data.getSkillPoints()); + config.set("attribute-points", data.getAttributePoints()); + // config.set("skill-realloc-points", skillReallocationPoints); + config.set("attribute-realloc-points", data.getAttributeReallocationPoints()); + config.set("level", data.getLevel()); + config.set("experience", data.getExperience()); + config.set("class", data.getProfess().getId()); + config.set("waypoints", new ArrayList<>(data.getWaypoints())); + config.set("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList())); + config.set("last-login", data.getLastLogin()); + config.set("guild", data.hasGuild() ? data.getGuild().getId() : null); - config.set("skill", null); - data.mapSkillLevels().forEach((key1, value) -> config.set("skill." + key1, value)); - data.getItemClaims().forEach((key, times) -> config.set("times-claimed." + key, times)); + config.set("skill", null); + data.mapSkillLevels().forEach((key1, value) -> config.set("skill." + key1, value)); + data.getItemClaims().forEach((key, times) -> config.set("times-claimed." + key, times)); - List boundSkills = new ArrayList<>(); - data.getBoundSkills().forEach(skill -> boundSkills.add(skill.getSkill().getHandler().getId())); - config.set("bound-skills", boundSkills); + List boundSkills = new ArrayList<>(); + data.getBoundSkills().forEach(skill -> boundSkills.add(skill.getSkill().getHandler().getId())); + config.set("bound-skills", boundSkills); - config.set("attribute", null); - config.createSection("attribute"); - data.getAttributes().save(config.getConfigurationSection("attribute")); + config.set("attribute", null); + config.createSection("attribute"); + data.getAttributes().save(config.getConfigurationSection("attribute")); - config.set("profession", null); - config.createSection("profession"); - data.getCollectionSkills().save(config.getConfigurationSection("profession")); + config.set("profession", null); + config.createSection("profession"); + data.getCollectionSkills().save(config.getConfigurationSection("profession")); - config.set("quest", null); - config.createSection("quest"); - data.getQuestData().save(config.getConfigurationSection("quest")); + config.set("quest", null); + config.createSection("quest"); + data.getQuestData().save(config.getConfigurationSection("quest")); - config.set("class-info", null); - for (String key : data.getSavedClasses()) { - SavedClassInformation info = data.getClassInfo(key); - config.set("class-info." + key + ".level", info.getLevel()); - config.set("class-info." + key + ".experience", info.getExperience()); - config.set("class-info." + key + ".skill-points", info.getSkillPoints()); - config.set("class-info." + key + ".attribute-points", info.getAttributePoints()); - config.set("class-info." + key + ".attribute-realloc-points", info.getAttributeReallocationPoints()); - info.getSkillKeys().forEach(skill -> config.set("class-info." + key + ".skill." + skill, info.getSkillLevel(skill))); - info.getAttributeKeys() - .forEach(attribute -> config.set("class-info." + key + ".attribute." + attribute, info.getAttributeLevel(attribute))); - } + config.set("class-info", null); + for (String key : data.getSavedClasses()) { + SavedClassInformation info = data.getClassInfo(key); + config.set("class-info." + key + ".level", info.getLevel()); + config.set("class-info." + key + ".experience", info.getExperience()); + config.set("class-info." + key + ".skill-points", info.getSkillPoints()); + config.set("class-info." + key + ".attribute-points", info.getAttributePoints()); + config.set("class-info." + key + ".attribute-realloc-points", info.getAttributeReallocationPoints()); + info.getSkillKeys().forEach(skill -> config.set("class-info." + key + ".skill." + skill, info.getSkillLevel(skill))); + info.getAttributeKeys() + .forEach(attribute -> config.set("class-info." + key + ".attribute." + attribute, info.getAttributeLevel(attribute))); + } - file.save(); - } + file.save(); + } - @NotNull - @Override - public OfflinePlayerData getOffline(UUID uuid) { - return isLoaded(uuid) ? get(uuid) : new YAMLOfflinePlayerData(uuid); - } + + /** + * Used to save Data from a SavingPlayerDataInstance (Data of an offline player) + * @param data + */ + @Override + public void saveData(SavingPlayerData data) { + ConfigFile file = new ConfigFile(data.uuid()); + FileConfiguration config = file.getConfig(); + + config.set("class-points", data.classPoints()); + config.set("skill-points", data.skillPoints()); + config.set("attribute-points", data.attributePoints()); + // config.set("skill-realloc-points", skillReallocationPoints); + config.set("attribute-realloc-points", data.attributeReallocationPoints()); + config.set("level", data.level()); + config.set("experience", data.experience()); + config.set("class", data.classId()); + config.set("waypoints", data.waypoints()); + config.set("friends", data.friends()); + config.set("last-login", data.lastLogin()); + config.set("guild", data.guildId()); + + config.set("skill", null); + data.skills().forEach((key1, value) -> config.set("skill." + key1, value)); + data.itemClaims().forEach((key, times) -> config.set("times-claimed." + key, times)); + + List boundSkills = new ArrayList<>(); + data.boundSkills().forEach(skill -> boundSkills.add(skill)); + config.set("bound-skills", boundSkills); + + config.set("attribute", null); + Gson parser = new Gson(); + JsonObject jo = parser.fromJson(data.attributes(), JsonObject.class); + for (Map.Entry entry : jo.entrySet()) { + try { + String id = entry.getKey().toLowerCase().replace("_", "-").replace(" ", "-"); + config.set("attributes." + id, entry.getValue().getAsInt()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + jo = parser.fromJson(data.collectionsSkills(), JsonObject.class); + config.createSection("profession"); + ConfigurationSection section = config.getConfigurationSection("profession"); + // Load profession exp and levels + for (Map.Entry entry : jo.entrySet()) + if (MMOCore.plugin.professionManager.has(entry.getKey())) { + JsonObject value = entry.getValue().getAsJsonObject(); + section.set(entry.getKey() + ".exp", value.get("exp").getAsDouble()); + section.set(entry.getKey() + ".level", value.get("level").getAsInt()); + } + + + config.set("quest", null); + config.createSection("quest"); + section = config.getConfigurationSection("quest"); + jo = parser.fromJson(data.questData(), JsonObject.class); + if (jo.has("current")) { + JsonObject cur = jo.getAsJsonObject("current"); + try { + section.set("current.id", cur.get("id").getAsString()); + section.set("current.objective", cur.get("objective").getAsInt()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + if (jo.has("finished")) + for (Map.Entry entry : jo.getAsJsonObject("finished").entrySet()) + section.set("finished." + entry.getKey(), entry.getValue().getAsLong()); + + + config.set("class-info", null); + jo = parser.fromJson(data.classInfoData(), JsonObject.class); + + + for (Map.Entry entry : jo.entrySet()) { + try { + String key = entry.getKey(); + JsonObject info = entry.getValue().getAsJsonObject(); + config.set("class-info." + key + ".level", info.get("level").getAsInt()); + config.set("class-info." + key + ".experience", info.get("experience").getAsDouble()); + config.set("class-info." + key + ".skill-points", info.get("skill-points").getAsInt()); + config.set("class-info." + key + ".attribute-points", info.get("attribute-points").getAsInt()); + config.set("class-info." + key + ".attribute-realloc-points", info.get("attribute-realloc-points").getAsInt()); + + if (info.has("attribute")) + for (Map.Entry attributesEntry : info.getAsJsonObject("attribute").entrySet()) + config.set("class-info." + key + ".attribute." + attributesEntry.getKey(), attributesEntry.getValue().getAsInt()); + + if (info.has("skill")) + for (Map.Entry skillsEntry : info.getAsJsonObject("skill").entrySet()) + config.set("class-info." + key + ".skill." + skillsEntry.getKey(), skillsEntry.getValue().getAsInt()); + + } catch (IllegalArgumentException exception) { + MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); + } + } + file.save(); + } + + @NotNull + @Override + public OfflinePlayerData getOffline(UUID uuid) { + return isLoaded(uuid) ? get(uuid) : new YAMLOfflinePlayerData(uuid); + } + + @Override + public void loadSavingPlayerData(UUID uuid, List savingPlayerDataList) { + + } } From a4065b1205db2e666b1627263652c226f60e6ea3 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 12:31:00 +0200 Subject: [PATCH 84/91] SavingPlayerData. Object to store all the data of an offline player. Restructuration for /mmocore admin transferdata --- .../data/yaml/YAMLPlayerDataManager.java | 109 +++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) 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 eb39e481..2f46d1d6 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 @@ -3,8 +3,6 @@ package net.Indyuce.mmocore.manager.data.yaml; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import io.lumine.mythic.lib.MythicLib; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.SavingPlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; @@ -14,6 +12,9 @@ import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.player.OfflinePlayerData; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; +import net.Indyuce.mmocore.api.quest.PlayerQuests; +import net.Indyuce.mmocore.experience.PlayerProfessions; +import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.PlayerDataManager; @@ -149,6 +150,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager { /** * Used to save Data from a SavingPlayerDataInstance (Data of an offline player) + * * @param data */ @Override @@ -257,6 +259,109 @@ public class YAMLPlayerDataManager extends PlayerDataManager { @Override public void loadSavingPlayerData(UUID uuid, List savingPlayerDataList) { + FileConfiguration config = new ConfigFile(uuid).getConfig(); + Map skills = new HashMap<>(); + config.getConfigurationSection("skill").getKeys(false).forEach(id -> skills.put(id, config.getInt("skill." + id))); + + Map itemClaims = new HashMap<>(); + for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) + itemClaims.put(key, config.getInt("times-claimed." + key)); + + + //Creates the attributes json + + + ConfigurationSection section = config.getConfigurationSection("attributes"); + JsonObject attributesJson = new JsonObject(); + for (String key : section.getKeys(false)) { + String id = key.toLowerCase().replace("-", "_").replace(" ", "_"); + attributesJson.addProperty(id, section.getInt(key)); + } + + + //Creates the profession json + + + section = config.getConfigurationSection("profession"); + JsonObject collectionSkillsJson = new JsonObject(); + ; + for (String key : config.getKeys(false)) { + if (MMOCore.plugin.professionManager.has(key)) { + JsonObject object = new JsonObject(); + object.addProperty("exp", section.getDouble(key + ".exp")); + object.addProperty("level", section.getInt(key + ".level")); + + collectionSkillsJson.add(key, object); + } + } + + //Creates the questJson + + section = config.getConfigurationSection("quest"); + JsonObject questsJson = new JsonObject(); + + if (section.contains("current")) { + JsonObject cur = new JsonObject(); + cur.addProperty("id", section.getString("current.id")); + cur.addProperty("objective", section.getInt("current.objective")); + questsJson.add("current", cur); + } + JsonObject fin = new JsonObject(); + if (section.contains("finished")) + for (String key : section.getConfigurationSection("finished").getKeys(false)) + fin.addProperty(key, section.getLong("finished." + key)); + + if (fin.size() != 0) + questsJson.add("finished", fin); + + + JsonObject classInfoJson = new JsonObject(); + // Load class slots, use try so the player can log in. + if (config.contains("class-info")) + for (String key : config.getConfigurationSection("class-info").getKeys(false)) { + SavedClassInformation info = new SavedClassInformation(config.getConfigurationSection("class-info." + key)); + JsonObject classinfo = new JsonObject(); + classinfo.addProperty("level", info.getLevel()); + classinfo.addProperty("experience", info.getExperience()); + classinfo.addProperty("skill-points", info.getSkillPoints()); + classinfo.addProperty("attribute-points", info.getAttributePoints()); + classinfo.addProperty("attribute-realloc-points", info.getAttributeReallocationPoints()); + JsonObject skillinfo = new JsonObject(); + for (String skill : info.getSkillKeys()) + skillinfo.addProperty(skill, info.getSkillLevel(skill)); + classinfo.add("skill", skillinfo); + JsonObject attributeinfo = new JsonObject(); + for (String attribute : info.getAttributeKeys()) + attributeinfo.addProperty(attribute, info.getAttributeLevel(attribute)); + classinfo.add("attribute", attributeinfo); + classInfoJson.add(key, classinfo); + } + + + SavingPlayerData data = new SavingPlayerData( + uuid, + config.getInt("class-points"), + config.getInt("skill-points"), + config.getInt("attribute-points"), + config.getInt("attribute-realloc-points"), + config.getInt("level"), + config.getInt("experience"), + config.getString("class"), + config.getLong("last-login"), + config.getString("guild"), + config.getStringList("waypoints").stream().collect(Collectors.toSet()), + config.getStringList("friends").stream().map(UUID::fromString).toList(), + config.getStringList("bound-skills"), + skills, + itemClaims, + attributesJson.toString(), + collectionSkillsJson.toString(), + questsJson.toString(), + classInfoJson.toString()); + + savingPlayerDataList.add(data); } + } + From 5589609750a1be8e804587f80a4d83f77b285da2 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 15:08:17 +0200 Subject: [PATCH 85/91] SavingPlayerData. Object to store all the data of an offline player. Restructuration for /mmocore admin transferdata --- .../Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataManager.java | 1 + 1 file changed, 1 insertion(+) 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 2f46d1d6..5563ae30 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 @@ -365,3 +365,4 @@ public class YAMLPlayerDataManager extends PlayerDataManager { } + From 6af4c2ee46d3986fb30f7f48c5156a5092906db1 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 17:28:33 +0200 Subject: [PATCH 86/91] SavingPlayerData. Object to store all the data of an offline player. Restructuration for /mmocore admin transferdata --- .../data/mysql/MySQLPlayerDataManager.java | 4 ++ .../data/yaml/YAMLPlayerDataManager.java | 43 +++++++++++-------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java index 42a475c2..90254927 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/data/mysql/MySQLPlayerDataManager.java @@ -1,5 +1,6 @@ package net.Indyuce.mmocore.manager.data.mysql; +import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -14,6 +15,7 @@ import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.PlayerDataManager; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; @@ -238,12 +240,14 @@ public class MySQLPlayerDataManager extends PlayerDataManager { result.getString("class_info")); savingPlayerDataList.add(data); + Bukkit.broadcastMessage(new Gson().toJson(data)); } } catch (SQLException e) { e.printStackTrace(); } + }); } 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 5563ae30..4c135010 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 @@ -19,6 +19,7 @@ import net.Indyuce.mmocore.guild.provided.Guild; import net.Indyuce.mmocore.manager.data.DataProvider; import net.Indyuce.mmocore.manager.data.PlayerDataManager; import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.NotNull; @@ -166,10 +167,11 @@ public class YAMLPlayerDataManager extends PlayerDataManager { config.set("level", data.level()); config.set("experience", data.experience()); config.set("class", data.classId()); - config.set("waypoints", data.waypoints()); + config.set("waypoints", data.waypoints().stream().toList()); config.set("friends", data.friends()); config.set("last-login", data.lastLogin()); - config.set("guild", data.guildId()); + if (data.guildId() != null) + config.set("guild", data.guildId()); config.set("skill", null); data.skills().forEach((key1, value) -> config.set("skill." + key1, value)); @@ -185,7 +187,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager { for (Map.Entry entry : jo.entrySet()) { try { String id = entry.getKey().toLowerCase().replace("_", "-").replace(" ", "-"); - config.set("attributes." + id, entry.getValue().getAsInt()); + config.set("attribute." + id, entry.getValue().getAsInt()); } catch (Exception e) { throw new RuntimeException(e); } @@ -248,6 +250,8 @@ public class YAMLPlayerDataManager extends PlayerDataManager { MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage()); } } + + Bukkit.broadcastMessage("SAVED"); file.save(); } @@ -262,11 +266,13 @@ public class YAMLPlayerDataManager extends PlayerDataManager { FileConfiguration config = new ConfigFile(uuid).getConfig(); Map skills = new HashMap<>(); - config.getConfigurationSection("skill").getKeys(false).forEach(id -> skills.put(id, config.getInt("skill." + id))); + if (config.contains("skill")) + config.getConfigurationSection("skill").getKeys(false).forEach(id -> skills.put(id, config.getInt("skill." + id))); Map itemClaims = new HashMap<>(); - for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) - itemClaims.put(key, config.getInt("times-claimed." + key)); + if (config.contains("times-claimed")) + for (String key : config.getConfigurationSection("times-claimed").getKeys(true)) + itemClaims.put(key, config.getInt("times-claimed." + key)); //Creates the attributes json @@ -274,10 +280,11 @@ public class YAMLPlayerDataManager extends PlayerDataManager { ConfigurationSection section = config.getConfigurationSection("attributes"); JsonObject attributesJson = new JsonObject(); - for (String key : section.getKeys(false)) { - String id = key.toLowerCase().replace("-", "_").replace(" ", "_"); - attributesJson.addProperty(id, section.getInt(key)); - } + if (section != null) + for (String key : section.getKeys(false)) { + String id = key.toLowerCase().replace("-", "_").replace(" ", "_"); + attributesJson.addProperty(id, section.getInt(key)); + } //Creates the profession json @@ -285,16 +292,16 @@ public class YAMLPlayerDataManager extends PlayerDataManager { section = config.getConfigurationSection("profession"); JsonObject collectionSkillsJson = new JsonObject(); - ; - for (String key : config.getKeys(false)) { - if (MMOCore.plugin.professionManager.has(key)) { - JsonObject object = new JsonObject(); - object.addProperty("exp", section.getDouble(key + ".exp")); - object.addProperty("level", section.getInt(key + ".level")); + if (section != null) + for (String key : section.getKeys(false)) { + if (MMOCore.plugin.professionManager.has(key)) { + JsonObject object = new JsonObject(); + object.addProperty("exp", section.getDouble(key + ".exp")); + object.addProperty("level", section.getInt(key + ".level")); - collectionSkillsJson.add(key, object); + collectionSkillsJson.add(key, object); + } } - } //Creates the questJson From eac9cfa74e73e9d445bdaf91acbb8c7bcd0f9753 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 17:52:36 +0200 Subject: [PATCH 87/91] exp-sources.yml to have predownloaded exp sources you can refer to anywhere (like experience tables) --- .../mmocore/api/load/DefaultMMOLoader.java | 18 ++++++++++++++++++ .../api/player/profess/PlayerClass.java | 4 ++-- .../Indyuce/mmocore/experience/Profession.java | 4 ++-- .../Indyuce/mmocore/manager/ConfigManager.java | 1 + src/main/resources/default/exp-sources.yml | 0 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/default/exp-sources.yml diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index 03054204..8c01f63b 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -1,5 +1,7 @@ package net.Indyuce.mmocore.api.load; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.api.block.BlockType; import net.Indyuce.mmocore.api.block.SkullBlockType; import net.Indyuce.mmocore.api.block.VanillaBlockType; @@ -30,6 +32,9 @@ import net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger; import net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger; import net.Indyuce.mmocore.api.quest.trigger.Trigger; import io.lumine.mythic.lib.api.MMOLineConfig; +import org.checkerframework.checker.units.qual.C; + +import java.util.logging.Level; public class DefaultMMOLoader extends MMOLoader { @@ -118,6 +123,19 @@ public class DefaultMMOLoader extends MMOLoader { @Override public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { + if(config.getKey().equals("from")) { + String source=config.getString("source"); + ConfigFile configFile= new ConfigFile("exp-sources"); + if(!configFile.getConfig().contains(source)) { + MMOCore.plugin.getLogger().log(Level.WARNING,"Couldn't find "+source+" in experience-sources.yml"); + return null; + } + for(String expSource: configFile.getConfig().getStringList(source)) { + loadExperienceSource(new MMOLineConfig(expSource),dispenser); + } + } + + if (config.getKey().equals("resource")) return new ResourceExperienceSource(dispenser, config); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 7ced6650..00a4cf6e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -156,8 +156,8 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { "Could not load option '" + key + "' from class '" + key + "': " + exception.getMessage()); } - if (config.contains("main-exp-sources")) { - for (String key : config.getStringList("main-exp-sources")) + if (config.contains("main-exp-sources.yml")) { + for (String key : config.getStringList("main-exp-sources.yml")) try { ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); MMOCore.plugin.experience.registerSource(source); diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java index ac71dc28..9041ea12 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -64,8 +64,8 @@ public class Profession extends PostLoadObject implements ExperienceObject { maxLevel = config.getInt("max-level"); - if (config.contains("exp-sources")) - for (String key : config.getStringList("exp-sources")) + if (config.contains("exp-sources.yml")) + for (String key : config.getStringList("exp-sources.yml")) try { MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this)); } catch (IllegalArgumentException exception) { diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index fb990c21..2234376a 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -87,6 +87,7 @@ public class ConfigManager { loadDefaultFile("loot-chests.yml"); loadDefaultFile("commands.yml"); loadDefaultFile("exp-tables.yml"); + loadDefaultFile("exp-sources.yml"); loadDefaultFile("guilds.yml"); commandVerbose.reload(MMOCore.plugin.getConfig().getConfigurationSection("command-verbose")); diff --git a/src/main/resources/default/exp-sources.yml b/src/main/resources/default/exp-sources.yml new file mode 100644 index 00000000..e69de29b From 13eec448e48a880cc91056406b215574c27b608d Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 18:40:45 +0200 Subject: [PATCH 88/91] Change the loading of experienceSources to adapt to linked experience sources. --- .../mmocore/api/load/DefaultMMOLoader.java | 51 +++++++++++-------- .../Indyuce/mmocore/api/load/MMOLoader.java | 4 +- .../api/player/profess/PlayerClass.java | 7 +-- .../experience/ExperienceSourceList.java | 15 ++++++ .../mmocore/experience/Profession.java | 11 ++-- .../mmocore/manager/MMOLoadManager.java | 8 ++- 6 files changed, 65 insertions(+), 31 deletions(-) create mode 100644 src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index 8c01f63b..4820c112 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -8,6 +8,7 @@ import net.Indyuce.mmocore.api.block.VanillaBlockType; import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser; import net.Indyuce.mmocore.experience.source.*; import net.Indyuce.mmocore.loot.chest.condition.*; +import org.apache.commons.math3.analysis.function.Exp; import org.bukkit.configuration.ConfigurationSection; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; @@ -34,6 +35,9 @@ import net.Indyuce.mmocore.api.quest.trigger.Trigger; import io.lumine.mythic.lib.api.MMOLineConfig; import org.checkerframework.checker.units.qual.C; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.logging.Level; public class DefaultMMOLoader extends MMOLoader { @@ -121,8 +125,10 @@ public class DefaultMMOLoader extends MMOLoader { return null; } + + @Override - public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { + public List> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { if(config.getKey().equals("from")) { String source=config.getString("source"); ConfigFile configFile= new ConfigFile("exp-sources"); @@ -130,66 +136,67 @@ public class DefaultMMOLoader extends MMOLoader { MMOCore.plugin.getLogger().log(Level.WARNING,"Couldn't find "+source+" in experience-sources.yml"); return null; } + List> list= new ArrayList<>(); for(String expSource: configFile.getConfig().getStringList(source)) { - loadExperienceSource(new MMOLineConfig(expSource),dispenser); + list.addAll(loadExperienceSource(new MMOLineConfig(expSource),dispenser)); } + return list; + } - - if (config.getKey().equals("resource")) - return new ResourceExperienceSource(dispenser, config); + return Arrays.asList(new ResourceExperienceSource(dispenser, config)); if (config.getKey().equals("climb")) - return new ClimbExperienceSource(dispenser, config); + return Arrays.asList(new ClimbExperienceSource(dispenser, config)); if (config.getKey().equals("eat")) { - return new EatExperienceSource(dispenser, config); + return Arrays.asList(new EatExperienceSource(dispenser, config)); } if (config.getKey().equals("damagedealt")) - return new DamageDealtExperienceSource(dispenser, config); + return Arrays.asList(new DamageDealtExperienceSource(dispenser, config)); if (config.getKey().equals("damagetaken")) - return new DamageTakenExperienceSource(dispenser, config); + return Arrays.asList(new DamageTakenExperienceSource(dispenser, config)); if (config.getKey().equals("move")) - return new MoveExperienceSource(dispenser, config); + return Arrays.asList(new MoveExperienceSource(dispenser, config)); if (config.getKey().equals("play")) - return new PlayExperienceSource(dispenser, config); + return Arrays.asList(new PlayExperienceSource(dispenser, config)); if (config.getKey().equals("projectile")) - return new ProjectileExperienceSource(dispenser, config); + return Arrays.asList(new ProjectileExperienceSource(dispenser, config)); if (config.getKey().equals("ride")) - return new RideExperienceSource(dispenser, config); + return Arrays.asList(new RideExperienceSource(dispenser, config)); if (config.getKey().equals("tame")) - return new TameExperienceSource(dispenser, config); + return Arrays.asList(new TameExperienceSource(dispenser, config)); if (config.getKey().equals("killmob")) - return new KillMobExperienceSource(dispenser, config); + return Arrays.asList(new KillMobExperienceSource(dispenser, config)); if (config.getKey().equals("mineblock")) - return new MineBlockExperienceSource(dispenser, config); + return Arrays.asList(new MineBlockExperienceSource(dispenser, config)); if (config.getKey().equals("placeblock")) - return new PlaceBlockExperienceSource(dispenser, config); + return Arrays.asList(new PlaceBlockExperienceSource(dispenser, config)); if (config.getKey().equals("brewpotion")) - return new BrewPotionExperienceSource(dispenser, config); + return Arrays.asList(new BrewPotionExperienceSource(dispenser, config)); if (config.getKey().equals("smeltitem")) - return new SmeltItemExperienceSource(dispenser, config); + return Arrays.asList(new SmeltItemExperienceSource(dispenser, config)); if (config.getKey().equals("enchantitem")) - return new EnchantItemExperienceSource(dispenser, config); + return Arrays.asList(new EnchantItemExperienceSource(dispenser, config)); if (config.getKey().equals("repairitem")) - return new RepairItemExperienceSource(dispenser, config); + return Arrays.asList(new RepairItemExperienceSource(dispenser, config)); if (config.getKey().equals("craftitem")) - return new CraftItemExperienceSource(dispenser, config); + return Arrays.asList(new CraftItemExperienceSource(dispenser, config)); return null; } diff --git a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java index 51564421..38333482 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java @@ -10,6 +10,8 @@ import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.api.quest.objective.Objective; import org.bukkit.configuration.ConfigurationSection; +import java.util.List; + /** * MMOLoader was initially an interface but it is now a * class so devs do not have to add a new method @@ -33,7 +35,7 @@ public class MMOLoader { return null; } - public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { + public List> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { return null; } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 00a4cf6e..3021d87e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -84,7 +84,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { profileField.set(meta, gp); icon.setItemMeta(meta); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException - | SecurityException exception) { + | SecurityException exception) { throw new IllegalArgumentException("Could not apply playerhead texture: " + exception.getMessage()); } @@ -159,8 +159,9 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { if (config.contains("main-exp-sources.yml")) { for (String key : config.getStringList("main-exp-sources.yml")) try { - ExperienceSource source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); - MMOCore.plugin.experience.registerSource(source); + List> list = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); + for (ExperienceSource source : list) + MMOCore.plugin.experience.registerSource(source); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp source '" + key + "' from class '" + id + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java new file mode 100644 index 00000000..08211ed4 --- /dev/null +++ b/src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java @@ -0,0 +1,15 @@ +package net.Indyuce.mmocore.experience; + +import net.Indyuce.mmocore.experience.source.type.ExperienceSource; + +import java.util.ArrayList; +import java.util.List; + +public class ExperienceSourceList { + List experienceSourceList= new ArrayList<>(); + + public void add(ExperienceSource source) { + + } + +} diff --git a/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/src/main/java/net/Indyuce/mmocore/experience/Profession.java index 9041ea12..03ba0db5 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -6,6 +6,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.experience.droptable.ExperienceTable; +import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; @@ -14,6 +15,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.logging.Level; @@ -64,10 +66,13 @@ public class Profession extends PostLoadObject implements ExperienceObject { maxLevel = config.getInt("max-level"); - if (config.contains("exp-sources.yml")) - for (String key : config.getStringList("exp-sources.yml")) + if (config.contains("exp-sources")) + for (String key : config.getStringList("exp-sources")) try { - MMOCore.plugin.experience.registerSource(MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this)); + List> experienceSourceList=MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this); + for(ExperienceSource experienceSource: experienceSourceList) { + MMOCore.plugin.experience.registerSource(experienceSource); + } } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not register exp source '" + key + "' from profession '" + id + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java index 15c49d03..a448882f 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java @@ -41,9 +41,13 @@ public class MMOLoadManager { return load(Objective.class, config, loader -> loader.loadObjective(config, section)); } + /** + Returns a List of Experience Source as one experience source can be linked to others. + Loading one exp source can in fact oad multiples if they are linked + */ @Deprecated - public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { - return load(ExperienceSource.class, config, loader -> loader.loadExperienceSource(config, dispenser)); + public List> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { + return load(List.class, config, loader -> loader.loadExperienceSource(config, dispenser)); } public Trigger loadTrigger(MMOLineConfig config) { From f3b8db1383f41ffb3de455274e23fa9122a37609 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 18:56:17 +0200 Subject: [PATCH 89/91] Debugging about ExperienceSources --- .../comp/mythicmobs/MythicMobsMMOLoader.java | 9 ++++++--- .../mmocore/experience/ExperienceSourceList.java | 15 --------------- 2 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java index 83f4aa1f..7a4b38fa 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java @@ -10,6 +10,9 @@ import net.Indyuce.mmocore.experience.source.type.ExperienceSource; import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem; import org.bukkit.configuration.ConfigurationSection; +import java.util.Arrays; +import java.util.List; + public class MythicMobsMMOLoader extends MMOLoader { @Override @@ -42,12 +45,12 @@ public class MythicMobsMMOLoader extends MMOLoader { } @Override - public ExperienceSource loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { + public List> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { if (config.getKey().equalsIgnoreCase("killmythicmob")) - return new KillMythicMobExperienceSource(dispenser, config); + return Arrays.asList(new KillMythicMobExperienceSource(dispenser, config)); if (config.getKey().equalsIgnoreCase("killmythicfaction")) - return new KillMythicFactionExperienceSource(dispenser, config); + return Arrays.asList(new KillMythicFactionExperienceSource(dispenser, config)); return null; } diff --git a/src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java b/src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java deleted file mode 100644 index 08211ed4..00000000 --- a/src/main/java/net/Indyuce/mmocore/experience/ExperienceSourceList.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.Indyuce.mmocore.experience; - -import net.Indyuce.mmocore.experience.source.type.ExperienceSource; - -import java.util.ArrayList; -import java.util.List; - -public class ExperienceSourceList { - List experienceSourceList= new ArrayList<>(); - - public void add(ExperienceSource source) { - - } - -} From 5ef636f5b92a98ad255a3842605ecd9ff95f2203 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 19:19:21 +0200 Subject: [PATCH 90/91] triggers.yml where you can reference some triggers. --- .../Indyuce/mmocore/api/block/BlockInfo.java | 2 +- .../mmocore/api/load/DefaultMMOLoader.java | 48 ++++++++++++------- .../Indyuce/mmocore/api/load/MMOLoader.java | 2 +- .../player/profess/event/EventTrigger.java | 2 +- .../api/quest/objective/Objective.java | 2 +- .../comp/mythicmobs/MythicMobsMMOLoader.java | 4 +- .../mmocore/comp/vault/VaultMMOLoader.java | 7 ++- .../experience/droptable/ExperienceItem.java | 2 +- .../mmocore/gui/api/GeneratedInventory.java | 2 +- .../mmocore/gui/api/item/TriggerItem.java | 10 ++-- .../mmocore/manager/ConfigManager.java | 1 + .../mmocore/manager/MMOLoadManager.java | 4 +- src/main/resources/default/exp-sources.yml | 8 ++++ src/main/resources/default/triggers.yml | 0 14 files changed, 60 insertions(+), 34 deletions(-) create mode 100644 src/main/resources/default/triggers.yml diff --git a/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java b/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java index 04d444b7..394eaacd 100644 --- a/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java +++ b/src/main/java/net/Indyuce/mmocore/api/block/BlockInfo.java @@ -52,7 +52,7 @@ public class BlockInfo { for (String key : list) try { - triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key))); + triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load trigger '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index 4820c112..e9c5a623 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -43,30 +43,43 @@ import java.util.logging.Level; public class DefaultMMOLoader extends MMOLoader { @Override - public Trigger loadTrigger(MMOLineConfig config) { + public List loadTrigger(MMOLineConfig config) { + if (config.getKey().equals("from")) { + String source = config.getString("source"); + ConfigFile configFile = new ConfigFile("triggers"); + if (!configFile.getConfig().contains(source)) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Couldn't find " + source + " in experience-sources.yml"); + return null; + } + List list = new ArrayList<>(); + for (String trigger : configFile.getConfig().getStringList(source)) { + list.addAll(loadTrigger(new MMOLineConfig(trigger))); + } + return list; + } if (config.getKey().equals("message")) - return new MessageTrigger(config); + return Arrays.asList(new MessageTrigger(config)); if (config.getKey().equals("sound") || config.getKey().equals("playsound")) - return new SoundTrigger(config); + return Arrays.asList(new SoundTrigger(config)); if (config.getKey().equals("mana")) - return new ManaTrigger(config); + return Arrays.asList(new ManaTrigger(config)); if (config.getKey().equals("stamina")) - return new StaminaTrigger(config); + return Arrays.asList(new StaminaTrigger(config)); if (config.getKey().equals("stellium")) - return new StelliumTrigger(config); + return Arrays.asList(new StelliumTrigger(config)); if (config.getKey().equals("command")) - return new CommandTrigger(config); + return Arrays.asList(new CommandTrigger(config)); if (config.getKey().equals("item") || config.getKey().equals("vanilla")) - return new ItemTrigger(config); + return Arrays.asList(new ItemTrigger(config)); if (config.getKey().equals("exp") || config.getKey().equals("experience")) - return new ExperienceTrigger(config); + return Arrays.asList(new ExperienceTrigger(config)); return null; } @@ -126,19 +139,18 @@ public class DefaultMMOLoader extends MMOLoader { } - @Override public List> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) { - if(config.getKey().equals("from")) { - String source=config.getString("source"); - ConfigFile configFile= new ConfigFile("exp-sources"); - if(!configFile.getConfig().contains(source)) { - MMOCore.plugin.getLogger().log(Level.WARNING,"Couldn't find "+source+" in experience-sources.yml"); + if (config.getKey().equals("from")) { + String source = config.getString("source"); + ConfigFile configFile = new ConfigFile("exp-sources"); + if (!configFile.getConfig().contains(source)) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Couldn't find " + source + " in experience-sources.yml"); return null; } - List> list= new ArrayList<>(); - for(String expSource: configFile.getConfig().getStringList(source)) { - list.addAll(loadExperienceSource(new MMOLineConfig(expSource),dispenser)); + List> list = new ArrayList<>(); + for (String expSource : configFile.getConfig().getStringList(source)) { + list.addAll(loadExperienceSource(new MMOLineConfig(expSource), dispenser)); } return list; diff --git a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java index 38333482..42cf0453 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java @@ -23,7 +23,7 @@ public class MMOLoader { return null; } - public Trigger loadTrigger(MMOLineConfig config) { + public List loadTrigger(MMOLineConfig config) { return null; } diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java index fca598b2..ac223e92 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/EventTrigger.java @@ -25,7 +25,7 @@ public class EventTrigger { for (String format : list) try { - triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(format))); + triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(format))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load trigger '" + format + "' from event trigger '" + event + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java b/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java index 3f23fa9e..35305647 100644 --- a/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java +++ b/src/main/java/net/Indyuce/mmocore/api/quest/objective/Objective.java @@ -30,7 +30,7 @@ public abstract class Objective { for (String key : config.getStringList("triggers")) try { - triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key))); + triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load trigger '" + key + "' from objective '" + id + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java index 7a4b38fa..f471dcd5 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsMMOLoader.java @@ -16,10 +16,10 @@ import java.util.List; public class MythicMobsMMOLoader extends MMOLoader { @Override - public Trigger loadTrigger(MMOLineConfig config) { + public List loadTrigger(MMOLineConfig config) { if (config.getKey().equalsIgnoreCase("mmskill") || config.getKey().equalsIgnoreCase("mythicmobskill")) - return new MythicSkillTrigger(config); + return Arrays.asList(new MythicSkillTrigger(config)); return null; } diff --git a/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java index 1cadefc0..db004558 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/comp/vault/VaultMMOLoader.java @@ -4,13 +4,16 @@ import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.api.load.MMOLoader; import io.lumine.mythic.lib.api.MMOLineConfig; +import java.util.Arrays; +import java.util.List; + public class VaultMMOLoader extends MMOLoader { @Override - public Trigger loadTrigger(MMOLineConfig config) { + public List loadTrigger(MMOLineConfig config) { if (config.getKey().equalsIgnoreCase("money")) - return new MoneyTrigger(config); + return Arrays.asList(new MoneyTrigger(config)); return null; } diff --git a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java index 27045351..aac2dd3f 100644 --- a/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java +++ b/src/main/java/net/Indyuce/mmocore/experience/droptable/ExperienceItem.java @@ -63,7 +63,7 @@ public class ExperienceItem { triggers = new ArrayList<>(); for (String triggerFormat : config.getStringList("triggers")) - triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(triggerFormat))); + triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(triggerFormat))); } public String getId() { diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java b/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java index 85be0d26..e7c8c71b 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/GeneratedInventory.java @@ -100,7 +100,7 @@ public abstract class GeneratedInventory extends PluginInventory { return; if (item instanceof TriggerItem) - ((TriggerItem) item).getTrigger().apply(getPlayerData()); + ((TriggerItem) item).getTriggers().forEach(trigger->trigger.apply(getPlayerData())); else whenClicked(event, item); } diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java b/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java index 78f0c65d..502bff75 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/item/TriggerItem.java @@ -6,13 +6,15 @@ import net.Indyuce.mmocore.api.quest.trigger.Trigger; import net.Indyuce.mmocore.gui.api.GeneratedInventory; import org.bukkit.configuration.ConfigurationSection; +import java.util.List; + public class TriggerItem extends InventoryItem { - private final Trigger trigger; + private final List triggers; public TriggerItem(ConfigurationSection config, String format) { super(config); - trigger = MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(format)); + triggers = MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(format)); } @Override @@ -20,7 +22,7 @@ public class TriggerItem extends InventoryItem { return new Placeholders(); } - public Trigger getTrigger() { - return trigger; + public List getTriggers() { + return triggers; } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 2234376a..72c94f91 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -88,6 +88,7 @@ public class ConfigManager { loadDefaultFile("commands.yml"); loadDefaultFile("exp-tables.yml"); loadDefaultFile("exp-sources.yml"); + loadDefaultFile("triggers.yml"); loadDefaultFile("guilds.yml"); commandVerbose.reload(MMOCore.plugin.getConfig().getConfigurationSection("command-verbose")); diff --git a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java index a448882f..157deaaf 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java @@ -50,8 +50,8 @@ public class MMOLoadManager { return load(List.class, config, loader -> loader.loadExperienceSource(config, dispenser)); } - public Trigger loadTrigger(MMOLineConfig config) { - return load(Trigger.class, config, loader -> loader.loadTrigger(config)); + public List loadTrigger(MMOLineConfig config) { + return load(List.class, config, loader -> loader.loadTrigger(config)); } public DropItem loadDropItem(MMOLineConfig config) { diff --git a/src/main/resources/default/exp-sources.yml b/src/main/resources/default/exp-sources.yml index e69de29b..fd768fe7 100644 --- a/src/main/resources/default/exp-sources.yml +++ b/src/main/resources/default/exp-sources.yml @@ -0,0 +1,8 @@ +#A list of experience source that can be loaded using 'from{source="test-exp-source"}' +test-exp-source: + - 'damagedealt{type=physical;amount=250}' + - 'move{type=WALK;amount=300}' + - 'from{source=test2}' + +test2: + - 'eat{type=CARROT;amount="50"}' \ No newline at end of file diff --git a/src/main/resources/default/triggers.yml b/src/main/resources/default/triggers.yml new file mode 100644 index 00000000..e69de29b From bfe2b27ab5187b5e57b9585fc8e161cc8ede14fd Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Wed, 27 Jul 2022 19:36:39 +0200 Subject: [PATCH 91/91] conditions.yml where you can reference some conditions. --- .../mmocore/api/load/DefaultMMOLoader.java | 27 ++++++++++++++----- .../Indyuce/mmocore/api/load/MMOLoader.java | 2 +- .../comp/region/WorldGuardMMOLoader.java | 7 +++-- .../mmocore/loot/droptable/DropTable.java | 2 +- .../mmocore/manager/ConfigManager.java | 1 + .../mmocore/manager/MMOLoadManager.java | 4 +-- .../profession/CustomBlockManager.java | 2 +- .../manager/profession/FishingManager.java | 2 +- .../Indyuce/mmocore/waypoint/Waypoint.java | 2 +- src/main/resources/default/conditions.yml | 0 10 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 src/main/resources/default/conditions.yml diff --git a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java index e9c5a623..cd2c891d 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/DefaultMMOLoader.java @@ -119,21 +119,36 @@ public class DefaultMMOLoader extends MMOLoader { } @Override - public Condition loadCondition(MMOLineConfig config) { + public List loadCondition(MMOLineConfig config) { + if (config.getKey().equals("from")) { + String source = config.getString("source"); + ConfigFile configFile = new ConfigFile("conditions"); + if (!configFile.getConfig().contains(source)) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Couldn't find " + source + " in experience-sources.yml"); + return null; + } + List list = new ArrayList<>(); + for (String condition : configFile.getConfig().getStringList(source)) { + list.addAll(loadCondition(new MMOLineConfig(condition))); + } + return list; + + } + if (config.getKey().equals("distance")) - return new DistanceCondition(config); + return Arrays.asList(new DistanceCondition(config)); if (config.getKey().equals("world")) - return new WorldCondition(config); + return Arrays.asList(new WorldCondition(config)); if (config.getKey().equals("biome")) - return new BiomeCondition(config); + return Arrays.asList(new BiomeCondition(config)); if (config.getKey().equals("level")) - return new LevelCondition(config); + return Arrays.asList(new LevelCondition(config)); if (config.getKey().equals("permission")) - return new PermissionCondition(config); + return Arrays.asList(new PermissionCondition(config)); return null; } diff --git a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java index 42cf0453..4e83734e 100644 --- a/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/api/load/MMOLoader.java @@ -19,7 +19,7 @@ import java.util.List; */ public class MMOLoader { - public Condition loadCondition(MMOLineConfig config) { + public List loadCondition(MMOLineConfig config) { return null; } diff --git a/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java b/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java index 735ebda6..50da8a61 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java +++ b/src/main/java/net/Indyuce/mmocore/comp/region/WorldGuardMMOLoader.java @@ -4,13 +4,16 @@ import net.Indyuce.mmocore.loot.chest.condition.Condition; import net.Indyuce.mmocore.api.load.MMOLoader; import io.lumine.mythic.lib.api.MMOLineConfig; +import java.util.Arrays; +import java.util.List; + public class WorldGuardMMOLoader extends MMOLoader { @Override - public Condition loadCondition(MMOLineConfig config) { + public List loadCondition(MMOLineConfig config) { if (config.getKey().equals("region")) - return new RegionCondition(config); + return Arrays.asList(new RegionCondition(config)); return null; } diff --git a/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java b/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java index ffc90a61..9b69db63 100644 --- a/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java +++ b/src/main/java/net/Indyuce/mmocore/loot/droptable/DropTable.java @@ -53,7 +53,7 @@ public class DropTable extends PostLoadObject { } for (String key : conditionsList) try { - conditions.add(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(key))); + conditions.addAll(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(key))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load condition '" + key + "' from table '" + id + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 72c94f91..f089e009 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -89,6 +89,7 @@ public class ConfigManager { loadDefaultFile("exp-tables.yml"); loadDefaultFile("exp-sources.yml"); loadDefaultFile("triggers.yml"); + loadDefaultFile("conditions.yml"); loadDefaultFile("guilds.yml"); commandVerbose.reload(MMOCore.plugin.getConfig().getConfigurationSection("command-verbose")); diff --git a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java index 157deaaf..95301573 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/MMOLoadManager.java @@ -33,8 +33,8 @@ public class MMOLoadManager { loaders.add(loader); } - public Condition loadCondition(MMOLineConfig config) { - return load(Condition.class, config, loader -> loader.loadCondition(config)); + public List loadCondition(MMOLineConfig config) { + return load(List.class, config, loader -> loader.loadCondition(config)); } public Objective loadObjective(MMOLineConfig config, ConfigurationSection section) { diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java index 4f089d10..f1f23f87 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java @@ -189,7 +189,7 @@ public class CustomBlockManager extends SpecificProfessionManager { for (String key : MMOCore.plugin.getConfig().getStringList("custom-mine-conditions")) try { - customMineConditions.add(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(key))); + customMineConditions.addAll(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(key))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load custom mining condition '" + key + "': " + exception.getMessage()); } diff --git a/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java b/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java index aad6403d..bd50a234 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/profession/FishingManager.java @@ -60,7 +60,7 @@ public class FishingManager extends SpecificProfessionManager { for (String str : list) try { - conditions.add(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(str))); + conditions.addAll(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(str))); } catch (IllegalArgumentException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load condition '" + str + "' from fishing drop table '" + id + "': " + exception.getMessage()); diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java index 93bee8ae..bd263ac0 100644 --- a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java +++ b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java @@ -60,7 +60,7 @@ public class Waypoint extends PostLoadObject implements Unlockable { List conditions = config.getStringList("dynamic-conditions"); for (String condition : conditions) try { - dynamicUseConditions.add(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(condition))); + dynamicUseConditions.addAll(MMOCore.plugin.loadManager.loadCondition(new MMOLineConfig(condition))); } catch (RuntimeException exception) { MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load condition '" + condition + "' from waypoint '" + id + "': " + exception.getMessage()); } diff --git a/src/main/resources/default/conditions.yml b/src/main/resources/default/conditions.yml new file mode 100644 index 00000000..e69de29b