Reduce to 34 compiler errors

This commit is contained in:
2025-07-30 18:49:54 +02:00
parent 72d603fdf6
commit df9c7f122e
24 changed files with 84 additions and 95 deletions

View File

@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.backup;
import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.ChangedMode;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.command.SWCommand;
@@ -62,7 +63,7 @@ public class BackupCommand extends SWCommand {
if (checkGlobalRegion(region, p)) {
return;
}
if (region.getFlag(Flag.CHANGED).isPresent()) {
if (region.getFlags().get(Flag.CHANGED).isWithDefault(ChangedMode.NO_CHANGE)) {
BauSystem.MESSAGE.send("BACKUP_CREATE_NO_CHANGE", p);
return;
}
@@ -86,12 +87,12 @@ public class BackupCommand extends SWCommand {
return;
}
EditSession editSession = new PasteBuilder(new PasteBuilder.FileProvider(backupFile))
.pastePoint(region.getMinPoint().add(region.getPrototype().getSizeX() / 2, 0, region.getPrototype().getSizeZ() / 2))
.minPoint(region.getMinPoint())
.maxPoint(region.getMaxPoint())
.pastePoint(region.getArea().getMinPoint(false).add(region.getPrototype().getSizeX() / 2, 0, region.getPrototype().getSizeZ() / 2))
.minPoint(region.getArea().getMinPoint(false))
.maxPoint(region.getArea().getMaxPoint(false))
.waterLevel(region.getWaterLevel())
.run();
region.remember(editSession);
region.getHistory().remember(editSession);
BauSystem.MESSAGE.send("BACKUP_LOAD", p);
}

View File

@@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.region.FlagOptional;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.core.Core;
@@ -62,9 +63,9 @@ public class BauInfoBauGuiItem extends BauGuiItem {
if (flag == Flag.ITEMS && Core.getVersion() < 19) {
continue;
}
Flag.Value<?> value = region.get(flag);
if (value != null) {
stringList.add(BauSystem.MESSAGE.parse("BAU_INFO_ITEM_LORE_" + flag.name(), player, BauSystem.MESSAGE.parse(value.getChatValue(), player)));
FlagOptional<?> value = region.getFlags().get(flag);
if (value.isPresent()) {
stringList.add(BauSystem.MESSAGE.parse("BAU_INFO_ITEM_LORE_" + flag.name(), player, BauSystem.MESSAGE.parse(value.getWithDefault().getChatValue(), player)));
}
}
itemStack.setLore(stringList);

View File

@@ -3,6 +3,7 @@ package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.region.FlagOptional;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.command.SWCommand;
@@ -33,9 +34,9 @@ public class InfoCommand extends SWCommand {
if (flag == Flag.PROTECT && region.getFloorLevel() == 0) {
continue;
}
Flag.Value<?> value = region.get(flag);
if (value != null) {
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_FLAG", p, BauSystem.MESSAGE.parse(flag.getChatValue(), p), BauSystem.MESSAGE.parse(value.getChatValue(), p));
FlagOptional<?> value = region.getFlags().get(flag);
if (value.isPresent()) {
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_FLAG", p, BauSystem.MESSAGE.parse(flag.getChatValue(), p), BauSystem.MESSAGE.parse(value.getWithDefault().getChatValue(), p));
}
}

View File

@@ -52,7 +52,9 @@ public class ColorCommand extends SWCommand {
@Register(description = "REGION_COLOR_HELP_COLOR_TYPE")
public void genericColorSet(@Validator Player p, ColorMode color, ColorizationType colorizationType) {
if (colorizationType == ColorizationType.GLOBAL) {
Region.setGlobal(Flag.COLOR, color);
Region.getRegions().forEach(region -> {
region.getFlags().set(Flag.COLOR, color);
});
BauSystem.MESSAGE.send("REGION_COLOR_GLOBAL", p, BauSystem.MESSAGE.parse(color.getChatValue(), p));
return;
}
@@ -61,13 +63,13 @@ public class ColorCommand extends SWCommand {
BauSystem.MESSAGE.send("REGION_COLOR_NO_REGION", p);
return;
}
region.setFlag(Flag.COLOR, color);
region.getFlags().set(Flag.COLOR, color);
try {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
.ignoreAir(true)
.onlyColors(true)
.color(color.getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
.color(color);
region.getArea().reset(pasteBuilder, false);
RegionUtils.message(region, "REGION_REGION_COLORED");
RegionUtils.message(region, "REGION_REGION_COLORED_FAILED");
} catch (SecurityException e) {

View File

@@ -55,11 +55,11 @@ public class ItemsCommand extends SWCommand {
}
private boolean toggle(Region region) {
if (region.isFlag(Flag.ITEMS, ItemMode.ACTIVE)) {
region.setFlag(Flag.ITEMS, ItemMode.INACTIVE);
if (region.getFlags().get(Flag.ITEMS).isWithDefault(ItemMode.ACTIVE)) {
region.getFlags().set(Flag.ITEMS, ItemMode.INACTIVE);
return false;
} else {
region.setFlag(Flag.ITEMS, ItemMode.ACTIVE);
region.getFlags().set(Flag.ITEMS, ItemMode.ACTIVE);
return true;
}
}

View File

@@ -31,9 +31,7 @@ import de.steamwar.bausystem.features.util.SelectCommand;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.ColorMode;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.FlatteningWrapper;
@@ -83,7 +81,7 @@ public class RegionCommand extends SWCommand {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) return;
if (region.undo()) {
if (region.getHistory().undo()) {
RegionUtils.message(region, "REGION_REGION_UNDID");
} else {
BauSystem.MESSAGE.send("REGION_REGION_NOTHING_UNDO", p);
@@ -97,7 +95,7 @@ public class RegionCommand extends SWCommand {
return;
}
if (region.redo()) {
if (region.getHistory().redo()) {
RegionUtils.message(region, "REGION_REGION_REDID");
} else {
BauSystem.MESSAGE.send("REGION_REGION_NOTHING_REDO", p);
@@ -112,8 +110,8 @@ public class RegionCommand extends SWCommand {
try {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
.ignoreAir(true)
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
region.getArea().reset(pasteBuilder, true);
RegionUtils.message(region, "REGION_REGION_RESTORED");
} catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
@@ -134,8 +132,8 @@ public class RegionCommand extends SWCommand {
try {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
.ignoreAir(true)
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
region.getArea().reset(pasteBuilder, true);
RegionUtils.message(region, "REGION_REGION_RESTORED");
} catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
@@ -149,11 +147,11 @@ public class RegionCommand extends SWCommand {
if (checkGlobalRegion(region, p)) {
return;
}
if (region.getCopyPoint() == null) {
if (region.getBuildArea().isEmpty()) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
p.teleport(region.getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
p.teleport(region.getBuildArea().getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
BauSystem.MESSAGE.send("REGION_REGION_TP_COPY", p);
}
@@ -164,11 +162,11 @@ public class RegionCommand extends SWCommand {
if (checkGlobalRegion(region, p)) {
return;
}
if (region.getTestBlockPoint() == null) {
if (region.getTestblockArea().isEmpty()) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
p.teleport(region.getTestBlockPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
p.teleport(region.getTestblockArea().getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND);
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
}
@@ -211,14 +209,10 @@ public class RegionCommand extends SWCommand {
if (checkGlobalRegion(region, p)) {
return;
}
if (!region.hasType(RegionType.BUILD)) {
if (region.getBuildArea().isEmpty()) {
BauSystem.MESSAGE.send("REGION_REGION_NO_BUILD", p);
return;
}
if (region.getCopyPoint() == null) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
Point minPoint = region.getBuildArea().getMinPoint(false);
Point maxPoint = region.getBuildArea().getMaxPoint(false);
@@ -238,7 +232,7 @@ public class RegionCommand extends SWCommand {
break;
}
Clipboard clipboard = FlatteningWrapper.impl.copy(minPoint, maxPoint, region.getCopyPoint());
Clipboard clipboard = FlatteningWrapper.impl.copy(minPoint, maxPoint, region.getBuildArea().getCopyPoint());
WorldEdit.getInstance()
.getSessionManager()
.get(BukkitAdapter.adapt(p))
@@ -252,14 +246,10 @@ public class RegionCommand extends SWCommand {
if (checkGlobalRegion(region, p)) {
return;
}
if (!region.hasType(RegionType.BUILD)) {
if (region.getBuildArea().isEmpty()) {
BauSystem.MESSAGE.send("REGION_REGION_NO_BUILD", p);
return;
}
if (region.getCopyPoint() == null) {
BauSystem.MESSAGE.send("REGION_REGION_TP_UNKNOWN", p);
return;
}
ClipboardHolder clipboardHolder = WorldEdit.getInstance()
.getSessionManager()
@@ -287,13 +277,13 @@ public class RegionCommand extends SWCommand {
}
try (EditSession e = WorldEditUtils.getEditSession(p)) {
Operations.completeBlindly(clipboardHolder.createPaste(e).ignoreAirBlocks(ignoreAir).to(toBlockVector3(region.getCopyPoint())).build());
Operations.completeBlindly(clipboardHolder.createPaste(e).ignoreAirBlocks(ignoreAir).to(toBlockVector3(region.getBuildArea().getCopyPoint())).build());
WorldEditUtils.addToPlayer(p, e);
if (selectPasted) {
Clipboard clipboard = clipboardHolder.getClipboards().get(0);
BlockVector3 minPointSelection = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getCopyPoint()));
BlockVector3 maxPointSelection = clipboard.getRegion().getMaximumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getCopyPoint()));
BlockVector3 minPointSelection = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getBuildArea().getCopyPoint()));
BlockVector3 maxPointSelection = clipboard.getRegion().getMaximumPoint().subtract(clipboard.getOrigin()).add(toBlockVector3(region.getBuildArea().getCopyPoint()));
FlatteningWrapper.impl.setSelection(p, Point.fromBlockVector3(minPointSelection), Point.fromBlockVector3(maxPointSelection));
}
BauSystem.MESSAGE.send("REGION_REGION_PASTE_DONE", p);

View File

@@ -24,9 +24,8 @@ import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionSystem;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.ColorMode;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.command.SWCommand;
@@ -56,10 +55,10 @@ public class ResetCommand extends SWCommand {
if (region == null) return;
try {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
region.getArea().reset(pasteBuilder, false);
for (Flag value : Flag.getResetFlags()) {
region.set(value, value.getDefaultValue());
region.getFlags().set(value, value.getDefaultValue());
}
RegionUtils.message(region, "REGION_RESET_RESETED");
} catch (SecurityException e) {
@@ -88,8 +87,8 @@ public class ResetCommand extends SWCommand {
}
try {
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.SchematicProvider(node))
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
region.getArea().reset(pasteBuilder, true);
RegionUtils.message(region, "REGION_RESET_RESETED");
} catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_RESET_ERROR", p);

View File

@@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.ColorMode;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
@@ -101,8 +100,8 @@ public class TestblockCommand extends SWCommand {
.onlyColors(onlyColors)
.removeTNT(removeTNT)
.removeWater(removeWater)
.color(region.getFlag(Flag.COLOR).orElse(ColorMode.YELLOW).getColor());
region.reset(pasteBuilder, RegionType.TESTBLOCK, regionExtensionType);
.color(region.getFlags().get(Flag.COLOR).getWithDefault());
region.getTestblockArea().reset(pasteBuilder, regionExtensionType == RegionExtensionType.EXTENSION);
RegionUtils.message(region, "REGION_TB_DONE");
} catch (SecurityException e) {
BauSystem.MESSAGE.send("REGION_TB_ERROR", p);
@@ -155,7 +154,7 @@ public class TestblockCommand extends SWCommand {
private Region regionCheck(Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasType(RegionType.TESTBLOCK)) {
if (region.getTestblockArea().isEmpty()) {
BauSystem.MESSAGE.send("REGION_TB_NO_REGION", player);
return null;
}

View File

@@ -42,10 +42,10 @@ public class FireBauGuiItem extends BauGuiItem {
@Override
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasFlag(Flag.FIRE).isApplicable()) {
if (!region.getFlags().has(Flag.FIRE).isApplicable()) {
return new SWItem(Material.BARRIER, "").getItemStack();
}
if (region.isFlag(Flag.FIRE, FireMode.ALLOW)) {
if (region.getFlags().get(Flag.FIRE).isWithDefault(FireMode.ALLOW)) {
return new SWItem(Material.FIRE_CHARGE, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_ALLOW", player)).getItemStack();
} else {
return new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_DISALLOW", player)).getItemStack();

View File

@@ -42,10 +42,10 @@ public class FreezeBauGuiItem extends BauGuiItem {
@Override
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasFlag(Flag.FREEZE).isApplicable()) {
if (!region.getFlags().has(Flag.FREEZE).isApplicable()) {
return new SWItem(Material.BARRIER, "").getItemStack();
}
if (region.isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) {
if (region.getFlags().get(Flag.FREEZE).isWithDefault(FreezeMode.ACTIVE)) {
return new SWItem(Material.GUNPOWDER, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_ALLOW", player)).getItemStack();
} else {
return new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_DISALLOW", player)).getItemStack();

View File

@@ -43,10 +43,10 @@ public class ProtectBauGuiItem extends BauGuiItem {
@Override
public ItemStack getItem(Player player) {
Region region = Region.getRegion(player.getLocation());
if (!region.hasFlag(Flag.PROTECT).isApplicable()) {
if (!region.getFlags().has(Flag.PROTECT).isApplicable()) {
return new SWItem(Material.BARRIER, "").getItemStack();
}
if (region.isFlag(Flag.PROTECT, ProtectMode.ACTIVE)) {
if (region.getFlags().get(Flag.PROTECT).isWithDefault(ProtectMode.ACTIVE)) {
return SWUtils.setCustomModelData(new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_ALLOW", player)), 1).getItemStack();
} else {
return SWUtils.setCustomModelData(new SWItem(Material.STONE, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_DISALLOW", player)), 1).getItemStack();

View File

@@ -43,7 +43,7 @@ public class TntBauGuiItem extends BauGuiItem {
@Override
public ItemStack getItem(Player player) {
switch (Region.getRegion(player.getLocation()).getPlain(Flag.TNT, TNTMode.class)) {
switch (Region.getRegion(player.getLocation()).getFlags().get(Flag.TNT).getWithDefault()) {
case DENY:
return new SWItem(Material.MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_OFF", player)).getItemStack();
case ONLY_TB:
@@ -58,12 +58,12 @@ public class TntBauGuiItem extends BauGuiItem {
@Override
public boolean click(ClickType click, Player p) {
if (click == ClickType.LEFT) {
switch (Region.getRegion(p.getLocation()).getPlain(Flag.TNT, TNTMode.class)) {
switch (Region.getRegion(p.getLocation()).getFlags().get(Flag.TNT).getWithDefault()) {
case DENY:
updateTntMode(TNTMode.ALLOW, p);
break;
case ALLOW:
if (Region.getRegion(p.getLocation()).hasType(RegionType.BUILD) && Region.getRegion(p.getLocation()).hasType(RegionType.TESTBLOCK)) {
if (!Region.getRegion(p.getLocation()).getBuildArea().isEmpty() && !Region.getRegion(p.getLocation()).getTestblockArea().isEmpty()) {
updateTntMode(TNTMode.ONLY_TB, p);
break;
}
@@ -77,7 +77,7 @@ public class TntBauGuiItem extends BauGuiItem {
updateTntMode(TNTMode.ALLOW, p);
p.closeInventory();
}));
if (Region.getRegion(p.getLocation()).hasType(RegionType.BUILD) && Region.getRegion(p.getLocation()).hasType(RegionType.TESTBLOCK)) {
if (!Region.getRegion(p.getLocation()).getBuildArea().isEmpty() && !Region.getRegion(p.getLocation()).getTestblockArea().isEmpty()) {
selector.setItem(3, new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_SELECTOR_ONLY_TB", p), clickType -> {
updateTntMode(TNTMode.ONLY_TB, p);
p.closeInventory();

View File

@@ -64,7 +64,7 @@ public final class TNTPhase extends SimulatorPhase {
@Override
public void accept(World world) {
Location location = position.toLocation(world);
if (Region.getRegion(location).getFlag(Flag.FREEZE).isPresent()) return;
if (Region.getRegion(location).getFlags().get(Flag.FREEZE).isPresent()) return;
TNTPrimed tnt = world.spawn(location, TNTPrimed.class);
if (!xJump) tnt.setVelocity(tnt.getVelocity().setX(0));
if (!yJump) tnt.setVelocity(tnt.getVelocity().setY(0));

View File

@@ -45,7 +45,7 @@ public class StabDirection extends StabStep {
@Override
protected void start() {
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
e.setBlocks((com.sk89q.worldedit.regions.Region) new CuboidRegion(data.region.getMinPointTestblockExtension().toBlockVector3(), data.region.getMaxPointTestblockExtension().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
e.setBlocks((com.sk89q.worldedit.regions.Region) new CuboidRegion(data.region.getTestblockArea().getMinPoint(true).toBlockVector3(), data.region.getTestblockArea().getMaxPoint(true).toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
}
Trace trace = TraceRecorder.instance.startRecording(data.region);

View File

@@ -20,10 +20,7 @@
package de.steamwar.bausystem.features.simulator.execute;
import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.region.flags.ColorMode;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
@@ -38,10 +35,10 @@ public class StabFinalizer extends StabStep {
try {
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider);
if (data.region.hasFlag(Flag.COLOR).isReadable()) {
pasteBuilder.color(data.region.getFlag(Flag.COLOR).get().getColor());
if (data.region.getFlags().has(Flag.COLOR).isReadable()) {
pasteBuilder.color(data.region.getFlags().get(Flag.COLOR).getWithDefault());
}
data.region.reset(pasteBuilder, RegionType.TESTBLOCK, RegionExtensionType.EXTENSION);
data.region.getTestblockArea().reset(pasteBuilder, true);
} catch (SecurityException e) {
stop();
throw e;

View File

@@ -22,8 +22,6 @@ package de.steamwar.bausystem.features.simulator.execute;
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import org.bukkit.Bukkit;
@@ -55,7 +53,7 @@ public class StabGenerator extends StabStep implements Listener {
public void onEntityExplode(EntityExplodeEvent event) {
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
event.blockList().forEach(block -> {
if (!data.region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION))
if (!data.region.getTestblockArea().inRegion(block.getLocation(), true))
return;
int component = data.direction.component.apply(block.getLocation().toVector());
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
@@ -73,10 +71,10 @@ public class StabGenerator extends StabStep implements Listener {
try {
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider);
if (data.region.hasFlag(Flag.COLOR).isReadable()) {
pasteBuilder.color(data.region.getFlag(Flag.COLOR).get().getColor());
if (data.region.getFlags().has(Flag.COLOR).isReadable()) {
pasteBuilder.color(data.region.getFlags().get(Flag.COLOR).getWithDefault());
}
data.region.reset(pasteBuilder, RegionType.TESTBLOCK, RegionExtensionType.EXTENSION);
data.region.getTestblockArea().reset(pasteBuilder, true);
} catch (SecurityException e) {
stop();
throw e;

View File

@@ -72,7 +72,7 @@ public class StabSetup extends StabStep {
if (TraceRecorder.instance.isAutoTraceEnabledInRegion(data.region)) {
TraceRecorder.instance.removeAutoTraceRegion(data.region);
}
data.clipboard = FlatteningWrapper.impl.copy(data.region.getMinPointTestblockExtension(), data.region.getMaxPointTestblockExtension(), data.region.getTestBlockPoint());
data.clipboard = FlatteningWrapper.impl.copy(data.region.getTestblockArea().getMinPoint(true), data.region.getTestblockArea().getMaxPoint(true), data.region.getTestblockArea().getCopyPoint());
new StabDirection(data);
}

View File

@@ -89,9 +89,9 @@ public class SkinCommand extends SWCommand {
return;
}
Region.copy(region.getMinPoint(), region.getMaxPoint(), arenaFile);
Region.copy(region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false), arenaFile);
if (testblockFile != null) {
Region.copy(region.getMinPointTestblock(), region.getMaxPointTestblock(), testblockFile);
Region.copy(region.getTestblockArea().getMinPoint(false), region.getTestblockArea().getMaxPoint(false), testblockFile);
}
YAPIONObject yapionObject = new YAPIONObject();

View File

@@ -53,11 +53,11 @@ public class BoundaryViewer implements Listener {
}
private void showRegion(Region region, Player player) {
drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getMinPoint(), region.getMaxPoint());
if (region.getTestblockArea().isPresent()) {
drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false));
if (!region.getTestblockArea().isEmpty()) {
drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true));
}
if (region.getBuildArea().isPresent()) {
if (!region.getBuildArea().isEmpty()) {
drawCuboid(player, Particle.END_ROD, region.getBuildArea().getMinPoint(true), region.getBuildArea().getMaxPoint(true));
}
}

View File

@@ -21,10 +21,7 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.entity.CWireframe;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RTextDisplay;
import de.steamwar.entity.*;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import org.bukkit.Bukkit;

View File

@@ -91,11 +91,11 @@ public class WarpListener implements Listener {
locations.put(warp.getName(), warp.getLocation());
});
Region region = Region.getRegion(p.getLocation());
if (region.getCopyPoint() != null) {
locations.put("Copy", region.getCopyPoint().toLocation(p).add(0.5, 0, 0.5));
if (region.getBuildArea().getCopyPoint() != null) {
locations.put("Copy", region.getBuildArea().getCopyPoint().toLocation(p).add(0.5, 0, 0.5));
}
if (region.getTestBlockPoint() != null) {
locations.put("TestBlock", region.getTestBlockPoint().toLocation(p).add(0.5, 0, 0.5));
if (region.getTestblockArea().getCopyPoint() != null) {
locations.put("TestBlock", region.getTestblockArea().getCopyPoint().toLocation(p).add(0.5, 0, 0.5));
}
}

View File

@@ -28,9 +28,13 @@ import java.io.File;
import java.util.Optional;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.stream.Stream;
public interface Region {
static Stream<Region> getRegions() {
return RegionSystem.INSTANCE.getRegions();
}
static Region getRegion(Location location) {
return RegionSystem.INSTANCE.get(location);
}

View File

@@ -41,7 +41,7 @@ public class RegionUtils {
public void forEachInRegion(Region region, Consumer<Player> consumer) {
Bukkit.getOnlinePlayers()
.stream()
.filter(player -> region.inRegion(player.getLocation()))
.filter(player -> region.getArea().inRegion(player.getLocation(), false))
.filter(player -> !region.getType().isGlobal() || Region.getRegion(player.getLocation()).getType().isGlobal())
.forEach(consumer);
}

View File

@@ -118,7 +118,7 @@ public class RegionedBossbar implements BauSystemBossbar, Listener {
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if (event.getPlayer() != player) return;
if (region.inRegion(event.getTo())) {
if (region.getArea().inRegion(event.getTo(), false)) {
bossBar.addPlayer(player);
} else {
bossBar.removePlayer(player);