Skip to content

Commit

Permalink
Add experimental reload subcommand
Browse files Browse the repository at this point in the history
Took 11 minutes
  • Loading branch information
Darkyenus committed Apr 4, 2020
1 parent 74bed60 commit a52b857
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/main/java/com/darkyen/minecraft/DeadSouls.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/darkyen/minecraft/SoulDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a52b857

Please sign in to comment.