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_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_PERM = §cDu darfst hier nicht das Panzern System verwenden
|
||||||
PANZERN_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection
|
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
|
PANZERN_DONE = §aZuende gepanzert
|
@ -24,6 +24,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.*;
|
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 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> current = new HashSet<>(); // Potenzielle geschwindigkeit durch `LinkedHashSet<>();` möchte aber lieber ein HashSet nehmen, weil dieses besser für mein Anwendungsfall ist
|
||||||
private Set<Location> emptyBlocks = new HashSet<>();
|
private Set<Vector> emptyBlocks = new HashSet<>();
|
||||||
|
|
||||||
private World world;
|
private World world;
|
||||||
private Location pos1;
|
private Location pos1;
|
||||||
@ -91,7 +92,7 @@ public class Panzern {
|
|||||||
|
|
||||||
switch (panzernResult) {
|
switch (panzernResult) {
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
emptyBlocks.add(currentBlock.getLocation());
|
emptyBlocks.add(currentBlock.getLocation().toVector());
|
||||||
return;
|
return;
|
||||||
case SLAB:
|
case SLAB:
|
||||||
currentBlock.setType(slabMaterial);
|
currentBlock.setType(slabMaterial);
|
||||||
@ -104,12 +105,12 @@ public class Panzern {
|
|||||||
currentBlock.setType(Material.JUKEBOX);
|
currentBlock.setType(Material.JUKEBOX);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
emptyBlocks.add(currentBlock.getLocation());
|
emptyBlocks.add(currentBlock.getLocation().toVector());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjacent.forEach((blockFace, temp) -> {
|
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());
|
current.add(temp.getLocation());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -76,15 +76,24 @@ public class PanzernCommand extends SWCommand {
|
|||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("PANZERN_PROGRESS", player, panzern.blocksLeft()));
|
int blockLeft = panzern.blocksLeft();
|
||||||
for (int i = 0; i < 1000; i++) {
|
long totalTime = 0;
|
||||||
|
long blocks = 0;
|
||||||
|
while (true) {
|
||||||
if (!panzern.hasNext()) {
|
if (!panzern.hasNext()) {
|
||||||
BauSystem.MESSAGE.send("PANZERN_DONE", player);
|
BauSystem.MESSAGE.send("PANZERN_DONE", player);
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
panzern.next();
|
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);
|
}.runTaskTimer(BauSystem.getInstance(), 1, 1);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren