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();
|
float flySpeed = data.getFlySpeed();
|
||||||
// Reset the speed value if it was 0
|
// Reset the speed value if it was 0
|
||||||
if (walkSpeed < 0.01f) {
|
if (walkSpeed < 0.01f) {
|
||||||
walkSpeed = 0.2f;
|
walkSpeed = LimboPlayer.DEFAULT_WALK_SPEED;
|
||||||
}
|
}
|
||||||
if (flySpeed < 0.01f) {
|
if (flySpeed < 0.01f) {
|
||||||
flySpeed = 0.2f;
|
flySpeed = LimboPlayer.DEFAULT_FLY_SPEED;
|
||||||
}
|
}
|
||||||
player.setWalkSpeed(walkSpeed);
|
player.setWalkSpeed(walkSpeed);
|
||||||
player.setFlySpeed(flySpeed);
|
player.setFlySpeed(flySpeed);
|
||||||
|
|||||||
@ -10,6 +10,9 @@ import org.bukkit.scheduler.BukkitTask;
|
|||||||
*/
|
*/
|
||||||
public class LimboPlayer {
|
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 canFly;
|
||||||
private final boolean operator;
|
private final boolean operator;
|
||||||
private final String group;
|
private final String group;
|
||||||
|
|||||||
@ -148,8 +148,8 @@ public class LimboPlayerStorage {
|
|||||||
String group = "";
|
String group = "";
|
||||||
boolean operator = false;
|
boolean operator = false;
|
||||||
boolean canFly = false;
|
boolean canFly = false;
|
||||||
float walkSpeed = 0.2f;
|
float walkSpeed = LimboPlayer.DEFAULT_WALK_SPEED;
|
||||||
float flySpeed = 0.2f;
|
float flySpeed = LimboPlayer.DEFAULT_FLY_SPEED;
|
||||||
|
|
||||||
JsonElement e;
|
JsonElement e;
|
||||||
if ((e = jsonObject.getAsJsonObject("location")) != null) {
|
if ((e = jsonObject.getAsJsonObject("location")) != null) {
|
||||||
|
|||||||
@ -143,8 +143,8 @@ public class LimboCacheTest {
|
|||||||
limboCache.restoreData(player);
|
limboCache.restoreData(player);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
verify(player).setWalkSpeed(0.2f);
|
verify(player).setWalkSpeed(LimboPlayer.DEFAULT_WALK_SPEED);
|
||||||
verify(player).setFlySpeed(0.2f);
|
verify(player).setFlySpeed(LimboPlayer.DEFAULT_FLY_SPEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user