diff --git a/src/main/java/ac/grim/grimac/commands/GrimStopSpectating.java b/src/main/java/ac/grim/grimac/commands/GrimStopSpectating.java index 502ace43a4..2e08c9fd68 100644 --- a/src/main/java/ac/grim/grimac/commands/GrimStopSpectating.java +++ b/src/main/java/ac/grim/grimac/commands/GrimStopSpectating.java @@ -22,9 +22,8 @@ public class GrimStopSpectating extends BaseCommand { @CommandPermission("grim.spectate") @CommandCompletion("@stopspectating") public void onStopSpectate(CommandSender sender, String[] args) { + if (!(sender instanceof Player player)) return; String string = args.length > 0 ? args[0] : null; - if (!(sender instanceof Player)) return; - Player player = (Player) sender; if (GrimAPI.INSTANCE.getSpectateManager().isSpectating(player.getUniqueId())) { boolean teleportBack = string == null || !string.equalsIgnoreCase("here") || !sender.hasPermission("grim.spectate.stophere"); GrimAPI.INSTANCE.getSpectateManager().disable(player, teleportBack); diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index c2fcc15d91..78bb2d5683 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -592,17 +592,14 @@ public double[] getPossibleEyeHeights() { // We don't return sleeping eye height return this.isSneaking ? this.possibleEyeHeights[1] : this.possibleEyeHeights[0]; } else { // 1.8 players just have their pose set to standing all the time - switch (pose) { - case FALL_FLYING: // Elytra gliding - case SPIN_ATTACK: // Riptide trident - case SWIMMING: // Swimming (includes crawling in 1.14+) - return this.possibleEyeHeights[2]; // [swimming/gliding/riptide height, standing height, sneaking height] - case NINE_CROUCHING: - case CROUCHING: - return this.possibleEyeHeights[1]; // [sneaking height, standing height, swimming/gliding/riptide height] - default: - return this.possibleEyeHeights[0]; // [standing height, sneaking height, swimming/gliding/riptide height] - } + return switch (pose) { + case FALL_FLYING, // Elytra gliding + SPIN_ATTACK, // Riptide trident + SWIMMING -> // Swimming (includes crawling in 1.14+) + this.possibleEyeHeights[2]; // [swimming/gliding/riptide height, standing height, sneaking height] + case NINE_CROUCHING, CROUCHING -> this.possibleEyeHeights[1]; // [sneaking height, standing height, swimming/gliding/riptide height] + default -> this.possibleEyeHeights[0]; // [standing height, sneaking height, swimming/gliding/riptide height] + }; } }