1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2022-07-10 10:59:23 +02:00
parent 1948858ccd
commit 2813e76075
2 changed files with 7 additions and 2 deletions

View File

@ -45,6 +45,7 @@
#### Fixes
* Fixed #3597
* Fixed an issue related to "Bee Wings"
* Fixed #3573
## Release Candidate 32 (26 Jun 2022)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#32

View File

@ -128,7 +128,8 @@ public final class TeleportationManager {
teleporterUsers.add(uuid);
int time = getTeleportationTime(complexity, source, destination);
updateProgress(uuid, Math.max(1, 100 / time), 0, source, destination, resistance);
int speed = Math.max(1, 100 / time);
updateProgress(uuid, speed, 0, source, destination, resistance);
}
/**
@ -162,7 +163,10 @@ public final class TeleportationManager {
}
int speed = 50_000 + complexity * complexity;
return 1 + Math.min(4 * distanceSquared(source, destination) / speed, 40);
int unsafeTime = Math.min(4 * distanceSquared(source, destination) / speed, 40);
// Fixes #3573 - Using Math.max is a safer way to ensure values > 0 than relying on addition.
return Math.max(1, unsafeTime);
}
@ParametersAreNonnullByDefault