Added %uuid% placeholder to commands

This commit is contained in:
cervinakuy committed 2022-10-07 20:27:34 -07:00
1 parent f93918d5be
commit 72e53e429c
1 file changed
+11 -10
@@ -97,7 +97,6 @@ public class Toolkit {
if (commands == null) return;
for (String commandString : commands) {
String[] commandPhrase = commandString.split(":", 2);
if (commandPhrase.length == 1) {
@@ -111,23 +110,25 @@ public class Toolkit {
String command = commandPhrase[1];
if (sender.equals("console")) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), addPlaceholdersIfPossible(p, command.replace("%player%", p.getName()).replace(replaceFrom, replaceTo)));
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
replaceCommandPlaceholders(command, p, replaceFrom, replaceTo));
} else if (sender.equals("player")) {
p.performCommand(addPlaceholdersIfPossible(p, command.replace("%player%", p.getName()).replace(replaceFrom, replaceTo)));
p.performCommand(replaceCommandPlaceholders(command, p, replaceFrom, replaceTo));
} else {
Toolkit.printToConsole("&7[&b&lKIT-PVP&7] &cIncorrect command format. Please see: &fhttps://bit.ly/kp-command-format");
return;
}
}
}
private static String replaceCommandPlaceholders(String s, Player p, String replaceFrom, String replaceTo) {
String withPotentialPapiPlaceholders = addPlaceholdersIfPossible(p, s);
return withPotentialPapiPlaceholders
.replace("%player%", p.getName())
.replace("%uuid%", p.getUniqueId().toString())
.replace(replaceFrom, replaceTo);
}
public static int versionToNumber() {