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