From a3de8f6a3a07f9f1e45f758dceaf739da4ae4d56 Mon Sep 17 00:00:00 2001 From: William Date: Mon, 17 Jan 2022 13:51:28 +0000 Subject: [PATCH] Remove cancelling teleports for dealing damage --- .../huskhomes2/teleport/TimedTeleport.java | 17 ----------------- src/main/resources/languages/en-gb.yml | 1 - src/main/resources/languages/it-it.yml | 1 - src/main/resources/languages/pl.yml | 1 - src/main/resources/languages/zh-cn.yml | 1 - src/main/resources/languages/zh-tw.yml | 1 - 6 files changed, 22 deletions(-) diff --git a/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java b/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java index bec049bf..ad7489d8 100644 --- a/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java +++ b/src/main/java/me/william278/huskhomes2/teleport/TimedTeleport.java @@ -30,7 +30,6 @@ public class TimedTeleport { private final Player player; private final Location initialLocation; private final double initialHealth; - private final int initialDamageDealt; private final int warmupTime = HuskHomes.getSettings().getTeleportWarmupTime(); @@ -38,7 +37,6 @@ public class TimedTeleport { this.player = player; this.initialLocation = player.getLocation(); this.initialHealth = player.getHealth(); - this.initialDamageDealt = player.getStatistic(Statistic.DAMAGE_DEALT); this.targetType = targetType; this.targetPoint = targetPoint; @@ -50,7 +48,6 @@ public class TimedTeleport { this.player = player; this.initialLocation = player.getLocation(); this.initialHealth = player.getHealth(); - this.initialDamageDealt = player.getStatistic(Statistic.DAMAGE_DEALT); this.targetType = TargetType.RANDOM; MessageManager.sendMessage(player, "teleporting_countdown_start", Integer.toString(this.warmupTime)); @@ -61,7 +58,6 @@ public class TimedTeleport { this.player = player; this.initialLocation = player.getLocation(); this.initialHealth = player.getHealth(); - this.initialDamageDealt = player.getStatistic(Statistic.DAMAGE_DEALT); this.targetType = TargetType.PLAYER; this.targetPlayerName = targetPlayerName; @@ -93,13 +89,6 @@ public class TimedTeleport { sendWarmupMessage(player, "teleporting_action_bar_cancelled"); return; } - if (hasDealtDamage(executablePlayer)) { - cancel(); - executablePlayer.playSound(executablePlayer.getLocation(), HuskHomes.getSettings().getTeleportCancelledSound(), 1, 1); - MessageManager.sendMessage(player, "teleporting_cancelled_pvp"); - sendWarmupMessage(player, "teleporting_action_bar_cancelled"); - return; - } i[0] = i[0] - 1; if (i[0] == 0) { cancel(); @@ -202,12 +191,6 @@ public class TimedTeleport { return totalDiff > movementThreshold; } - // This returns if the player has dealt damage - public boolean hasDealtDamage(Player p) { - final int damageDealt = p.getStatistic(Statistic.DAMAGE_DEALT); - return damageDealt > initialDamageDealt; - } - public Player getPlayer() { return player; } diff --git a/src/main/resources/languages/en-gb.yml b/src/main/resources/languages/en-gb.yml index a1ab93ba..aecc3cbc 100644 --- a/src/main/resources/languages/en-gb.yml +++ b/src/main/resources/languages/en-gb.yml @@ -120,7 +120,6 @@ error_invalid_player: '[Error:](#ff3300) [Please specify the name of a valid pla error_no_homes_set_other: '[Error:](#ff3300) [%1% hasn''t set any homes!](#ff7e5e)' error_home_invalid_other: '[Error:](#ff3300) [%1% doesn''t have a home set named "%2%"](#ff7e5e)' error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)' -teleporting_cancelled_pvp: '[Teleportation cancelled; you engaged in combat!](#ff7e5e)' tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)' diff --git a/src/main/resources/languages/it-it.yml b/src/main/resources/languages/it-it.yml index 6262542f..aaccca42 100644 --- a/src/main/resources/languages/it-it.yml +++ b/src/main/resources/languages/it-it.yml @@ -120,7 +120,6 @@ error_home_invalid_other: '[Errore:](#ff3300) [%1% non ha una home chiamata "%2% home_deleted_other: '[Hai cancellato la home](#00fb9a)[%2%](#00fb9a bold)[di %1%](#00fb9a) ' edit_home_privacy_private_other: '• Accesso: &#ff7e5e&Privato &7(Solo %1% può usarla)' error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)' -teleporting_cancelled_pvp: '[Teleportation cancelled; you engaged in combat!](#ff7e5e)' tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)' diff --git a/src/main/resources/languages/pl.yml b/src/main/resources/languages/pl.yml index 6521b0d6..c9a8c301 100644 --- a/src/main/resources/languages/pl.yml +++ b/src/main/resources/languages/pl.yml @@ -120,7 +120,6 @@ error_home_invalid_other: '[Błąd:](#ff3300) [%1% nie ma domu nazwanego "%2%"]( home_deleted_other: '[Pomyślnie usunięto dom %1%,](#00fb9a) [%2%](#00fb9a bold)' edit_home_privacy_private_other: '• Dostęp: &#ff7e5e&Prywatny &7(Tylko %1% może to użyć)' error_edit_home_maximum_public_homes: '[Błąd:](#ff3300) [Możesz maksymalnie utworzyć %1% publicznych domów.](#ff7e5e)' -teleporting_cancelled_pvp: '[Teleportation cancelled; you engaged in combat!](#ff7e5e)' tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)' diff --git a/src/main/resources/languages/zh-cn.yml b/src/main/resources/languages/zh-cn.yml index 698e9633..a2ccac5d 100644 --- a/src/main/resources/languages/zh-cn.yml +++ b/src/main/resources/languages/zh-cn.yml @@ -120,7 +120,6 @@ error_home_invalid_other: '[错误:](#ff3300) [%1% 没有叫做 "%2%" 的家](#f home_deleted_other: '[成功删除了 %1% 的名字叫](#00fb9a) [%2%](#00fb9a bold) [的家](#00fb9a)' edit_home_privacy_private_other: '• 隐私性: &#ff7e5e&私有的 &7(只有 %1% 可以使用该家)' error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)' -teleporting_cancelled_pvp: '[Teleportation cancelled; you engaged in combat!](#ff7e5e)' tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)' diff --git a/src/main/resources/languages/zh-tw.yml b/src/main/resources/languages/zh-tw.yml index f5f98fab..381b183b 100644 --- a/src/main/resources/languages/zh-tw.yml +++ b/src/main/resources/languages/zh-tw.yml @@ -120,7 +120,6 @@ edit_home_privacy_private_other: '• Access: &#ff7e5e&Private &7(Only %1% can u edit_home_title_other: '\n[Edit home details for %1%''s home,](#00fb9a) [%2%](#00fb9a bold)[:](#00fb9a)' command_list_item: '[/%1%](#00fb9a show_text=�fb9a&%2% suggest_command=/%1%) [•](white) [%3%](gray)' error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)' -teleporting_cancelled_pvp: '[Teleportation cancelled; you engaged in combat!](#ff7e5e)' tpaall_request_sent: '[You sent a teleport request asking everyone to teleport to you!](#00fb9a)' error_no_other_online_players: '[Error:](#ff3300) [There are no other online players who could teleport to you.](#ff7e5e)' teleporting_all_players: '[Teleporting all players to your position...](#00fb9a)'