Merge remote-tracking branch 'origin/master'

This commit is contained in:
Indyuce 2021-11-13 12:23:27 +01:00
commit 5d4a38a482
44 changed files with 152 additions and 105 deletions

5
LICENSE Normal file
View File

@ -0,0 +1,5 @@
This project is owned and maintained by Lumine LLC and is distributed with "All Right's Reserved".
This is just to protect the project and its status as a Paid Resource.
You can fork and modify the project as you wish to meet your server's needs, and merge requests are accepted under the terms that you grant full rights to us using any pushed code. However, you may not distribute the plugin and may not bypass any anti-piracy protection.

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.Indyuce</groupId> <groupId>net.Indyuce</groupId>
<artifactId>MMOCore</artifactId> <artifactId>MMOCore</artifactId>
<version>1.8.1</version> <version>1.8.2</version>
<name>MMOCore</name> <name>MMOCore</name>
<description>Offer your players a brand new RPG experience!!</description> <description>Offer your players a brand new RPG experience!!</description>
@ -109,7 +109,7 @@
<!-- Spigot API --> <!-- Spigot API -->
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-1.17</artifactId> <artifactId>spigot-1.17.1</artifactId>
<version>dev</version> <version>dev</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -125,7 +125,7 @@
<dependency> <dependency>
<groupId>io.lumine</groupId> <groupId>io.lumine</groupId>
<artifactId>MythicLib</artifactId> <artifactId>MythicLib</artifactId>
<version>1.1.3</version> <version>1.1.5</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View File

@ -97,7 +97,6 @@ public class MMOCore extends LuminePlugin {
} }
public void load() { public void load() {
// Register target restrictions due to MMOCore in MythicLib // Register target restrictions due to MMOCore in MythicLib
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction()); MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());

View File

