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

View File

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

View File

@ -1,6 +1,6 @@
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.CooldownMap;
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.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.api.util.math.particle.SmallParticleEffect;
import net.Indyuce.mmocore.comp.mythicmobs.MythicSkill;
import net.Indyuce.mmocore.experience.EXPSource;
import net.Indyuce.mmocore.experience.PlayerProfessions;
import net.Indyuce.mmocore.listener.SpellCast.SkillCasting;
@ -46,7 +46,7 @@ import java.util.*;
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
@ -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() {
return mmoData;
}
@ -571,6 +582,7 @@ public class PlayerData extends OfflinePlayerData {
return;
// Use updated amount from Bukkit event
setStamina(stamina + event.getAmount());
stamina = Math.max(0, Math.min(stamina + event.getAmount(), max));
}
@ -758,12 +770,6 @@ public class PlayerData extends OfflinePlayerData {
// Update stats
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) {
@ -849,7 +855,8 @@ public class PlayerData extends OfflinePlayerData {
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;
}
@ -865,7 +872,8 @@ public class PlayerData extends OfflinePlayerData {
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;
}
@ -888,11 +896,32 @@ public class PlayerData extends OfflinePlayerData {
}
/**
* This is being used to easily check if an online player corresponds to
* a real player or a Citizens NPC. Citizens NPCs do not have any player
* data associated to them
* 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
*
* @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) {
return MMOCore.plugin.dataProvider.getDataManager().isLoaded(uuid);

View File

@ -1,6 +1,6 @@
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.StatMap;
import io.lumine.mythic.lib.api.stat.modifier.ModifierSource;

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import org.bukkit.command.CommandSender;
import net.Indyuce.mmocore.MMOCore;
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 ReloadCommandTreeNode(CommandTreeNode parent) {

View File

@ -1,6 +1,6 @@
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.profess.resource.PlayerResource;
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.attribute.PlayerAttribute;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class AttributeCommandTreeNode extends CommandTreeNode {
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.SavedClassInformation;
import net.Indyuce.mmocore.command.CommandVerbose;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ClassCommandTreeNode extends CommandTreeNode {
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.command.CommandVerbose;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ExperienceCommandTreeNode extends CommandTreeNode {
public ExperienceCommandTreeNode(CommandTreeNode parent) {

View File

@ -9,8 +9,8 @@ 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.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ForceClassCommandTreeNode extends CommandTreeNode {
public ForceClassCommandTreeNode(CommandTreeNode parent) {

View File

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

View File

@ -8,8 +8,8 @@ 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.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class InfoCommandTreeNode extends CommandTreeNode {
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.api.player.PlayerData;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class LevelCommandTreeNode extends CommandTreeNode {
public LevelCommandTreeNode(CommandTreeNode parent) {

View File

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

View File

@ -10,8 +10,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.player.PlayerData;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class PointsCommandTreeNode extends CommandTreeNode {
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.attribute.PlayerAttributes.AttributeInstance;
import net.Indyuce.mmocore.command.CommandVerbose;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class ResetCommandTreeNode extends CommandTreeNode {
public ResetCommandTreeNode(CommandTreeNode parent) {

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.command.rpg.admin;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
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 io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
public class BoosterCommandTreeNode extends CommandTreeNode {
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.Profession;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class CreateCommandTreeNode extends CommandTreeNode {
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.api.util.math.format.DelayFormat;
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 ListCommandTreeNode(CommandTreeNode parent) {

View File

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

View File

@ -3,7 +3,7 @@ package net.Indyuce.mmocore.command.rpg.debug;
import org.bukkit.ChatColor;
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 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.modifier.StatModifier;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.stats.StatType;
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.stats.StatType;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class StatValueCommandTreeNode extends CommandTreeNode {
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.quest.PlayerQuests;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class CancelCommandTreeNode extends CommandTreeNode {
public CancelCommandTreeNode(CommandTreeNode parent) {

View File

@ -2,7 +2,7 @@ package net.Indyuce.mmocore.command.rpg.quest;
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 {

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.Quest;
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
import io.lumine.mythic.lib.mmolibcommands.api.CommandTreeNode;
import io.lumine.mythic.lib.mmolibcommands.api.Parameter;
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
public class StartCommandTreeNode extends CommandTreeNode {
public StartCommandTreeNode(CommandTreeNode parent) {

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ package net.Indyuce.mmocore.command.rpg.waypoint;
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 WaypointsCommandTreeNode(CommandTreeNode parent) {

View File

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

View File

@ -1,6 +1,6 @@
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.api.event.AsyncPlayerDataLoadEvent;
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");
}
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 remove(PlayerData data);
public static class DefaultPlayerData {
private final int level, classPoints, skillPoints, attributePoints, attrReallocPoints;

View File

@ -235,10 +235,4 @@ public class MySQLPlayerDataManager extends PlayerDataManager {
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) {
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;
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.damage.AttackMetadata;
import io.lumine.mythic.lib.damage.DamageMetadata;

View File

@ -1,7 +1,7 @@
package net.Indyuce.mmocore.skill.list;
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.damage.DamageType;
import io.lumine.mythic.lib.version.VersionMaterial;