HellsBells #275
@ -132,28 +132,14 @@ public class HellsBells {
|
|||||||
int zOffset = getLengthStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
|
int zOffset = getLengthStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
|
||||||
int yOffset = getHeightStart();
|
int yOffset = getHeightStart();
|
||||||
|
|
||||||
Point redStart;
|
Point redStart = direction.isNorthOrWest() ? new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset) : new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset);
|
||||||
Point blueStart;
|
Point blueStart = direction.isNorthOrWest() ? new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset) : new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset);
|
||||||
|
|
||||||
if (direction.isNorthOrWest()) {
|
|
||||||
redStart = new Point(Config.RedPasteRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMaxZ() - zOffset);
|
|
||||||
blueStart = new Point(Config.BluePasteRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMinZ() + zOffset);
|
|
||||||
} else {
|
|
||||||
redStart = new Point(Config.RedPasteRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedPasteRegion.getMinZ() + zOffset);
|
|
||||||
blueStart = new Point(Config.BluePasteRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BluePasteRegion.getMaxZ() - zOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
|
|||||||
|
int factor = direction.isNorthOrWest() ? 1 : -1;
|
||||||
for (int w = 0; w < width; w++) {
|
for (int w = 0; w < width; w++) {
|
||||||
if (direction.isNorthOrWest()) {
|
world.spawnEntity(redStart.subtractAndToLocation(world, (direction.dx * length.get() + w * direction.other().dx) * factor, 0, (direction.dz * length.get() + w * direction.other().dz) * factor), EntityType.PRIMED_TNT);
|
||||||
Lixfel
hat
Kann glaube noch private static sein. Kann glaube noch private static sein.
|
|||||||
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() + w * direction.other().dx) * factor, 0, (direction.dz * length.get() + w * direction.other().dz) * factor), EntityType.PRIMED_TNT);
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Könnte man statt diesen Ifs nicht einfach eine Methode in der Direction machen, die dann den passenden Wert zurückgibt? Könnte man statt diesen Ifs nicht einfach eine Methode in der Direction machen, die dann den passenden Wert zurückgibt?
|
|||||||
|
|
||||||
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() + 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() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (length.addAndGet(-2) <= 0) {
|
if (length.addAndGet(-2) <= 0) {
|
||||||
currentDropping.cancel();
|
currentDropping.cancel();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Diesen if-Block kann man denke ich vereinfachen, wenn man stattdessen in den Assignments mit dem conditional-Operator arbeitet ?:.