mirror of
https://github.com/nkomarn/harbor.git
synced 2024-12-20 07:17:39 +01:00
Config class work
This commit is contained in:
parent
429b960ec1
commit
255d6b343f
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018 TechToolbox
|
Copyright (c) 2018 Mykyta
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -71,3 +71,4 @@ messages:
|
|||||||
|
|
||||||
# Version identifier (do not change)
|
# Version identifier (do not change)
|
||||||
version: 1.5
|
version: 1.5
|
||||||
|
debug: true
|
||||||
|
@ -1,5 +1,25 @@
|
|||||||
package mykyta.Harbor;
|
package mykyta.Harbor;
|
||||||
|
|
||||||
public class Config {
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,9 +17,12 @@ public class Harbor extends JavaPlugin {
|
|||||||
|
|
||||||
// Check for updates
|
// Check for updates
|
||||||
if (this.getConfig().getBoolean("features.notifier")) {
|
if (this.getConfig().getBoolean("features.notifier")) {
|
||||||
System.out.println("Checking for updates.");
|
log.info("Checking for updates.");
|
||||||
updater.check();
|
updater.check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable debugging if set in config
|
||||||
|
if (this.getConfig().getBoolean("debug")) Util.debug = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
@ -10,6 +10,7 @@ import mykyta.Harbor.Actionbar.Actionbar;
|
|||||||
public class Util implements Actionbar {
|
public class Util implements Actionbar {
|
||||||
public static HashMap<World, Integer> sleeping = new HashMap<World, Integer>();
|
public static HashMap<World, Integer> sleeping = new HashMap<World, Integer>();
|
||||||
public String version = "1.5";
|
public String version = "1.5";
|
||||||
|
public static boolean debug = false;
|
||||||
private Actionbar actionbar;
|
private Actionbar actionbar;
|
||||||
|
|
||||||
Harbor harbor;
|
Harbor harbor;
|
||||||
|
Loading…
Reference in New Issue
Block a user