Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
8f2e5df3a7
Commit
d437b450e5
@ -527,5 +527,5 @@ PANZERN_PREPARE3 = §73. Schildtechnik sollte explizit eingeschlossen sein.
|
||||
PANZERN_PREPARE4 = §74. Innerhalb der zu panzernden Region zu stehen, beim Befehlausführen kann das Panzern verbessern.
|
||||
PANZERN_NO_PERM = §cDu darfst hier nicht das Panzern System verwenden
|
||||
PANZERN_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection
|
||||
PANZERN_PROGRESS = §e{0} §7Blöcke übrig
|
||||
PANZERN_PROGRESS = §e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{2} §7Block Delta
|
||||
PANZERN_DONE = §aZuende gepanzert
|
@ -24,6 +24,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -37,8 +38,8 @@ public class Panzern {
|
||||
|
||||
private static final BlockFace[] BLOCK_FACES = new BlockFace[]{BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN};
|
||||
|
||||
private Set<Location> current = new HashSet<>();
|
||||
private Set<Location> emptyBlocks = new HashSet<>();
|
||||
private Set<Location> current = new HashSet<>(); // Potenzielle geschwindigkeit durch `LinkedHashSet<>();` möchte aber lieber ein HashSet nehmen, weil dieses besser für mein Anwendungsfall ist
|
||||
private Set<Vector> emptyBlocks = new HashSet<>();
|
||||
|
||||
private World world;
|
||||
private Location pos1;
|
||||
@ -91,7 +92,7 @@ public class Panzern {
|
||||
|
||||
switch (panzernResult) {
|
||||
case EMPTY:
|
||||
emptyBlocks.add(currentBlock.getLocation());
|
||||
emptyBlocks.add(currentBlock.getLocation().toVector());
|
||||
return;
|
||||
case SLAB:
|
||||
currentBlock.setType(slabMaterial);
|
||||
@ -104,12 +105,12 @@ public class Panzern {
|
||||
currentBlock.setType(Material.JUKEBOX);
|
||||
break;
|
||||
default:
|
||||
emptyBlocks.add(currentBlock.getLocation());
|
||||
emptyBlocks.add(currentBlock.getLocation().toVector());
|
||||
break;
|
||||
}
|
||||
|
||||
adjacent.forEach((blockFace, temp) -> {
|
||||
if (temp.getType().isAir() && !emptyBlocks.contains(temp.getLocation())) {
|
||||
if (temp.getType().isAir() && !emptyBlocks.contains(temp.getLocation().toVector())) {
|
||||
current.add(temp.getLocation());
|
||||
}
|
||||
});
|
||||
|
@ -76,16 +76,25 @@ public class PanzernCommand extends SWCommand {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("PANZERN_PROGRESS", player, panzern.blocksLeft()));
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
int blockLeft = panzern.blocksLeft();
|
||||
long totalTime = 0;
|
||||
long blocks = 0;
|
||||
while (true) {
|
||||
if (!panzern.hasNext()) {
|
||||
BauSystem.MESSAGE.send("PANZERN_DONE", player);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
long time = System.currentTimeMillis();
|
||||
panzern.next();
|
||||
totalTime += System.currentTimeMillis() - time;
|
||||
blocks++;
|
||||
if (totalTime > 40) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("PANZERN_PROGRESS", player, panzern.blocksLeft(), blocks * 20, panzern.blocksLeft() - blockLeft));
|
||||
}
|
||||
}.runTaskTimer(BauSystem.getInstance(), 1, 1);
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren