Compare commits
No commits in common. "51c9ee0716877d95d730e0ce29b8d450202618fb" and "6c2e06afaf58ad4801d3c10aaf00f30000d88e24" have entirely different histories.
51c9ee0716
...
6c2e06afaf
@ -52,9 +52,7 @@ public class CustomPlayerMoveEventHandler {
|
||||
if(distance > 0)
|
||||
locationChangeListeners(e);
|
||||
}
|
||||
else if(loc.getBlockX() != oldLoc.getBlockX() ||
|
||||
loc.getBlockY() != oldLoc.getBlockY() ||
|
||||
loc.getBlockZ() != oldLoc.getBlockZ())
|
||||
else
|
||||
locationChangeListeners(e);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class LinkedBeaconTeleporterBlock extends LinkedBeaconTeleporter {
|
||||
e.setExpToDrop(0);
|
||||
|
||||
// Notify Player when link was destroyed
|
||||
if(this.linkedBeaconTeleporters.size() == 2){
|
||||
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()
|
||||
|
@ -56,10 +56,6 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
|
||||
|
||||
// Block from item
|
||||
LinkedBeaconTeleporterBlock lbtBlock = new LinkedBeaconTeleporterBlock(this.teleporterId(), block);
|
||||
// Both objects have different lists (as both are new), overwrite block-list with item-list
|
||||
// FIXME: This seems like a bad design.. maybe only create the list when necessary? (e.g. keep null if no linked objects found)
|
||||
lbtBlock.linkedBeaconTeleporters = this.linkedBeaconTeleporters;
|
||||
|
||||
// Add to list
|
||||
this.linkedBeaconTeleporters.add(lbtBlock);
|
||||
|
||||
|
@ -69,39 +69,29 @@ public class OnCustomPlayerMove implements CustomPlayerMoveEventListener {
|
||||
// Get first partner thats not our current-block
|
||||
LinkedBeaconTeleporterBlock lbtBlockPartner = null;
|
||||
for(LinkedBeaconTeleporter lbtBlockTmp: lbtBlock.linkedBeaconTeleporters()){
|
||||
if(lbtBlockTmp != lbtBlock){
|
||||
// Upcast as linked-Teleporters are only blocks anyways
|
||||
if((LinkedBeaconTeleporterBlock)lbtBlockTmp != lbtBlock){
|
||||
lbtBlockPartner = (LinkedBeaconTeleporterBlock)lbtBlockTmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(lbtBlockPartner == null){
|
||||
// No other partner
|
||||
p.sendMessage("§cNo linked beacon found with id §7"+ lbtBlock.teleporterId());
|
||||
|
||||
// Set player as ignored on this LinkedBeaconTeleporter (so he wont trigger the checks again)
|
||||
playerBeaconLocation.put(uuid, lbtBlock);
|
||||
}
|
||||
else{
|
||||
// TODO: Check if beacon is active
|
||||
// Set player as ignored on target-LinkedBeaconTeleporter (so he wont trigger the teleport again)
|
||||
playerBeaconLocation.put(uuid, lbtBlockPartner);
|
||||
|
||||
// Get safe-location on top of other beacon
|
||||
Block safeBlock = Function.searchForMaterial(
|
||||
lbtBlockPartner.block().getLocation().add(0, 1, 0),
|
||||
new Vector(0, 1, 0),
|
||||
Material.AIR,
|
||||
Function.transparentMaterials
|
||||
Material.AIR
|
||||
);
|
||||
|
||||
if(safeBlock == null){
|
||||
// No safe location found
|
||||
p.sendMessage("§cNo safe-location found at target teleporter");
|
||||
return;
|
||||
}
|
||||
// TODO: Check if there is enough space for a player
|
||||
|
||||
// Set player as ignored on target-LinkedBeaconTeleporter (so he wont trigger the teleport again)
|
||||
playerBeaconLocation.put(uuid, lbtBlockPartner);
|
||||
|
||||
// Teleport
|
||||
e.player().teleport(
|
||||
safeBlock.getLocation().add(0.5, 0, 0.5)
|
||||
|
Loading…
x
Reference in New Issue
Block a user