[UNTESTED] added playertarget setting
This commit is contained in:
@@ -267,7 +267,7 @@ public class BotCommand extends CommandInstance {
|
||||
|
||||
String extra = ChatColor.GRAY + " [" + ChatColor.YELLOW + "/bot settings" + ChatColor.GRAY + "]";
|
||||
|
||||
if (arg1 == null || ((!arg1.equals("setgoal")) && !arg1.equals("mobtarget"))) {
|
||||
if (arg1 == null || ((!arg1.equalsIgnoreCase("setgoal")) && !arg1.equalsIgnoreCase("mobtarget") && !arg1.equalsIgnoreCase("playertarget"))) {
|
||||
sender.sendMessage(ChatUtils.LINE);
|
||||
sender.sendMessage(ChatColor.GOLD + "Bot Settings" + extra);
|
||||
sender.sendMessage(ChatUtils.BULLET_FORMATTED + ChatColor.YELLOW + "setgoal" + ChatUtils.BULLET_FORMATTED + "Set the global bot target selection method.");
|
||||
@@ -292,8 +292,22 @@ public class BotCommand extends CommandInstance {
|
||||
} else if (arg1.equalsIgnoreCase("mobtarget")) {
|
||||
manager.setMobTarget(!manager.isMobTarget());
|
||||
sender.sendMessage("Mob targeting is now " + (manager.isMobTarget() ? ChatColor.GREEN + "enabled" : ChatColor.RED + "disabled") + ChatColor.RESET + ". (for all future bots)");
|
||||
} else if (arg1.equalsIgnoreCase("playertarget")) {
|
||||
if (args.size() < 2) {
|
||||
sender.sendMessage(ChatColor.RED + "You must specify a player name!");
|
||||
return;
|
||||
}
|
||||
String playerName = args.get(1);
|
||||
Player player = Bukkit.getPlayer(playerName);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find player " + ChatColor.YELLOW + playerName + ChatColor.RED + "!");
|
||||
return;
|
||||
}
|
||||
for (Terminator fetch : manager.fetch()) {
|
||||
fetch.setTargetPlayer(player.getUniqueId());
|
||||
}
|
||||
sender.sendMessage("All spawned bots are now set to target " + ChatColor.BLUE + player.getName() + ChatColor.RESET + ". They will target the closest player if they can't be found.\nYou may need to set the goal to PLAYER.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Autofill
|
||||
@@ -310,10 +324,15 @@ public class BotCommand extends CommandInstance {
|
||||
|
||||
if (args.length == 2) {
|
||||
output.add("setgoal");
|
||||
output.add("mobtarget");
|
||||
} else if (args.length == 3) {
|
||||
if (args[1].equalsIgnoreCase("setgoal")) {
|
||||
Arrays.stream(EnumTargetGoal.values()).forEach(goal -> output.add(goal.name().replace("_", "").toLowerCase()));
|
||||
}
|
||||
if (args[1].equalsIgnoreCase("mobtarget")) {
|
||||
output.add("true");
|
||||
output.add("false");
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
|
||||
Reference in New Issue
Block a user