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;
}