no need for mobtarget boolean
This commit is contained in:
@@ -76,8 +76,6 @@ public class Bot extends EntityPlayer {
|
|||||||
|
|
||||||
private final Vector offset;
|
private final Vector offset;
|
||||||
|
|
||||||
public static boolean mobTargeting;
|
|
||||||
|
|
||||||
private Bot(MinecraftServer minecraftServer, WorldServer worldServer, GameProfile profile, PlayerInteractManager manager) {
|
private Bot(MinecraftServer minecraftServer, WorldServer worldServer, GameProfile profile, PlayerInteractManager manager) {
|
||||||
super(minecraftServer, worldServer, profile, manager);
|
super(minecraftServer, worldServer, profile, manager);
|
||||||
|
|
||||||
@@ -121,11 +119,8 @@ public class Bot extends EntityPlayer {
|
|||||||
bot.getBukkitEntity().setNoDamageTicks(0);
|
bot.getBukkitEntity().setNoDamageTicks(0);
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
Bukkit.getOnlinePlayers().forEach(p -> ((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||||
new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, bot)));
|
new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, bot)));
|
||||||
if(mobTargeting)
|
|
||||||
nmsWorld.addPlayerJoin(bot);
|
|
||||||
else
|
|
||||||
nmsWorld.addEntity(bot);
|
|
||||||
|
|
||||||
|
nmsWorld.addEntity(bot);
|
||||||
bot.renderAll();
|
bot.renderAll();
|
||||||
|
|
||||||
TerminatorPlus.getInstance().getManager().add(bot);
|
TerminatorPlus.getInstance().getManager().add(bot);
|
||||||
|
|||||||
@@ -1157,16 +1157,7 @@ public class LegacyAgent extends Agent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case NEAREST_HOSTILE: {
|
case NEAREST_HOSTILE: {
|
||||||
World world = null;
|
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
|
||||||
for(World wld : Bukkit.getWorlds())
|
|
||||||
{
|
|
||||||
if(((CraftWorld)wld).getHandle() == bot.getWorld())
|
|
||||||
{
|
|
||||||
world = wld;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (LivingEntity entity : world.getLivingEntities()) {
|
|
||||||
if (entity instanceof Monster && validateCloserEntity(entity, loc, result)) {
|
if (entity instanceof Monster && validateCloserEntity(entity, loc, result)) {
|
||||||
result = entity;
|
result = entity;
|
||||||
}
|
}
|
||||||
@@ -1176,16 +1167,7 @@ public class LegacyAgent extends Agent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case NEAREST_MOB: {
|
case NEAREST_MOB: {
|
||||||
World world = null;
|
for (LivingEntity entity : bot.getBukkitEntity().getWorld().getLivingEntities()) {
|
||||||
for(World wld : Bukkit.getWorlds())
|
|
||||||
{
|
|
||||||
if(((CraftWorld)wld).getHandle() == bot.getWorld())
|
|
||||||
{
|
|
||||||
world = wld;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (LivingEntity entity : world.getLivingEntities()) {
|
|
||||||
if (entity instanceof Mob && validateCloserEntity(entity, loc, result)) {
|
if (entity instanceof Mob && validateCloserEntity(entity, loc, result)) {
|
||||||
result = entity;
|
result = entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ public class BotCommand extends CommandInstance {
|
|||||||
|
|
||||||
String extra = ChatColor.GRAY + " [" + ChatColor.YELLOW + "/bot settings" + ChatColor.GRAY + "]";
|
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(ChatUtils.LINE);
|
||||||
sender.sendMessage(ChatColor.GOLD + "Bot Settings" + extra);
|
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.");
|
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;
|
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);
|
EnumTargetGoal goal = EnumTargetGoal.from(arg2 == null ? "" : arg2);
|
||||||
|
|
||||||
if (goal == null) {
|
if (goal == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user