remove speed already done in join process

This commit is contained in:
DNx5 2015-11-15 04:49:03 +07:00
parent 1af937651c
commit 6f1af92a58

View File

@ -130,31 +130,27 @@ public class AuthMePlayerListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event) { public void onPlayerMove(PlayerMoveEvent event) {
if (Settings.isMovementAllowed && Settings.getMovementRadius <= 0) int radius = Settings.getMovementRadius;
boolean allowMove = Settings.isMovementAllowed;
if (allowMove && radius <= 0)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (Utils.checkAuth(player)) if (Utils.checkAuth(player))
return; return;
if (!Settings.isMovementAllowed) { if (!allowMove) {
if (event.getFrom().distance(event.getTo()) > 0) { if (event.getFrom().distance(event.getTo()) > 0) {
if (Settings.isRemoveSpeedEnabled) {
player.setWalkSpeed(0.0f);
player.setFlySpeed(0.0f);
}
event.setTo(event.getFrom()); event.setTo(event.getFrom());
return; return;
} }
} }
if (Settings.getMovementRadius <= 0) { if (radius <= 0) {
return; return;
} }
int radius = Settings.getMovementRadius;
Location spawn = plugin.getSpawnLocation(player); Location spawn = plugin.getSpawnLocation(player);
if (spawn != null && spawn.getWorld() != null) { if (spawn != null && spawn.getWorld() != null) {
if (!event.getPlayer().getWorld().equals(spawn.getWorld())) { if (!event.getPlayer().getWorld().equals(spawn.getWorld())) {
event.getPlayer().teleport(spawn); event.getPlayer().teleport(spawn);