SteamWar/BauSystem2.0
Archiviert
12
0

Add RegionCommand.testBlockPointCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-11-09 20:18:09 +01:00
Ursprung 02159988c9
Commit 7ecae162d9
6 geänderte Dateien mit 60 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -483,6 +483,7 @@ REGION_REGION_HELP_4=§8/§eregion §8[§7RegionsTyp§8] §8- §7Wähle einen Re
REGION_REGION_HELP_5=§8/§eregion §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension
REGION_REGION_HELP_6=§8/§eregion color §8[§7Color§8] §8- §7Ändere die Regions Farbe
REGION_REGION_HELP_7=§8/§eregion copypoint §8- §7Teleportiere dich zum Regions Kopierpunkt
REGION_REGION_HELP_8=§8/§eregion testblockpoint §8- §7Teleportiere dich zum Regions Testblockpunkt
REGION_REGION_NOTHING_UNDO=§cNichts zum rückgängig machen
REGION_REGION_UNDID=§7Letzte Aktion rückgangig gemacht
REGION_REGION_NOTHING_REDO=§cNichts zum wiederhohlen
@ -494,6 +495,8 @@ REGION_REGION_COLORED_FAILED=§7Nutze §e/rg restore§7 um manuell die Farbe zu
REGION_REGION_FAILED_COLORED=§cFehler beim umfärben der Region
REGION_REGION_NO_SCHEM=§cSchematic nicht gefunden
REGION_REGION_TP_COPY=§7Zum Kopierpunkt teleportiert
REGION_REGION_TP_TEST_BLOCK=§7Zum Testblock teleportiert
REGION_REGION_TP_UNKNOWN=§cNicht definierter Teleportierpunkt
REGION_REGION_NO_REGION=§cDu bist in keiner Region
REGION_REGION_NO_PERMS=§cDu darfst hier nicht die Region verändern
REGION_REGION_CHANGETYPE_INFO=§7Regions Type ist §e{0}

Datei anzeigen

