Improves console logging
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
This commit is contained in:
@@ -142,7 +142,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
getLogger().log(Level.INFO, " v" + getDescription().getVersion() + " disabled.");
|
||||
log(" v" + getDescription().getVersion() + " disabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +178,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
//Register all listeners
|
||||
registerListeners();
|
||||
|
||||
getLogger().log(Level.INFO, " v" + getDescription().getVersion() + " enabled.");
|
||||
log(" v" + getDescription().getVersion() + " enabled.");
|
||||
|
||||
//Alert about an update in the console
|
||||
UpdateChecker.checkForUpdate(this, "https://api.spigotmc.org/legacy/update.php?resource=105938",
|
||||
@@ -193,7 +193,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
try {
|
||||
this.configuration.load(new File(getDataFolder(), CONFIG_FILE_NAME));
|
||||
} catch (IOException | InvalidConfigurationException exception) {
|
||||
getLogger().log(Level.SEVERE, "Unable to load the configuration! Message: " + exception.getMessage());
|
||||
error("Unable to load the configuration! Message: " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
try {
|
||||
this.configuration.save(new File(getDataFolder(), CONFIG_FILE_NAME));
|
||||
} catch (IOException exception) {
|
||||
getLogger().log(Level.SEVERE, "Unable to save the configuration! Message: " + exception.getMessage());
|
||||
error("Unable to save the configuration! Message: " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,42 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints an info message to the console
|
||||
*
|
||||
* @param message <p>The message to print</p>
|
||||
*/
|
||||
public static void log(@NotNull String message) {
|
||||
BlacksmithPlugin.getInstance().getLogger().log(Level.INFO, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a warning message to the console
|
||||
*
|
||||
* @param message <p>The message to print</p>
|
||||
*/
|
||||
public static void warn(@NotNull String message) {
|
||||
BlacksmithPlugin.getInstance().getLogger().log(Level.WARNING, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints an error message to the console
|
||||
*
|
||||
* @param message <p>The message to print</p>
|
||||
*/
|
||||
public static void error(@NotNull String message) {
|
||||
BlacksmithPlugin.getInstance().getLogger().log(Level.SEVERE, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a debug message to the console
|
||||
*
|
||||
* @param message <p>The message to print</p>
|
||||
*/
|
||||
public static void debug(@NotNull String message) {
|
||||
BlacksmithPlugin.getInstance().getLogger().log(Level.FINE, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes custom configuration and translation
|
||||
*
|
||||
@@ -253,10 +289,10 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
* @return <p>True if Vault setup/integration succeeded</p>
|
||||
*/
|
||||
private boolean setUpVault() {
|
||||
getLogger().log(Level.INFO, "Setting Up Vault now....");
|
||||
boolean canLoad = EconomyManager.setUp(getServer().getServicesManager(), getLogger());
|
||||
log("Setting Up Vault now....");
|
||||
boolean canLoad = EconomyManager.setUp(getServer().getServicesManager());
|
||||
if (!canLoad) {
|
||||
getLogger().log(Level.SEVERE, "Vault Integration Failed....");
|
||||
error("Vault Integration Failed....");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user