From 2f325a1e1eab86b879f4be4a7f446bf21628d1ca Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 6 Jan 2019 13:29:06 -0500 Subject: [PATCH] Include config option to disable GPS, fixes #617 --- src/main/java/me/blackvein/quests/Quests.java | 12 +++++++++--- src/main/resources/config.yml | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index d7520d837..95fc60f98 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -153,6 +153,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener public boolean translateItems = false; public boolean translateSubCommands = false; public boolean useCompass = true; + public boolean useGPS = true; // Interfaces public HashMap commands = new HashMap(); public HashMap adminCommands = new HashMap(); @@ -194,6 +195,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener partiesListener = new PartiesListener(); questFactory = new QuestFactory(this); eventFactory = new EventFactory(this); + + //Load main config before plugins because GPS is optional + loadConfig(); + + // Link with soft-depends linkOtherPlugins(); // Save resources @@ -201,8 +207,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener saveResourceAs("events.yml", "events.yml", false); saveResourceAs("data.yml", "data.yml", false); - // Load stuff - loadConfig(); + // Load other configs and modules loadModules(); try { setupLang(); @@ -442,7 +447,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener if (isPluginReady("mcMMO")) { mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO"); } - if (isPluginReady("GPS")) { + if (useGPS && isPluginReady("GPS")) { gpsapi = new GPSAPI(this); } if (isPluginReady("Heroes")) { @@ -564,6 +569,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener translateItems = config.getBoolean("translate-items", false); translateSubCommands = config.getBoolean("translate-subcommands", false); useCompass = config.getBoolean("use-compass", true); + useGPS = config.getBoolean("use-gps-plugin", true); try { config.save(new File(this.getDataFolder(), "config.yml")); } catch (IOException e) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c8655c12d..74ea0fb06 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -17,4 +17,5 @@ show-requirements: true show-titles: true translate-items: false translate-subcommands: false -use-compass: true \ No newline at end of file +use-compass: true +use-gps-plugin: true \ No newline at end of file