ignore yaw changes in player move event.

This commit is contained in:
DNx5 2015-11-24 21:55:55 +07:00
parent 8e9bfc6299
commit 5be476e2d6
2 changed files with 17 additions and 11 deletions

View File

@ -164,15 +164,21 @@ public class AuthMePlayerListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled())
if (event.isCancelled()) {
return;
}
int radius = Settings.getMovementRadius;
boolean allowMove = Settings.isMovementAllowed;
if (Settings.noTeleport) {
return;
}
if (allowMove && radius <= 0) {
if (Settings.isMovementAllowed && Settings.getMovementRadius <= 0) {
return;
}
if (event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockY() == event.getTo().getBlockY()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()) {
return;
}
@ -181,9 +187,9 @@ public class AuthMePlayerListener implements Listener {
return;
}
if (!allowMove) {
if (!Settings.isMovementAllowed) {
if (event.getFrom().distance(event.getTo()) > 0) {
event.setCancelled(true);
event.setTo(event.getFrom());
return;
}
}
@ -194,7 +200,7 @@ public class AuthMePlayerListener implements Listener {
player.teleport(spawn);
return;
}
if ((spawn.distance(player.getLocation()) > radius)) {
if ((spawn.distance(player.getLocation()) > Settings.getMovementRadius)) {
player.teleport(spawn);
}
}

View File

@ -173,7 +173,8 @@ public final class Utils {
assert permsMan != null;
// Remove old groups
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup, Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup,
Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
// Add the normal group, return the result
return permsMan.addGroup(player, group);
@ -185,13 +186,12 @@ public final class Utils {
return true;
}
String name = player.getName().toLowerCase();
if (PlayerCache.getInstance().isAuthenticated(name)) {
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
return true;
}
if (!Settings.isForcedRegistrationEnabled) {
if (!plugin.database.isAuthAvailable(name)) {
if (!plugin.database.isAuthAvailable(player.getName())) {
return true;
}
}