Set id to preset name if not specified (Fixes #32)

This commit is contained in:
Phoenix616 2019-07-27 15:28:28 +01:00
parent a49cc5fc8f
commit 6ee71ec50e

View File

@ -387,6 +387,9 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
*/ */
public RandomSearcher runPreset(CommandSender sender, String preset, Player target, Location center) { public RandomSearcher runPreset(CommandSender sender, String preset, Player target, Location center) {
String cmd = getConfig().getString("presets." + preset) + " -p " + target.getName(); String cmd = getConfig().getString("presets." + preset) + " -p " + target.getName();
if (!cmd.contains("-id")) {
cmd += " -id " + preset;
}
if (cmd.startsWith("/")) { if (cmd.startsWith("/")) {
cmd = cmd.substring(1); cmd = cmd.substring(1);
} }