Remove cancelling teleports for dealing damage

This commit is contained in:
William committed 2022-01-17 13:51:28 +00:00
1 parent 8d7da86c1e
commit a3de8f6a3a
6 files changed
-22

No files matched your search

@@ -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;
}
-1
View File
@@ -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)'
-1
View File
@@ -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)'
-1
View File
@@ -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)'
-1
View File
@@ -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)'
-1
View File
@@ -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=&#00fb9a&%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)'