Reword command & add aliases

This commit is contained in:
business-goose 2022-03-21 21:28:45 +00:00
parent f0eb0f5d28
commit a07d2317e4

View file

@ -13,12 +13,12 @@ import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
@CommandParameters(description = "For developers only - update TFM.", usage = "/<command>") @CommandParameters(description = "For developers only - update TFM.", usage = "/<command>", aliases = ("tfmupdate,update,compiletfm,tfmcompile,build,buildtfm,tfmbuild"))
public class Command_updatetfm extends FreedomCommand { public class Command_updatetfm extends FreedomCommand {
@Override @Override
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
playerMsg("Updating TFM, please wait...", ChatColor.RED); playerMsg("Compiling TFM, please wait...", ChatColor.RED);
Utilities.adminAction(sender.getName(), "Updating TFM", true); Utilities.adminAction(sender.getName(), "Compiling TFM", true);
String path = MainConfig.getString(ConfigurationEntry.TFM_BUILD_SHELLSCRIPT); String path = MainConfig.getString(ConfigurationEntry.TFM_BUILD_SHELLSCRIPT);
File file = new File(path); File file = new File(path);
String directory = file.getParent(); String directory = file.getParent();
@ -28,8 +28,8 @@ public class Command_updatetfm extends FreedomCommand {
ProcessBuilder proc = new ProcessBuilder("/bin/bash", "-c", command); ProcessBuilder proc = new ProcessBuilder("/bin/bash", "-c", command);
Process process = proc.start(); Process process = proc.start();
process.waitFor(); process.waitFor();
playerMsg("Updated TFM! Reloading..."); playerMsg("Compiling TFM! Reloading...");
Utilities.adminAction(sender.getName(), "Update successful, reloading TFM...", false); Utilities.adminAction(sender.getName(), "Compilation successful, reloading TFM...", false);
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
onlinePlayer.kickPlayer(ChatColor.RED + "Reloading TFM, please rejoin."); onlinePlayer.kickPlayer(ChatColor.RED + "Reloading TFM, please rejoin.");
} }