mirror of
https://github.com/kaboomserver/icontrolu.git
synced 2024-11-28 10:25:33 -05:00
Select targets via UUID (#1)
Adds the ability to control players via UUID instead of just their username
This commit is contained in:
parent
ca385ad7c3
commit
fa9104e9af
1 changed files with 6 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
package pw.kaboom.icontrolu.commands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -21,8 +23,10 @@ public final class CommandIcu implements CommandExecutor {
|
|||
if (args.length == 1) {
|
||||
controller.sendMessage(ChatColor.RED + "Usage: /" + label + " control <player>");
|
||||
} else {
|
||||
final Player target = Bukkit.getPlayer(args[1]);
|
||||
|
||||
Player target = Bukkit.getPlayer(args[1]);
|
||||
if (target == null && args[1].matches("([a-f0-9]{8}(-[a-f0-9]{4}){4}[a-f0-9]{8})")) {
|
||||
target = Bukkit.getPlayer(UUID.fromString(args[1]));
|
||||
}
|
||||
if (target != null) {
|
||||
if (target == controller) {
|
||||
controller.sendMessage("You are already controlling yourself");
|
||||
|
|
Loading…
Reference in a new issue