From 0625efdfeb50d9c9714a8ceab27df477549a0917 Mon Sep 17 00:00:00 2001 From: Niestrat99 <35385996+niestrat99@users.noreply.github.com> Date: Mon, 24 Jul 2023 11:54:00 +0100 Subject: [PATCH 01/11] feat: Added permission nodes for bypassing movement and rotation on teleport timers Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- AdvancedTeleport-Bukkit/build.gradle.kts | 2 ++ .../managers/MovementManager.java | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/AdvancedTeleport-Bukkit/build.gradle.kts b/AdvancedTeleport-Bukkit/build.gradle.kts index 2974d22d..e998b148 100644 --- a/AdvancedTeleport-Bukkit/build.gradle.kts +++ b/AdvancedTeleport-Bukkit/build.gradle.kts @@ -579,6 +579,8 @@ bukkit { "at.admin.bypass.distance-limit" to true, "at.admin.sethome.bypass" to true, "at.admin.bypass.teleport-on-join" to true, + "at.admin.bypass.movement" to true, + "at.admin.bypass.rotation" to true, "at.admin.toggletp" to true, "at.admin.bypass" to true, "at.admin.tploc" to true, diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java index b70ba659..5a09cd57 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java @@ -28,8 +28,8 @@ public class MovementManager implements Listener { @EventHandler public void onMovement(PlayerMoveEvent event) { - boolean cancelOnRotate = MainConfig.get().CANCEL_WARM_UP_ON_ROTATION.get(); - boolean cancelOnMove = MainConfig.get().CANCEL_WARM_UP_ON_MOVEMENT.get(); + boolean cancelOnRotate = MainConfig.get().CANCEL_WARM_UP_ON_ROTATION.get() && !event.getPlayer().hasPermission("at.admin.bypass.rotation"); + boolean cancelOnMove = MainConfig.get().CANCEL_WARM_UP_ON_MOVEMENT.get() && !event.getPlayer().hasPermission("at.admin.bypass.movement"); if (!cancelOnRotate) { Location locTo = event.getTo(); Location locFrom = event.getFrom(); @@ -39,6 +39,16 @@ public void onMovement(PlayerMoveEvent event) { return; } } + if (!cancelOnMove) { + Location locTo = event.getTo(); + Location locFrom = event.getFrom(); + + if (locTo.getPitch() == locFrom.getPitch() + && locTo.getYaw() == locFrom.getYaw()) { + return; + } + } + UUID uuid = event.getPlayer().getUniqueId(); if ((cancelOnRotate || cancelOnMove) && movement.containsKey(uuid)) { ImprovedRunnable timer = movement.get(uuid); @@ -122,8 +132,8 @@ public void run() { }; movement.put(uuid, movementtimer); movementtimer.runTaskLater(CoreClass.getInstance(), warmUp * 20L); - if (MainConfig.get().CANCEL_WARM_UP_ON_MOVEMENT.get() - || MainConfig.get().CANCEL_WARM_UP_ON_ROTATION.get()) { + if ((MainConfig.get().CANCEL_WARM_UP_ON_MOVEMENT.get() && !teleportingPlayer.hasPermission("at.admin.bypass.movement")) + || (MainConfig.get().CANCEL_WARM_UP_ON_ROTATION.get() && !teleportingPlayer.hasPermission("at.admin.bypass.rotation"))) { CustomMessages.sendMessage( teleportingPlayer, "Teleport.eventBeforeTP", From 3947ca71cc3ac1a932bd6386c5345a94734ea672 Mon Sep 17 00:00:00 2001 From: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:19:57 +0100 Subject: [PATCH 02/11] fix: return true by default if player is not stored in database for tp toggle (#116) Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- .../niestrat99/advancedteleport/sql/PlayerSQLManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/sql/PlayerSQLManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/sql/PlayerSQLManager.java index 46c1a57a..fc369cfb 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/sql/PlayerSQLManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/sql/PlayerSQLManager.java @@ -232,7 +232,7 @@ public boolean isTeleportationOn(UUID uuid) { } catch (SQLException exception) { throw new RuntimeException(exception); } - return false; + return true; } public void setTeleportationOn(UUID uuid, boolean enabled) { From 5528d40ca09bed4c9eac311a50fa2a9513600b58 Mon Sep 17 00:00:00 2001 From: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:26:57 +0100 Subject: [PATCH 03/11] chore: add debugging for command registration Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- .../advancedteleport/managers/CommandManager.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/CommandManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/CommandManager.java index 4e6c505f..2c565c1e 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/CommandManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/CommandManager.java @@ -86,13 +86,12 @@ public static void registerCommands() { private static void register(String name, ATCommand atCommand) { PluginCommand command = Bukkit.getPluginCommand("advancedteleport:" + name); + CoreClass.debug("Fetching " + command + " - " + command); if (command == null) command = atCommands.get(name); - if (command == null) return; - - if (command.getPlugin() != CoreClass.getInstance()) { - command = Bukkit.getPluginCommand("advancedteleport:" + name); + if (command == null) { + CoreClass.getInstance().getLogger().warning("Could not add command " + name + " - has it been set up properly?"); + return; } - if (command == null) return; atCommands.put(name, command); CommandMap map = getMap(); @@ -108,6 +107,7 @@ private static void register(String name, ATCommand atCommand) { if (MainConfig.get().DISABLED_COMMANDS.get().contains(alias) || removed || !atCommand.getRequiredFeature()) { + CoreClass.debug(alias + " has been marked for removal."); if (command.isRegistered()) { removed = true; command.unregister(map); @@ -120,6 +120,8 @@ private static void register(String name, ATCommand atCommand) { commands.remove(alias); commands.remove("advancedteleport:" + alias); + CoreClass.debug("Removed " + alias + "."); + // Let another plugin take over Bukkit.getScheduler() .runTaskLater( @@ -135,6 +137,7 @@ private static void register(String name, ATCommand atCommand) { if (parts.length < 2) continue; if (parts[1].equals(alias)) { if (parts[0].equals("advancedteleport")) continue; + CoreClass.debug("Letting " + parts[0] + "'s " + alias + " take over..."); pendingChanges.put(alias, commands.get(otherCmd)); break; } @@ -163,6 +166,8 @@ private static void register(String name, ATCommand atCommand) { command.setTabCompleter(atCommand); } + CoreClass.debug(aliases + " has " + (command.isRegistered() ? "" : "not ") + "been registed successfully."); + registeredCommands.put(name, command); } From b22e212302ad20bfe8c69201918b2c4c371d5529 Mon Sep 17 00:00:00 2001 From: Holly P <25277367+Thatsmusic99@users.noreply.github.com> Date: Tue, 25 Jul 2023 11:35:42 +0100 Subject: [PATCH 04/11] chore: add debugging for payment parsing --- .../advancedteleport/payments/PaymentManager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java index 5d2cef8e..8c05ef92 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java @@ -71,6 +71,14 @@ private Payment parsePayment(String rawPayment) { if (matcher.matches()) { String plugin = matcher.group(1); double payment = Double.parseDouble(matcher.group(2)); + + CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment); + CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin); + + // If it's not a plugin and actually an item, lmao + if (plugin != null && Material.getMaterial(plugin) != null) { + return ItemsPayment.getFromString(rawPayment); + } return new VaultPayment( payment, plugin == null ? null : plugin.substring(0, plugin.length() - 1)); } @@ -87,6 +95,9 @@ private Payment parsePayment(String rawPayment) { String plugin = matcher.group(1); double payment = Double.parseDouble(matcher.group(2)); + CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment); + CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin); + // If it's not a plugin and actually an item, lmao if (plugin != null && Material.getMaterial(plugin) != null) { return ItemsPayment.getFromString(rawPayment); From 04ad1e009fbadab73492d698e1aa537e6f310909 Mon Sep 17 00:00:00 2001 From: Holly P <25277367+Thatsmusic99@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:16:41 +0100 Subject: [PATCH 05/11] fix: missing brackets --- .../niestrat99/advancedteleport/payments/PaymentManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java index 8c05ef92..9131562a 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java @@ -73,7 +73,7 @@ private Payment parsePayment(String rawPayment) { double payment = Double.parseDouble(matcher.group(2)); CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment); - CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin); + CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin)); // If it's not a plugin and actually an item, lmao if (plugin != null && Material.getMaterial(plugin) != null) { @@ -96,7 +96,7 @@ private Payment parsePayment(String rawPayment) { double payment = Double.parseDouble(matcher.group(2)); CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment); - CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin); + CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin)); // If it's not a plugin and actually an item, lmao if (plugin != null && Material.getMaterial(plugin) != null) { From cecc8ebe43fb5cde4a2913bbb92e169cd8886599 Mon Sep 17 00:00:00 2001 From: Holly P <25277367+Thatsmusic99@users.noreply.github.com> Date: Tue, 25 Jul 2023 13:10:59 +0100 Subject: [PATCH 06/11] fix: item payments being parsed incorrectly --- .../advancedteleport/payments/PaymentManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java index 9131562a..2586f587 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java @@ -67,10 +67,10 @@ private void addCommand(String command, Object value) { private Payment parsePayment(String rawPayment) { if (rawPayment.length() - 3 <= 0) { - Matcher matcher = Pattern.compile("^(.+:)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment); + Matcher matcher = Pattern.compile("^((.+):)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment); if (matcher.matches()) { - String plugin = matcher.group(1); - double payment = Double.parseDouble(matcher.group(2)); + String plugin = matcher.group(2); + double payment = Double.parseDouble(matcher.group(3)); CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment); CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin)); @@ -90,10 +90,10 @@ private Payment parsePayment(String rawPayment) { } else if (rawPayment.endsWith("EXP")) { return new PointsPayment(Integer.parseInt(points)); } else { - Matcher matcher = Pattern.compile("^(.+:)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment); + Matcher matcher = Pattern.compile("^((.+):)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment); if (matcher.matches()) { - String plugin = matcher.group(1); - double payment = Double.parseDouble(matcher.group(2)); + String plugin = matcher.group(2); + double payment = Double.parseDouble(matcher.group(3)); CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment); CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin)); From de63fb0f9ebc6a8cee39604b60c6fd46d83478be Mon Sep 17 00:00:00 2001 From: Holly P <25277367+Thatsmusic99@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:05:28 +0100 Subject: [PATCH 07/11] fix: check if permission is set --- .../advancedteleport/payments/PaymentManager.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java index 2586f587..3655217f 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/payments/PaymentManager.java @@ -176,10 +176,10 @@ private HashMap getPayments(String command, Player player, Worl var payments = new HashMap(); for (String key : customCosts.getKeys(false)) { String worldName = toWorld.getName().toLowerCase(Locale.ROOT); - if (!player.hasPermission("at.member.cost." + key) - && !player.hasPermission("at.member.cost." + command + "." + key) - && !player.hasPermission("at.member.cost." + worldName + "." + key) - && !player.hasPermission( + if (!hasPermission(player, "at.member.cost." + key) + && !hasPermission(player, "at.member.cost." + command + "." + key) + && !hasPermission(player, "at.member.cost." + worldName + "." + key) + && !hasPermission(player, "at.member.cost." + command + "." + worldName + "." + key)) continue; String rawPayment = customCosts.getString(key); if (rawPayment == null) continue; @@ -190,4 +190,8 @@ private HashMap getPayments(String command, Player player, Worl if (payments.isEmpty()) payments = teleportCosts.get(command); return payments; } + + private boolean hasPermission(Player player, String permission) { + return player.isPermissionSet(permission) && player.hasPermission(permission); + } } From 2d61bf4f93ae743aceaf8eea72b439a9b997425f Mon Sep 17 00:00:00 2001 From: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:22:35 +0100 Subject: [PATCH 08/11] fix: warning about slimjar and semi-fix for building Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- AdvancedTeleport-Bukkit/build.gradle.kts | 4 ++++ README.md | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AdvancedTeleport-Bukkit/build.gradle.kts b/AdvancedTeleport-Bukkit/build.gradle.kts index e998b148..40598a3c 100644 --- a/AdvancedTeleport-Bukkit/build.gradle.kts +++ b/AdvancedTeleport-Bukkit/build.gradle.kts @@ -189,6 +189,10 @@ tasks { } } +tasks.shadowJar { + from(tasks.slimJar.get().outputDirectory) +} + // Lead development use only. modrinth { token.set(System.getenv("MODRINTH_TOKEN")) diff --git a/README.md b/README.md index baf5a6f7..432c551b 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,7 @@ Advanced Teleport is a rapidly growing plugin that is not only increasing sharpl ## Installation/Cloning As of currently, Advanced Teleport uses Gradle to manage its dependencies. -The Gradle command used to build the plugin is `gradle shadowJar` and is done under the AdvancedTeleport-Bukkit module. +The Gradle command used to build the plugin is `gradle slimJar` and is done under the AdvancedTeleport-Bukkit module. + +> NOTE: Due to a bug with SlimJar you should try building twice when updating dependencies or building for the first time, or necessary files will not be installed. From 20eaaf992885ebd6d68cc1625336d435b95a5567 Mon Sep 17 00:00:00 2001 From: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:49:49 +0100 Subject: [PATCH 09/11] chore(version): bump to v6.0.0-rc.3 Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d22731fe..c5b2d9d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # suppress inspection "UnusedProperty" for whole file group=io.github.niestrat99 -version=6.0.0-rc.2 +version=6.0.0-rc.3 # Keep up to date with https://github.com/DaRacci/Minix-Conventions kotlinVersion=1.8.0 build=7 From 2535b3e66eae5415539971d404e85f7c429b75ac Mon Sep 17 00:00:00 2001 From: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> Date: Wed, 15 May 2024 18:51:02 +0100 Subject: [PATCH 10/11] chore: remove old build stuff here too Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- AdvancedTeleport-Bukkit/build.gradle.kts | 4 ---- README.md | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/AdvancedTeleport-Bukkit/build.gradle.kts b/AdvancedTeleport-Bukkit/build.gradle.kts index d2fec1ce..ee6c745b 100644 --- a/AdvancedTeleport-Bukkit/build.gradle.kts +++ b/AdvancedTeleport-Bukkit/build.gradle.kts @@ -195,10 +195,6 @@ tasks { } } -tasks.shadowJar { - from(tasks.slimJar.get().outputDirectory) -} - // Lead development use only. modrinth { token.set(System.getenv("MODRINTH_TOKEN")) diff --git a/README.md b/README.md index d688f393..1eab5685 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,6 @@ Advanced Teleport is a rapidly growing plugin that is not only increasing sharpl ## Installation/Cloning As of currently, Advanced Teleport uses Gradle to manage its dependencies. -The Gradle command used to build the plugin is `gradle slimJar` and is done under the AdvancedTeleport-Bukkit module. - -> NOTE: Due to a bug with SlimJar you should try building twice when updating dependencies or building for the first time, or necessary files will not be installed. +The Gradle command used to build the plugin is `gradle shadowJar` and is done under the AdvancedTeleport-Bukkit module. From f6af0404cd587621dac836658c3aa32b8b0bc42f Mon Sep 17 00:00:00 2001 From: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> Date: Wed, 15 May 2024 19:25:51 +0100 Subject: [PATCH 11/11] chore: clarify movement timer code better Signed-off-by: Thatsmusic99 <25277367+thatsmusic99@users.noreply.github.com> --- .../managers/MovementManager.java | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java index 5a09cd57..1038ec50 100644 --- a/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java +++ b/AdvancedTeleport-Bukkit/src/main/java/io/github/niestrat99/advancedteleport/managers/MovementManager.java @@ -28,35 +28,48 @@ public class MovementManager implements Listener { @EventHandler public void onMovement(PlayerMoveEvent event) { + + boolean cancelled = willCancelTimer(event); + + UUID uuid = event.getPlayer().getUniqueId(); + if (cancelled && movement.containsKey(uuid)) { + ImprovedRunnable timer = movement.get(uuid); + timer.cancel(); + CustomMessages.sendMessage(event.getPlayer(), "Teleport.eventMovement"); + ParticleManager.removeParticles(event.getPlayer(), timer.command); + movement.remove(uuid); + } + } + + private static boolean willCancelTimer(PlayerMoveEvent event) { boolean cancelOnRotate = MainConfig.get().CANCEL_WARM_UP_ON_ROTATION.get() && !event.getPlayer().hasPermission("at.admin.bypass.rotation"); boolean cancelOnMove = MainConfig.get().CANCEL_WARM_UP_ON_MOVEMENT.get() && !event.getPlayer().hasPermission("at.admin.bypass.movement"); - if (!cancelOnRotate) { + + boolean cancelled = false; + + // If we have to perform position checks, compare blocks + if (cancelOnMove) { Location locTo = event.getTo(); Location locFrom = event.getFrom(); - if (locTo.getBlockX() == locFrom.getBlockX() // If the player rotated instead of moved - && locTo.getBlockY() == locFrom.getBlockY() - && locTo.getBlockZ() == locFrom.getBlockZ()) { - return; + if (locTo.getBlockX() != locFrom.getBlockX() // If the player moved + || locTo.getBlockY() != locFrom.getBlockY() + || locTo.getBlockZ() != locFrom.getBlockZ()) { + cancelled = true; } } - if (!cancelOnMove) { + + // If we have to perform rotation checks, compare + if (cancelOnRotate && !cancelled) { Location locTo = event.getTo(); Location locFrom = event.getFrom(); - if (locTo.getPitch() == locFrom.getPitch() - && locTo.getYaw() == locFrom.getYaw()) { - return; + if (locTo.getPitch() != locFrom.getPitch() + || locTo.getYaw() != locFrom.getYaw()) { + cancelled = true; } } - UUID uuid = event.getPlayer().getUniqueId(); - if ((cancelOnRotate || cancelOnMove) && movement.containsKey(uuid)) { - ImprovedRunnable timer = movement.get(uuid); - timer.cancel(); - CustomMessages.sendMessage(event.getPlayer(), "Teleport.eventMovement"); - ParticleManager.removeParticles(event.getPlayer(), timer.command); - movement.remove(uuid); - } + return cancelled; } public static HashMap getMovement() {