Reduce to 34 compiler errors

This commit is contained in:
2025-08-02 13:25:22 +02:00
parent 0287881e33
commit 598daadd33
24 changed files with 84 additions and 95 deletions
@@ -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) {
@@ -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;
}
}
@@ -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);
@@ -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);
@@ -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;
}
@@ -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();
@@ -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();
@@ -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();
@@ -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();