From a52b857ccc1c0e4f918bc3972248a52f02f3b4e9 Mon Sep 17 00:00:00 2001 From: Darkyenus Date: Sat, 4 Apr 2020 16:59:27 +0200 Subject: [PATCH] Add experimental reload subcommand Took 11 minutes --- .../java/com/darkyen/minecraft/DeadSouls.java | 15 +++++++++++++++ .../java/com/darkyen/minecraft/SoulDatabase.java | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/darkyen/minecraft/DeadSouls.java b/src/main/java/com/darkyen/minecraft/DeadSouls.java index 6a85c27..02e8a65 100644 --- a/src/main/java/com/darkyen/minecraft/DeadSouls.java +++ b/src/main/java/com/darkyen/minecraft/DeadSouls.java @@ -562,6 +562,21 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command return true; } + if ("reload".equalsIgnoreCase(word) && sender.isOp()) { + sender.sendMessage(org.bukkit.ChatColor.RED+"----------------------------"); + sender.sendMessage(org.bukkit.ChatColor.RED+"Reloading plugin Dead Souls"); + sender.sendMessage(org.bukkit.ChatColor.RED+"RELOAD FUNCTIONALITY IS ONLY FOR TESTING AND EXPERIMENTING AND SHOULD NEVER BE USED ON A LIVE SERVER!!!"); + sender.sendMessage(org.bukkit.ChatColor.RED+"If you encounter any problems with the plugin after the reload, restart the server!"); + sender.sendMessage(org.bukkit.ChatColor.RED+"----------------------------"); + + final Server server = getServer(); + server.getPluginManager().disablePlugin(this); + server.getPluginManager().enablePlugin(this); + + sender.sendMessage(org.bukkit.ChatColor.RED+" - Reload done - "); + return true; + } + boolean listOwnSouls = sender.hasPermission("com.darkyen.minecraft.deadsouls.souls"); boolean listAllSouls = sender.hasPermission("com.darkyen.minecraft.deadsouls.souls.all"); diff --git a/src/main/java/com/darkyen/minecraft/SoulDatabase.java b/src/main/java/com/darkyen/minecraft/SoulDatabase.java index 8d4a5cd..f0f9644 100644 --- a/src/main/java/com/darkyen/minecraft/SoulDatabase.java +++ b/src/main/java/com/darkyen/minecraft/SoulDatabase.java @@ -193,7 +193,6 @@ public boolean save() throws IOException { if (failedWrites > 0) { LOG.log(Level.WARNING, failedWrites + " soul(s) failed to save"); } - LOG.log(Level.INFO, "Saved"); return true; } LOG.log(Level.SEVERE, "Failed to save souls", exception);