fix: finally fix going up from void

This commit is contained in:
ChomeNS
2024-12-07 18:10:34 +07:00
parent b3beac6c3b
commit 1afcfde5e5
2 changed files with 11 additions and 11 deletions

View File

@@ -166,7 +166,7 @@ public class PositionPlugin extends Bot.Listener {
final int minY = bot.world.minY;
final int maxY = bot.world.maxY;
if (y < maxY) {
if (y < maxY && y > minY) {
if (isGoingDownFromHeightLimit) {
isGoingDownFromHeightLimit = false;
@@ -178,15 +178,7 @@ public class PositionPlugin extends Bot.Listener {
isGoingDownFromHeightLimit = true;
final Vector3d newPosition = Vector3d.from(
position.getX(),
position.getY() - 2,
position.getZ()
);
position = newPosition;
if (position.getY() > maxY + 500 || position.getY() < minY) {
if (y > maxY + 500 || y < minY) {
String command = "/";
if (bot.serverPluginsManager.hasPlugin(ServerPluginsManagerPlugin.ESSENTIALS)) command += "essentials:";
@@ -198,6 +190,14 @@ public class PositionPlugin extends Bot.Listener {
return;
}
final Vector3d newPosition = Vector3d.from(
position.getX(),
position.getY() - 2,
position.getZ()
);
position = newPosition;
bot.session.send(new ServerboundMovePlayerPosPacket(
false,
false,