Added player-messages

master
Ruakij 4 years ago
parent cf061f9d75
commit 2f64eb5ed0

@ -50,6 +50,15 @@ public class LinkedBeaconTeleporterBlock extends LinkedBeaconTeleporter {
lbtItem.item() 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; return lbtItem;
} }

@ -43,6 +43,14 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
public LinkedBeaconTeleporterBlock place(BlockPlaceEvent e){ public LinkedBeaconTeleporterBlock place(BlockPlaceEvent e){
// Deny placing when 2 LinkedBeaconTeleporter's are already placed
if(this.linkedBeaconTeleporters.size() == 2){
e.getPlayer().sendMessage("§cMaximum-Amount §7(2) §cof §6LinkedBeaconTeleporters §cwith id §7"+ this.teleporterId +" §care already placed");
e.setCancelled(true);
return null;
}
Block block = e.getBlock(); Block block = e.getBlock();
Location loc = block.getLocation(); Location loc = block.getLocation();
@ -61,6 +69,19 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
lbtBlock lbtBlock
); );
// Notify Player when no other teleporter was found (yet?)
if(this.linkedBeaconTeleporters.size() == 2){
e.getPlayer().sendMessage("§6No other Teleporter found with with id §7"+ this.teleporterId);
}
// Notify Player when we have a full link
else if(this.linkedBeaconTeleporters.size() == 2){
e.getPlayer().sendMessage("§aConnected 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)");
}
return lbtBlock; return lbtBlock;
} }

Loading…
Cancel
Save