diff options
| author | fatpigsarefat <fatpigsarefat@outlook.com> | 2018-07-21 21:25:00 +0100 |
|---|---|---|
| committer | fatpigsarefat <fatpigsarefat@outlook.com> | 2018-07-21 21:25:01 +0100 |
| commit | bcd4d141c04768c2ed3d00d4963e4f40424b5bc4 (patch) | |
| tree | b79a965aaa19bee8f859f1de5272feae2fbb0153 /src/me/fatpigsarefat/quests/player/QPlayer.java | |
| parent | 56aae6d737aa523f23160256b5022b8cce8fe9c5 (diff) | |
Now using Maven
- pom.xml was added
- Source files moved
- .gitignore adjusted to allow .xml
- All Title classes changed to use Bukkit method instead
Diffstat (limited to 'src/me/fatpigsarefat/quests/player/QPlayer.java')
| -rw-r--r-- | src/me/fatpigsarefat/quests/player/QPlayer.java | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/src/me/fatpigsarefat/quests/player/QPlayer.java b/src/me/fatpigsarefat/quests/player/QPlayer.java deleted file mode 100644 index e797d7bb..00000000 --- a/src/me/fatpigsarefat/quests/player/QPlayer.java +++ /dev/null @@ -1,123 +0,0 @@ -package me.fatpigsarefat.quests.player; - -import me.fatpigsarefat.quests.Quests; -import me.fatpigsarefat.quests.events.EventInventory; -import me.fatpigsarefat.quests.obj.Options; -import me.fatpigsarefat.quests.obj.misc.QMenu; -import me.fatpigsarefat.quests.obj.misc.QMenuCategory; -import me.fatpigsarefat.quests.obj.misc.QMenuQuest; -import me.fatpigsarefat.quests.player.questprogressfile.QuestProgressFile; -import me.fatpigsarefat.quests.quests.Category; -import me.fatpigsarefat.quests.quests.Quest; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -public class QPlayer { - - private UUID uuid; - private QuestProgressFile questProgressFile; - private boolean onlyDataLoaded; - - public QPlayer(UUID uuid, QuestProgressFile questProgressFile) { - this(uuid, questProgressFile, false); - } - - public QPlayer(UUID uuid, QuestProgressFile questProgressFile, boolean onlyDataLoaded) { - this.uuid = uuid; - this.questProgressFile = questProgressFile; - this.onlyDataLoaded = onlyDataLoaded; - } - - public UUID getUuid() { - return uuid; - } - - public void openCategory(Category category) { - if (onlyDataLoaded) { - return; - } - - Player player = Bukkit.getPlayer(uuid); - if (player == null) { - return; - } - - QMenuQuest qMenuQuest = new QMenuQuest(Quests.getPlayerManager().getPlayer(player.getUniqueId()), category.getId(), null); - List<Quest> quests = new ArrayList<>(); - for (String questid : category.getRegisteredQuestIds()) { - Quest quest = Quests.getQuestManager().getQuestById(questid); - if (quest != null) { - quests.add(quest); - } - } - qMenuQuest.populate(quests); - qMenuQuest.setBackButtonEnabled(false); - - player.openInventory(qMenuQuest.toInventory(1)); - EventInventory.track(player.getUniqueId(), qMenuQuest); - } - - public void openQuests() { - if (onlyDataLoaded) { - return; - } - - Player player = Bukkit.getPlayer(uuid); - if (player == null) { - return; - } - - if (Options.CATEGORIES_ENABLED.getBooleanValue()) { - QMenuCategory qMenuCategory = new QMenuCategory(Quests.getPlayerManager().getPlayer(player.getUniqueId())); - List<QMenuQuest> questMenus = new ArrayList<>(); - for (Category category : Quests.getQuestManager().getCategories()) { - QMenuQuest qMenuQuest = new QMenuQuest(Quests.getPlayerManager().getPlayer(player.getUniqueId()), category.getId(), qMenuCategory); - List<Quest> quests = new ArrayList<>(); - for (String questid : category.getRegisteredQuestIds()) { - Quest quest = Quests.getQuestManager().getQuestById(questid); - if (quest != null) { - quests.add(quest); - } - } - qMenuQuest.populate(quests); - questMenus.add(qMenuQuest); - } - qMenuCategory.populate(questMenus); - - player.openInventory(qMenuCategory.toInventory(1)); - EventInventory.track(player.getUniqueId(), qMenuCategory); - } else { - QMenuQuest qMenuQuest = new QMenuQuest(Quests.getPlayerManager().getPlayer(player.getUniqueId()), "", null); - List<Quest> quests = new ArrayList<>(); - for (Map.Entry<String, Quest> entry : Quests.getQuestManager().getQuests().entrySet()) { - quests.add(entry.getValue()); - } - qMenuQuest.populate(quests); - qMenuQuest.setBackButtonEnabled(false); - - player.openInventory(qMenuQuest.toInventory(1)); - EventInventory.track(player.getUniqueId(), qMenuQuest); - } - } - - public boolean isOnlyDataLoaded() { - return onlyDataLoaded; - } - - public void setOnlyDataLoaded(boolean onlyDataLoaded) { - this.onlyDataLoaded = onlyDataLoaded; - } - - public QuestProgressFile getQuestProgressFile() { - return questProgressFile; - } - - public QuestProgressFile setQuestProgressFile() { - return questProgressFile; - } -} |
