mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-08 03:29:41 +01:00
Reset speed if it was 0 #890
This commit is contained in:
parent
402a5e016e
commit
efe62beccd
@ -81,11 +81,17 @@ public class LimboCache {
|
|||||||
PlayerData data = cache.get(lowerName);
|
PlayerData data = cache.get(lowerName);
|
||||||
player.setOp(data.isOperator());
|
player.setOp(data.isOperator());
|
||||||
player.setAllowFlight(data.isCanFly());
|
player.setAllowFlight(data.isCanFly());
|
||||||
//player.setWalkSpeed(data.getWalkSpeed());
|
float walkSpeed = data.getWalkSpeed();
|
||||||
//player.setFlySpeed(data.getFlySpeed());
|
float flySpeed = data.getFlySpeed();
|
||||||
// FIXME: this is a temp fix!
|
// Reset the speed value if it was 0
|
||||||
player.setWalkSpeed(0.2f);
|
if(walkSpeed == 0f) {
|
||||||
player.setFlySpeed(0.2f);
|
walkSpeed = 0.2f;
|
||||||
|
}
|
||||||
|
if(flySpeed == 0f) {
|
||||||
|
flySpeed = 0.2f;
|
||||||
|
}
|
||||||
|
player.setWalkSpeed(walkSpeed);
|
||||||
|
player.setFlySpeed(flySpeed);
|
||||||
restoreGroup(player, data.getGroup());
|
restoreGroup(player, data.getGroup());
|
||||||
data.clearTasks();
|
data.clearTasks();
|
||||||
}
|
}
|
||||||
|
@ -128,16 +128,40 @@ public class LimboCacheTest {
|
|||||||
// when
|
// when
|
||||||
limboCache.restoreData(player);
|
limboCache.restoreData(player);
|
||||||
|
|
||||||
// FIXME: speeds
|
|
||||||
// then
|
// then
|
||||||
verify(player).setOp(true);
|
verify(player).setOp(true);
|
||||||
//verify(player).setWalkSpeed(walkSpeed);
|
verify(player).setWalkSpeed(walkSpeed);
|
||||||
verify(player).setAllowFlight(true);
|
verify(player).setAllowFlight(true);
|
||||||
//verify(player).setFlySpeed(flySpeed);
|
verify(player).setFlySpeed(flySpeed);
|
||||||
verify(permissionsManager).setGroup(player, group);
|
verify(permissionsManager).setGroup(player, group);
|
||||||
verify(playerData).clearTasks();
|
verify(playerData).clearTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldResetPlayerSpeed() {
|
||||||
|
// given
|
||||||
|
String name = "Champ";
|
||||||
|
Player player = mock(Player.class);
|
||||||
|
given(player.getName()).willReturn(name);
|
||||||
|
PlayerData playerData = mock(PlayerData.class);
|
||||||
|
given(playerData.isOperator()).willReturn(true);
|
||||||
|
given(playerData.getWalkSpeed()).willReturn(0f);
|
||||||
|
given(playerData.isCanFly()).willReturn(true);
|
||||||
|
given(playerData.getFlySpeed()).willReturn(0f);
|
||||||
|
String group = "primary-group";
|
||||||
|
given(playerData.getGroup()).willReturn(group);
|
||||||
|
getCache().put(name.toLowerCase(), playerData);
|
||||||
|
given(settings.getProperty(PluginSettings.ENABLE_PERMISSION_CHECK)).willReturn(true);
|
||||||
|
given(permissionsManager.hasGroupSupport()).willReturn(true);
|
||||||
|
|
||||||
|
// when
|
||||||
|
limboCache.restoreData(player);
|
||||||
|
|
||||||
|
// then
|
||||||
|
verify(player).setWalkSpeed(0.2f);
|
||||||
|
verify(player).setFlySpeed(0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldNotInteractWithPlayerIfNoDataAvailable() {
|
public void shouldNotInteractWithPlayerIfNoDataAvailable() {
|
||||||
// given
|
// given
|
||||||
|
Loading…
Reference in New Issue
Block a user