forked from SteamWar/SteamWar
Implement Area for FixedRegion
This commit is contained in:
+52
-28
@@ -26,6 +26,7 @@ import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.TestblockMode;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import lombok.NonNull;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
|
||||
@@ -36,9 +37,10 @@ import java.util.UUID;
|
||||
|
||||
public class FixedRegion implements Region {
|
||||
|
||||
private UUID uuid;
|
||||
private FixedFlagStorage flagStorage;
|
||||
private Prototype prototype;
|
||||
private final UUID uuid;
|
||||
private final FixedFlagStorage flagStorage;
|
||||
private final Prototype prototype;
|
||||
private final String skin;
|
||||
|
||||
private final Area area;
|
||||
private final Area build;
|
||||
@@ -52,7 +54,7 @@ public class FixedRegion implements Region {
|
||||
uuid = UUID.nameUUIDFromBytes(name.getBytes(StandardCharsets.UTF_8));
|
||||
this.flagStorage = flagStorage;
|
||||
this.prototype = prototype;
|
||||
System.out.println(name + " " + prototype + " " + flagStorage);
|
||||
this.skin = prototype.getDefaultSkin();
|
||||
|
||||
Point minPoint;
|
||||
if (regionConfig.containsKey("minX", Integer.class) && regionConfig.containsKey("minY", Integer.class) && regionConfig.containsKey("minZ", Integer.class)) {
|
||||
@@ -78,21 +80,24 @@ public class FixedRegion implements Region {
|
||||
return minPoint;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EditSession copy(boolean extension) {
|
||||
return null; // TODO: Implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public File getResetFile() {
|
||||
return null; // TODO: Implement
|
||||
return prototype.getSkinMap().get(skin).getSchematicFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(PasteBuilder pasteBuilder, boolean extension) {
|
||||
// TODO: Implement
|
||||
pasteBuilder.reset(extension)
|
||||
.minPoint(getMinPoint(extension))
|
||||
.maxPoint(getMaxPoint(extension))
|
||||
.waterLevel(waterLevel);
|
||||
if (pasteBuilder.getClipboardProvider().is(PasteBuilder.SchematicProvider.class)) {
|
||||
SchematicType schematicType = pasteBuilder.getClipboardProvider().as(PasteBuilder.SchematicProvider.class).getSchematic().getSchemtype();
|
||||
pasteBuilder.rotate(schematicType.fightType() || schematicType.check());
|
||||
}
|
||||
pasteBuilder.pastePoint(minPoint.add(prototype.getSizeX() / 2, 0, prototype.getSizeY() / 2));
|
||||
regionHistory.remember(pasteBuilder.run());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -128,21 +133,24 @@ public class FixedRegion implements Region {
|
||||
return copyPoint;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EditSession copy(boolean extension) {
|
||||
return null; // TODO: Implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public File getResetFile() {
|
||||
return null; // TODO: Implement
|
||||
return prototype.getSkinMap().get(skin).getBuildSchematicFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(PasteBuilder pasteBuilder, boolean extension) {
|
||||
// TODO: Implement
|
||||
pasteBuilder.reset(extension)
|
||||
.minPoint(getMinPoint(extension))
|
||||
.maxPoint(getMaxPoint(extension))
|
||||
.waterLevel(waterLevel);
|
||||
if (pasteBuilder.getClipboardProvider().is(PasteBuilder.SchematicProvider.class)) {
|
||||
SchematicType schematicType = pasteBuilder.getClipboardProvider().as(PasteBuilder.SchematicProvider.class).getSchematic().getSchemtype();
|
||||
pasteBuilder.rotate(schematicType.fightType() || schematicType.check());
|
||||
}
|
||||
pasteBuilder.pastePoint(minPointBuild.add(prototype.getBuild().getSizeX() / 2, 0, prototype.getBuild().getSizeZ() / 2));
|
||||
regionHistory.remember(pasteBuilder.run());
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -181,21 +189,37 @@ public class FixedRegion implements Region {
|
||||
return copyPoint;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public EditSession copy(boolean extension) {
|
||||
return null; // TODO: Implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public File getResetFile() {
|
||||
return null; // TODO: Implement
|
||||
return prototype.getSkinMap().get(skin).getTestblockSchematicFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(PasteBuilder pasteBuilder, boolean extension) {
|
||||
// TODO: Implement
|
||||
pasteBuilder.reset(extension)
|
||||
.minPoint(getMinPoint(extension))
|
||||
.maxPoint(getMaxPoint(extension))
|
||||
.waterLevel(waterLevel);
|
||||
if (pasteBuilder.getClipboardProvider().is(PasteBuilder.SchematicProvider.class)) {
|
||||
SchematicType schematicType = pasteBuilder.getClipboardProvider().as(PasteBuilder.SchematicProvider.class).getSchematic().getSchemtype();
|
||||
pasteBuilder.rotate(schematicType.fightType() || schematicType.check());
|
||||
}
|
||||
Point pastePoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, prototype.getTestblock().getSizeZ() / 2);
|
||||
if (pasteBuilder.getClipboardProvider().is(PasteBuilder.SchematicProvider.class)) {
|
||||
SchematicType schematicType = pasteBuilder.getClipboardProvider().as(PasteBuilder.SchematicProvider.class).getSchematic().getSchemtype();
|
||||
if (schematicType.getKuerzel().equalsIgnoreCase("wg")) {
|
||||
pastePoint = pastePoint.add(0, 0, 1);
|
||||
}
|
||||
if (schematicType.getKuerzel().equalsIgnoreCase("ws")) {
|
||||
pastePoint = pastePoint.add(-1, 0, 1);
|
||||
}
|
||||
if (schematicType.getKuerzel().equalsIgnoreCase("as")) {
|
||||
pastePoint = pastePoint.add(-1, 0, 1);
|
||||
}
|
||||
}
|
||||
pasteBuilder.pastePoint(pastePoint);
|
||||
regionHistory.remember(pasteBuilder.run());
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user