Initial commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package net.crankedpvp.chattitles.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter @AllArgsConstructor
|
||||
public class Title {
|
||||
private String id;
|
||||
private String fancyName;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package net.crankedpvp.chattitles.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.crankedpvp.storageutils.utils.KeyToSave;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter @AllArgsConstructor
|
||||
public class TitlePlayer implements KeyToSave {
|
||||
|
||||
private UUID playerUUID;
|
||||
private final List<String> titlesIDs;
|
||||
private Title currentTitle;
|
||||
|
||||
|
||||
public void setCurrentTitle(String title) {
|
||||
}
|
||||
|
||||
public void setCurrentTitle(Title title) {
|
||||
this.currentTitle = title;
|
||||
}
|
||||
|
||||
public void addTitle(String title) {
|
||||
this.titlesIDs.add(title);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return playerUUID.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKey(String s) {
|
||||
this.playerUUID = UUID.fromString(s);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.crankedpvp.chattitles.data;
|
||||
|
||||
import net.crankedpvp.chattitles.ChatTitlesPlugin;
|
||||
import net.crankedpvp.storageutils.StorageUtils;
|
||||
import net.crankedpvp.storageutils.utils.SaveLoadManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TitlePlayerManager extends SaveLoadManager<TitlePlayer> {
|
||||
public TitlePlayerManager(ChatTitlesPlugin plugin) {
|
||||
super(plugin, StorageUtils.getInstance().getGson(), "data/", TitlePlayer.class);
|
||||
}
|
||||
|
||||
public TitlePlayer getTitlePlayer(UUID uuid) {
|
||||
if (!containsKey(uuid.toString())) {
|
||||
TitlePlayer titlePlayer = new TitlePlayer(uuid, new ArrayList<>(), null);
|
||||
addToCache(titlePlayer);
|
||||
}
|
||||
return getFromCache(uuid.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user