mirror of
https://github.com/JonasunderscoreJones/ConsoleMC.git
synced 2025-10-23 02:39:17 +02:00
Code cleanup
moved threading to parent scope added issues link to mod config
This commit is contained in:
parent
8efeb1cc5b
commit
643f9497ea
3 changed files with 33 additions and 32 deletions
|
@ -76,7 +76,8 @@ public class RunCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static int runCommand(String cmd, CommandContext<ServerCommandSource> context) {
|
public static int runCommand(String cmd, CommandContext<ServerCommandSource> context) {
|
||||||
return ShellCommand.execute(cmd, context);
|
new Thread(() -> {ShellCommand.execute(cmd, context);}).start();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
public static void returnCommandOutput(String cmd, String commandFeedback, CommandContext<ServerCommandSource> context) {
|
public static void returnCommandOutput(String cmd, String commandFeedback, CommandContext<ServerCommandSource> context) {
|
||||||
String consoleLog = " [" + cmd + "]: " + commandFeedback;
|
String consoleLog = " [" + cmd + "]: " + commandFeedback;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.io.InputStreamReader;
|
||||||
|
|
||||||
public class ShellCommand {
|
public class ShellCommand {
|
||||||
public static int execute(String command, CommandContext<ServerCommandSource> context) {
|
public static int execute(String command, CommandContext<ServerCommandSource> context) {
|
||||||
new Thread(() -> {
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder();
|
ProcessBuilder processBuilder = new ProcessBuilder();
|
||||||
if (ConsoleMC.ISWINDOWS) {
|
if (ConsoleMC.ISWINDOWS) {
|
||||||
processBuilder.command("cmd.exe", "/c", command);
|
processBuilder.command("cmd.exe", "/c", command);
|
||||||
|
@ -43,7 +43,6 @@ public class ShellCommand {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}).start();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "http://jonasjones.me/consolemc",
|
"homepage": "http://jonasjones.me/consolemc",
|
||||||
"sources": "https://github.com/J-onasJones/ConsoleMC"
|
"sources": "https://github.com/J-onasJones/ConsoleMC",
|
||||||
|
"issues": "https://github.com/J-onasJones/ConsoleMC/issues"
|
||||||
},
|
},
|
||||||
|
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue