diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-06-05 22:01:03 +0100 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-06-05 22:01:03 +0100 |
| commit | bf1a2b93a512ca7aa8208191d9db49be731ec280 (patch) | |
| tree | 85b26fc054321145dd9a7f56821e33ef6ae16386 /src/main/java | |
| parent | 159109f5c28e8611171ce0d492393ccd3382231e (diff) | |
Remove clean option since it is stupid
Diffstat (limited to 'src/main/java')
6 files changed, 8 insertions, 16 deletions
diff --git a/src/main/java/com/leonardobishop/quests/Quests.java b/src/main/java/com/leonardobishop/quests/Quests.java index 21cd8a6e..bfbc0e60 100644 --- a/src/main/java/com/leonardobishop/quests/Quests.java +++ b/src/main/java/com/leonardobishop/quests/Quests.java @@ -248,12 +248,6 @@ public class Quests extends JavaPlugin { taskTypeManager.closeRegistrations(); reloadQuests(); -// if (!questsConfigLoader.getBrokenFiles().isEmpty()) { -// this.getQuestsLogger().severe("Quests has failed to load the following files:"); -// for (Map.Entry<String, QuestsConfigLoader.ConfigLoadError> entry : questsConfigLoader.getBrokenFiles().entrySet()) { -// this.getQuestsLogger().severe(" - " + entry.getKey() + ": " + entry.getValue().getMessage()); -// } -// } for (Player player : Bukkit.getOnlinePlayers()) { qPlayerManager.loadPlayer(player.getUniqueId()); diff --git a/src/main/java/com/leonardobishop/quests/listener/PlayerJoinListener.java b/src/main/java/com/leonardobishop/quests/listener/PlayerJoinListener.java index fcee6b40..5cdb465e 100644 --- a/src/main/java/com/leonardobishop/quests/listener/PlayerJoinListener.java +++ b/src/main/java/com/leonardobishop/quests/listener/PlayerJoinListener.java @@ -30,13 +30,6 @@ public class PlayerJoinListener implements Listener { public void onEvent(PlayerJoinEvent event) { UUID playerUuid = event.getPlayer().getUniqueId(); plugin.getPlayerManager().loadPlayer(playerUuid); - if (Options.SOFT_CLEAN_QUESTSPROGRESSFILE_ON_JOIN.getBooleanValue()) { - QPlayer qPlayer = plugin.getPlayerManager().getPlayer(playerUuid); - qPlayer.getQuestProgressFile().clean(); - if (Options.PUSH_SOFT_CLEAN_TO_DISK.getBooleanValue()) { - plugin.getPlayerManager().savePlayer(playerUuid, qPlayer.getQuestProgressFile()); - } - } if (plugin.getDescription().getVersion().contains("beta") && event.getPlayer().hasPermission("quests.admin")) { event.getPlayer().sendMessage(Messages.BETA_REMINDER.getMessage()); } diff --git a/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java b/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java index ccdb1db1..3f6d9900 100644 --- a/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java +++ b/src/main/java/com/leonardobishop/quests/player/questprogressfile/QuestProgressFile.java @@ -4,6 +4,7 @@ import com.leonardobishop.quests.Quests; import com.leonardobishop.quests.player.QPlayer; import com.leonardobishop.quests.quest.Quest; import com.leonardobishop.quests.quest.Task; +import com.leonardobishop.quests.util.Options; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; @@ -40,6 +41,9 @@ public class QuestProgressFile { } public void addQuestProgress(QuestProgress questProgress) { + if (Options.VERIFY_QUEST_EXISTS_ON_LOAD.getBooleanValue(true) && plugin.getQuestManager().getQuestById(questProgress.getQuestId()) == null) { + return; + } this.questProgress.put(questProgress.getQuestId(), questProgress); } diff --git a/src/main/java/com/leonardobishop/quests/storage/MySqlStorageProvider.java b/src/main/java/com/leonardobishop/quests/storage/MySqlStorageProvider.java index bac0b5c9..c2b30734 100644 --- a/src/main/java/com/leonardobishop/quests/storage/MySqlStorageProvider.java +++ b/src/main/java/com/leonardobishop/quests/storage/MySqlStorageProvider.java @@ -4,6 +4,7 @@ import com.leonardobishop.quests.Quests; import com.leonardobishop.quests.player.questprogressfile.QuestProgress; import com.leonardobishop.quests.player.questprogressfile.QuestProgressFile; import com.leonardobishop.quests.player.questprogressfile.TaskProgress; +import com.leonardobishop.quests.util.Options; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.bukkit.configuration.ConfigurationSection; @@ -17,6 +18,7 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.UUID; diff --git a/src/main/java/com/leonardobishop/quests/storage/YamlStorageProvider.java b/src/main/java/com/leonardobishop/quests/storage/YamlStorageProvider.java index 4c803baa..8ba30a4e 100644 --- a/src/main/java/com/leonardobishop/quests/storage/YamlStorageProvider.java +++ b/src/main/java/com/leonardobishop/quests/storage/YamlStorageProvider.java @@ -108,8 +108,8 @@ public class YamlStorageProvider implements StorageProvider { } YamlConfiguration data = YamlConfiguration.loadConfiguration(file); - data.set("quest-progress", null); for (QuestProgress questProgress : questProgressValues) { + if (!questProgress.isModified()) continue; data.set("quest-progress." + questProgress.getQuestId() + ".started", questProgress.isStarted()); data.set("quest-progress." + questProgress.getQuestId() + ".completed", questProgress.isCompleted()); data.set("quest-progress." + questProgress.getQuestId() + ".completed-before", questProgress.isCompletedBefore()); diff --git a/src/main/java/com/leonardobishop/quests/util/Options.java b/src/main/java/com/leonardobishop/quests/util/Options.java index 34922f18..0ad0a41d 100644 --- a/src/main/java/com/leonardobishop/quests/util/Options.java +++ b/src/main/java/com/leonardobishop/quests/util/Options.java @@ -25,8 +25,7 @@ public enum Options { GUITITLE_QUEST_CANCEL("options.guinames.quest-cancel"), ALLOW_QUEST_CANCEL("options.allow-quest-cancel"), ALLOW_QUEST_TRACK("options.allow-quest-track"), - SOFT_CLEAN_QUESTSPROGRESSFILE_ON_JOIN("options.soft-clean-questsprogressfile-on-join"), - PUSH_SOFT_CLEAN_TO_DISK("options.tab-completion.push-soft-clean-to-disk"), + VERIFY_QUEST_EXISTS_ON_LOAD("options.verify-quest-exists-on-load"), TAB_COMPLETE_ENABLED("options.tab-completion.enabled"), ERROR_CHECKING_OVERRIDE("options.error-checking.override-errors"), QUEST_AUTOSTART("options.quest-autostart"), |
