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(); 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, Location location);
void createBots(CommandSender sender, String name, String skinName, int n, NeuralNetwork network, 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()); }).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 @Override
public Agent getAgent() { public Agent getAgent() {
return agent; return agent;
@@ -104,10 +109,12 @@ public class BotManagerImpl implements BotManager, Listener {
if (n < 1) n = 1; if (n < 1) n = 1;
if (sender != null) {
sender.sendMessage("Creating " + (n == 1 ? "new bot" : ChatColor.RED + numberFormat.format(n) + ChatColor.RESET + " new bots") 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) + " with name " + ChatColor.GREEN + name.replace("%", ChatColor.LIGHT_PURPLE + "%" + ChatColor.RESET)
+ (skinName == null ? "" : ChatColor.RESET + " and skin " + ChatColor.GREEN + skinName) + (skinName == null ? "" : ChatColor.RESET + " and skin " + ChatColor.GREEN + skinName)
+ ChatColor.RESET + "..."); + ChatColor.RESET + "...");
}
skinName = skinName == null ? name : skinName; skinName = skinName == null ? name : skinName;
@@ -118,11 +125,13 @@ public class BotManagerImpl implements BotManager, Listener {
createBots(player.getLocation(), name, MojangAPI.getSkin(skinName), n, network); createBots(player.getLocation(), name, MojangAPI.getSkin(skinName), n, network);
else { else {
Location l = new Location(Bukkit.getWorlds().get(0), 0, 0, 0); Location l = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
if (sender != null)
sender.sendMessage(ChatColor.RED + "No location specified, defaulting to " + l + "."); sender.sendMessage(ChatColor.RED + "No location specified, defaulting to " + l + ".");
createBots(l, name, MojangAPI.getSkin(skinName), n, network); createBots(l, name, MojangAPI.getSkin(skinName), n, network);
} }
} }
if (sender != null)
sender.sendMessage("Process completed (" + ChatColor.RED + ((System.currentTimeMillis() - timestamp) / 1000D) + "s" + ChatColor.RESET + ")."); sender.sendMessage("Process completed (" + ChatColor.RED + ((System.currentTimeMillis() - timestamp) / 1000D) + "s" + ChatColor.RESET + ").");
} }