Include config option to disable GPS, fixes #617

This commit is contained in:
BuildTools 2019-01-06 13:29:06 -05:00
parent 6eb9cfa7bd
commit 2f325a1e1e
2 changed files with 11 additions and 4 deletions

View File

@ -153,6 +153,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public boolean translateItems = false; public boolean translateItems = false;
public boolean translateSubCommands = false; public boolean translateSubCommands = false;
public boolean useCompass = true; public boolean useCompass = true;
public boolean useGPS = true;
// Interfaces // Interfaces
public HashMap<String, Integer> commands = new HashMap<String, Integer>(); public HashMap<String, Integer> commands = new HashMap<String, Integer>();
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>(); public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
@ -194,6 +195,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
partiesListener = new PartiesListener(); partiesListener = new PartiesListener();
questFactory = new QuestFactory(this); questFactory = new QuestFactory(this);
eventFactory = new EventFactory(this); eventFactory = new EventFactory(this);
//Load main config before plugins because GPS is optional
loadConfig();
// Link with soft-depends
linkOtherPlugins(); linkOtherPlugins();
// Save resources // Save resources
@ -201,8 +207,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
saveResourceAs("events.yml", "events.yml", false); saveResourceAs("events.yml", "events.yml", false);
saveResourceAs("data.yml", "data.yml", false); saveResourceAs("data.yml", "data.yml", false);
// Load stuff // Load other configs and modules
loadConfig();
loadModules(); loadModules();
try { try {
setupLang(); setupLang();
@ -442,7 +447,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (isPluginReady("mcMMO")) { if (isPluginReady("mcMMO")) {
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO"); mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
} }
if (isPluginReady("GPS")) { if (useGPS && isPluginReady("GPS")) {
gpsapi = new GPSAPI(this); gpsapi = new GPSAPI(this);
} }
if (isPluginReady("Heroes")) { if (isPluginReady("Heroes")) {
@ -564,6 +569,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
translateItems = config.getBoolean("translate-items", false); translateItems = config.getBoolean("translate-items", false);
translateSubCommands = config.getBoolean("translate-subcommands", false); translateSubCommands = config.getBoolean("translate-subcommands", false);
useCompass = config.getBoolean("use-compass", true); useCompass = config.getBoolean("use-compass", true);
useGPS = config.getBoolean("use-gps-plugin", true);
try { try {
config.save(new File(this.getDataFolder(), "config.yml")); config.save(new File(this.getDataFolder(), "config.yml"));
} catch (IOException e) { } catch (IOException e) {

View File

@ -17,4 +17,5 @@ show-requirements: true
show-titles: true show-titles: true
translate-items: false translate-items: false
translate-subcommands: false translate-subcommands: false
use-compass: true use-compass: true
use-gps-plugin: true