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