From bf18c82d6d6aedaab207fb3b5eae93cde00a33d5 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 10 May 2021 15:27:29 +0200 Subject: [PATCH] Fixed broken if-statements --- .../LinkedBeaconTeleporterBlock.java | 18 +++++++++--------- .../LinkedBeaconTeleporterItem.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterBlock.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterBlock.java index 3e516b1..e280749 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterBlock.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterBlock.java @@ -31,6 +31,15 @@ public class LinkedBeaconTeleporterBlock extends LinkedBeaconTeleporter { e.setDropItems(false); e.setExpToDrop(0); + // Notify Player when link was destroyed + if(this.linkedBeaconTeleporters.size()-1 < 2){ + e.getPlayer().sendMessage("§cConnection to Teleporter with id §7"+ this.teleporterId +" §e("+ + (int)((LinkedBeaconTeleporterBlock)this.linkedBeaconTeleporters.get(0)).block.getLocation().distance( + ((LinkedBeaconTeleporterBlock)this.linkedBeaconTeleporters.get(1)).block().getLocation() + ) + +" Blocks away) §cdestroyed"); + } + // Remove from list this.linkedBeaconTeleporters.remove(this); // TODO: Remove from placedLBTsById when empty? @@ -50,15 +59,6 @@ public class LinkedBeaconTeleporterBlock extends LinkedBeaconTeleporter { lbtItem.item() ); - // Notify Player when link was destroyed - if(this.linkedBeaconTeleporters.size() < 2){ - e.getPlayer().sendMessage("§cConnection to Teleporter with id §7"+ this.teleporterId +" §e("+ - (int)((LinkedBeaconTeleporterBlock)this.linkedBeaconTeleporters.get(0)).block.getLocation().distance( - ((LinkedBeaconTeleporterBlock)this.linkedBeaconTeleporters.get(1)).block().getLocation() - ) - +" Blocks away) §cdestroyed"); - } - return lbtItem; } diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java index 78e2266..e1bb3ec 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterItem.java @@ -70,7 +70,7 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter { ); // Notify Player when no other teleporter was found (yet?) - if(this.linkedBeaconTeleporters.size() == 2){ + if(this.linkedBeaconTeleporters.size() == 1){ e.getPlayer().sendMessage("§6No other Teleporter found with with id §7"+ this.teleporterId); } // Notify Player when we have a full link