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

@@ -112,6 +112,8 @@ public interface Terminator {
void addVelocity(Vector velocity);
int getAliveTicks();
int getNoFallTicks();
boolean tickDelay(int ticks);

View File

@@ -145,7 +145,7 @@ public class LegacyBlockCheck {
}
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;
if (tryPreMLG(bot, botLoc, 3))
return true;

View File

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

View File

@@ -315,8 +315,19 @@ public class BotCommand extends CommandInstance {
sender.sendMessage("The spawn location has been reset to the player location.");
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) {
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;
}
double x, y, z;