SpawnLoc changes

+NoFall check
This commit is contained in:
ThisTestUser
2022-12-15 17:10:15 -05:00
parent a41d9245b2
commit 58f39c1d39
4 changed files with 19 additions and 1 deletions

View File

@@ -113,6 +113,8 @@ public interface Terminator {
int getAliveTicks(); int getAliveTicks();
int getNoFallTicks();
boolean tickDelay(int ticks); boolean tickDelay(int ticks);
void renderBot(Object packetListener, boolean login); void renderBot(Object packetListener, boolean login);

View File

@@ -145,7 +145,7 @@ public class LegacyBlockCheck {
} }
public boolean tryPreMLG(Terminator bot, Location botLoc) { public boolean tryPreMLG(Terminator bot, Location botLoc) {
if(bot.isBotOnGround() || bot.getVelocity().getY() >= -0.8D) if(bot.isBotOnGround() || bot.getVelocity().getY() >= -0.8D || bot.getNoFallTicks() > 7)
return false; return false;
if (tryPreMLG(bot, botLoc, 3)) if (tryPreMLG(bot, botLoc, 3))
return true; return true;

View File

@@ -255,6 +255,11 @@ public class Bot extends ServerPlayer implements Terminator {
return aliveTicks; return aliveTicks;
} }
@Override
public int getNoFallTicks() {
return noFallTicks;
}
@Override @Override
public boolean tickDelay(int i) { public boolean tickDelay(int i) {
return aliveTicks % i == 0; return aliveTicks % i == 0;

View File

@@ -315,8 +315,19 @@ public class BotCommand extends CommandInstance {
sender.sendMessage("The spawn location has been reset to the player location."); sender.sendMessage("The spawn location has been reset to the player location.");
return; return;
} }
if (arg2.equalsIgnoreCase("playerloc")) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to do this!");
return;
}
Location loc = ((Player)sender).getLocation();
manager.setSpawnLoc(loc.clone());
sender.sendMessage("The spawn location has been set to " + ChatColor.BLUE + formatter.format(loc.getX()) + ", " + formatter.format(loc.getY()) + ", " + formatter.format(loc.getZ()) + ChatColor.RESET + ".");
return;
}
if (args.size() != 4) { if (args.size() != 4) {
sender.sendMessage("Incorrect argument size. Correct syntax: " + ChatColor.YELLOW + "/bot settings spawnloc <x> <y> <z>" + ChatColor.RESET); sender.sendMessage("Incorrect argument size. Correct syntax: " + ChatColor.YELLOW + "/bot settings spawnloc <x> <y> <z>" + ChatColor.RESET);
sender.sendMessage("Additionally, to specify a spawnloc at the current player position: " + ChatColor.YELLOW + "/bot settings spawnloc playerloc" + ChatColor.RESET);
return; return;
} }
double x, y, z; double x, y, z;