Dieser Commit ist enthalten in:
Ursprung
5a32b90499
Commit
6c30fae13d
@ -125,35 +125,22 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
|
||||
private final Map<String, Long> timing = new HashMap<>();
|
||||
|
||||
private void start(String name) {
|
||||
timing.put(name, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private long stop(String name) {
|
||||
return System.currentTimeMillis() - timing.getOrDefault(name, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
|
||||
start("clipboardLoad");
|
||||
Clipboard clipboard;
|
||||
try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) {
|
||||
clipboard = reader.read();
|
||||
} catch (NullPointerException | IOException e) {
|
||||
throw new SecurityException("Bausystem schematic not found", e);
|
||||
}
|
||||
System.out.println("Clipboard Load: " + stop("clipboardLoad"));
|
||||
|
||||
start("paste");
|
||||
EditSession editSession = paste(clipboard, pastePoint, pasteOptions);
|
||||
System.out.println("Paste: " + stop("paste"));
|
||||
return editSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions) {
|
||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
||||
start("changeColor");
|
||||
if (pasteOptions.getColor() != Color.YELLOW) {
|
||||
changeColor(clipboard, pasteOptions.getColor());
|
||||
}
|
||||
@ -187,9 +174,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
}
|
||||
});
|
||||
}
|
||||
System.out.println("ChangeColor: " + stop("changeColor"));
|
||||
|
||||
start("transform");
|
||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
BlockVector3 v = BlockVector3.at(pastePoint.getX(), pastePoint.getY(), pastePoint.getZ());
|
||||
@ -200,19 +185,14 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
||||
} else {
|
||||
v = v.subtract(dimensions.getX() / 2, 0, dimensions.getZ() / 2).subtract(offset);
|
||||
}
|
||||
System.out.println("Transform: " + stop("transform"));
|
||||
|
||||
start("reset");
|
||||
if (pasteOptions.isReset()) {
|
||||
e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
||||
if (pasteOptions.getWaterLevel() != 0) {
|
||||
e.setBlocks((Region) new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
||||
}
|
||||
}
|
||||
System.out.println("Reset: " + stop("reset"));
|
||||
start("operation");
|
||||
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteOptions.isIgnoreAir()).build());
|
||||
System.out.println("Operation: " + stop("operation"));
|
||||
return e;
|
||||
} catch (WorldEditException e) {
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
|
@ -56,7 +56,6 @@ public class BauGUI {
|
||||
if (ITEMS.containsKey(item.getId())) {
|
||||
throw new IllegalArgumentException("Duplicate Id Key: " + item.getId() + ". From Classes: " + ITEMS.get(item.getId()).getClass().getName() + " and " + item.getClass().getName());
|
||||
}
|
||||
System.out.println("Added Item: " + item.getId());
|
||||
ITEMS.put(item.getId(), item);
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren