RegionFix #240
@ -157,11 +157,11 @@ public class CommandTNT extends SWCommand implements Listener {
|
||||
event.blockList().removeIf(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
if (region.getTntMode() == TNTMode.ON) return false;
|
||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation(), Region.RegionExtensionType.NORMAL)) {
|
||||
if (region.hasBuildRegion() && region.inRegion(block.getLocation(), Region.RegionType.BUILD_AREA, Region.RegionExtensionType.NORMAL)) {
|
||||
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
|
||||
return true;
|
||||
}
|
||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation(), Region.RegionExtensionType.EXTENSION)) {
|
||||
if (region.hasBuildRegion() && region.inRegion(block.getLocation(), Region.RegionType.BUILD_AREA, Region.RegionExtensionType.EXTENSION)) {
|
||||
RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
|
||||
return true;
|
||||
}
|
||||
|
@ -20,17 +20,19 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.world.Region;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@UtilityClass
|
||||
public class RegionUtils {
|
||||
|
||||
public static void actionBar(Region region, String s) {
|
||||
if (Region.GlobalRegion.isGlobalRegion(region)) {
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> Region.getRegion(player.getLocation()) == null).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||
} else {
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), Region.RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), Region.RegionType.NORMAL, Region.RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class Region {
|
||||
|
||||
public static Region getRegion(Location location) {
|
||||
for (Region region : regions) {
|
||||
if (region.inRegion(location, RegionExtensionType.NORMAL)) return region;
|
||||
if (region.inRegion(location, RegionType.NORMAL, RegionExtensionType.NORMAL)) return region;
|
||||
}
|
||||
return GlobalRegion.getInstance();
|
||||
}
|
||||
@ -191,18 +191,10 @@ public class Region {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inRegion(Location l, RegionExtensionType regionExtensionType) {
|
||||
return prototype.inRegion(this, l, regionExtensionType);
|
||||
}
|
||||
|
||||
public boolean hasBuildRegion() {
|
||||
return prototype.buildArea != null;
|
||||
}
|
||||
|
||||
public boolean inBuildRegion(Location l, RegionExtensionType regionExtensionType) {
|
||||
return prototype.buildArea.inRegion(this, l, regionExtensionType);
|
||||
}
|
||||
|
||||
public void reset() throws IOException {
|
||||
initSessions();
|
||||
undosessions.push(prototype.reset(this, null));
|
||||
@ -297,7 +289,7 @@ public class Region {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inRegion(Location l, RegionExtensionType regionExtensionType) {
|
||||
public boolean inRegion(Location l, RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren