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