@ -1,6 +1,6 @@
package net.Indyuce.mmocore.api.player; package net.Indyuce.mmocore.api.player;
import io.lumine.mythic.lib.player.MMOPlayerData; import io.lumine.mythic.lib.api.player.MMOPlayerData;
import io.lumine.mythic.lib.player.cooldown.CooldownInfo; import io.lumine.mythic.lib.player.cooldown.CooldownInfo;
import io.lumine.mythic.lib.player.cooldown.CooldownMap; import io.lumine.mythic.lib.player.cooldown.CooldownMap;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
@ -19,9 +19,9 @@ import net.Indyuce.mmocore.api.player.social.guilds.Guild;
import net.Indyuce.mmocore.api.player.stats.PlayerStats; import net.Indyuce.mmocore.api.player.stats.PlayerStats;
import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.player.stats.StatType;
import net.Indyuce.mmocore.api.quest.PlayerQuests; 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.api.util.MMOCoreUtils;
import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect; import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect;
import net.Indyuce.mmocore.comp.mythicmobs.MythicSkill;
import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.EXPSource;
import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.PlayerProfessions;
import net.Indyuce.mmocore.listener.SpellCast.SkillCasting; import net.Indyuce.mmocore.listener.SpellCast.SkillCasting;
@ -46,7 +46,7 @@ import java.util.*;
import java.util.logging.Level; import java.util.logging.Level;
public class PlayerData extends OfflinePlayerData { public class PlayerData extends OfflinePlayerData implements Closable {
/** /**
* Corresponds to the MythicLib player data. It is used to keep * Corresponds to the MythicLib player data. It is used to keep
@ -128,6 +128,17 @@ public class PlayerData extends OfflinePlayerData {
} }
} }
@Override
public void close() {
// Remove from party
if (hasParty())
getParty().removeMember(this);
// Close quest data
questData.close();
}
public MMOPlayerData getMMOPlayerData() { public MMOPlayerData getMMOPlayerData() {
return mmoData; return mmoData;
} }
@ -571,6 +582,7 @@ public class PlayerData extends OfflinePlayerData {
return; return;
// Use updated amount from Bukkit event // Use updated amount from Bukkit event
setStamina(stamina + event.getAmount());
stamina = Math.max(0, Math.min(stamina + event.getAmount(), max)); stamina = Math.max(0, Math.min(stamina + event.getAmount(), max));
} }
@ -758,12 +770,6 @@ public class PlayerData extends OfflinePlayerData {
// Update stats // Update stats
getStats().updateStats(); getStats().updateStats();
// Update skill triggers
mmoData.unregisterSkillTriggers("MMOCorePassiveSkill");
for (SkillInfo skill : getProfess().getSkills())
if (skill.getSkill() instanceof MythicSkill && skill.getSkill().isPassive())
mmoData.registerSkillTrigger(((MythicSkill) skill.getSkill()).toMythicLib());
} }
public boolean hasSkillBound(int slot) { public boolean hasSkillBound(int slot) {
@ -849,7 +855,8 @@ public class PlayerData extends OfflinePlayerData {
MMOCore.plugin.configManager.getSimpleMessage("casting.on-cooldown").send(getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("casting.on-cooldown").send(getPlayer());
} }
Bukkit.getPluginManager().callEvent(new PlayerPostCastSkillEvent(this, skill, cast)); PlayerPostCastSkillEvent postEvent = new PlayerPostCastSkillEvent(this, skill, cast);
Bukkit.getPluginManager().callEvent(postEvent);
return cast; return cast;
} }
@ -865,7 +872,8 @@ public class PlayerData extends OfflinePlayerData {
giveStamina(-cast.getStaminaCost(), PlayerResourceUpdateEvent.UpdateReason.SKILL_COST); giveStamina(-cast.getStaminaCost(), PlayerResourceUpdateEvent.UpdateReason.SKILL_COST);
} }
Bukkit.getPluginManager().callEvent(new PlayerPostCastSkillEvent(this, skill, cast)); PlayerPostCastSkillEvent postEvent = new PlayerPostCastSkillEvent(this, skill, cast);
Bukkit.getPluginManager().callEvent(postEvent);
return cast; return cast;
} }
@ -888,11 +896,32 @@ public class PlayerData extends OfflinePlayerData {
} }
/** /**
* This is being used to easily check if an online player corresponds to * This is used to check if the player data is loaded for a
* a real player or a Citizens NPC. Citizens NPCs do not have any player * specific player. This might seem redundant because the given
* data associated to them * Player instance is linked to an online player, and data
* is always loaded for an online player.
* <p>
* In fact a Player instance can be attached to a Citizens NPC
* which has no player data loaded hence this method
* *
* @return Checks if plater data is loaded for a specific player UID * @param player Either a real player or an NPC
* @return If player data for that player is loaded
*/
public static boolean has(Player player) {
return has(player.getUniqueId());
}
/**
* This is used to check if the player data is loaded for a
* specific player. This might seem redundant because the given
* Player instance is linked to an online player, and data
* is always loaded for an online player.
* <p>
* In fact a Player instance can be attached to a Citizens NPC
* which has no player data loaded hence this method
*
* @param uuid A (real or fictive) player UUID
* @return If player data for that player is loaded
*/ */
public static boolean has(UUID uuid) { public static boolean has(UUID uuid) {
return MMOCore.plugin.dataProvider.getDataManager().isLoaded(uuid); return MMOCore.plugin.dataProvider.getDataManager().isLoaded(uuid);

View File

@ -1,6 +1,6 @@
package net.Indyuce.mmocore.api.player.stats; package net.Indyuce.mmocore.api.player.stats;
import io.lumine.mythic.lib.player.EquipmentSlot; import io.lumine.mythic.lib.api.player.EquipmentSlot;
import io.lumine.mythic.lib.api.stat.StatInstance; import io.lumine.mythic.lib.api.stat.StatInstance;
import io.lumine.mythic.lib.api.stat.StatMap; import io.lumine.mythic.lib.api.stat.StatMap;
import io.lumine.mythic.lib.api.stat.modifier.ModifierSource; import io.lumine.mythic.lib.api.stat.modifier.ModifierSource;

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmocore.api.quest; package net.Indyuce.mmocore.api.quest;
import net.Indyuce.mmocore.api.util.Closable;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -8,7 +9,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.quest.objective.Objective; import net.Indyuce.mmocore.api.quest.objective.Objective;
public abstract class ObjectiveProgress { public abstract class ObjectiveProgress implements Closable {
private final Objective objective; private final Objective objective;
private final QuestProgress questProgress; private final QuestProgress questProgress;
@ -32,6 +33,7 @@ public abstract class ObjectiveProgress {
return questProgress; return questProgress;
} }
@Override
public void close() { public void close() {
if (this instanceof Listener) if (this instanceof Listener)
HandlerList.unregisterAll((Listener) this); HandlerList.unregisterAll((Listener) this);

View File

@ -6,6 +6,7 @@ import com.google.gson.JsonObject;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.util.Closable;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.boss.BarColor; import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle; import org.bukkit.boss.BarStyle;
@ -19,7 +20,7 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
public class PlayerQuests { public class PlayerQuests implements Closable {
private final PlayerData playerData; private final PlayerData playerData;
private final BossBar bossbar; private final BossBar bossbar;
private final Map<String, Long> finished = new HashMap<>(); private final Map<String, Long> finished = new HashMap<>();
@ -36,12 +37,6 @@ public class PlayerQuests {
bossbar.addPlayer(playerData.getPlayer()); bossbar.addPlayer(playerData.getPlayer());
} }
@Deprecated
public PlayerQuests(PlayerData playerData, BossBar bar) {
this.playerData = playerData;
this.bossbar = bar;
}
public PlayerQuests load(ConfigurationSection config) { public PlayerQuests load(ConfigurationSection config) {
if (config.contains("current")) if (config.contains("current"))
try { try {
@ -148,15 +143,20 @@ public class PlayerQuests {
public void start(Quest quest) { public void start(Quest quest) {
// close current objective progress if quest is active // Close current objective progress if quest is active
if (hasCurrent()) close();
current.getProgress().close();
// apply newer quest // Apply newest quest
current = quest == null ? null : quest.generateNewProgress(playerData); current = quest == null ? null : quest.generateNewProgress(playerData);
updateBossBar(); updateBossBar();
} }
@Override
public void close() {
if (current != null)
current.getProgress().close();
}
public boolean checkCooldownAvailability(Quest quest) { public boolean checkCooldownAvailability(Quest quest) {
return (finished.get(quest.getId()) + quest.getDelayMillis()) < System.currentTimeMillis(); return (finished.get(quest.getId()) + quest.getDelayMillis()) < System.currentTimeMillis();
} }

View File

@ -0,0 +1,15 @@
package net.Indyuce.mmocore.api.util;
/**
* Indicates that a class temporarily registers something
* such as a Bukkit event, which needs to be unregistered
* when the class is finally garbage collected.
*/
public interface Closable {
/**
* Method that must be called before the class
* is garbage collected
*/
void close();
}

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.command; package net.Indyuce.mmocore.command;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeRoot; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode; import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode;
import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode; import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode;

View File

@ -1,8 +1,8 @@
package net.Indyuce.mmocore.command.rpg; package net.Indyuce.mmocore.command.rpg;
import io.lumine.mythic.lib.api.util.SmartGive; import io.lumine.mythic.lib.api.util.SmartGive;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.api.util.item.CurrencyItem; import net.Indyuce.mmocore.api.util.item.CurrencyItem;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View File

@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.util.item.CurrencyItem; import net.Indyuce.mmocore.api.util.item.CurrencyItem;
import io.lumine.mythic.lib.api.util.SmartGive; import io.lumine.mythic.lib.api.util.SmartGive;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class NoteCommandTreeNode extends CommandTreeNode { public class NoteCommandTreeNode extends CommandTreeNode {
public NoteCommandTreeNode(CommandTreeNode parent) { public NoteCommandTreeNode(CommandTreeNode parent) {

View File

@ -5,7 +5,7 @@ import org.bukkit.command.CommandSender;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class ReloadCommandTreeNode extends CommandTreeNode { public class ReloadCommandTreeNode extends CommandTreeNode {
public ReloadCommandTreeNode(CommandTreeNode parent) { public ReloadCommandTreeNode(CommandTreeNode parent) {

View File

@ -1,6 +1,6 @@
package net.Indyuce.mmocore.command.rpg.admin; package net.Indyuce.mmocore.command.rpg.admin;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -10,8 +10,8 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance; import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class AttributeCommandTreeNode extends CommandTreeNode { public class AttributeCommandTreeNode extends CommandTreeNode {
public AttributeCommandTreeNode(CommandTreeNode parent) { public AttributeCommandTreeNode(CommandTreeNode parent) {

View File

@ -12,8 +12,8 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.api.player.profess.PlayerClass;
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
import net.Indyuce.mmocore.command.CommandVerbose; import net.Indyuce.mmocore.command.CommandVerbose;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ClassCommandTreeNode extends CommandTreeNode { public class ClassCommandTreeNode extends CommandTreeNode {
public ClassCommandTreeNode(CommandTreeNode parent) { public ClassCommandTreeNode(CommandTreeNode parent) {

View File

@ -14,8 +14,8 @@ import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.command.CommandVerbose; import net.Indyuce.mmocore.command.CommandVerbose;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ExperienceCommandTreeNode extends CommandTreeNode { public class ExperienceCommandTreeNode extends CommandTreeNode {
public ExperienceCommandTreeNode(CommandTreeNode parent) { public ExperienceCommandTreeNode(CommandTreeNode parent) {

View File

@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.profess.PlayerClass; import net.Indyuce.mmocore.api.player.profess.PlayerClass;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ForceClassCommandTreeNode extends CommandTreeNode { public class ForceClassCommandTreeNode extends CommandTreeNode {
public ForceClassCommandTreeNode(CommandTreeNode parent) { public ForceClassCommandTreeNode(CommandTreeNode parent) {

View File

@ -6,8 +6,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class HideActionBarCommandTreeNode extends CommandTreeNode { public class HideActionBarCommandTreeNode extends CommandTreeNode {
public HideActionBarCommandTreeNode(CommandTreeNode parent) { public HideActionBarCommandTreeNode(CommandTreeNode parent) {

View File

@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class InfoCommandTreeNode extends CommandTreeNode { public class InfoCommandTreeNode extends CommandTreeNode {
public InfoCommandTreeNode(CommandTreeNode parent) { public InfoCommandTreeNode(CommandTreeNode parent) {

View File

@ -14,8 +14,8 @@ import net.Indyuce.mmocore.experience.PlayerProfessions;
import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class LevelCommandTreeNode extends CommandTreeNode { public class LevelCommandTreeNode extends CommandTreeNode {
public LevelCommandTreeNode(CommandTreeNode parent) { public LevelCommandTreeNode(CommandTreeNode parent) {

View File

@ -7,8 +7,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class NoCooldownCommandTreeNode extends CommandTreeNode { public class NoCooldownCommandTreeNode extends CommandTreeNode {
public NoCooldownCommandTreeNode(CommandTreeNode parent) { public NoCooldownCommandTreeNode(CommandTreeNode parent) {

View File

@ -10,8 +10,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class PointsCommandTreeNode extends CommandTreeNode { public class PointsCommandTreeNode extends CommandTreeNode {
private final String type; private final String type;

View File

@ -10,8 +10,8 @@ import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance; import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance;
import net.Indyuce.mmocore.command.CommandVerbose; import net.Indyuce.mmocore.command.CommandVerbose;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ResetCommandTreeNode extends CommandTreeNode { public class ResetCommandTreeNode extends CommandTreeNode {
public ResetCommandTreeNode(CommandTreeNode parent) { public ResetCommandTreeNode(CommandTreeNode parent) {

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.command.rpg.admin; package net.Indyuce.mmocore.command.rpg.admin;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;

View File

@ -2,7 +2,7 @@ package net.Indyuce.mmocore.command.rpg.booster;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class BoosterCommandTreeNode extends CommandTreeNode { public class BoosterCommandTreeNode extends CommandTreeNode {
public BoosterCommandTreeNode(CommandTreeNode parent) { public BoosterCommandTreeNode(CommandTreeNode parent) {

View File

@ -12,8 +12,8 @@ import net.Indyuce.mmocore.api.ConfigMessage;
import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.experience.Booster;
import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class CreateCommandTreeNode extends CommandTreeNode { public class CreateCommandTreeNode extends CommandTreeNode {
public CreateCommandTreeNode(CommandTreeNode parent) { public CreateCommandTreeNode(CommandTreeNode parent) {

View File

@ -8,7 +8,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.experience.Booster;
import net.Indyuce.mmocore.api.util.math.format.DelayFormat; import net.Indyuce.mmocore.api.util.math.format.DelayFormat;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class ListCommandTreeNode extends CommandTreeNode { public class ListCommandTreeNode extends CommandTreeNode {
public ListCommandTreeNode(CommandTreeNode parent) { public ListCommandTreeNode(CommandTreeNode parent) {

View File

@ -8,8 +8,8 @@ import org.bukkit.command.CommandSender;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.experience.Booster; import net.Indyuce.mmocore.experience.Booster;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class RemoveCommandTreeNode extends CommandTreeNode { public class RemoveCommandTreeNode extends CommandTreeNode {
public RemoveCommandTreeNode(CommandTreeNode parent) { public RemoveCommandTreeNode(CommandTreeNode parent) {

View File

@ -3,7 +3,7 @@ package net.Indyuce.mmocore.command.rpg.debug;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class DebugCommandTreeNode extends CommandTreeNode { public class DebugCommandTreeNode extends CommandTreeNode {
public static final String commandPrefix = ChatColor.YELLOW + "[" + ChatColor.RED + "DEBUG" + ChatColor.GOLD + "] " + ChatColor.RESET; public static final String commandPrefix = ChatColor.YELLOW + "[" + ChatColor.RED + "DEBUG" + ChatColor.GOLD + "] " + ChatColor.RESET;

View File

@ -2,8 +2,8 @@ package net.Indyuce.mmocore.command.rpg.debug;
import io.lumine.mythic.lib.api.stat.StatInstance; import io.lumine.mythic.lib.api.stat.StatInstance;
import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.player.stats.StatType;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View File

@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.player.stats.StatType;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class StatValueCommandTreeNode extends CommandTreeNode { public class StatValueCommandTreeNode extends CommandTreeNode {
public StatValueCommandTreeNode(CommandTreeNode parent) { public StatValueCommandTreeNode(CommandTreeNode parent) {

View File

@ -7,8 +7,8 @@ import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.api.quest.PlayerQuests;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class CancelCommandTreeNode extends CommandTreeNode { public class CancelCommandTreeNode extends CommandTreeNode {
public CancelCommandTreeNode(CommandTreeNode parent) { public CancelCommandTreeNode(CommandTreeNode parent) {

View File

@ -2,7 +2,7 @@ package net.Indyuce.mmocore.command.rpg.quest;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class QuestCommandTreeNode extends CommandTreeNode { public class QuestCommandTreeNode extends CommandTreeNode {

View File

@ -10,8 +10,8 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.Indyuce.mmocore.api.quest.PlayerQuests;
import net.Indyuce.mmocore.api.quest.Quest; import net.Indyuce.mmocore.api.quest.Quest;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class StartCommandTreeNode extends CommandTreeNode { public class StartCommandTreeNode extends CommandTreeNode {
public StartCommandTreeNode(CommandTreeNode parent) { public StartCommandTreeNode(CommandTreeNode parent) {

View File

@ -6,8 +6,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.manager.InventoryManager;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class OpenCommandTreeNode extends CommandTreeNode { public class OpenCommandTreeNode extends CommandTreeNode {
public OpenCommandTreeNode(CommandTreeNode parent) { public OpenCommandTreeNode(CommandTreeNode parent) {

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.command.rpg.waypoint; package net.Indyuce.mmocore.command.rpg.waypoint;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.Waypoint; import net.Indyuce.mmocore.api.Waypoint;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;

View File

@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.Waypoint; import net.Indyuce.mmocore.api.Waypoint;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter; import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class UnlockCommandTreeNode extends CommandTreeNode { public class UnlockCommandTreeNode extends CommandTreeNode {
public UnlockCommandTreeNode(CommandTreeNode parent) { public UnlockCommandTreeNode(CommandTreeNode parent) {

View File

@ -2,7 +2,7 @@ package net.Indyuce.mmocore.command.rpg.waypoint;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode; import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class WaypointsCommandTreeNode extends CommandTreeNode { public class WaypointsCommandTreeNode extends CommandTreeNode {
public WaypointsCommandTreeNode(CommandTreeNode parent) { public WaypointsCommandTreeNode(CommandTreeNode parent) {

View File

@ -67,10 +67,7 @@ public class PlayerListener implements Listener {
@EventHandler @EventHandler
public void e(PlayerQuitEvent event) { public void e(PlayerQuitEvent event) {
PlayerData playerData = PlayerData.get(event.getPlayer()); PlayerData playerData = PlayerData.get(event.getPlayer());
if (playerData.hasParty()) MMOCore.plugin.dataProvider.getDataManager().unregisterSafe(playerData);
playerData.getParty().removeMember(playerData);
MMOCore.plugin.dataProvider.getDataManager().remove(playerData);
} }
/** /**

View File

@ -1,6 +1,6 @@
package net.Indyuce.mmocore.manager.data; package net.Indyuce.mmocore.manager.data;
import io.lumine.mythic.lib.player.MMOPlayerData; import io.lumine.mythic.lib.api.player.MMOPlayerData;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.event.AsyncPlayerDataLoadEvent; import net.Indyuce.mmocore.api.event.AsyncPlayerDataLoadEvent;
import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent; import net.Indyuce.mmocore.api.event.PlayerDataLoadEvent;
@ -34,8 +34,19 @@ public abstract class PlayerDataManager {
return Objects.requireNonNull(data.get(uuid), "Player data is not loaded"); return Objects.requireNonNull(data.get(uuid), "Player data is not loaded");
} }
public void remove(UUID uuid) { /**
data.remove(uuid); * 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) {
if (playerData.isFullyLoaded())
saveData(playerData);
playerData.close();
this.data.remove(playerData.getUniqueId());
} }
/** /**
@ -114,8 +125,6 @@ public abstract class PlayerDataManager {
*/ */
public abstract void saveData(PlayerData data); public abstract void saveData(PlayerData data);
public abstract void remove(PlayerData data);
public static class DefaultPlayerData { public static class DefaultPlayerData {
private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints; private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints;

View File

@ -235,10 +235,4 @@ public class MySQLPlayerDataManager extends PlayerDataManager {
return lastLogin; return lastLogin;
} }
} }
@Override
public void remove(PlayerData data) {
if (data.isFullyLoaded()) saveData(data);
remove(data.getUniqueId());
}
} }

View File

@ -127,7 +127,4 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
public OfflinePlayerData getOffline(UUID uuid) { public OfflinePlayerData getOffline(UUID uuid) {
return isLoaded(uuid) ? get(uuid) : new YAMLOfflinePlayerData(uuid); return isLoaded(uuid) ? get(uuid) : new YAMLOfflinePlayerData(uuid);
} }
@Override
public void remove(PlayerData data) {}
} }

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.skill; package net.Indyuce.mmocore.skill;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.player.EquipmentSlot; import io.lumine.mythic.lib.api.player.EquipmentSlot;
import io.lumine.mythic.lib.api.stat.StatMap; import io.lumine.mythic.lib.api.stat.StatMap;
import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.damage.AttackMetadata;
import io.lumine.mythic.lib.damage.DamageMetadata; import io.lumine.mythic.lib.damage.DamageMetadata;

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.skill.list; package net.Indyuce.mmocore.skill.list;
import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.player.EquipmentSlot; import io.lumine.mythic.lib.api.player.EquipmentSlot;
import io.lumine.mythic.lib.api.stat.StatMap; import io.lumine.mythic.lib.api.stat.StatMap;
import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.damage.DamageType;
import io.lumine.mythic.lib.version.VersionMaterial; import io.lumine.mythic.lib.version.VersionMaterial;