Fix ObserverTracerCommand
Fix ObserverTracer Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
2c88381146
Commit
cd80c0a741
@ -314,6 +314,8 @@ LOADTIMER_SUMARY_STATS_FREQ=§7Belade Frequenz: §e{0}/m§8, §7Schuss Frequenz:
|
|||||||
# Observer
|
# Observer
|
||||||
OBSERVER_HELP = §7Rechts-Klicke einen Observer um den Trace zu bekommen. Hierfür müssen Flammenpartikel an sein. Die Partikel werden im Block angezeigt.
|
OBSERVER_HELP = §7Rechts-Klicke einen Observer um den Trace zu bekommen. Hierfür müssen Flammenpartikel an sein. Die Partikel werden im Block angezeigt.
|
||||||
OBSERVER_DELETE = §7Observer Trace gelöscht
|
OBSERVER_DELETE = §7Observer Trace gelöscht
|
||||||
|
OBSERVER_RETRACE_DONE = §7Observer Trace neu berechnet
|
||||||
|
OBSERVER_RETRACE_NO-TRACE = §7Kein Observer Trace zum neu berechnen
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
OTHER_ITEMS_TELEPORT_NAME=§eTeleporter
|
OTHER_ITEMS_TELEPORT_NAME=§eTeleporter
|
||||||
|
@ -71,12 +71,17 @@ public class ObserverTracer {
|
|||||||
seen.add(b.getLocation());
|
seen.add(b.getLocation());
|
||||||
spawnParticle(player, b.getLocation(), b);
|
spawnParticle(player, b.getLocation(), b);
|
||||||
|
|
||||||
switch (b.getType()) {
|
if (b.getType() == Material.OBSERVER) {
|
||||||
case OBSERVER:
|
|
||||||
calculateObserver(b);
|
calculateObserver(b);
|
||||||
break;
|
continue;
|
||||||
default:
|
}
|
||||||
|
|
||||||
BlockData blockData = b.getBlockData();
|
BlockData blockData = b.getBlockData();
|
||||||
|
if (blockData instanceof Fence) {
|
||||||
|
calculateSimple(b);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (blockData instanceof Door) {
|
if (blockData instanceof Door) {
|
||||||
if (((Door) blockData).getHalf() == Bisected.Half.BOTTOM) {
|
if (((Door) blockData).getHalf() == Bisected.Half.BOTTOM) {
|
||||||
blockList.add(b.getLocation().add(0, 1, 0).getBlock());
|
blockList.add(b.getLocation().add(0, 1, 0).getBlock());
|
||||||
@ -86,13 +91,11 @@ public class ObserverTracer {
|
|||||||
}
|
}
|
||||||
if (checkAllowed(b, blockData)) {
|
if (checkAllowed(b, blockData)) {
|
||||||
calculateSpecial(b);
|
calculateSpecial(b);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (b.getType().isBlock() && b.getType().isSolid()) {
|
|
||||||
|
if (b.getType().isBlock() && b.getType().isSolid() && b.getType().isOccluding()) {
|
||||||
calculateSolidBlock(b);
|
calculateSolidBlock(b);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +128,27 @@ public class ObserverTracer {
|
|||||||
blockList.add(b);
|
blockList.add(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (observer.getFacing() == BlockFace.UP) {
|
||||||
|
Location location = block.getLocation();
|
||||||
|
location.add(0, -2, 0);
|
||||||
|
if (location.getY() >= 0) {
|
||||||
|
Block b = location.getBlock();
|
||||||
|
if (b.getType() == Material.DROPPER || b.getType() == Material.DISPENSER) {
|
||||||
|
blockList.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (observer.getFacing() != BlockFace.UP && observer.getFacing() != BlockFace.DOWN) {
|
||||||
|
Location location = block.getLocation();
|
||||||
|
BlockFace blockFace = observer.getFacing().getOppositeFace();
|
||||||
|
location.add(blockFace.getModX(), -1, blockFace.getModZ());
|
||||||
|
if (location.getY() >= 0) {
|
||||||
|
Block b = location.getBlock();
|
||||||
|
if (b.getType() == Material.DROPPER || b.getType() == Material.DISPENSER) {
|
||||||
|
blockList.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateRedstoneLamp(Block block) {
|
private void calculateRedstoneLamp(Block block) {
|
||||||
@ -161,21 +185,79 @@ public class ObserverTracer {
|
|||||||
if (block.getType() == Material.REDSTONE_LAMP) {
|
if (block.getType() == Material.REDSTONE_LAMP) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (block.getType() == Material.BELL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return blockData instanceof Door
|
return blockData instanceof Door
|
||||||
|| blockData instanceof Gate
|
|| blockData instanceof Gate
|
||||||
|| blockData instanceof NoteBlock
|
|| blockData instanceof NoteBlock
|
||||||
|| blockData instanceof CraftPoweredRail
|
|| blockData instanceof CraftPoweredRail
|
||||||
|| blockData instanceof TrapDoor;
|
|| blockData instanceof TrapDoor
|
||||||
|
|| blockData instanceof GlassPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateSpecial(Block block) {
|
private void calculateSpecial(Block block) {
|
||||||
|
BlockData blockData = block.getBlockData();
|
||||||
|
Location blockLocation = block.getLocation();
|
||||||
|
if (blockData instanceof TrapDoor) {
|
||||||
|
TrapDoor trapDoor = (TrapDoor) blockData;
|
||||||
|
fence(trapDoor.getFacing().getOppositeFace(), blockLocation);
|
||||||
|
}
|
||||||
|
if (blockData instanceof Door) {
|
||||||
|
Door door = (Door) blockData;
|
||||||
|
fence(door.getFacing().getOppositeFace(), blockLocation);
|
||||||
|
fence(doorHinge(door.getFacing(), door.getHinge()), blockLocation);
|
||||||
|
}
|
||||||
|
calculateSimple(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fence(BlockFace current, Location location) {
|
||||||
|
Block b = location.clone().add(current.getModX(), current.getModY(), current.getModZ()).getBlock();
|
||||||
|
if (b.getBlockData() instanceof Fence || b.getBlockData() instanceof GlassPane) {
|
||||||
|
blockList.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BlockFace doorHinge(BlockFace blockFace, Door.Hinge hinge) {
|
||||||
|
switch (blockFace) {
|
||||||
|
case WEST:
|
||||||
|
if (hinge == Door.Hinge.RIGHT) {
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
} else {
|
||||||
|
return BlockFace.SOUTH;
|
||||||
|
}
|
||||||
|
case SOUTH:
|
||||||
|
if (hinge == Door.Hinge.RIGHT) {
|
||||||
|
return BlockFace.WEST;
|
||||||
|
} else {
|
||||||
|
return BlockFace.EAST;
|
||||||
|
}
|
||||||
|
case EAST:
|
||||||
|
if (hinge == Door.Hinge.RIGHT) {
|
||||||
|
return BlockFace.SOUTH;
|
||||||
|
} else {
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
}
|
||||||
|
case NORTH:
|
||||||
|
if (hinge == Door.Hinge.RIGHT) {
|
||||||
|
return BlockFace.EAST;
|
||||||
|
} else {
|
||||||
|
return BlockFace.WEST;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
throw new SecurityException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateSimple(Block block) {
|
||||||
|
Location blockLocation = block.getLocation();
|
||||||
for (BlockFace blockFace : ALLOWED) {
|
for (BlockFace blockFace : ALLOWED) {
|
||||||
Location location = block.getLocation().add(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());
|
Location location = blockLocation.clone().add(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());
|
||||||
Block b = location.getBlock();
|
Block b = location.getBlock();
|
||||||
if (b.getType() == Material.OBSERVER) {
|
if (b.getType() == Material.OBSERVER) {
|
||||||
Observer blockData = (Observer) b.getBlockData();
|
Observer current = (Observer) b.getBlockData();
|
||||||
if (blockData.getFacing() == blockFace.getOppositeFace()) {
|
if (current.getFacing() == blockFace.getOppositeFace()) {
|
||||||
blockList.add(b);
|
blockList.add(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,4 +44,14 @@ public class ObserverTracerCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("OBSERVER_DELETE", p);
|
BauSystem.MESSAGE.send("OBSERVER_DELETE", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Register(value = "retrace")
|
||||||
|
public void retrace(Player p) {
|
||||||
|
if (ObserverTracerListener.observerTracerMap.containsKey(p)) {
|
||||||
|
BauSystem.MESSAGE.send("OBSERVER_RETRACE_NO-TRACE", p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ObserverTracerListener.observerTracerMap.get(p).trace();
|
||||||
|
BauSystem.MESSAGE.send("OBSERVER_RETRACE_DONE", p);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren