Merge branch 'refs/heads/version/7.0.x'

# Conflicts:
#	buildSrc/build.gradle.kts
This commit is contained in:
Joo200 2024-05-03 19:57:42 +02:00
commit aa254c80e0
41 changed files with 307 additions and 289 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## 7.0.10
* Add support for MC 1.20.5 and 1.20.6, drop support for other 1.20 versions
## 7.0.9 ## 7.0.9
* Add support for MC 1.20, drop support for MC 1.19 * Add support for MC 1.20, drop support for MC 1.19
* Made entities spawned via the `/summon` command get treated as plugin-spawned entities * Made entities spawned via the `/summon` command get treated as plugin-spawned entities

View File

@ -1,11 +1,8 @@
Compiling Compiling
========= =========
You can compile WorldGuard as long as you have some version of Java greater than or equal to 17 installed. Gradle will download JDK 17 specifically if needed, You can compile WorldGuard as long as you have some version of Java greater than or equal to 21 installed.
but it needs some version of Java to bootstrap from. Gradle will download JDK 21 specifically if needed, but it needs some version of Java to bootstrap from.
Note that if you have JRE 17 installed, Gradle will currently attempt to use that to compile, which will not work. It is easiest to uninstall JRE 16 and
replace it with JDK 17.
The build process uses Gradle, which you do *not* need to download. WorldGuard is a multi-module project with three modules: The build process uses Gradle, which you do *not* need to download. WorldGuard is a multi-module project with three modules:

View File

@ -11,7 +11,19 @@ repositories {
dependencies { dependencies {
implementation(gradleApi()) implementation(gradleApi())
implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1") implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1")
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.1") implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2")
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") implementation("com.github.johnrengelman:shadow:8.1.1")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.27.1") implementation("org.jfrog.buildinfo:build-info-extractor-gradle:5.2.0")
constraints {
val asmVersion = "[9.7,)"
implementation("org.ow2.asm:asm:$asmVersion") {
because("Need Java 21 support in shadow")
}
implementation("org.ow2.asm:asm-commons:$asmVersion") {
because("Need Java 21 support in shadow")
}
implementation("org.vafer:jdependency:[2.10,)") {
because("Need Java 21 support in shadow")
}
}
} }

View File

@ -25,7 +25,7 @@ fun Project.applyCommonConfiguration() {
plugins.withId("java") { plugins.withId("java") {
the<JavaPluginExtension>().toolchain { the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(21))
} }
} }

View File

@ -1,7 +1,7 @@
object Versions { object Versions {
// const val PISTON = "0.4.3" // const val PISTON = "0.4.3"
// const val AUTO_VALUE = "1.6.5" // const val AUTO_VALUE = "1.6.5"
const val WORLDEDIT = "7.2.14" const val WORLDEDIT = "7.3.0"
const val JUNIT = "5.9.1" const val JUNIT = "5.9.1"
const val MOCKITO = "4.9.0" const val MOCKITO = "4.9.0"
const val SQUIRRELID = "0.3.2" const val SQUIRRELID = "0.3.2"

Binary file not shown.

View File

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

22
gradlew vendored
View File

@ -83,7 +83,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -130,10 +131,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

20
gradlew.bat vendored
View File

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View File

@ -12,6 +12,11 @@ repositories {
name = "paper" name = "paper"
url = uri("https://repo.papermc.io/repository/maven-public/") url = uri("https://repo.papermc.io/repository/maven-public/")
} }
maven {
// TODO: Remove this once paper updated to adventure release
name = "adventure-snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
} }
configurations { configurations {
@ -20,8 +25,8 @@ configurations {
dependencies { dependencies {
"api"(project(":worldguard-core")) "api"(project(":worldguard-core"))
"compileOnly"("io.papermc.paper:paper-api:1.20-R0.1-SNAPSHOT") "compileOnly"("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
"runtimeOnly"("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT") { "runtimeOnly"("org.spigotmc:spigot-api:1.20.6-R0.1-SNAPSHOT") {
exclude("junit", "junit") exclude("junit", "junit")
} }
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false } "api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }

View File

@ -266,7 +266,7 @@ public class BukkitWorldGuardPlatform implements WorldGuardPlatform {
if (radius > 0) { if (radius > 0) {
BlockVector3 spawnLoc = BukkitAdapter.asBlockVector(bWorld.getSpawnLocation()); BlockVector3 spawnLoc = BukkitAdapter.asBlockVector(bWorld.getSpawnLocation());
return new ProtectedCuboidRegion("__spawn_protection__", return new ProtectedCuboidRegion("__spawn_protection__",
spawnLoc.subtract(radius, 0, radius).withY(world.getMinimumPoint().getY()), spawnLoc.subtract(radius, 0, radius).withY(world.getMinimumPoint().y()),
spawnLoc.add(radius, 0, radius).withY(world.getMaxY())); spawnLoc.add(radius, 0, radius).withY(world.getMaxY()));
} }
} }

View File

@ -35,6 +35,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import java.util.ArrayList;
import java.util.List;
/** /**
* Handles blocked potions. * Handles blocked potions.
@ -50,43 +54,50 @@ public class BlockedPotionsListener extends AbstractListener {
super(plugin); super(plugin);
} }
private PotionEffectType getBlockedEffectByArrow(Arrow arrow, BukkitWorldConfiguration wcfg) {
List<PotionEffect> effects = new ArrayList<>();
PotionType potionType = arrow.getBasePotionType();
if (potionType != null) {
effects.addAll(potionType.getPotionEffects());
}
effects.addAll(arrow.getCustomEffects());
for (PotionEffect potionEffect : effects) {
if (wcfg.blockPotions.contains(potionEffect.getType())) {
return potionEffect.getType();
}
}
return null;
}
@EventHandler @EventHandler
public void onProjectile(DamageEntityEvent event) { public void onProjectile(DamageEntityEvent event) {
if (event.getOriginalEvent() instanceof EntityDamageByEntityEvent) { if (!(event.getOriginalEvent() instanceof EntityDamageByEntityEvent originalEvent)) {
EntityDamageByEntityEvent originalEvent = (EntityDamageByEntityEvent) event.getOriginalEvent(); return;
if (Entities.isPotionArrow(originalEvent.getDamager())) { // should take care of backcompat }
BukkitWorldConfiguration wcfg = getWorldConfig(event.getWorld()); if (!Entities.isPotionArrow(originalEvent.getDamager())) {
PotionEffectType blockedEffect = null; return;
if (originalEvent.getDamager() instanceof SpectralArrow) { }
if (wcfg.blockPotions.contains(PotionEffectType.GLOWING)) {
blockedEffect = PotionEffectType.GLOWING; BukkitWorldConfiguration wcfg = getWorldConfig(event.getWorld());
} PotionEffectType blockedEffect = null;
} else if (originalEvent.getDamager() instanceof Arrow) { if (originalEvent.getDamager() instanceof SpectralArrow) {
Arrow tippedArrow = (Arrow) originalEvent.getDamager(); if (wcfg.blockPotions.contains(PotionEffectType.GLOWING)) {
PotionEffectType baseEffect = tippedArrow.getBasePotionData().getType().getEffectType(); blockedEffect = PotionEffectType.GLOWING;
if (wcfg.blockPotions.contains(baseEffect)) {
blockedEffect = baseEffect;
} else {
for (PotionEffect potionEffect : tippedArrow.getCustomEffects()) {
if (wcfg.blockPotions.contains(potionEffect.getType())) {
blockedEffect = potionEffect.getType();
break;
}
}
}
}
if (blockedEffect != null) {
Player player = event.getCause().getFirstPlayer();
if (player != null) {
if (getPlugin().hasPermission(player, "worldguard.override.potions")) {
return;
}
player.sendMessage(ChatColor.RED + "Sorry, arrows with "
+ blockedEffect.getName() + " are presently disabled.");
}
event.setCancelled(true);
}
} }
} else if (originalEvent.getDamager() instanceof Arrow arrow) {
blockedEffect = getBlockedEffectByArrow(arrow, wcfg);
}
if (blockedEffect != null) {
Player player = event.getCause().getFirstPlayer();
if (player != null) {
if (getPlugin().hasPermission(player, "worldguard.override.potions")) {
return;
}
player.sendMessage(ChatColor.RED + "Sorry, arrows with "
+ blockedEffect.getName() + " are presently disabled.");
}
event.setCancelled(true);
} }
} }
@ -104,25 +115,20 @@ public class BlockedPotionsListener extends AbstractListener {
if (!wcfg.blockPotions.isEmpty()) { if (!wcfg.blockPotions.isEmpty()) {
PotionEffectType blockedEffect = null; PotionEffectType blockedEffect = null;
PotionMeta meta; if (!(item.getItemMeta() instanceof PotionMeta meta)) {
if (item.getItemMeta() instanceof PotionMeta) { return;
meta = ((PotionMeta) item.getItemMeta());
} else {
return; // ok...?
} }
// Find the first blocked effect // Find the first blocked effect
PotionEffectType baseEffect = meta.getBasePotionData().getType().getEffectType(); List<PotionEffect> effects = new ArrayList<>();
if (wcfg.blockPotions.contains(baseEffect)) { if (meta.getBasePotionType() != null) {
blockedEffect = baseEffect; effects.addAll(meta.getBasePotionType().getPotionEffects());
} }
effects.addAll(meta.getCustomEffects());
if (blockedEffect == null && meta.hasCustomEffects()) { for (PotionEffect potionEffect : effects) {
for (PotionEffect effect : meta.getCustomEffects()) { if (wcfg.blockPotions.contains(potionEffect.getType())) {
if (wcfg.blockPotions.contains(effect.getType())) { blockedEffect = potionEffect.getType();
blockedEffect = effect.getType(); break;
break;
}
} }
} }

View File

@ -47,6 +47,7 @@ import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.config.WorldConfiguration; import com.sk89q.worldguard.config.WorldConfiguration;
import com.sk89q.worldguard.protection.flags.Flags; import com.sk89q.worldguard.protection.flags.Flags;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import io.papermc.paper.event.player.PlayerOpenSignEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -145,7 +146,6 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -482,7 +482,7 @@ public class EventAbstractionListener extends AbstractListener {
firedEvent.setSilent(true); firedEvent.setSilent(true);
} }
interactDebounce.debounce(clicked, event.getPlayer(), event, firedEvent); interactDebounce.debounce(clicked, event.getPlayer(), event, firedEvent);
if (event.useInteractedBlock() == Result.DENY) { if (event.useInteractedBlock() == Result.DENY && !firedEvent.isSilent()) {
playDenyEffect(player, clicked.getLocation().add(0, 1, 0)); playDenyEffect(player, clicked.getLocation().add(0, 1, 0));
} }
} }
@ -1086,9 +1086,9 @@ public class EventAbstractionListener extends AbstractListener {
public void onLingeringApply(AreaEffectCloudApplyEvent event) { public void onLingeringApply(AreaEffectCloudApplyEvent event) {
AreaEffectCloud entity = event.getEntity(); AreaEffectCloud entity = event.getEntity();
List<PotionEffect> effects = new ArrayList<>(); List<PotionEffect> effects = new ArrayList<>();
PotionEffectType baseEffectType = entity.getBasePotionData().getType().getEffectType(); List<PotionEffect> baseEffectTypes = entity.getBasePotionType() == null ? null : entity.getBasePotionType().getPotionEffects();
if (baseEffectType != null) { if (baseEffectTypes != null) {
effects.add(new PotionEffect(baseEffectType, 0, 0)); effects.addAll(baseEffectTypes);
} }
if (entity.hasCustomEffects()) { if (entity.hasCustomEffects()) {
effects.addAll(entity.getCustomEffects()); effects.addAll(entity.getCustomEffects());
@ -1173,7 +1173,7 @@ public class EventAbstractionListener extends AbstractListener {
if (item != null && item.getType() == Material.END_CRYSTAL) { /*&& placed.getType() == Material.BEDROCK) {*/ // in vanilla you can only place them on bedrock but who knows what plugins will add if (item != null && item.getType() == Material.END_CRYSTAL) { /*&& placed.getType() == Material.BEDROCK) {*/ // in vanilla you can only place them on bedrock but who knows what plugins will add
// may be overprotective as a result, but better than being underprotective // may be overprotective as a result, but better than being underprotective
Events.fireToCancel(event, new SpawnEntityEvent(event, cause, placed.getLocation().add(0.5, 0, 0.5), EntityType.ENDER_CRYSTAL)); Events.fireToCancel(event, new SpawnEntityEvent(event, cause, placed.getLocation().add(0.5, 0, 0.5), EntityType.END_CRYSTAL));
return; return;
} }
@ -1266,5 +1266,13 @@ public class EventAbstractionListener extends AbstractListener {
public void onEntityTransform(EntityZapEvent event) { public void onEntityTransform(EntityZapEvent event) {
Events.fireToCancel(event, new DamageEntityEvent(event, create(event.getBolt()), event.getEntity())); Events.fireToCancel(event, new DamageEntityEvent(event, create(event.getBolt()), event.getEntity()));
} }
@EventHandler(ignoreCancelled = true)
public void onSignOpen(PlayerOpenSignEvent event) {
if (event.getCause() == PlayerOpenSignEvent.Cause.INTERACT) {
// other cases are handled by other events
Events.fireToCancel(event, new UseBlockEvent(event, create(event.getPlayer()), event.getSign().getBlock()));
}
}
} }
} }

