SteamWar/FightSystem
Archiviert
13
1

HellsBells #275

Manuell gemergt
Lixfel hat 19 Commits von Hells_bells nach master 2021-06-25 07:17:45 +02:00 zusammengeführt
Nur Änderungen aus Commit bdbb4c510b werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -42,6 +42,21 @@ public class HellsBells {
this.dz = dz;
this.zLength = zLength;
}
Direction other() {
switch (this) {
case NORTH:
return EAST;
case SOUTH:
return WEST;
case EAST:
return NORTH;
case WEST:
return SOUTH;
default:
return this;
}
}
}
public HellsBells() {
@ -141,19 +156,20 @@ public class HellsBells {
new BukkitRunnable() {
@Override
public void run() {
for (int z = 0; z < width; z++) {
for (int w = 0; w < width; w++) {
if (direction == Direction.NORTH || direction == Direction.WEST) {
world.spawnEntity(redStart.subtractAndToLocation(world, direction.dx * length.get(), 0, direction.dz * length.get()), EntityType.PRIMED_TNT);
world.spawnEntity(redStart.subtractAndToLocation(world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
world.spawnEntity(blueStart.addAndToLocation(world, direction.dx * length.get(), 0, direction.dz * length.get()), EntityType.PRIMED_TNT);
world.spawnEntity(blueStart.addAndToLocation(world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
} else {
world.spawnEntity(redStart.addAndToLocation(world, direction.dx * length.get(), 0, direction.dz * length.get()), EntityType.PRIMED_TNT);
world.spawnEntity(redStart.addAndToLocation(world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
world.spawnEntity(blueStart.subtractAndToLocation(world, direction.dx * length.get(), 0, direction.dz * length.get()), EntityType.PRIMED_TNT);
world.spawnEntity(blueStart.subtractAndToLocation(world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
}
}
if (length.decrementAndGet() == 0) {
length.decrementAndGet();
if (length.decrementAndGet() <= 0) {
cancel();
}
}