no need for mobtarget boolean

This commit is contained in:
batchprogrammer314
2021-08-31 11:32:09 -05:00
parent 77e3ac60ee
commit aec59a5cfa
3 changed files with 4 additions and 41 deletions

View File

@@ -76,8 +76,6 @@ public class Bot extends EntityPlayer {
private final Vector offset;
public static boolean mobTargeting;
private Bot(MinecraftServer minecraftServer, WorldServer worldServer, GameProfile profile, PlayerInteractManager manager) {
super(minecraftServer, worldServer, profile, manager);
@@ -121,11 +119,8 @@ public class Bot extends EntityPlayer {
bot.getBukkitEntity().setNoDamageTicks(0);
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().playerConnection.sendPacket(
new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, bot)));
if(mobTargeting)
nmsWorld.addPlayerJoin(bot);
else
nmsWorld.addEntity(bot);
nmsWorld.addEntity(bot);
bot.renderAll();
TerminatorPlus.getInstance().getManager().add(bot);

View File

@@ -1157,16 +1157,7 @@ public class LegacyAgent extends Agent {
}
case NEAREST_HOSTILE: {
World world = null;
for(World wld : Bukkit.getWorlds())
{
if(((CraftWorld)wld).getHandle() == bot.getWorld())
{
world = wld;
break;
}
}
for (LivingEntity entity : world.getLivingEntities()) {
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
if (entity instanceof Monster && validateCloserEntity(entity, loc, result)) {
result = entity;
}
@@ -1176,16 +1167,7 @@ public class LegacyAgent extends Agent {
}
case NEAREST_MOB: {
World world = null;
for(World wld : Bukkit.getWorlds())
{
if(((CraftWorld)wld).getHandle() == bot.getWorld())
{
world = wld;
break;
}
}
for (LivingEntity entity : world.getLivingEntities()) {
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
if (entity instanceof Mob && validateCloserEntity(entity, loc, result)) {
result = entity;
}

View File

@@ -328,7 +328,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.equals("setgoal"))) {
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.");
@@ -337,20 +337,6 @@ public class BotCommand extends CommandInstance {
return;
}
if(arg1.equals("mobtarget"))
{
if(arg2 == null || (!arg2.equals("true") && !arg2.equals("false")))
{
sender.sendMessage(ChatUtils.LINE);
sender.sendMessage(ChatColor.GOLD + "Only true or false is accepted");
sender.sendMessage(ChatUtils.LINE);
return;
}
Bot.mobTargeting = Boolean.parseBoolean(arg2);
sender.sendMessage("Mob targeting has been set to " + ChatColor.BLUE + arg2 + ChatColor.RESET + ".");
return;
}
EnumTargetGoal goal = EnumTargetGoal.from(arg2 == null ? "" : arg2);
if (goal == null) {