1
0
mirror of https://github.com/nkomarn/harbor.git synced 2024-11-16 07:05:22 +01:00

Config class work

This commit is contained in:
BuildTools 2019-03-05 07:27:22 -08:00
parent 429b960ec1
commit 255d6b343f
5 changed files with 28 additions and 3 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 TechToolbox
Copyright (c) 2018 Mykyta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -71,3 +71,4 @@ messages:
# Version identifier (do not change)
version: 1.5
debug: true

View File

@ -1,5 +1,25 @@
package mykyta.Harbor;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
public class Config {
private Logger log = Bukkit.getLogger();
private String error = "An error occured while trying to read the configuration. The plugin may not function correctly as a result.";
/**
* Gets a boolean from the configuration
* @param location Config location of the boolean
*/
public boolean getBool(String location) {
try {
}
catch (Exception e) {
log.severe(error);
if (Util.debug) System.err.println(e);
return false;
}
}
}

View File

@ -17,9 +17,12 @@ public class Harbor extends JavaPlugin {
// Check for updates
if (this.getConfig().getBoolean("features.notifier")) {
System.out.println("Checking for updates.");
log.info("Checking for updates.");
updater.check();
}
// Enable debugging if set in config
if (this.getConfig().getBoolean("debug")) Util.debug = true;
}
public void onDisable() {

View File

@ -10,6 +10,7 @@ import mykyta.Harbor.Actionbar.Actionbar;
public class Util implements Actionbar {
public static HashMap<World, Integer> sleeping = new HashMap<World, Integer>();
public String version = "1.5";
public static boolean debug = false;
private Actionbar actionbar;
Harbor harbor;