Minor logging improvements
This commit is contained in:
parent
f53e0b1e9f
commit
93ab4a304b
5 changed files with 16 additions and 11 deletions
|
|
@ -266,15 +266,15 @@ public class EggDestroyListener implements Listener {
|
|||
* Alerts when the egg is destroyed and respawns it if needed
|
||||
*/
|
||||
private void eggDestroyed() {
|
||||
announce("The dragon egg has been destroyed!");
|
||||
data.resetEggOwner(false, config);
|
||||
|
||||
if (config.getRespawnEgg()) {
|
||||
if (config.getRespawnImmediately()) {
|
||||
announce("The dragon egg has been destroyed!");
|
||||
respawnEgg();
|
||||
} else {
|
||||
data.resetEggLocation();
|
||||
announce("It will respawn the next time the dragon is defeated");
|
||||
announce("The dragon egg has been destroyed! It will respawn the next time the Ender Dragon is defeated.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ public class Data {
|
|||
|
||||
if (storageString == null) {
|
||||
logger.warning("Could not correctly load egg location data! Was this plugin's data folder deleted?\n" +
|
||||
"If this is the first time this plugin has run, it is safe to ignore this error.");
|
||||
"If this is the first time this plugin has run, it is safe to ignore this warning.");
|
||||
storedAs = Egg_Storage_Type.DNE;
|
||||
saveData();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -40,4 +40,8 @@ public class LogHandler {
|
|||
public void warning(String msg) {
|
||||
log(msg, Level.WARNING);
|
||||
}
|
||||
|
||||
public void severe(String msg) {
|
||||
log(msg, Level.SEVERE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import io.github.J0hnL0cke.egghunt.Model.LogHandler;
|
||||
|
||||
public class DataFileDAO {
|
||||
|
||||
public static final String DATA_FILE = "data.yml";
|
||||
|
|
@ -22,17 +24,16 @@ public class DataFileDAO {
|
|||
private static DataFileDAO thisDao;
|
||||
private FileConfiguration fileConfig;
|
||||
private File file;
|
||||
private LogHandler logger;
|
||||
|
||||
JavaPlugin plugin;
|
||||
|
||||
private DataFileDAO(JavaPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
private DataFileDAO(JavaPlugin plugin, LogHandler logger) {
|
||||
this.logger = logger;
|
||||
loadData(plugin, DATA_FILE);
|
||||
}
|
||||
|
||||
public static DataFileDAO getDataDAO(JavaPlugin plugin){
|
||||
public static DataFileDAO getDataDAO(JavaPlugin plugin, LogHandler logger){
|
||||
if(thisDao == null){
|
||||
thisDao = new DataFileDAO(plugin);
|
||||
thisDao = new DataFileDAO(plugin, logger);
|
||||
}
|
||||
return thisDao;
|
||||
}
|
||||
|
|
@ -58,7 +59,7 @@ public class DataFileDAO {
|
|||
try {
|
||||
fileConfig.save(file);
|
||||
} catch (IOException e) {
|
||||
Bukkit.getServer().getLogger().severe(String.format("Could not save data file!"));
|
||||
logger.severe(String.format("Could not save data file!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public final class egghunt extends JavaPlugin {
|
|||
logger.log("Scheduling task...");
|
||||
belowWorldTask = scheduler.runTaskTimer(this, 20, 20);
|
||||
|
||||
logger.info("Done!");
|
||||
logger.info("EggHunt enabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue