SteamWar/BauSystem2.0
Archiviert
12
0

Fix Region.reset

Initial fix for Region.inRegion one off
Dieser Commit ist enthalten in:
yoyosource 2021-04-21 14:13:01 +02:00
Ursprung 1c91105367
Commit f0fa92f5ca

Datei anzeigen

@ -20,15 +20,12 @@
package de.steamwar.bausystem.region;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.shared.SizedStack;
import de.steamwar.core.VersionedCallable;
import de.steamwar.sql.Schematic;
import lombok.AccessLevel;
import lombok.Getter;
@ -194,9 +191,9 @@ public class Region {
}
private boolean inRegion(Location location, Point minPoint, Point maxPoint) {
return location.getBlockX() >= minPoint.getX() && location.getBlockX() < maxPoint.getX() &&
location.getBlockY() >= minPoint.getY() && location.getBlockY() < maxPoint.getY() &&
location.getBlockZ() >= minPoint.getZ() && location.getBlockZ() < maxPoint.getZ();
return location.getBlockX() >= minPoint.getX() && location.getBlockX() <= maxPoint.getX() &&
location.getBlockY() >= minPoint.getY() && location.getBlockY() <= maxPoint.getY() &&
location.getBlockZ() >= minPoint.getZ() && location.getBlockZ() <= maxPoint.getZ();
}
public boolean hasType(RegionType regionType) {
@ -356,35 +353,37 @@ public class Region {
PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemType().fightType() || schematic.getSchemType().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel);
EditSession editSession = null;
Point pastePoint;
File tempFile = null;
switch (regionType) {
case BUILD:
System.out.println(schematic + " " + prototype.getBuild().getSchematicFile() + " " + regionType + " " + regionExtensionType + " " + minPointBuild);
if (schematic != null) {
editSession = paste(schematic.load(), minPointBuild, pasteOptions);
} else {
editSession = paste(prototype.getBuild().getSchematicFile(), minPointBuild, pasteOptions);
pastePoint = minPointBuild.add(prototype.getBuild().getSizeX() / 2, 0, prototype.getBuild().getSizeZ() / 2);
if (schematic == null) {
tempFile = prototype.getBuild().getSchematicFile();
}
break;
case TESTBLOCK:
System.out.println(schematic + " " + prototype.getBuild().getSchematicFile() + " " + regionType + " " + regionExtensionType + " " + minPointTestblock);
if (schematic != null) {
editSession = paste(schematic.load(), minPointTestblock, pasteOptions);
} else {
editSession = paste(prototype.getTestblock().getSchematicFile(), minPointTestblock, pasteOptions);
pastePoint = minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, prototype.getTestblock().getSizeZ() / 2);
if (schematic == null) {
tempFile = prototype.getTestblock().getSchematicFile();
}
break;
default:
case NORMAL:
System.out.println(schematic + " " + prototype.getBuild().getSchematicFile() + " " + regionType + " " + regionExtensionType + " " + minPoint);
if (schematic != null) {
editSession = paste(schematic.load(), minPoint, pasteOptions);
} else {
editSession = paste(prototype.getSchematicFile(), minPoint, pasteOptions);
pastePoint = minPoint.add(prototype.getSizeX() / 2, 0, prototype.getSizeZ() / 2);
if (schematic == null) {
tempFile = prototype.getSchematicFile();
}
break;
}
EditSession editSession = null;
if (schematic != null) {
editSession = paste(schematic.load(), pastePoint, pasteOptions);
} else {
editSession = paste(tempFile, pastePoint, pasteOptions);
}
initSessions();
undoSessions.push(editSession);
}