mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 18:47:37 +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);
|
||||
player.setOp(data.isOperator());
|
||||
player.setAllowFlight(data.isCanFly());
|
||||
//player.setWalkSpeed(data.getWalkSpeed());
|
||||
//player.setFlySpeed(data.getFlySpeed());
|
||||
// FIXME: this is a temp fix!
|
||||
player.setWalkSpeed(0.2f);
|
||||
player.setFlySpeed(0.2f);
|
||||
float walkSpeed = data.getWalkSpeed();
|
||||
float flySpeed = data.getFlySpeed();
|
||||
// Reset the speed value if it was 0
|
||||
if(walkSpeed == 0f) {
|
||||
walkSpeed = 0.2f;
|
||||
}
|
||||
if(flySpeed == 0f) {
|
||||
flySpeed = 0.2f;
|
||||
}
|
||||
player.setWalkSpeed(walkSpeed);
|
||||
player.setFlySpeed(flySpeed);
|
||||
restoreGroup(player, data.getGroup());
|
||||
data.clearTasks();
|
||||
}
|
||||
|
@ -128,16 +128,40 @@ public class LimboCacheTest {
|
||||
// when
|
||||
limboCache.restoreData(player);
|
||||
|
||||
// FIXME: speeds
|
||||
// then
|
||||
verify(player).setOp(true);
|
||||
//verify(player).setWalkSpeed(walkSpeed);
|
||||
verify(player).setWalkSpeed(walkSpeed);
|
||||
verify(player).setAllowFlight(true);
|
||||
//verify(player).setFlySpeed(flySpeed);
|
||||
verify(player).setFlySpeed(flySpeed);
|
||||
verify(permissionsManager).setGroup(player, group);
|
||||
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
|
||||
public void shouldNotInteractWithPlayerIfNoDataAvailable() {
|
||||
// given
|
||||
|
Loading…
Reference in New Issue
Block a user