mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-26 01:21:27 +01:00
Transform values into constants
(cherry picked from commit 20d83e5 et al.)
This commit is contained in:
parent
bf3d6b0e7c
commit
41b6c34b6b
@ -80,10 +80,10 @@ public class LimboCache {
|
||||
float flySpeed = data.getFlySpeed();
|
||||
// Reset the speed value if it was 0
|
||||
if (walkSpeed < 0.01f) {
|
||||
walkSpeed = 0.2f;
|
||||
walkSpeed = LimboPlayer.DEFAULT_WALK_SPEED;
|
||||
}
|
||||
if (flySpeed < 0.01f) {
|
||||
flySpeed = 0.2f;
|
||||
flySpeed = LimboPlayer.DEFAULT_FLY_SPEED;
|
||||
}
|
||||
player.setWalkSpeed(walkSpeed);
|
||||
player.setFlySpeed(flySpeed);
|
||||
|
@ -10,6 +10,9 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
*/
|
||||
public class LimboPlayer {
|
||||
|
||||
public static final float DEFAULT_WALK_SPEED = 0.2f;
|
||||
public static final float DEFAULT_FLY_SPEED = 0.1f;
|
||||
|
||||
private final boolean canFly;
|
||||
private final boolean operator;
|
||||
private final String group;
|
||||
|
@ -148,8 +148,8 @@ public class LimboPlayerStorage {
|
||||
String group = "";
|
||||
boolean operator = false;
|
||||
boolean canFly = false;
|
||||
float walkSpeed = 0.2f;
|
||||
float flySpeed = 0.2f;
|
||||
float walkSpeed = LimboPlayer.DEFAULT_WALK_SPEED;
|
||||
float flySpeed = LimboPlayer.DEFAULT_FLY_SPEED;
|
||||
|
||||
JsonElement e;
|
||||
if ((e = jsonObject.getAsJsonObject("location")) != null) {
|
||||
|
@ -143,8 +143,8 @@ public class LimboCacheTest {
|
||||
limboCache.restoreData(player);
|
||||
|
||||
// then
|
||||
verify(player).setWalkSpeed(0.2f);
|
||||
verify(player).setFlySpeed(0.2f);
|
||||
verify(player).setWalkSpeed(LimboPlayer.DEFAULT_WALK_SPEED);
|
||||
verify(player).setFlySpeed(LimboPlayer.DEFAULT_FLY_SPEED);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user