Fix some more issues
This commit is contained in:
@@ -109,7 +109,7 @@ public class AutostartListener implements Listener {
|
||||
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_NO_REGION", player);
|
||||
return;
|
||||
}
|
||||
if (region.getTestblockArea().isPresent()) {
|
||||
if (region.getTestblockArea().isEmpty()) {
|
||||
BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_NO_REGION", player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class EventListener implements Listener {
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation())) {
|
||||
if (tntRegion.getArea().inRegion(player.getLocation(), false)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTSpawn, LuaValue.NIL, event);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class EventListener implements Listener {
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation())) {
|
||||
if (tntRegion.getArea().inRegion(player.getLocation(), false)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplode, table, event);
|
||||
if (inBuild) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplodeInBuild, table, event);
|
||||
|
||||
@@ -85,8 +85,8 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
Set<String> hiddenBlocks = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlocks")));
|
||||
Set<String> hiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
|
||||
|
||||
TechHider current = new TechHider((TechHider.LocationEvaluator) (p, cX, cY) -> {
|
||||
if (rg.buildChunkOutside(cX, cY)) return true;
|
||||
TechHider current = new TechHider((p, cX, cY) -> {
|
||||
if (rg.getBuildArea().isChunkOutside(cX, cY)) return true;
|
||||
return !hidden.get(rg).contains(p);
|
||||
}, Material.valueOf(obfuscateWith.toUpperCase()), hiddenBlocks.stream().map(String::toUpperCase).map(Material::valueOf).collect(Collectors.toSet()), hiddenBlockEntities);
|
||||
current.enable();
|
||||
@@ -105,7 +105,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
hidden.get(region).add(player);
|
||||
BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
region.forEachChunk((x, z) -> {
|
||||
region.getBuildArea().forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class KillAllCommand extends SWCommand {
|
||||
WORLD.getEntities()
|
||||
.stream()
|
||||
.filter(e -> !(e instanceof Player))
|
||||
.filter(e -> region.inRegion(e.getLocation()))
|
||||
.filter(e -> region.getArea().inRegion(e.getLocation(), false))
|
||||
.forEach(entity -> {
|
||||
entity.remove();
|
||||
count.incrementAndGet();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@@ -101,8 +102,8 @@ public class BauScoreboard implements Listener {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getType().isGlobal()) return "§eSteam§8War";
|
||||
String colorCode = "§e";
|
||||
if (region.hasFlag(Flag.COLOR).isReadable()) {
|
||||
colorCode = "§" + region.getFlag(Flag.COLOR).get().getColor().getColorCode();
|
||||
if (region.getFlags().has(Flag.COLOR).isReadable()) {
|
||||
colorCode = "§" + region.getFlags().get(Flag.COLOR).orElse(ColorMode.PINK).getColorCode();
|
||||
}
|
||||
return colorCode + "■ §eSteam§8War " + colorCode + "■"; // ■
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
|
||||
hidden.get(region).add(player);
|
||||
BauSystem.MESSAGE.sendPrefixless("XRAY_ON", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
region.forEachChunk((x, z) -> {
|
||||
region.getBuildArea().forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
||||
});
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
|
||||
|
||||
private TechHider createXray(Region rg, Set<Material> obfuscate) {
|
||||
TechHider current = new TechHider((TechHider.LocationEvaluator) (p, cX, cY) -> {
|
||||
if (rg.buildChunkOutside(cX, cY)) return true;
|
||||
if (rg.getBuildArea().isChunkOutside(cX, cY)) return true;
|
||||
return !hidden.get(rg).contains(p);
|
||||
}, Material.STRUCTURE_VOID, obfuscate, new HashSet<>());
|
||||
current.enable();
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.bukkit.entity.Player;
|
||||
@AllArgsConstructor
|
||||
public class Point {
|
||||
|
||||
public static final Point ZERO = new Point(0, 0, 0);
|
||||
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
@@ -46,9 +46,9 @@ public interface Region {
|
||||
|
||||
Area getArea();
|
||||
|
||||
Optional<Area> getBuildArea();
|
||||
Area getBuildArea();
|
||||
|
||||
Optional<Area> getTestblockArea();
|
||||
Area getTestblockArea();
|
||||
|
||||
Optional<File> getGameModeConfig();
|
||||
|
||||
@@ -56,6 +56,55 @@ public interface Region {
|
||||
|
||||
interface Area {
|
||||
|
||||
Area EMPTY = new Area() {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getMinPoint(boolean extension) {
|
||||
return Point.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getMaxPoint(boolean extension) {
|
||||
return Point.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getCopyPoint() {
|
||||
return Point.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inRegion(Location location, boolean extension) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession copy(boolean extension) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(@Nullable SchematicNode schematicNode, boolean extension) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachChunk(BiConsumer<Integer, Integer> executor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChunkOutside(int chunkX, int chunkZ) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
default boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Point getMinPoint(boolean extension);
|
||||
|
||||
Point getMaxPoint(boolean extension);
|
||||
|
||||
Reference in New Issue
Block a user