@ -82,6 +82,7 @@ public class RegionCommand extends SWCommand {
BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_5", player);
BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_6", player);
BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_7", player);
BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_8", player);
}
@Register("undo")
@ -170,10 +171,29 @@ public class RegionCommand extends SWCommand {
if (checkGlobalRegion(region, p)) {
return;
}
if (region.getCopyPoint() == null) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
p.teleport(region.getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
BauSystem.MESSAGE.send("REGION_REGION_TP_COPY", p);
}
@Register("testblockpoint")
@Register("tbpoint")
public void testBlockPointCommand(Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
if (region.getTestBlockPoint() == null) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
p.teleport(region.getTestBlockPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
}
@Register("changetype")
@Register("type")
public void changeTypeCommand(Player p) {

Datei anzeigen

@ -89,7 +89,7 @@ public class Prototype {
if (PROTOTYPE_MAP.containsKey(name)) {
Region.getRegion(PROTOTYPE_MAP.remove(name)).forEach(region -> {
region.setPrototype(this);
region._setPrototype(this);
});
}
PROTOTYPE_MAP.put(name, this);
@ -117,6 +117,10 @@ public class Prototype {
private boolean extensionRegistered;
private final int copyOffsetX;
private final int copyOffsetY;
private final int copyOffsetZ;
private SubPrototype(YAPIONObject yapionObject) {
offsetX = yapionObject.getPlainValueOrDefault("offsetX", 0);
offsetY = yapionObject.getPlainValueOrDefault("offsetY", 0);
@ -157,6 +161,10 @@ public class Prototype {
}
extensionRegistered = extensionNegativeX != 0 || extensionPositiveX != 0 || extensionNegativeY != 0 || extensionPositiveY != 0 || extensionNegativeZ != 0 || extensionPositiveZ != 0;
copyOffsetX = yapionObject.getPlainValueOrDefault("copyOffsetX", 0);
copyOffsetY = yapionObject.getPlainValueOrDefault("copyOffsetY", 0);
copyOffsetZ = yapionObject.getPlainValueOrDefault("copyOffsetZ", 0);
}
}

Datei anzeigen

@ -99,6 +99,7 @@ public class Region {
private int waterLevel;
private Point copyPoint; // Nullable
private Point testBlockPoint; // Nullable
private String linkedRegionName = null; // Nullable
private Region linkedRegion = null; // Nullable
@ -156,6 +157,12 @@ public class Region {
this.minPointTestblockExtension = this.minPointTestblock.subtract(prototype.getTestblock().getExtensionNegativeX(), prototype.getTestblock().getExtensionNegativeY(), prototype.getTestblock().getExtensionNegativeZ());
this.maxPointTestblockExtension = this.maxPointTestblock.add(prototype.getTestblock().getExtensionPositiveX(), prototype.getTestblock().getExtensionPositiveY(), prototype.getTestblock().getExtensionPositiveZ());
if (prototype.getTestblock().getCopyOffsetX() != 0 || prototype.getTestblock().getCopyOffsetY() != 0 || prototype.getTestblock().getCopyOffsetZ() != 0) {
this.testBlockPoint = this.minPointTestblock.add(prototype.getTestblock().getCopyOffsetX(), prototype.getTestblock().getCopyOffsetY(), prototype.getTestblock().getCopyOffsetZ());
} else {
this.testBlockPoint = this.minPointTestblock.add(prototype.getTestblock().getSizeX() / 2, 0, -1);
}
}
if (prototype.getBuild() != null) {
@ -164,6 +171,16 @@ public class Region {
this.minPointBuildExtension = this.minPointBuild.subtract(prototype.getBuild().getExtensionNegativeX(), prototype.getBuild().getExtensionNegativeY(), prototype.getBuild().getExtensionNegativeZ());
this.maxPointBuildExtension = this.maxPointBuild.add(prototype.getBuild().getExtensionPositiveX(), prototype.getBuild().getExtensionPositiveY(), prototype.getBuild().getExtensionPositiveZ());
if (prototype.getBuild().getCopyOffsetX() == 0 && prototype.getBuild().getCopyOffsetY() == 0 && prototype.getBuild().getCopyOffsetZ() == 0) {
this.copyPoint = minPoint.add(prototype.getCopyPointOffsetX(), prototype.getCopyPointOffsetY(), prototype.getCopyPointOffsetZ());
} else if (prototype.getBuild().getCopyOffsetX() != 0 || prototype.getBuild().getCopyOffsetY() != 0 || prototype.getBuild().getCopyOffsetZ() != 0) {
this.copyPoint = this.minPointBuild.add(prototype.getBuild().getCopyOffsetX(), prototype.getBuild().getCopyOffsetY(), prototype.getBuild().getCopyOffsetZ());
} else {
this.copyPoint = this.minPointBuild.add(prototype.getBuild().getSizeX() / 2, 0, prototype.getBuild().getSizeZ());
}
} else if (prototype.getCopyPointOffsetX() != 0 || prototype.getCopyPointOffsetY() != 0 || prototype.getCopyPointOffsetZ() != 0) {
this.copyPoint = minPoint.add(prototype.getCopyPointOffsetX(), prototype.getCopyPointOffsetY(), prototype.getCopyPointOffsetZ());
}
if (prototype.getFloorOffset() != 0) {
@ -177,8 +194,6 @@ public class Region {
} else {
waterLevel = 0;
}
copyPoint = this.minPoint.add(prototype.getCopyPointOffsetX(), prototype.getCopyPointOffsetY(), prototype.getCopyPointOffsetZ());
}
public boolean inRegion(Location location, RegionType regionType, RegionExtensionType regionExtensionType) {
@ -271,6 +286,10 @@ public class Region {
if (!prototypes.contains(prototype.getName()) && !prototypes.isEmpty()) {
return false;
}
return _setPrototype(prototype);
}
boolean _setPrototype(@NonNull Prototype prototype) {
generatePrototypeData(prototype, minPoint);
RegionUtils.save(this);
setLinkedRegion(region -> {

Datei anzeigen

@ -46,7 +46,7 @@ public class PrototypeLoader {
throw new SecurityException(e.getMessage(), e);
}
if (loaded != null && new YAPIONDiff(loaded, yapionObject).getDiffs().stream().anyMatch(diffBase -> !(diffBase instanceof DiffBase.DiffChange))) {
if (loaded != null && new YAPIONDiff(loaded, yapionObject).getDiffs().stream().anyMatch(diffBase -> (diffBase instanceof DiffBase.DiffDelete))) {
throw new SecurityException("Version was not the specified version needed.");
}
loaded = yapionObject;

Datei anzeigen

@ -5,9 +5,6 @@
sizeX(178)
sizeY(119)
sizeZ(221)
copyOffsetX(89)
copyOffsetY(45)
copyOffsetZ(85)
floorOffset(45)
testblock{
sizeX(67)
@ -41,9 +38,6 @@
sizeX(178)
sizeY(119)
sizeZ(221)
copyOffsetX(89)
copyOffsetY(45)
copyOffsetZ(85)
floorOffset(45)
testblock{
sizeX(67)
@ -77,9 +71,6 @@
sizeX(107)
sizeY(94)
sizeZ(141)
copyOffsetX(53)
copyOffsetY(45)
copyOffsetZ(45)
floorOffset(45)
testblock{
sizeX(37)
@ -113,9 +104,6 @@
sizeX(121)
sizeY(64)
sizeZ(177)
copyOffsetX(2)
copyOffsetY(11)
copyOffsetZ(38)
testblock{
sizeX(115)
sizeY(45)
@ -123,6 +111,9 @@
offsetX(3)
offsetY(10)
offsetZ(106)
copyOffsetX(2)
copyOffsetY(1)
copyOffsetZ(32)
schematic(sections4/ASTestblock.schem)
}
build{
@ -132,6 +123,9 @@
offsetX(3)
offsetY(10)
offsetZ(6)
copyOffsetX(2)
copyOffsetY(1)
copyOffsetZ(32)
}
}
ws{