View File

@ -25,7 +25,6 @@ import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.session.MoveType; import com.sk89q.worldguard.session.MoveType;
import com.sk89q.worldguard.session.Session; import com.sk89q.worldguard.session.Session;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.AbstractHorse; import org.bukkit.entity.AbstractHorse;
@ -34,14 +33,13 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityMountEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.spigotmc.event.entity.EntityMountEvent;
public class PlayerMoveListener extends AbstractListener { public class PlayerMoveListener extends AbstractListener {
@ -54,13 +52,10 @@ public class PlayerMoveListener extends AbstractListener {
if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().usePlayerMove) { if (WorldGuard.getInstance().getPlatform().getGlobalStateManager().usePlayerMove) {
PluginManager pm = getPlugin().getServer().getPluginManager(); PluginManager pm = getPlugin().getServer().getPluginManager();
pm.registerEvents(this, getPlugin()); pm.registerEvents(this, getPlugin());
if (PaperLib.isSpigot()) {
pm.registerEvents(new EntityMountListener(), getPlugin());
}
} }
} }
@EventHandler @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
LocalPlayer player = getPlugin().wrapPlayer(event.getPlayer()); LocalPlayer player = getPlugin().wrapPlayer(event.getPlayer());
@ -152,16 +147,14 @@ public class PlayerMoveListener extends AbstractListener {
session.uninitialize(localPlayer); session.uninitialize(localPlayer);
} }
private class EntityMountListener implements Listener { @EventHandler
@EventHandler public void onEntityMount(EntityMountEvent event) {
public void onEntityMount(EntityMountEvent event) { Entity entity = event.getEntity();
Entity entity = event.getEntity(); if (entity instanceof Player) {
if (entity instanceof Player) { LocalPlayer player = getPlugin().wrapPlayer((Player) entity);
LocalPlayer player = getPlugin().wrapPlayer((Player) entity); Session session = WorldGuard.getInstance().getPlatform().getSessionManager().get(player);
Session session = WorldGuard.getInstance().getPlatform().getSessionManager().get(player); if (null != session.testMoveTo(player, BukkitAdapter.adapt(event.getMount().getLocation()), MoveType.EMBARK, true)) {
if (null != session.testMoveTo(player, BukkitAdapter.adapt(event.getMount().getLocation()), MoveType.EMBARK, true)) { event.setCancelled(true);
event.setCancelled(true);
}
} }
} }
} }

View File

@ -69,7 +69,7 @@ public class RegionFlagsListener extends AbstractListener {
} }
} }
if (event.getCause().find(EntityType.SNOWMAN) != null) { if (event.getCause().find(EntityType.SNOW_GOLEM) != null) {
event.filter(testState(query, Flags.SNOWMAN_TRAILS), false); event.filter(testState(query, Flags.SNOWMAN_TRAILS), false);
} }
@ -100,7 +100,7 @@ public class RegionFlagsListener extends AbstractListener {
event.filter(testState(query, Flags.ENDERDRAGON_BLOCK_DAMAGE), config.explosionFlagCancellation); event.filter(testState(query, Flags.ENDERDRAGON_BLOCK_DAMAGE), config.explosionFlagCancellation);
} }
if (event.getCause().find(EntityType.ENDER_CRYSTAL) != null) { // EnderCrystal if (event.getCause().find(EntityType.END_CRYSTAL) != null) { // EnderCrystal
event.filter(testState(query, Flags.OTHER_EXPLOSION), config.explosionFlagCancellation); event.filter(testState(query, Flags.OTHER_EXPLOSION), config.explosionFlagCancellation);
} }

