code cleanup shrinkingborder

This commit is contained in:
2025-06-23 20:34:48 +02:00
parent 03d4f4e6d8
commit f3b884058e

View File

@ -42,8 +42,9 @@ public class ShrinkingBorderListener extends ApplianceListener<ShrinkingBorder>
Location relativeLocation = playerLocation.clone().subtract(worldBorder.getCenter()); Location relativeLocation = playerLocation.clone().subtract(worldBorder.getCenter());
double playerBorderDistanceX = worldBorder.getSize()/2 - Math.abs(relativeLocation.getX()); double playerBorderDistanceX = worldBorder.getSize()/2 - Math.abs(relativeLocation.getX());
double playerBorderDistanceZ = worldBorder.getSize()/2 - Math.abs(relativeLocation.getZ()); double playerBorderDistanceZ = worldBorder.getSize()/2 - Math.abs(relativeLocation.getZ());
int xSteps = (int) Math.ceil(playerBorderDistanceX / ((double) this.getAppliance().getOption(ShrinkingBorderCommand.Argument.SHRINK_PER_DAY) / 2)); double halfShrinkPerDayX = (double) this.getAppliance().getOption(ShrinkingBorderCommand.Argument.SHRINK_PER_DAY) / 2;
int zSteps = (int) Math.ceil(playerBorderDistanceZ / ((double) this.getAppliance().getOption(ShrinkingBorderCommand.Argument.SHRINK_PER_DAY) / 2)); int xSteps = (int) Math.ceil(playerBorderDistanceX / halfShrinkPerDayX);
int zSteps = (int) Math.ceil(playerBorderDistanceZ / halfShrinkPerDayX);
return Math.min(xSteps, zSteps); return Math.min(xSteps, zSteps);
} }