mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2025-01-03 19:38:18 +00:00
CD into the directory and run the script directly
This commit is contained in:
parent
6752e4aa5d
commit
33a34cfa56
1 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,8 @@ import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
|
@CommandPermissions(level = AdminLevel.SENIOR, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "For developers only - update TFM.", usage = "/<command>")
|
@CommandParameters(description = "For developers only - update TFM.", usage = "/<command>")
|
||||||
public class Command_updatetfm extends FreedomCommand {
|
public class Command_updatetfm extends FreedomCommand {
|
||||||
|
@ -16,8 +18,10 @@ public class Command_updatetfm extends FreedomCommand {
|
||||||
playerMsg("Updating TFM, please wait...", ChatColor.RED);
|
playerMsg("Updating TFM, please wait...", ChatColor.RED);
|
||||||
Utilities.adminAction(sender.getName(), "Updating TFM", true);
|
Utilities.adminAction(sender.getName(), "Updating TFM", true);
|
||||||
String path = MainConfig.getString(ConfigurationEntry.TFM_BUILD_SHELLSCRIPT);
|
String path = MainConfig.getString(ConfigurationEntry.TFM_BUILD_SHELLSCRIPT);
|
||||||
|
String directory = new File(path).getParent();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Process uptimeProc = Runtime.getRuntime().exec(String.format("bash -c \"./%s\"", path));
|
Process uptimeProc = Runtime.getRuntime().exec(String.format("bash -c \"cd %s; %s\"", directory, path));
|
||||||
uptimeProc.waitFor();
|
uptimeProc.waitFor();
|
||||||
playerMsg("Updated TFM! Reloading...");
|
playerMsg("Updated TFM! Reloading...");
|
||||||
Utilities.adminAction(sender.getName(), "Update successful, reloading TFM...", false);
|
Utilities.adminAction(sender.getName(), "Update successful, reloading TFM...", false);
|
||||||
|
|
Loading…
Reference in a new issue