This commit is contained in:
Indyuce 2020-07-05 23:05:03 +02:00
commit 0c7e978f9e
4 changed files with 18 additions and 1 deletions

View File

@ -70,6 +70,8 @@ public class PlayerListener implements Listener {
PlayerData playerData = PlayerData.get(event.getPlayer());
if (playerData.hasParty())
playerData.getParty().removeMember(playerData);
MMOCore.plugin.dataProvider.getDataManager().remove(playerData);
}
/*

View File

@ -25,6 +25,10 @@ public abstract class PlayerDataManager {
return map.getOrDefault(uuid, PlayerData.NOT_LOADED);
}
public void remove(UUID uuid) {
map.remove(uuid);
}
public abstract OfflinePlayerData getOffline(UUID uuid);
public void setup(Player player) {
@ -54,7 +58,7 @@ public abstract class PlayerDataManager {
public boolean isLoaded(UUID uuid) {
return map.containsKey(uuid);
}
public Collection<PlayerData> getLoaded() {
return map.values();
}
@ -62,4 +66,6 @@ public abstract class PlayerDataManager {
public abstract void loadData(PlayerData data);
public abstract void saveData(PlayerData data);
public abstract void remove(PlayerData data);
}

View File

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

View File

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