API Updates

This commit is contained in:
Badbird5907
2024-03-15 16:41:41 -04:00
parent 58c6f4980a
commit d3814d01d1
2 changed files with 17 additions and 6 deletions

View File

@@ -21,6 +21,8 @@ public interface BotManager {
List<String> fetchNames();
Terminator createBot(Location loc, String name, String skin, String signature);
void createBots(CommandSender sender, String name, String skinName, int n, Location location);
void createBots(CommandSender sender, String name, String skinName, int n, NeuralNetwork network, Location location);

View File

@@ -88,6 +88,11 @@ public class BotManagerImpl implements BotManager, Listener {
}).collect(Collectors.toList());
}
@Override
public Terminator createBot(Location loc, String name, String skin, String sig) {
return Bot.createBot(loc, name, new String[]{skin, sig});
}
@Override
public Agent getAgent() {
return agent;
@@ -104,10 +109,12 @@ public class BotManagerImpl implements BotManager, Listener {
if (n < 1) n = 1;
sender.sendMessage("Creating " + (n == 1 ? "new bot" : ChatColor.RED + numberFormat.format(n) + ChatColor.RESET + " new bots")
+ " with name " + ChatColor.GREEN + name.replace("%", ChatColor.LIGHT_PURPLE + "%" + ChatColor.RESET)
+ (skinName == null ? "" : ChatColor.RESET + " and skin " + ChatColor.GREEN + skinName)
+ ChatColor.RESET + "...");
if (sender != null) {
sender.sendMessage("Creating " + (n == 1 ? "new bot" : ChatColor.RED + numberFormat.format(n) + ChatColor.RESET + " new bots")
+ " with name " + ChatColor.GREEN + name.replace("%", ChatColor.LIGHT_PURPLE + "%" + ChatColor.RESET)
+ (skinName == null ? "" : ChatColor.RESET + " and skin " + ChatColor.GREEN + skinName)
+ ChatColor.RESET + "...");
}
skinName = skinName == null ? name : skinName;
@@ -118,12 +125,14 @@ public class BotManagerImpl implements BotManager, Listener {
createBots(player.getLocation(), name, MojangAPI.getSkin(skinName), n, network);
else {
Location l = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
sender.sendMessage(ChatColor.RED + "No location specified, defaulting to " + l + ".");
if (sender != null)
sender.sendMessage(ChatColor.RED + "No location specified, defaulting to " + l + ".");
createBots(l, name, MojangAPI.getSkin(skinName), n, network);
}
}
sender.sendMessage("Process completed (" + ChatColor.RED + ((System.currentTimeMillis() - timestamp) / 1000D) + "s" + ChatColor.RESET + ").");
if (sender != null)
sender.sendMessage("Process completed (" + ChatColor.RED + ((System.currentTimeMillis() - timestamp) / 1000D) + "s" + ChatColor.RESET + ").");
}
@Override