Compare commits
No commits in common. "main" and "0.2" have entirely different histories.
17
README.md
17
README.md
@ -1,18 +1,3 @@
|
|||||||
# Exec
|
# Exec
|
||||||
|
|
||||||
Exec is a Minecraft server plugin that makes possible to run external scripts via commands. The scripts can be written with Bash or Python for example and the code changes don't need a server restart.
|
Makes possible to run external scripts via commands.
|
||||||
|
|
||||||
[PlaceholderAPI](https://www.spigotmc.org/resources/placeholderapi.6245/) is required. You might also want to use [mcrcon](https://github.com/Tiiffi/mcrcon) for script output.
|
|
||||||
|
|
||||||
## Config
|
|
||||||
commands:
|
|
||||||
examplecommand:
|
|
||||||
script: "/path/to/your/script %player_name% %args%"
|
|
||||||
permission: "exec.example"
|
|
||||||
|
|
||||||
The Exec config looks like this. You can use the following placeholders:
|
|
||||||
* %args% means all arguments provided to the command.
|
|
||||||
* %arg_1%, %arg_2% can be used to read arguments too.
|
|
||||||
* PlaceholderAPI is supported (and usually required). %player_name% is the most useful one.
|
|
||||||
|
|
||||||
You can use `/exec reload` to reload the config.
|
|
@ -1,6 +1,6 @@
|
|||||||
name: Exec
|
name: Exec
|
||||||
description: Makes possible to run external scripts via commands.
|
description: Makes possible to run external scripts via commands.
|
||||||
version: 0.2.1
|
version: 0.2
|
||||||
author: Ardakaz
|
author: Ardakaz
|
||||||
main: net.ardakaz.exec.Exec
|
main: net.ardakaz.exec.Exec
|
||||||
api-version: 1.21
|
api-version: 1.21
|
||||||
|
@ -67,16 +67,16 @@ public class Exec extends JavaPlugin {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Placeholders to script
|
||||||
|
String cmdToRun = PlaceholderAPI.setPlaceholders(player, script);
|
||||||
|
|
||||||
// Args to script
|
// Args to script
|
||||||
String cmdToRun = script.replace("%args%", execArgs);
|
cmdToRun = cmdToRun.replace("%args%", execArgs);
|
||||||
|
|
||||||
for(int i = 0; i < args.length; ++i) {
|
for(int i = 0; i < args.length; ++i) {
|
||||||
cmdToRun = cmdToRun.replace("%arg_" + (i + 1) + "%", args[i]);
|
cmdToRun = cmdToRun.replace("%arg_" + (i + 1) + "%", args[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Placeholders to script
|
|
||||||
cmdToRun = PlaceholderAPI.setPlaceholders(player, cmdToRun);
|
|
||||||
|
|
||||||
// Execution
|
// Execution
|
||||||
getLogger().info("Executing " + cmdToRun);
|
getLogger().info("Executing " + cmdToRun);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user