View File

@ -218,7 +218,7 @@ public class RegionProtectionListener extends AbstractListener {
String what; String what;
/* TNT */ /* TNT */
if (event.getCause().find(EntityType.PRIMED_TNT, EntityType.MINECART_TNT) != null) { if (event.getCause().find(EntityType.TNT, EntityType.TNT_MINECART) != null) {
canBreak = query.testBuild(BukkitAdapter.adapt(target), associable, combine(event, Flags.BLOCK_BREAK, Flags.TNT)); canBreak = query.testBuild(BukkitAdapter.adapt(target), associable, combine(event, Flags.BLOCK_BREAK, Flags.TNT));
what = "use dynamite"; what = "use dynamite";

View File

@ -586,8 +586,8 @@ public class WorldGuardEntityListener extends AbstractListener {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
} else if (event.getEntityType() == EntityType.PRIMED_TNT } else if (event.getEntityType() == EntityType.TNT
|| event.getEntityType() == EntityType.MINECART_TNT) { || event.getEntityType() == EntityType.TNT_MINECART) {
if (wcfg.blockTNTExplosions) { if (wcfg.blockTNTExplosions) {
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -54,7 +54,7 @@ public class InventoryMoveItemEventDebounce extends AbstractEventDebounce<Key> {
if (holder instanceof BlockState blockState) { if (holder instanceof BlockState blockState) {
return new BlockMaterialKey(blockState); return new BlockMaterialKey(blockState);
} else if (holder instanceof DoubleChest doubleChest) { } else if (holder instanceof DoubleChest doubleChest) {
InventoryHolder left = doubleChest.getLeftSide(); InventoryHolder left = PaperLib.isPaper() ? doubleChest.getLeftSide(false) : doubleChest.getLeftSide();
if (left instanceof Chest chest) { if (left instanceof Chest chest) {
return new BlockMaterialKey(chest); return new BlockMaterialKey(chest);
} else { } else {

View File

@ -127,8 +127,8 @@ public final class Entities {
*/ */
public static boolean isMinecart(EntityType type) { public static boolean isMinecart(EntityType type) {
return switch(type) { return switch(type) {
case MINECART, MINECART_CHEST, MINECART_COMMAND, MINECART_FURNACE, case MINECART, CHEST_MINECART, COMMAND_BLOCK_MINECART, FURNACE_MINECART,
MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_TNT -> true; HOPPER_MINECART, SPAWNER_MINECART, TNT_MINECART -> true;
default -> false; default -> false;
}; };
} }

View File

@ -56,7 +56,6 @@ public final class Materials {
if (tag == null) return; if (tag == null) return;
tag.getValues().forEach(mat -> MATERIAL_FLAGS.put(mat, value)); tag.getValues().forEach(mat -> MATERIAL_FLAGS.put(mat, value));
} }
private static Tag<Material> SIGNS_TAG = Tag.SIGNS;
static { static {
ENTITY_ITEMS.put(EntityType.PAINTING, Material.PAINTING); ENTITY_ITEMS.put(EntityType.PAINTING, Material.PAINTING);
@ -64,22 +63,22 @@ public final class Materials {
ENTITY_ITEMS.put(EntityType.SNOWBALL, Material.SNOWBALL); ENTITY_ITEMS.put(EntityType.SNOWBALL, Material.SNOWBALL);
ENTITY_ITEMS.put(EntityType.FIREBALL, Material.FIRE_CHARGE); ENTITY_ITEMS.put(EntityType.FIREBALL, Material.FIRE_CHARGE);
ENTITY_ITEMS.put(EntityType.ENDER_PEARL, Material.ENDER_PEARL); ENTITY_ITEMS.put(EntityType.ENDER_PEARL, Material.ENDER_PEARL);
ENTITY_ITEMS.put(EntityType.THROWN_EXP_BOTTLE, Material.EXPERIENCE_BOTTLE); ENTITY_ITEMS.put(EntityType.EXPERIENCE_BOTTLE, Material.EXPERIENCE_BOTTLE);
ENTITY_ITEMS.put(EntityType.ITEM_FRAME, Material.ITEM_FRAME); ENTITY_ITEMS.put(EntityType.ITEM_FRAME, Material.ITEM_FRAME);
ENTITY_ITEMS.put(EntityType.GLOW_ITEM_FRAME, Material.GLOW_ITEM_FRAME); ENTITY_ITEMS.put(EntityType.GLOW_ITEM_FRAME, Material.GLOW_ITEM_FRAME);
ENTITY_ITEMS.put(EntityType.PRIMED_TNT, Material.TNT); ENTITY_ITEMS.put(EntityType.TNT, Material.TNT);
ENTITY_ITEMS.put(EntityType.FIREWORK, Material.FIREWORK_ROCKET); ENTITY_ITEMS.put(EntityType.FIREWORK_ROCKET, Material.FIREWORK_ROCKET);
ENTITY_ITEMS.put(EntityType.MINECART_COMMAND, Material.COMMAND_BLOCK_MINECART); ENTITY_ITEMS.put(EntityType.COMMAND_BLOCK_MINECART, Material.COMMAND_BLOCK_MINECART);
ENTITY_ITEMS.put(EntityType.BOAT, Material.OAK_BOAT); ENTITY_ITEMS.put(EntityType.BOAT, Material.OAK_BOAT);
ENTITY_ITEMS.put(EntityType.MINECART, Material.MINECART); ENTITY_ITEMS.put(EntityType.MINECART, Material.MINECART);
ENTITY_ITEMS.put(EntityType.MINECART_CHEST, Material.CHEST_MINECART); ENTITY_ITEMS.put(EntityType.CHEST_MINECART, Material.CHEST_MINECART);
ENTITY_ITEMS.put(EntityType.MINECART_FURNACE, Material.FURNACE_MINECART); ENTITY_ITEMS.put(EntityType.FURNACE_MINECART, Material.FURNACE_MINECART);
ENTITY_ITEMS.put(EntityType.MINECART_TNT, Material.TNT_MINECART); ENTITY_ITEMS.put(EntityType.TNT_MINECART, Material.TNT_MINECART);
ENTITY_ITEMS.put(EntityType.MINECART_HOPPER, Material.HOPPER_MINECART); ENTITY_ITEMS.put(EntityType.HOPPER_MINECART, Material.HOPPER_MINECART);
ENTITY_ITEMS.put(EntityType.SPLASH_POTION, Material.POTION); ENTITY_ITEMS.put(EntityType.POTION, Material.POTION);
ENTITY_ITEMS.put(EntityType.EGG, Material.EGG); ENTITY_ITEMS.put(EntityType.EGG, Material.EGG);
ENTITY_ITEMS.put(EntityType.ARMOR_STAND, Material.ARMOR_STAND); ENTITY_ITEMS.put(EntityType.ARMOR_STAND, Material.ARMOR_STAND);
ENTITY_ITEMS.put(EntityType.ENDER_CRYSTAL, Material.END_CRYSTAL); ENTITY_ITEMS.put(EntityType.END_CRYSTAL, Material.END_CRYSTAL);
MATERIAL_FLAGS.put(Material.AIR, 0); MATERIAL_FLAGS.put(Material.AIR, 0);
MATERIAL_FLAGS.put(Material.STONE, 0); MATERIAL_FLAGS.put(Material.STONE, 0);
@ -101,7 +100,7 @@ public final class Materials {
MATERIAL_FLAGS.put(Material.DETECTOR_RAIL, 0); MATERIAL_FLAGS.put(Material.DETECTOR_RAIL, 0);
MATERIAL_FLAGS.put(Material.STICKY_PISTON, 0); MATERIAL_FLAGS.put(Material.STICKY_PISTON, 0);
MATERIAL_FLAGS.put(Material.COBWEB, 0); MATERIAL_FLAGS.put(Material.COBWEB, 0);
MATERIAL_FLAGS.put(Material.GRASS, 0); MATERIAL_FLAGS.put(Material.SHORT_GRASS, 0);
MATERIAL_FLAGS.put(Material.DEAD_BUSH, 0); MATERIAL_FLAGS.put(Material.DEAD_BUSH, 0);
MATERIAL_FLAGS.put(Material.PISTON, 0); MATERIAL_FLAGS.put(Material.PISTON, 0);
MATERIAL_FLAGS.put(Material.PISTON_HEAD, 0); MATERIAL_FLAGS.put(Material.PISTON_HEAD, 0);
@ -642,7 +641,7 @@ public final class Materials {
MATERIAL_FLAGS.put(Material.PUFFERFISH_BUCKET, 0); MATERIAL_FLAGS.put(Material.PUFFERFISH_BUCKET, 0);
MATERIAL_FLAGS.put(Material.SALMON, 0); MATERIAL_FLAGS.put(Material.SALMON, 0);
MATERIAL_FLAGS.put(Material.SALMON_BUCKET, 0); MATERIAL_FLAGS.put(Material.SALMON_BUCKET, 0);
MATERIAL_FLAGS.put(Material.SCUTE, 0); MATERIAL_FLAGS.put(Material.TURTLE_SCUTE, 0);
MATERIAL_FLAGS.put(Material.SPLASH_POTION, 0); MATERIAL_FLAGS.put(Material.SPLASH_POTION, 0);
MATERIAL_FLAGS.put(Material.TURTLE_HELMET, 0); MATERIAL_FLAGS.put(Material.TURTLE_HELMET, 0);
MATERIAL_FLAGS.put(Material.TRIDENT, 0); MATERIAL_FLAGS.put(Material.TRIDENT, 0);
@ -821,31 +820,28 @@ public final class Materials {
MATERIAL_FLAGS.put(Material.ECHO_SHARD, 0); MATERIAL_FLAGS.put(Material.ECHO_SHARD, 0);
MATERIAL_FLAGS.put(Material.REINFORCED_DEEPSLATE, 0); MATERIAL_FLAGS.put(Material.REINFORCED_DEEPSLATE, 0);
// 1.20 MATERIAL_FLAGS.put(Material.BAMBOO_MOSAIC, 0);
try { MATERIAL_FLAGS.put(Material.BAMBOO_BLOCK, 0);
SIGNS_TAG = Tag.ALL_SIGNS; MATERIAL_FLAGS.put(Material.STRIPPED_BAMBOO_BLOCK, 0);
MATERIAL_FLAGS.put(Material.SUSPICIOUS_SAND, 0);
MATERIAL_FLAGS.put(Material.SUSPICIOUS_GRAVEL, 0);
MATERIAL_FLAGS.put(Material.PITCHER_PLANT, 0);
MATERIAL_FLAGS.put(Material.CHISELED_BOOKSHELF, MODIFIED_ON_RIGHT);
MATERIAL_FLAGS.put(Material.DECORATED_POT, MODIFIED_ON_RIGHT);
MATERIAL_FLAGS.put(Material.BRUSH, 0);
MATERIAL_FLAGS.put(Material.SNIFFER_EGG, 0);
MATERIAL_FLAGS.put(Material.CALIBRATED_SCULK_SENSOR, 0);
MATERIAL_FLAGS.put(Material.PIGLIN_HEAD, 0);
MATERIAL_FLAGS.put(Material.PIGLIN_WALL_HEAD, 0);
MATERIAL_FLAGS.put(Material.TORCHFLOWER_SEEDS, 0);
MATERIAL_FLAGS.put(Material.TORCHFLOWER_CROP, 0);
MATERIAL_FLAGS.put(Material.PITCHER_CROP, 0);
MATERIAL_FLAGS.put(Material.PINK_PETALS, 0);
MATERIAL_FLAGS.put(Material.PITCHER_POD, 0);
MATERIAL_FLAGS.put(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE, 0);
MATERIAL_FLAGS.put(Material.BAMBOO_MOSAIC, 0); MATERIAL_FLAGS.put(Material.ARMADILLO_SCUTE, 0);
MATERIAL_FLAGS.put(Material.BAMBOO_BLOCK, 0); MATERIAL_FLAGS.put(Material.WOLF_ARMOR, 0);
MATERIAL_FLAGS.put(Material.STRIPPED_BAMBOO_BLOCK, 0);
MATERIAL_FLAGS.put(Material.SUSPICIOUS_SAND, 0);
MATERIAL_FLAGS.put(Material.SUSPICIOUS_GRAVEL, 0);
MATERIAL_FLAGS.put(Material.PITCHER_PLANT, 0);
MATERIAL_FLAGS.put(Material.CHISELED_BOOKSHELF, MODIFIED_ON_RIGHT);
MATERIAL_FLAGS.put(Material.DECORATED_POT, MODIFIED_ON_RIGHT);
MATERIAL_FLAGS.put(Material.BRUSH, 0);
MATERIAL_FLAGS.put(Material.SNIFFER_EGG, 0);
MATERIAL_FLAGS.put(Material.CALIBRATED_SCULK_SENSOR, 0);
MATERIAL_FLAGS.put(Material.PIGLIN_HEAD, 0);
MATERIAL_FLAGS.put(Material.PIGLIN_WALL_HEAD, 0);
MATERIAL_FLAGS.put(Material.TORCHFLOWER_SEEDS, 0);
MATERIAL_FLAGS.put(Material.TORCHFLOWER_CROP, 0);
MATERIAL_FLAGS.put(Material.PITCHER_CROP, 0);
MATERIAL_FLAGS.put(Material.PINK_PETALS, 0);
MATERIAL_FLAGS.put(Material.PITCHER_POD, 0);
MATERIAL_FLAGS.put(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE, 0);
} catch (NoSuchFieldError ignored) {
}
// Generated via tag // Generated via tag
putMaterialTag(Tag.WOODEN_DOORS, MODIFIED_ON_RIGHT); putMaterialTag(Tag.WOODEN_DOORS, MODIFIED_ON_RIGHT);
@ -865,7 +861,7 @@ public final class Materials {
putMaterialTag(Tag.BUTTONS, MODIFIED_ON_RIGHT); putMaterialTag(Tag.BUTTONS, MODIFIED_ON_RIGHT);
putMaterialTag(Tag.FLOWER_POTS, MODIFIED_ON_RIGHT); putMaterialTag(Tag.FLOWER_POTS, MODIFIED_ON_RIGHT);
putMaterialTag(Tag.WALLS, 0); putMaterialTag(Tag.WALLS, 0);
putMaterialTag(SIGNS_TAG, 0); putMaterialTag(Tag.ALL_SIGNS, 0);
putMaterialTag(Tag.SMALL_FLOWERS, 0); putMaterialTag(Tag.SMALL_FLOWERS, 0);
putMaterialTag(Tag.BEDS, MODIFIED_ON_RIGHT); putMaterialTag(Tag.BEDS, MODIFIED_ON_RIGHT);
putMaterialTag(Tag.ITEMS_MUSIC_DISCS, 0); putMaterialTag(Tag.ITEMS_MUSIC_DISCS, 0);
@ -884,12 +880,10 @@ public final class Materials {
putMaterialTag(Tag.CANDLES, MODIFIED_ON_RIGHT); putMaterialTag(Tag.CANDLES, MODIFIED_ON_RIGHT);
putMaterialTag(Tag.CANDLE_CAKES, MODIFIED_ON_RIGHT); putMaterialTag(Tag.CANDLE_CAKES, MODIFIED_ON_RIGHT);
putMaterialTag(Tag.CAULDRONS, MODIFIED_ON_RIGHT); putMaterialTag(Tag.CAULDRONS, MODIFIED_ON_RIGHT);
try {
// 1.20 // 1.20
putMaterialTag(Tag.ITEMS_TRIM_TEMPLATES, 0); putMaterialTag(Tag.ITEMS_TRIM_TEMPLATES, 0);
putMaterialTag(Tag.ITEMS_DECORATED_POT_SHERDS, 0); putMaterialTag(Tag.ITEMS_DECORATED_POT_SHERDS, 0);
} catch (NoSuchFieldError ignored) {
}
Stream.concat(Stream.concat( Stream.concat(Stream.concat(
Tag.CORAL_BLOCKS.getValues().stream(), Tag.CORAL_BLOCKS.getValues().stream(),
@ -915,14 +909,14 @@ public final class Materials {
} }
// DAMAGE_EFFECTS.add(PotionEffectType.SPEED); // DAMAGE_EFFECTS.add(PotionEffectType.SPEED);
DAMAGE_EFFECTS.add(PotionEffectType.SLOW); DAMAGE_EFFECTS.add(PotionEffectType.SLOWNESS);
// DAMAGE_EFFECTS.add(PotionEffectType.FAST_DIGGING); // DAMAGE_EFFECTS.add(PotionEffectType.FAST_DIGGING);
DAMAGE_EFFECTS.add(PotionEffectType.SLOW_DIGGING); DAMAGE_EFFECTS.add(PotionEffectType.MINING_FATIGUE);
// DAMAGE_EFFECTS.add(PotionEffectType.INCREASE_DAMAGE); // DAMAGE_EFFECTS.add(PotionEffectType.INCREASE_DAMAGE);
// DAMAGE_EFFECTS.add(PotionEffectType.HEAL); // DAMAGE_EFFECTS.add(PotionEffectType.HEAL);
DAMAGE_EFFECTS.add(PotionEffectType.HARM); DAMAGE_EFFECTS.add(PotionEffectType.INSTANT_DAMAGE);
// DAMAGE_EFFECTS.add(PotionEffectType.JUMP); // DAMAGE_EFFECTS.add(PotionEffectType.JUMP);
DAMAGE_EFFECTS.add(PotionEffectType.CONFUSION); DAMAGE_EFFECTS.add(PotionEffectType.NAUSEA);
// DAMAGE_EFFECTS.add(PotionEffectType.REGENERATION); // DAMAGE_EFFECTS.add(PotionEffectType.REGENERATION);
// DAMAGE_EFFECTS.add(PotionEffectType.DAMAGE_RESISTANCE); // DAMAGE_EFFECTS.add(PotionEffectType.DAMAGE_RESISTANCE);
// DAMAGE_EFFECTS.add(PotionEffectType.FIRE_RESISTANCE); // DAMAGE_EFFECTS.add(PotionEffectType.FIRE_RESISTANCE);
@ -988,13 +982,11 @@ public final class Materials {
* @return the block material * @return the block material
*/ */
public static Material getBucketBlockMaterial(Material type) { public static Material getBucketBlockMaterial(Material type) {
switch (type) { return switch (type) {
case LAVA_BUCKET: case LAVA_BUCKET -> Material.LAVA;
return Material.LAVA; case WATER_BUCKET -> Material.WATER;
case WATER_BUCKET: default -> Material.WATER;
default: };
return Material.WATER;
}
} }
/** /**
@ -1146,6 +1138,7 @@ public final class Materials {
public static EntityType getEntitySpawnEgg(Material material) { public static EntityType getEntitySpawnEgg(Material material) {
return switch (material) { return switch (material) {
case ALLAY_SPAWN_EGG -> EntityType.ALLAY; case ALLAY_SPAWN_EGG -> EntityType.ALLAY;
case ARMADILLO_SPAWN_EGG -> EntityType.ARMADILLO;
case AXOLOTL_SPAWN_EGG -> EntityType.AXOLOTL; case AXOLOTL_SPAWN_EGG -> EntityType.AXOLOTL;
case SPIDER_SPAWN_EGG -> EntityType.SPIDER; case SPIDER_SPAWN_EGG -> EntityType.SPIDER;
case BAT_SPAWN_EGG -> EntityType.BAT; case BAT_SPAWN_EGG -> EntityType.BAT;
@ -1178,7 +1171,7 @@ public final class Materials {
case IRON_GOLEM_SPAWN_EGG -> EntityType.IRON_GOLEM; case IRON_GOLEM_SPAWN_EGG -> EntityType.IRON_GOLEM;
case LLAMA_SPAWN_EGG -> EntityType.LLAMA; case LLAMA_SPAWN_EGG -> EntityType.LLAMA;
case MAGMA_CUBE_SPAWN_EGG -> EntityType.MAGMA_CUBE; case MAGMA_CUBE_SPAWN_EGG -> EntityType.MAGMA_CUBE;
case MOOSHROOM_SPAWN_EGG -> EntityType.MUSHROOM_COW; case MOOSHROOM_SPAWN_EGG -> EntityType.MOOSHROOM;
case MULE_SPAWN_EGG -> EntityType.MULE; case MULE_SPAWN_EGG -> EntityType.MULE;
case OCELOT_SPAWN_EGG -> EntityType.OCELOT; case OCELOT_SPAWN_EGG -> EntityType.OCELOT;
case PANDA_SPAWN_EGG -> EntityType.PANDA; case PANDA_SPAWN_EGG -> EntityType.PANDA;
@ -1199,7 +1192,7 @@ public final class Materials {
case SKELETON_SPAWN_EGG -> EntityType.SKELETON; case SKELETON_SPAWN_EGG -> EntityType.SKELETON;
case SLIME_SPAWN_EGG -> EntityType.SLIME; case SLIME_SPAWN_EGG -> EntityType.SLIME;
case SNIFFER_SPAWN_EGG -> EntityType.SNIFFER; case SNIFFER_SPAWN_EGG -> EntityType.SNIFFER;
case SNOW_GOLEM_SPAWN_EGG -> EntityType.SNOWMAN; case SNOW_GOLEM_SPAWN_EGG -> EntityType.SNOW_GOLEM;
case SQUID_SPAWN_EGG -> EntityType.SQUID; case SQUID_SPAWN_EGG -> EntityType.SQUID;
case STRAY_SPAWN_EGG -> EntityType.STRAY; case STRAY_SPAWN_EGG -> EntityType.STRAY;
case STRIDER_SPAWN_EGG -> EntityType.STRIDER; case STRIDER_SPAWN_EGG -> EntityType.STRIDER;
@ -1343,7 +1336,8 @@ public final class Materials {
|| type == Material.DRAGON_EGG || type == Material.DRAGON_EGG
|| Tag.FLOWER_POTS.isTagged(type) || Tag.FLOWER_POTS.isTagged(type)
|| Tag.CANDLES.isTagged(type) || Tag.CANDLES.isTagged(type)
|| Tag.CANDLE_CAKES.isTagged(type); || Tag.CANDLE_CAKES.isTagged(type)
|| Tag.ALL_SIGNS.isTagged(type);
} }
/** /**
@ -1456,9 +1450,9 @@ public final class Materials {
case YELLOW_DYE: case YELLOW_DYE:
case GLOW_INK_SAC: case GLOW_INK_SAC:
case INK_SAC: case INK_SAC:
return SIGNS_TAG.isTagged(targetMaterial); return Tag.ALL_SIGNS.isTagged(targetMaterial);
case HONEYCOMB: case HONEYCOMB:
return isUnwaxedCopper(targetMaterial) || SIGNS_TAG.isTagged(targetMaterial); return isUnwaxedCopper(targetMaterial) || Tag.ALL_SIGNS.isTagged(targetMaterial);
case BRUSH: case BRUSH:
return switch (targetMaterial) { return switch (targetMaterial) {
case SUSPICIOUS_GRAVEL, SUSPICIOUS_SAND -> true; case SUSPICIOUS_GRAVEL, SUSPICIOUS_SAND -> true;

View File

@ -95,9 +95,9 @@ public class DatabaseHandler implements LoggerHandler {
stmt.setString(1, eventType.name()); stmt.setString(1, eventType.name());
stmt.setString(2, worldName); stmt.setString(2, worldName);
stmt.setString(3, player != null ? player.getName() : ""); stmt.setString(3, player != null ? player.getName() : "");
stmt.setInt(4, pos.getBlockX()); stmt.setInt(4, pos.x());
stmt.setInt(5, pos.getBlockY()); stmt.setInt(5, pos.y());
stmt.setInt(6, pos.getBlockZ()); stmt.setInt(6, pos.z());
stmt.setString(7, item); stmt.setString(7, item);
stmt.setInt(8, (int)(System.currentTimeMillis() / 1000)); stmt.setInt(8, (int)(System.currentTimeMillis() / 1000));
stmt.setString(9, comment); stmt.setString(9, comment);

View File

@ -221,7 +221,7 @@ public class FileHandler implements LoggerHandler {
* @return The position's coordinates in human-readable form * @return The position's coordinates in human-readable form
*/ */
private String getCoordinates(BlockVector3 pos) { private String getCoordinates(BlockVector3 pos) {
return "@" + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ(); return "@" + pos.x() + "," + pos.y() + "," + pos.z();
} }
private void logEvent(BlacklistEvent event, String text, Target target, BlockVector3 pos, String comment) { private void logEvent(BlacklistEvent event, String text, Target target, BlockVector3 pos, String comment) {

View File

@ -378,7 +378,7 @@ class FlagHelperBox extends PaginationBox {
if (currVal == null) { if (currVal == null) {
currVal = getInheritedValue(region, flag); currVal = getInheritedValue(region, flag);
} }
String display = currVal == null ? regName : currVal.getId(); String display = currVal == null ? regName : currVal.id();
appendValueText(builder, flag, display, null); appendValueText(builder, flag, display, null);
} }

View File

@ -305,8 +305,8 @@ class RegionCommandsBase {
// Detect the type of region from WorldEdit // Detect the type of region from WorldEdit
if (selection instanceof Polygonal2DRegion) { if (selection instanceof Polygonal2DRegion) {
Polygonal2DRegion polySel = (Polygonal2DRegion) selection; Polygonal2DRegion polySel = (Polygonal2DRegion) selection;
int minY = polySel.getMinimumPoint().getBlockY(); int minY = polySel.getMinimumPoint().y();
int maxY = polySel.getMaximumPoint().getBlockY(); int maxY = polySel.getMaximumPoint().y();
return new ProtectedPolygonalRegion(id, polySel.getPoints(), minY, maxY); return new ProtectedPolygonalRegion(id, polySel.getPoints(), minY, maxY);
} else if (selection instanceof CuboidRegion) { } else if (selection instanceof CuboidRegion) {
BlockVector3 min = selection.getMinimumPoint(); BlockVector3 min = selection.getMinimumPoint();
@ -345,7 +345,7 @@ class RegionCommandsBase {
if (region instanceof GlobalProtectedRegion) { if (region instanceof GlobalProtectedRegion) {
return; return;
} }
int height = region.getMaximumPoint().getBlockY() - region.getMinimumPoint().getBlockY(); int height = region.getMaximumPoint().y() - region.getMinimumPoint().y();
if (height <= 2) { if (height <= 2) {
sender.printDebug("(Warning: The height of the region was " + (height + 1) + " block(s).)"); sender.printDebug("(Warning: The height of the region was " + (height + 1) + " block(s).)");
} }

View File

@ -57,6 +57,6 @@ public class EntityTypeFlag extends Flag<EntityType> {
@Override @Override
public Object marshal(EntityType o) { public Object marshal(EntityType o) {
return o.getId(); return o.id();
} }
} }

View File

@ -57,6 +57,6 @@ public class GameModeTypeFlag extends Flag<GameMode> {
@Override @Override
public Object marshal(GameMode o) { public Object marshal(GameMode o) {
return o.getId(); return o.id();
} }
} }

View File

@ -137,9 +137,9 @@ public class LocationFlag extends Flag<Location> {
return null; return null;
} }
} }
vec.put("x", position.getX()); vec.put("x", position.x());
vec.put("y", position.getY()); vec.put("y", position.y());
vec.put("z", position.getZ()); vec.put("z", position.z());
vec.put("yaw", o.getYaw()); vec.put("yaw", o.getYaw());
vec.put("pitch", o.getPitch()); vec.put("pitch", o.getPitch());
return vec; return vec;

View File

@ -61,6 +61,6 @@ public class RegistryFlag<T extends Keyed> extends Flag<T> {
@Override @Override
public Object marshal(T o) { public Object marshal(T o) {
return o.getId(); return o.id();
} }
} }

View File

@ -82,9 +82,9 @@ public class VectorFlag extends Flag<Vector3> {
@Override @Override
public Object marshal(Vector3 o) { public Object marshal(Vector3 o) {
Map<String, Object> vec = new HashMap<>(); Map<String, Object> vec = new HashMap<>();
vec.put("x", o.getX()); vec.put("x", o.x());
vec.put("y", o.getY()); vec.put("y", o.y());
vec.put("z", o.getZ()); vec.put("z", o.z());
return vec; return vec;
} }

View File

@ -57,6 +57,6 @@ public class WeatherTypeFlag extends Flag<WeatherType> {
@Override @Override
public Object marshal(WeatherType o) { public Object marshal(WeatherType o) {
return o.getId(); return o.id();
} }
} }

View File

@ -93,10 +93,10 @@ public class ChunkHashTable implements ConcurrentRegionIndex {
private ChunkState get(BlockVector2 position, boolean create) { private ChunkState get(BlockVector2 position, boolean create) {
ChunkState state; ChunkState state;
synchronized (lock) { synchronized (lock) {
state = states.get(position.getBlockX(), position.getBlockZ()); state = states.get(position.x(), position.z());
if (state == null && create) { if (state == null && create) {
state = new ChunkState(position); state = new ChunkState(position);
states.put(position.getBlockX(), position.getBlockZ(), state); states.put(position.x(), position.z(), state);
executor.submit(new EnumerateRegions(position)); executor.submit(new EnumerateRegions(position));
} }
} }
@ -130,7 +130,7 @@ public class ChunkHashTable implements ConcurrentRegionIndex {
for (ChunkState state : previousStates.values()) { for (ChunkState state : previousStates.values()) {
BlockVector2 position = state.getPosition(); BlockVector2 position = state.getPosition();
positions.add(position); positions.add(position);
states.put(position.getBlockX(), position.getBlockZ(), new ChunkState(position)); states.put(position.x(), position.z(), new ChunkState(position));
} }
if (!positions.isEmpty()) { if (!positions.isEmpty()) {
@ -179,9 +179,9 @@ public class ChunkHashTable implements ConcurrentRegionIndex {
public void forget(BlockVector2 chunkPosition) { public void forget(BlockVector2 chunkPosition) {
checkNotNull(chunkPosition); checkNotNull(chunkPosition);
synchronized (lock) { synchronized (lock) {
states.remove(chunkPosition.getBlockX(), chunkPosition.getBlockZ()); states.remove(chunkPosition.x(), chunkPosition.z());
ChunkState state = lastState; ChunkState state = lastState;
if (state != null && state.getPosition().getBlockX() == chunkPosition.getBlockX() && state.getPosition().getBlockZ() == chunkPosition.getBlockZ()) { if (state != null && state.getPosition().x() == chunkPosition.x() && state.getPosition().z() == chunkPosition.z()) {
lastState = null; lastState = null;
} }
} }
@ -238,10 +238,10 @@ public class ChunkHashTable implements ConcurrentRegionIndex {
checkNotNull(consumer); checkNotNull(consumer);
ChunkState state = lastState; ChunkState state = lastState;
int chunkX = position.getBlockX() >> 4; int chunkX = position.x() >> 4;
int chunkZ = position.getBlockZ() >> 4; int chunkZ = position.z() >> 4;
if (state == null || state.getPosition().getBlockX() != chunkX || state.getPosition().getBlockZ() != chunkZ) { if (state == null || state.getPosition().x() != chunkX || state.getPosition().z() != chunkZ) {
state = get(BlockVector2.at(chunkX, chunkZ), false); state = get(BlockVector2.at(chunkX, chunkZ), false);
} }

View File

@ -69,7 +69,7 @@ public class PriorityRTreeIndex extends HashMapIndex {
@Override @Override
public void applyContaining(BlockVector3 position, Predicate<ProtectedRegion> consumer) { public void applyContaining(BlockVector3 position, Predicate<ProtectedRegion> consumer) {
Set<ProtectedRegion> seen = new HashSet<>(); Set<ProtectedRegion> seen = new HashSet<>();
MBR pointMBR = new SimpleMBR(position.getX(), position.getX(), position.getY(), position.getY(), position.getZ(), position.getZ()); MBR pointMBR = new SimpleMBR(position.x(), position.x(), position.y(), position.y(), position.z(), position.z());
for (ProtectedRegion region : tree.find(pointMBR)) { for (ProtectedRegion region : tree.find(pointMBR)) {
if (region.contains(position) && !seen.contains(region)) { if (region.contains(position) && !seen.contains(region)) {
@ -87,7 +87,7 @@ public class PriorityRTreeIndex extends HashMapIndex {
BlockVector3 max = region.getMaximumPoint().ceil(); BlockVector3 max = region.getMaximumPoint().ceil();
Set<ProtectedRegion> candidates = new HashSet<>(); Set<ProtectedRegion> candidates = new HashSet<>();
MBR pointMBR = new SimpleMBR(min.getX(), max.getX(), min.getY(), max.getY(), min.getZ(), max.getZ()); MBR pointMBR = new SimpleMBR(min.x(), max.x(), min.y(), max.y(), min.z(), max.z());
for (ProtectedRegion found : tree.find(pointMBR)) { for (ProtectedRegion found : tree.find(pointMBR)) {
candidates.add(found); candidates.add(found);

View File

@ -84,8 +84,8 @@ public class WorldHeightMigration extends AbstractMigration {
if (min == 0 && max == 255) return; if (min == 0 && max == 255) return;
} }
for (ProtectedRegion region : regions) { for (ProtectedRegion region : regions) {
if (region.getMinimumPoint().getBlockY() <= 0 if (region.getMinimumPoint().y() <= 0
&& region.getMaximumPoint().getBlockY() >= 255) { && region.getMaximumPoint().y() >= 255) {
expand(region, min, max); expand(region, min, max);
changed++; changed++;
} }

View File

@ -216,14 +216,14 @@ public class YamlRegionFile implements RegionDatabase {
} else if (region instanceof ProtectedPolygonalRegion) { } else if (region instanceof ProtectedPolygonalRegion) {
ProtectedPolygonalRegion poly = (ProtectedPolygonalRegion) region; ProtectedPolygonalRegion poly = (ProtectedPolygonalRegion) region;
node.setProperty("type", "poly2d"); node.setProperty("type", "poly2d");
node.setProperty("min-y", poly.getMinimumPoint().getBlockY()); node.setProperty("min-y", poly.getMinimumPoint().y());
node.setProperty("max-y", poly.getMaximumPoint().getBlockY()); node.setProperty("max-y", poly.getMaximumPoint().y());
List<Map<String, Object>> points = new ArrayList<>(); List<Map<String, Object>> points = new ArrayList<>();
for (BlockVector2 point : poly.getPoints()) { for (BlockVector2 point : poly.getPoints()) {
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("x", point.getBlockX()); data.put("x", point.x());
data.put("z", point.getBlockZ()); data.put("z", point.z());
points.add(data); points.add(data);
} }

View File

@ -113,12 +113,12 @@ class RegionInserter {
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
stmt.setString(1, region.getId()); stmt.setString(1, region.getId());
stmt.setInt(2, min.getBlockZ()); stmt.setInt(2, min.z());
stmt.setInt(3, min.getBlockY()); stmt.setInt(3, min.y());
stmt.setInt(4, min.getBlockX()); stmt.setInt(4, min.x());
stmt.setInt(5, max.getBlockZ()); stmt.setInt(5, max.z());
stmt.setInt(6, max.getBlockY()); stmt.setInt(6, max.y());
stmt.setInt(7, max.getBlockX()); stmt.setInt(7, max.x());
stmt.addBatch(); stmt.addBatch();
} }
@ -141,8 +141,8 @@ class RegionInserter {
for (List<ProtectedPolygonalRegion> partition : Lists.partition(polygons, StatementBatch.MAX_BATCH_SIZE)) { for (List<ProtectedPolygonalRegion> partition : Lists.partition(polygons, StatementBatch.MAX_BATCH_SIZE)) {
for (ProtectedPolygonalRegion region : partition) { for (ProtectedPolygonalRegion region : partition) {
stmt.setString(1, region.getId()); stmt.setString(1, region.getId());
stmt.setInt(2, region.getMaximumPoint().getBlockY()); stmt.setInt(2, region.getMaximumPoint().y());
stmt.setInt(3, region.getMinimumPoint().getBlockY()); stmt.setInt(3, region.getMinimumPoint().y());
stmt.addBatch(); stmt.addBatch();
} }
@ -167,8 +167,8 @@ class RegionInserter {
for (ProtectedPolygonalRegion region : polygons) { for (ProtectedPolygonalRegion region : polygons) {
for (BlockVector2 point : region.getPoints()) { for (BlockVector2 point : region.getPoints()) {
stmt.setString(1, region.getId()); stmt.setString(1, region.getId());
stmt.setInt(2, point.getBlockZ()); stmt.setInt(2, point.z());
stmt.setInt(3, point.getBlockX()); stmt.setInt(3, point.x());
batch.addBatch(); batch.addBatch();
} }
} }

View File

@ -69,7 +69,7 @@ public class GlobalProtectedRegion extends ProtectedRegion {
public List<BlockVector2> getPoints() { public List<BlockVector2> getPoints() {
// This doesn't make sense // This doesn't make sense
List<BlockVector2> pts = new ArrayList<>(); List<BlockVector2> pts = new ArrayList<>();
pts.add(BlockVector2.at(min.getBlockX(), min.getBlockZ())); pts.add(BlockVector2.at(min.x(), min.z()));
return pts; return pts;
} }

View File

@ -113,10 +113,10 @@ public class ProtectedCuboidRegion extends ProtectedRegion {
@Override @Override
public List<BlockVector2> getPoints() { public List<BlockVector2> getPoints() {
List<BlockVector2> pts = new ArrayList<>(); List<BlockVector2> pts = new ArrayList<>();
int x1 = min.getBlockX(); int x1 = min.x();
int x2 = max.getBlockX(); int x2 = max.x();
int z1 = min.getBlockZ(); int z1 = min.z();
int z2 = max.getBlockZ(); int z2 = max.z();
pts.add(BlockVector2.at(x1, z1)); pts.add(BlockVector2.at(x1, z1));
pts.add(BlockVector2.at(x2, z1)); pts.add(BlockVector2.at(x2, z1));
@ -128,12 +128,12 @@ public class ProtectedCuboidRegion extends ProtectedRegion {
@Override @Override
public boolean contains(BlockVector3 pt) { public boolean contains(BlockVector3 pt) {
final double x = pt.getX(); final double x = pt.x();
final double y = pt.getY(); final double y = pt.y();
final double z = pt.getZ(); final double z = pt.z();
return x >= min.getBlockX() && x < max.getBlockX() + 1 return x >= min.x() && x < max.x() + 1
&& y >= min.getBlockY() && y < max.getBlockY() + 1 && y >= min.y() && y < max.y() + 1
&& z >= min.getBlockZ() && z < max.getBlockZ() + 1; && z >= min.z() && z < max.z() + 1;
} }
@Override @Override
@ -143,10 +143,10 @@ public class ProtectedCuboidRegion extends ProtectedRegion {
@Override @Override
Area toArea() { Area toArea() {
int x = getMinimumPoint().getBlockX(); int x = getMinimumPoint().x();
int z = getMinimumPoint().getBlockZ(); int z = getMinimumPoint().z();
int width = getMaximumPoint().getBlockX() - x + 1; int width = getMaximumPoint().x() - x + 1;
int height = getMaximumPoint().getBlockZ() - z + 1; int height = getMaximumPoint().z() - z + 1;
return new Area(new Rectangle(x, z, width, height)); return new Area(new Rectangle(x, z, width, height));
} }
@ -161,9 +161,9 @@ public class ProtectedCuboidRegion extends ProtectedRegion {
@Override @Override
public int volume() { public int volume() {
int xLength = max.getBlockX() - min.getBlockX() + 1; int xLength = max.x() - min.x() + 1;
int yLength = max.getBlockY() - min.getBlockY() + 1; int yLength = max.y() - min.y() + 1;
int zLength = max.getBlockZ() - min.getBlockZ() + 1; int zLength = max.z() - min.z() + 1;
try { try {
long v = MathUtils.checkedMultiply(xLength, yLength); long v = MathUtils.checkedMultiply(xLength, yLength);

View File

@ -65,8 +65,8 @@ public class ProtectedPolygonalRegion extends ProtectedRegion {
ImmutableList<BlockVector2> immutablePoints = ImmutableList.copyOf(points); ImmutableList<BlockVector2> immutablePoints = ImmutableList.copyOf(points);
setMinMaxPoints(immutablePoints, minY, maxY); setMinMaxPoints(immutablePoints, minY, maxY);
this.points = immutablePoints; this.points = immutablePoints;
this.minY = min.getBlockY(); this.minY = min.y();
this.maxY = max.getBlockY(); this.maxY = max.y();
} }
/** /**
@ -82,7 +82,7 @@ public class ProtectedPolygonalRegion extends ProtectedRegion {
List<BlockVector3> points = new ArrayList<>(); List<BlockVector3> points = new ArrayList<>();
int y = minY; int y = minY;
for (BlockVector2 point2D : points2D) { for (BlockVector2 point2D : points2D) {
points.add(BlockVector3.at(point2D.getBlockX(), y, point2D.getBlockZ())); points.add(BlockVector3.at(point2D.x(), y, point2D.z()));
y = maxY; y = maxY;
} }
setMinMaxPoints(points); setMinMaxPoints(points);
@ -102,15 +102,15 @@ public class ProtectedPolygonalRegion extends ProtectedRegion {
public boolean contains(BlockVector3 position) { public boolean contains(BlockVector3 position) {
checkNotNull(position); checkNotNull(position);
int targetX = position.getBlockX(); // Width int targetX = position.x(); // Width
int targetY = position.getBlockY(); // Height int targetY = position.y(); // Height
int targetZ = position.getBlockZ(); // Depth int targetZ = position.z(); // Depth
if (targetY < minY || targetY > maxY) { if (targetY < minY || targetY > maxY) {
return false; return false;
} }
//Quick and dirty check. //Quick and dirty check.
if (targetX < min.getBlockX() || targetX > max.getBlockX() || targetZ < min.getBlockZ() || targetZ > max.getBlockZ()) { if (targetX < min.x() || targetX > max.x() || targetZ < min.z() || targetZ > max.z()) {
return false; return false;
} }
boolean inside = false; boolean inside = false;
@ -122,12 +122,12 @@ public class ProtectedPolygonalRegion extends ProtectedRegion {
long crossproduct; long crossproduct;
int i; int i;
xOld = points.get(npoints - 1).getBlockX(); xOld = points.get(npoints - 1).x();
zOld = points.get(npoints - 1).getBlockZ(); zOld = points.get(npoints - 1).z();
for (i = 0; i < npoints; i++) { for (i = 0; i < npoints; i++) {
xNew = points.get(i).getBlockX(); xNew = points.get(i).x();
zNew = points.get(i).getBlockZ(); zNew = points.get(i).z();
//Check for corner //Check for corner
if (xNew == targetX && zNew == targetZ) { if (xNew == targetX && zNew == targetZ) {
return true; return true;
@ -173,8 +173,8 @@ public class ProtectedPolygonalRegion extends ProtectedRegion {
int i = 0; int i = 0;
for (BlockVector2 point : points) { for (BlockVector2 point : points) {
xCoords[i] = point.getBlockX(); xCoords[i] = point.x();
yCoords[i] = point.getBlockZ(); yCoords[i] = point.z();
i++; i++;
} }

View File

@ -92,17 +92,17 @@ public abstract class ProtectedRegion implements ChangeTracked, Comparable<Prote
* @param points the points to set with at least one entry * @param points the points to set with at least one entry
*/ */
protected void setMinMaxPoints(List<BlockVector3> points) { protected void setMinMaxPoints(List<BlockVector3> points) {
int minX = points.get(0).getBlockX(); int minX = points.get(0).x();
int minY = points.get(0).getBlockY(); int minY = points.get(0).y();
int minZ = points.get(0).getBlockZ(); int minZ = points.get(0).z();
int maxX = minX; int maxX = minX;
int maxY = minY; int maxY = minY;
int maxZ = minZ; int maxZ = minZ;
for (BlockVector3 v : points) { for (BlockVector3 v : points) {
int x = v.getBlockX(); int x = v.x();
int y = v.getBlockY(); int y = v.y();
int z = v.getBlockZ(); int z = v.z();
if (x < minX) minX = x; if (x < minX) minX = x;
if (y < minY) minY = y; if (y < minY) minY = y;
@ -514,7 +514,7 @@ public abstract class ProtectedRegion implements ChangeTracked, Comparable<Prote
*/ */
public boolean contains(BlockVector2 position) { public boolean contains(BlockVector2 position) {
checkNotNull(position); checkNotNull(position);
return contains(BlockVector3.at(position.getBlockX(), min.getBlockY(), position.getBlockZ())); return contains(BlockVector3.at(position.x(), min.y(), position.z()));
} }
/** /**
@ -607,16 +607,16 @@ public abstract class ProtectedRegion implements ChangeTracked, Comparable<Prote
BlockVector3 rMaxPoint = region.getMaximumPoint(); BlockVector3 rMaxPoint = region.getMaximumPoint();
BlockVector3 min = getMinimumPoint(); BlockVector3 min = getMinimumPoint();
if (rMaxPoint.getBlockX() < min.getBlockX()) return false; if (rMaxPoint.x() < min.x()) return false;
if (rMaxPoint.getBlockY() < min.getBlockY()) return false; if (rMaxPoint.y() < min.y()) return false;
if (rMaxPoint.getBlockZ() < min.getBlockZ()) return false; if (rMaxPoint.z() < min.z()) return false;
BlockVector3 rMinPoint = region.getMinimumPoint(); BlockVector3 rMinPoint = region.getMinimumPoint();
BlockVector3 max = getMaximumPoint(); BlockVector3 max = getMaximumPoint();
if (rMinPoint.getBlockX() > max.getBlockX()) return false; if (rMinPoint.x() > max.x()) return false;
if (rMinPoint.getBlockY() > max.getBlockY()) return false; if (rMinPoint.y() > max.y()) return false;
if (rMinPoint.getBlockZ() > max.getBlockZ()) return false; if (rMinPoint.z() > max.z()) return false;
return true; return true;
} }
@ -636,16 +636,16 @@ public abstract class ProtectedRegion implements ChangeTracked, Comparable<Prote
for (BlockVector2 aPts2 : pts2) { for (BlockVector2 aPts2 : pts2) {
Line2D line1 = new Line2D.Double( Line2D line1 = new Line2D.Double(
lastPt1.getBlockX(), lastPt1.x(),
lastPt1.getBlockZ(), lastPt1.z(),
aPts1.getBlockX(), aPts1.x(),
aPts1.getBlockZ()); aPts1.z());
if (line1.intersectsLine( if (line1.intersectsLine(
lastPt2.getBlockX(), lastPt2.x(),
lastPt2.getBlockZ(), lastPt2.z(),
aPts2.getBlockX(), aPts2.x(),
aPts2.getBlockZ())) { aPts2.z())) {
return true; return true;
} }
lastPt2 = aPts2; lastPt2 = aPts2;

View File

@ -30,27 +30,21 @@ public class ProtectedRegionMBRConverter implements MBRConverter<ProtectedRegion
@Override @Override
public double getMax(int dimension, ProtectedRegion region) { public double getMax(int dimension, ProtectedRegion region) {
switch (dimension) { return switch (dimension) {
case 0: case 0 -> region.getMaximumPoint().x();
return region.getMaximumPoint().getBlockX(); case 1 -> region.getMaximumPoint().y();
case 1: case 2 -> region.getMaximumPoint().z();
return region.getMaximumPoint().getBlockY(); default -> 0;
case 2: };
return region.getMaximumPoint().getBlockZ();
}
return 0;
} }
@Override @Override
public double getMin(int dimension, ProtectedRegion region) { public double getMin(int dimension, ProtectedRegion region) {
switch (dimension) { return switch (dimension) {
case 0: case 0 -> region.getMinimumPoint().x();
return region.getMinimumPoint().getBlockX(); case 1 -> region.getMinimumPoint().y();
case 1: case 2 -> region.getMinimumPoint().z();
return region.getMinimumPoint().getBlockY(); default -> 0;
case 2: };
return region.getMinimumPoint().getBlockZ();
}
return 0;
} }
} }

View File

@ -50,7 +50,7 @@ public final class WorldEditRegionConverter {
} }
if (region instanceof ProtectedPolygonalRegion) { if (region instanceof ProtectedPolygonalRegion) {
return new Polygonal2DRegion(null, region.getPoints(), return new Polygonal2DRegion(null, region.getPoints(),
region.getMinimumPoint().getY(), region.getMaximumPoint().getY()); region.getMinimumPoint().y(), region.getMaximumPoint().y());
} }
return null; return null;
} }
@ -68,7 +68,7 @@ public final class WorldEditRegionConverter {
} }
if (region instanceof ProtectedPolygonalRegion) { if (region instanceof ProtectedPolygonalRegion) {
return new Polygonal2DRegionSelector(null, region.getPoints(), return new Polygonal2DRegionSelector(null, region.getPoints(),
region.getMinimumPoint().getY(), region.getMaximumPoint().getY()); region.getMinimumPoint().y(), region.getMaximumPoint().y());
} }
return null; return null;
} }