mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-22 17:17:57 +01:00
Merge branch 'version/7.0.x'
# Conflicts: # buildSrc/src/main/kotlin/Versions.kt # gradle/wrapper/gradle-wrapper.jar # gradle/wrapper/gradle-wrapper.properties # gradlew.bat # worldguard-core/build.gradle.kts
This commit is contained in:
commit
b67fd01ebd
@ -1,10 +1,10 @@
|
||||
object Versions {
|
||||
const val WORLDEDIT = "7.2.10"
|
||||
const val PISTON = "0.5.7"
|
||||
const val AUTO_VALUE = "1.9"
|
||||
const val JUNIT = "5.8.1"
|
||||
const val MOCKITO = "4.3.1"
|
||||
const val SQUIRRELID = "0.3.0"
|
||||
const val GUAVA = "31.0.1-jre"
|
||||
// const val PISTON = "0.4.3"
|
||||
// const val AUTO_VALUE = "1.6.5"
|
||||
const val WORLDEDIT = "7.2.12"
|
||||
const val JUNIT = "5.9.1"
|
||||
const val MOCKITO = "4.9.0"
|
||||
const val SQUIRRELID = "0.3.2"
|
||||
const val GUAVA = "31.1-jre"
|
||||
const val FINDBUGS = "3.0.2"
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
<allow pkg="org.bstats.charts"/>
|
||||
<allow pkg="io.papermc.lib"/>
|
||||
<allow pkg="com.destroystokyo.paper"/>
|
||||
<allow pkg="io.papermc.paper"/>
|
||||
<allow pkg="co.aikar.timings.lib" />
|
||||
<allow pkg="org.spigotmc" />
|
||||
</subpackage>
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
18
gradlew
vendored
18
gradlew
vendored
@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -80,10 +80,10 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# 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"'
|
||||
@ -143,12 +143,16 @@ fi
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@ -205,6 +209,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
181
gradlew.bat
vendored
181
gradlew.bat
vendored
@ -1,89 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
@ -10,11 +10,7 @@
|
||||
repositories {
|
||||
maven {
|
||||
name = "paper"
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
name = "bstats"
|
||||
url = uri("https://repo.codemc.org/repository/maven-public")
|
||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
name = "aikar-timings"
|
||||
@ -28,15 +24,15 @@
|
||||
|
||||
dependencies {
|
||||
"api"(project(":worldguard-core"))
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT")
|
||||
"runtimeOnly"("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT") {
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
||||
"runtimeOnly"("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
|
||||
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
||||
"compileOnly"("com.sk89q:commandbook:2.3") { isTransitive = false }
|
||||
"shadeOnly"("io.papermc:paperlib:1.0.7")
|
||||
"shadeOnly"("org.bstats:bstats-bukkit:2.1.0")
|
||||
"shadeOnly"("io.papermc:paperlib:1.0.8")
|
||||
"shadeOnly"("org.bstats:bstats-bukkit:3.0.1")
|
||||
"shadeOnly"("co.aikar:minecraft-timings:1.0.4")
|
||||
}
|
||||
|
||||
|
@ -281,6 +281,7 @@ public void loadConfiguration() {
|
||||
disableCropGrowth = getBoolean("dynamics.disable-crop-growth", false);
|
||||
disableSoilDehydration = getBoolean("dynamics.disable-soil-dehydration", false);
|
||||
disableCoralBlockFade = getBoolean("dynamics.disable-coral-block-fade", false);
|
||||
disableCopperBlockFade = getBoolean("dynamics.disable-copper-block-fade", false);
|
||||
allowedSnowFallOver = new HashSet<>(convertLegacyBlocks(getStringList("dynamics.snow-fall-blocks", null)));
|
||||
|
||||
useRegions = getBoolean("regions.enable", true);
|
||||
|
@ -34,6 +34,7 @@
|
||||
import com.sk89q.worldguard.util.profile.resolver.PaperPlayerService;
|
||||
import com.sk89q.worldguard.bukkit.protection.events.flags.FlagContextCreateEvent;
|
||||
import com.sk89q.worldguard.bukkit.session.BukkitSessionManager;
|
||||
import com.sk89q.worldguard.bukkit.util.report.DatapackReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.PerformanceReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.PluginReport;
|
||||
import com.sk89q.worldguard.bukkit.util.report.SchedulerReport;
|
||||
@ -239,6 +240,7 @@ public void addPlatformReports(ReportList report) {
|
||||
report.add(new ServicesReport());
|
||||
report.add(new WorldReport());
|
||||
report.add(new PerformanceReport());
|
||||
if (PaperLib.isPaper()) report.add(new DatapackReport());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +60,7 @@
|
||||
import com.sk89q.worldguard.bukkit.listener.WorldRulesListener;
|
||||
import com.sk89q.worldguard.bukkit.session.BukkitSessionManager;
|
||||
import com.sk89q.worldguard.bukkit.util.ClassSourceValidator;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.bukkit.util.Events;
|
||||
import com.sk89q.worldguard.commands.GeneralCommands;
|
||||
import com.sk89q.worldguard.commands.ProtectionCommands;
|
||||
@ -419,8 +420,9 @@ public LocalPlayer wrapPlayer(Player player, boolean silenced) {
|
||||
}
|
||||
|
||||
public Actor wrapCommandSender(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
return wrapPlayer((Player) sender);
|
||||
if (sender instanceof Player player) {
|
||||
if (Entities.isNPC(player)) return null;
|
||||
return wrapPlayer(player);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -24,6 +24,7 @@
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.internal.WGMetadata;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
@ -134,8 +135,8 @@ public Object getRootCause() {
|
||||
@Nullable
|
||||
public Player getFirstPlayer() {
|
||||
for (Object object : causes) {
|
||||
if (object instanceof Player) {
|
||||
return (Player) object;
|
||||
if (object instanceof Player p && !Entities.isNPC(p)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +146,8 @@ public Player getFirstPlayer() {
|
||||
@Nullable
|
||||
public Entity getFirstEntity() {
|
||||
for (Object object : causes) {
|
||||
if (object instanceof Entity) {
|
||||
return (Entity) object;
|
||||
if (object instanceof Entity e) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,8 +157,8 @@ public Entity getFirstEntity() {
|
||||
@Nullable
|
||||
public Entity getFirstNonPlayerEntity() {
|
||||
for (Object object : causes) {
|
||||
if (object instanceof Entity && !(object instanceof Player)) {
|
||||
return (Entity) object;
|
||||
if (object instanceof Entity e && (!(object instanceof Player) || Entities.isNPC(e))) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,8 +168,8 @@ public Entity getFirstNonPlayerEntity() {
|
||||
@Nullable
|
||||
public Block getFirstBlock() {
|
||||
for (Object object : causes) {
|
||||
if (object instanceof Block) {
|
||||
return (Block) object;
|
||||
if (object instanceof Block b) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.cause.Cause;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.config.WorldConfiguration;
|
||||
import com.sk89q.worldguard.domains.Association;
|
||||
import com.sk89q.worldguard.protection.association.DelayedRegionOverlapAssociation;
|
||||
@ -124,13 +125,12 @@ protected RegionAssociable createRegionAssociable(Cause cause) {
|
||||
|
||||
if (!cause.isKnown()) {
|
||||
return Associables.constant(Association.NON_MEMBER);
|
||||
} else if (rootCause instanceof Player) {
|
||||
return getPlugin().wrapPlayer((Player) rootCause);
|
||||
} else if (rootCause instanceof OfflinePlayer) {
|
||||
return getPlugin().wrapOfflinePlayer((OfflinePlayer) rootCause);
|
||||
} else if (rootCause instanceof Entity) {
|
||||
} else if (rootCause instanceof Player player && !Entities.isNPC(player)) {
|
||||
return getPlugin().wrapPlayer(player);
|
||||
} else if (rootCause instanceof OfflinePlayer offlinePlayer) {
|
||||
return getPlugin().wrapOfflinePlayer(offlinePlayer);
|
||||
} else if (rootCause instanceof Entity entity) {
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
final Entity entity = (Entity) rootCause;
|
||||
BukkitWorldConfiguration config = getWorldConfig(entity.getWorld());
|
||||
Location loc;
|
||||
if (PaperLib.isPaper() && config.usePaperEntityOrigin) {
|
||||
@ -144,9 +144,9 @@ protected RegionAssociable createRegionAssociable(Cause cause) {
|
||||
}
|
||||
return new DelayedRegionOverlapAssociation(query, BukkitAdapter.adapt(loc),
|
||||
config.useMaxPriorityAssociation);
|
||||
} else if (rootCause instanceof Block) {
|
||||
} else if (rootCause instanceof Block block) {
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
Location loc = ((Block) rootCause).getLocation();
|
||||
Location loc = block.getLocation();
|
||||
return new DelayedRegionOverlapAssociation(query, BukkitAdapter.adapt(loc),
|
||||
getWorldConfig(loc.getWorld()).useMaxPriorityAssociation);
|
||||
} else {
|
||||
|
@ -22,8 +22,6 @@
|
||||
import static com.sk89q.worldguard.bukkit.cause.Cause.create;
|
||||
|
||||
import com.destroystokyo.paper.event.entity.EntityZapEvent;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.bukkit.BukkitWorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.cause.Cause;
|
||||
import com.sk89q.worldguard.bukkit.event.DelegateEvent;
|
||||
@ -142,7 +140,6 @@
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@ -165,17 +162,6 @@ public class EventAbstractionListener extends AbstractListener {
|
||||
private final EventDebounce<BlockPistonRetractKey> pistonRetractDebounce = EventDebounce.create(5000);
|
||||
private final EventDebounce<BlockPistonExtendKey> pistonExtendDebounce = EventDebounce.create(5000);
|
||||
|
||||
private static final boolean HAS_SNAPSHOT_INVHOLDER;
|
||||
static {
|
||||
boolean temp;
|
||||
try {
|
||||
Inventory.class.getMethod("getHolder", boolean.class);
|
||||
temp = true;
|
||||
} catch (NoSuchMethodException e) {
|
||||
temp = false;
|
||||
}
|
||||
HAS_SNAPSHOT_INVHOLDER = temp;
|
||||
}
|
||||
/**
|
||||
* Construct the listener.
|
||||
*
|
||||
@ -963,12 +949,7 @@ public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryMoveItem(InventoryMoveItemEvent event) {
|
||||
InventoryHolder causeHolder;
|
||||
if (HAS_SNAPSHOT_INVHOLDER) {
|
||||
causeHolder = event.getInitiator().getHolder(false);
|
||||
} else {
|
||||
causeHolder = event.getInitiator().getHolder();
|
||||
}
|
||||
InventoryHolder causeHolder = PaperLib.getHolder(event.getInitiator(), false).getHolder();
|
||||
|
||||
WorldConfiguration wcfg = null;
|
||||
if (causeHolder instanceof Hopper
|
||||
@ -982,15 +963,8 @@ public void onInventoryMoveItem(InventoryMoveItemEvent event) {
|
||||
Entry entry;
|
||||
|
||||
if ((entry = moveItemDebounce.tryDebounce(event)) != null) {
|
||||
InventoryHolder sourceHolder;
|
||||
InventoryHolder targetHolder;
|
||||
/*if (HAS_SNAPSHOT_INVHOLDER) {
|
||||
sourceHolder = event.getSource().getHolder(false);
|
||||
targetHolder = event.getDestination().getHolder(false);
|
||||
} else {*/
|
||||
sourceHolder = event.getSource().getHolder();
|
||||
targetHolder = event.getDestination().getHolder();
|
||||
//}
|
||||
InventoryHolder sourceHolder = PaperLib.getHolder(event.getSource(), false).getHolder();
|
||||
InventoryHolder targetHolder = PaperLib.getHolder(event.getDestination(), false).getHolder();
|
||||
|
||||
Cause cause;
|
||||
|
||||
@ -1197,9 +1171,12 @@ private static <T extends Event & Cancellable> void handleBlockRightClick(T even
|
||||
}
|
||||
|
||||
// Handle created spawn eggs
|
||||
if (item != null && Materials.isSpawnEgg(item.getType())) {
|
||||
Events.fireToCancel(event, new SpawnEntityEvent(event, cause, placed.getLocation().add(0.5, 0, 0.5), Materials.getEntitySpawnEgg(item.getType())));
|
||||
return;
|
||||
if (item != null) {
|
||||
EntityType possibleEntityType = Materials.getEntitySpawnEgg(item.getType());
|
||||
if (possibleEntityType != null) {
|
||||
Events.fireToCancel(event, new SpawnEntityEvent(event, cause, placed.getLocation().add(0.5, 0, 0.5), possibleEntityType));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// handle water/lava placement
|
||||
|
@ -22,6 +22,7 @@
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -57,9 +58,9 @@ private boolean isInvincible(LocalPlayer player) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity victim = event.getEntity();
|
||||
if (Entities.isNPC(victim)) return;
|
||||
|
||||
if (victim instanceof Player) {
|
||||
Player player = (Player) victim;
|
||||
if (victim instanceof Player player) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (isInvincible(localPlayer)) {
|
||||
@ -87,9 +88,9 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (Entities.isNPC(entity)) return;
|
||||
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
if (entity instanceof Player player) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (isInvincible(localPlayer)) {
|
||||
@ -100,8 +101,9 @@ public void onEntityCombust(EntityCombustEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
if (Entities.isNPC(event.getEntity())) return;
|
||||
|
||||
if (event.getEntity() instanceof Player player) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (event.getFoodLevel() < player.getFoodLevel() && isInvincible(localPlayer)) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
|
||||
import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.bukkit.util.Materials;
|
||||
import com.sk89q.worldguard.config.WorldConfiguration;
|
||||
import com.sk89q.worldguard.protection.association.RegionAssociable;
|
||||
@ -118,24 +119,24 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
World world = entity.getWorld();
|
||||
if (!isRegionSupportEnabled(world)) return; // Region support disabled
|
||||
|
||||
if (Entities.isNPC(entity)) return;
|
||||
if (!(entity instanceof Player player)) return;
|
||||
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
|
||||
if (entity instanceof Player && event.getCause() == DamageCause.FALL) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer((Player) entity);
|
||||
if (event.getCause() == DamageCause.FALL) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
if (!query.testState(BukkitAdapter.adapt(entity.getLocation()), localPlayer, Flags.FALL_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (entity instanceof Player && event.getCause() == DamageCause.FLY_INTO_WALL) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer((Player) entity);
|
||||
if (!query.testState(BukkitAdapter.adapt(entity.getLocation()), localPlayer, Flags.FALL_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (event.getCause() == DamageCause.FLY_INTO_WALL) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
if (!query.testState(BukkitAdapter.adapt(entity.getLocation()), localPlayer, Flags.FALL_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -522,8 +522,7 @@ public void onVehicleExit(VehicleExitEvent event) {
|
||||
if (!isRegionSupportEnabled(vehicle.getWorld())) return; // Region support disabled
|
||||
Entity exited = event.getExited();
|
||||
|
||||
if (vehicle instanceof Tameable && exited instanceof Player) {
|
||||
Player player = (Player) exited;
|
||||
if (vehicle instanceof Tameable && exited instanceof Player player && !Entities.isNPC(player)) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
if (!isWhitelisted(Cause.create(player), vehicle.getWorld(), false)) {
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
|
@ -697,6 +697,16 @@ public void onBlockFade(BlockFadeEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (Materials.isUnwaxedCopper(event.getBlock().getType())) {
|
||||
if (wcfg.disableCopperBlockFade) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && !StateFlag.test(WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery()
|
||||
.queryState(BukkitAdapter.adapt(event.getBlock().getLocation()), (RegionAssociable) null, Flags.COPPER_FADE))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,7 @@ private void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (defender instanceof Player) {
|
||||
Player player = (Player) defender;
|
||||
} else if (defender instanceof Player player && !Entities.isNPC(defender)) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (wcfg.disableLavaDamage && type == DamageCause.LAVA) {
|
||||
@ -227,8 +226,7 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player) defender;
|
||||
if (defender instanceof Player player && !Entities.isNPC(defender)) {
|
||||
LocalPlayer localPlayer = getPlugin().wrapPlayer(player);
|
||||
|
||||
if (wcfg.disableLightningDamage && event.getCause() == DamageCause.LIGHTNING) {
|
||||
@ -289,8 +287,7 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
|
||||
WorldConfiguration wcfg = getWorldConfig(defender.getWorld());
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player) defender;
|
||||
if (defender instanceof Player player && !Entities.isNPC(defender)) {
|
||||
LocalPlayer localPlayer = getPlugin().wrapPlayer(player);
|
||||
|
||||
|
||||
@ -363,8 +360,7 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (defender instanceof Player) {
|
||||
Player player = (Player) defender;
|
||||
} else if (defender instanceof Player player && !Entities.isNPC(defender)) {
|
||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
|
||||
if (type == DamageCause.WITHER) {
|
||||
@ -665,8 +661,8 @@ public void onCreatePortal(PortalCreateEvent event) {
|
||||
.get(world);
|
||||
if (regionManager == null) return;
|
||||
LocalPlayer associable = null;
|
||||
if (event.getEntity() instanceof Player) {
|
||||
associable = getPlugin().wrapPlayer(((Player) event.getEntity()));
|
||||
if (event.getEntity() instanceof Player player) {
|
||||
associable = getPlugin().wrapPlayer(player);
|
||||
if (WorldGuard.getInstance().getPlatform().getSessionManager().hasBypass(associable, world)) {
|
||||
return;
|
||||
}
|
||||
@ -745,10 +741,10 @@ public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (wcfg.useRegions && ent instanceof Player
|
||||
if (wcfg.useRegions && ent instanceof Player player && !Entities.isNPC(ent)
|
||||
&& !WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().testState(
|
||||
BukkitAdapter.adapt(ent.getLocation()),
|
||||
WorldGuardPlugin.inst().wrapPlayer((Player) ent),
|
||||
WorldGuardPlugin.inst().wrapPlayer(player),
|
||||
Flags.HEALTH_REGEN)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -758,10 +754,11 @@ public void onEntityRegainHealth(EntityRegainHealthEvent event) {
|
||||
public void onFoodChange(FoodLevelChangeEvent event) {
|
||||
if (event.getItem() != null) return;
|
||||
HumanEntity ent = event.getEntity();
|
||||
if (!(ent instanceof Player)) return;
|
||||
if (Entities.isNPC(ent)) return;
|
||||
if (!(ent instanceof Player bukkitPlayer)) return;
|
||||
if (event.getFoodLevel() > ent.getFoodLevel()) return;
|
||||
|
||||
LocalPlayer player = WorldGuardPlugin.inst().wrapPlayer((Player) ent);
|
||||
LocalPlayer player = WorldGuardPlugin.inst().wrapPlayer(bukkitPlayer);
|
||||
WorldConfiguration wcfg = getWorldConfig(ent.getWorld());
|
||||
|
||||
if (wcfg.useRegions
|
||||
|
@ -314,6 +314,7 @@ private void handlePhysicalInteract(PlayerInteractEvent event) {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (com.sk89q.worldguard.bukkit.util.Entities.isNPC(player)) return;
|
||||
WorldConfiguration wcfg = getWorldConfig(player.getWorld());
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
@ -348,6 +349,7 @@ public void onItemHeldChange(PlayerItemHeldEvent event) {
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (com.sk89q.worldguard.bukkit.util.Entities.isNPC(player)) return;
|
||||
LocalPlayer localPlayer = getPlugin().wrapPlayer(player);
|
||||
ConfigurationManager cfg = getConfig();
|
||||
WorldConfiguration wcfg = getWorldConfig(player.getWorld());
|
||||
|
@ -24,6 +24,7 @@
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.config.WorldConfiguration;
|
||||
import com.sk89q.worldguard.session.MoveType;
|
||||
import com.sk89q.worldguard.util.Locations;
|
||||
@ -59,6 +60,7 @@ public void onVehicleMove(VehicleMoveEvent event) {
|
||||
// Did we move a block?
|
||||
if (Locations.isDifferentBlock(BukkitAdapter.adapt(event.getFrom()), BukkitAdapter.adapt(event.getTo()))) {
|
||||
for (Player player : playerPassengers) {
|
||||
if (Entities.isNPC(player)) continue;
|
||||
LocalPlayer localPlayer = getPlugin().wrapPlayer(player);
|
||||
Location lastValid;
|
||||
if ((lastValid = WorldGuard.getInstance().getPlatform().getSessionManager().get(localPlayer)
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldguard.bukkit.listener.debounce.legacy;
|
||||
|
||||
import com.sk89q.worldguard.bukkit.listener.debounce.legacy.InventoryMoveItemEventDebounce.Key;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -44,18 +45,18 @@ protected static class Key {
|
||||
private final Object target;
|
||||
|
||||
public Key(InventoryMoveItemEvent event) {
|
||||
cause = transform(event.getInitiator().getHolder());
|
||||
source = transform(event.getSource().getHolder());
|
||||
target = transform(event.getDestination().getHolder());
|
||||
cause = transform(PaperLib.getHolder(event.getInitiator(), false).getHolder());
|
||||
source = transform(PaperLib.getHolder(event.getSource(), false).getHolder());
|
||||
target = transform(PaperLib.getHolder(event.getDestination(), false).getHolder());
|
||||
}
|
||||
|
||||
private Object transform(InventoryHolder holder) {
|
||||
if (holder instanceof BlockState) {
|
||||
return new BlockMaterialKey(((BlockState) holder).getBlock());
|
||||
} else if (holder instanceof DoubleChest) {
|
||||
InventoryHolder left = ((DoubleChest) holder).getLeftSide();
|
||||
if (left instanceof Chest) {
|
||||
return new BlockMaterialKey(((Chest) left).getBlock());
|
||||
if (holder instanceof BlockState blockState) {
|
||||
return new BlockMaterialKey(blockState);
|
||||
} else if (holder instanceof DoubleChest doubleChest) {
|
||||
InventoryHolder left = doubleChest.getLeftSide();
|
||||
if (left instanceof Chest chest) {
|
||||
return new BlockMaterialKey(chest);
|
||||
} else {
|
||||
return holder;
|
||||
}
|
||||
@ -94,8 +95,8 @@ private static class BlockMaterialKey {
|
||||
private final Block block;
|
||||
private final Material material;
|
||||
|
||||
private BlockMaterialKey(Block block) {
|
||||
this.block = block;
|
||||
private BlockMaterialKey(BlockState block) {
|
||||
this.block = block.getBlock();
|
||||
material = block.getType();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
import com.sk89q.worldguard.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.event.player.ProcessPlayerEvent;
|
||||
import com.sk89q.worldguard.bukkit.util.Entities;
|
||||
import com.sk89q.worldguard.session.AbstractSessionManager;
|
||||
import com.sk89q.worldguard.session.Session;
|
||||
import com.sk89q.worldguard.session.handler.Handler;
|
||||
@ -81,9 +82,9 @@ public void run() {
|
||||
|
||||
@Override
|
||||
public boolean hasBypass(LocalPlayer player, World world) {
|
||||
if (player instanceof BukkitPlayer) {
|
||||
if (((BukkitPlayer) player).getPlayer().hasMetadata("NPC")
|
||||
&& WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(world).fakePlayerBuildOverride) {
|
||||
if (player instanceof BukkitPlayer bukkitPlayer) {
|
||||
if (Entities.isNPC(bukkitPlayer.getPlayer())
|
||||
&& WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(world).fakePlayerBuildOverride) {
|
||||
return true;
|
||||
}
|
||||
if (!((BukkitPlayer) player).getPlayer().isOnline()) {
|
||||
|
@ -70,7 +70,7 @@ public static boolean isFakePlayer(Player player) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
String name = player.getName();
|
||||
|
||||
if (player.hasMetadata("NPC")) {
|
||||
if (Entities.isNPC(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,11 @@ public final class Materials {
|
||||
private static final Map<Material, Integer> MATERIAL_FLAGS = new EnumMap<>(Material.class);
|
||||
private static final Set<PotionEffectType> DAMAGE_EFFECTS = new HashSet<>();
|
||||
|
||||
private static void putMaterialTag(Tag<Material> tag, Integer value) {
|
||||
tag.getValues().forEach(mat -> MATERIAL_FLAGS.put(mat, value));
|
||||
}
|
||||
private static Tag<Material> SIGNS_TAG;
|
||||
|
||||
static {
|
||||
ENTITY_ITEMS.put(EntityType.PAINTING, Material.PAINTING);
|
||||
ENTITY_ITEMS.put(EntityType.ARROW, Material.ARROW);
|
||||
@ -110,7 +115,7 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.IRON_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.BRICK, 0);
|
||||
MATERIAL_FLAGS.put(Material.TNT, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.BOOKSHELF, 0);
|
||||
MATERIAL_FLAGS.put(Material.BOOKSHELF, MODIFIED_ON_RIGHT);
|
||||
MATERIAL_FLAGS.put(Material.MOSSY_COBBLESTONE, 0);
|
||||
MATERIAL_FLAGS.put(Material.OBSIDIAN, 0);
|
||||
MATERIAL_FLAGS.put(Material.TORCH, 0);
|
||||
@ -815,111 +820,54 @@ public final class Materials {
|
||||
MATERIAL_FLAGS.put(Material.ECHO_SHARD, 0);
|
||||
MATERIAL_FLAGS.put(Material.REINFORCED_DEEPSLATE, 0);
|
||||
|
||||
// 1.19.3: Try to register those things
|
||||
try {
|
||||
SIGNS_TAG = Tag.ALL_SIGNS;
|
||||
|
||||
MATERIAL_FLAGS.put(Material.BAMBOO_MOSAIC, 0);
|
||||
MATERIAL_FLAGS.put(Material.BAMBOO_BLOCK, 0);
|
||||
MATERIAL_FLAGS.put(Material.STRIPPED_BAMBOO_BLOCK, 0);
|
||||
} catch (NoSuchFieldError ignored) {
|
||||
SIGNS_TAG = Tag.SIGNS;
|
||||
}
|
||||
|
||||
// Generated via tag
|
||||
for (Material woodenDoor : Tag.WOODEN_DOORS.getValues()) {
|
||||
MATERIAL_FLAGS.put(woodenDoor, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material woodenTrapdoor : Tag.WOODEN_TRAPDOORS.getValues()) {
|
||||
MATERIAL_FLAGS.put(woodenTrapdoor, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material shulkerBox : Tag.SHULKER_BOXES.getValues()) {
|
||||
MATERIAL_FLAGS.put(shulkerBox, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material boat : Tag.ITEMS_BOATS.getValues()) {
|
||||
MATERIAL_FLAGS.put(boat, 0);
|
||||
}
|
||||
for (Material banner : Tag.BANNERS.getValues()) {
|
||||
MATERIAL_FLAGS.put(banner, 0);
|
||||
}
|
||||
for (Material slab : Tag.SLABS.getValues()) {
|
||||
MATERIAL_FLAGS.put(slab, 0);
|
||||
}
|
||||
for (Material plank : Tag.PLANKS.getValues()) {
|
||||
MATERIAL_FLAGS.put(plank, 0);
|
||||
}
|
||||
for (Material carpet : Tag.WOOL_CARPETS.getValues()) {
|
||||
MATERIAL_FLAGS.put(carpet, 0);
|
||||
}
|
||||
for (Material sapling : Tag.SAPLINGS.getValues()) {
|
||||
MATERIAL_FLAGS.put(sapling, 0);
|
||||
}
|
||||
for (Material log : Tag.LOGS.getValues()) {
|
||||
MATERIAL_FLAGS.put(log, 0);
|
||||
}
|
||||
for (Material leaves : Tag.LEAVES.getValues()) {
|
||||
MATERIAL_FLAGS.put(leaves, 0);
|
||||
}
|
||||
for (Material stair : Tag.STAIRS.getValues()) {
|
||||
MATERIAL_FLAGS.put(stair, 0);
|
||||
}
|
||||
for (Material wool : Tag.WOOL.getValues()) {
|
||||
MATERIAL_FLAGS.put(wool, 0);
|
||||
}
|
||||
for (Material plate : Tag.WOODEN_PRESSURE_PLATES.getValues()) {
|
||||
MATERIAL_FLAGS.put(plate, 0);
|
||||
}
|
||||
for (Material button : Tag.BUTTONS.getValues()) {
|
||||
MATERIAL_FLAGS.put(button, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material pot : Tag.FLOWER_POTS.getValues()) {
|
||||
MATERIAL_FLAGS.put(pot, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material wall : Tag.WALLS.getValues()) {
|
||||
MATERIAL_FLAGS.put(wall, 0);
|
||||
}
|
||||
for (Material sign : Tag.SIGNS.getValues()) {
|
||||
MATERIAL_FLAGS.put(sign, 0);
|
||||
}
|
||||
for (Material flower : Tag.SMALL_FLOWERS.getValues()) {
|
||||
MATERIAL_FLAGS.put(flower, 0);
|
||||
}
|
||||
for (Material bed : Tag.BEDS.getValues()) {
|
||||
MATERIAL_FLAGS.put(bed, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material musicDisc : Tag.ITEMS_MUSIC_DISCS.getValues()) {
|
||||
MATERIAL_FLAGS.put(musicDisc, 0);
|
||||
}
|
||||
for (Material bannerPat : Tag.ITEMS_BANNERS.getValues()) {
|
||||
MATERIAL_FLAGS.put(bannerPat, 0);
|
||||
}
|
||||
for (Material fenceGate : Tag.FENCE_GATES.getValues()) {
|
||||
MATERIAL_FLAGS.put(fenceGate, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material fence : Tag.FENCES.getValues()) {
|
||||
MATERIAL_FLAGS.put(fence, 0);
|
||||
} for (Material coalOre : Tag.COAL_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(coalOre, 0);
|
||||
}
|
||||
for (Material ironOre : Tag.IRON_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(ironOre, 0);
|
||||
}
|
||||
for (Material goldOre : Tag.GOLD_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(goldOre, 0);
|
||||
}
|
||||
for (Material diamondOre : Tag.DIAMOND_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(diamondOre, 0);
|
||||
}
|
||||
for (Material redstoneOre : Tag.REDSTONE_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(redstoneOre, 0);
|
||||
}
|
||||
for (Material copperOre : Tag.COPPER_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(copperOre, 0);
|
||||
}
|
||||
for (Material emeraldOre : Tag.EMERALD_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(emeraldOre, 0);
|
||||
}
|
||||
for (Material lapisOre : Tag.LAPIS_ORES.getValues()) {
|
||||
MATERIAL_FLAGS.put(lapisOre, 0);
|
||||
}
|
||||
for (Material candle : Tag.CANDLES.getValues()) {
|
||||
MATERIAL_FLAGS.put(candle, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material candleCakes : Tag.CANDLE_CAKES.getValues()) {
|
||||
MATERIAL_FLAGS.put(candleCakes, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
for (Material cauldron : Tag.CAULDRONS.getValues()) {
|
||||
MATERIAL_FLAGS.put(cauldron, MODIFIED_ON_RIGHT);
|
||||
}
|
||||
putMaterialTag(Tag.WOODEN_DOORS, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.WOODEN_TRAPDOORS, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.SHULKER_BOXES, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.ITEMS_BOATS, 0);
|
||||
putMaterialTag(Tag.BANNERS, 0);
|
||||
putMaterialTag(Tag.SLABS, 0);
|
||||
putMaterialTag(Tag.PLANKS, 0);
|
||||
putMaterialTag(Tag.WOOL_CARPETS, 0);
|
||||
putMaterialTag(Tag.SAPLINGS, 0);
|
||||
putMaterialTag(Tag.LOGS, 0);
|
||||
putMaterialTag(Tag.LEAVES, 0);
|
||||
putMaterialTag(Tag.STAIRS, 0);
|
||||
putMaterialTag(Tag.WOOL, 0);
|
||||
putMaterialTag(Tag.WOODEN_PRESSURE_PLATES, 0);
|
||||
putMaterialTag(Tag.BUTTONS, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.FLOWER_POTS, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.WALLS, 0);
|
||||
putMaterialTag(SIGNS_TAG, 0);
|
||||
putMaterialTag(Tag.SMALL_FLOWERS, 0);
|
||||
putMaterialTag(Tag.BEDS, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.ITEMS_MUSIC_DISCS, 0);
|
||||
putMaterialTag(Tag.ITEMS_BANNERS, 0);
|
||||
putMaterialTag(Tag.FENCE_GATES, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.FENCES, 0);
|
||||
|
||||
putMaterialTag(Tag.COAL_ORES, 0);
|
||||
putMaterialTag(Tag.IRON_ORES, 0);
|
||||
putMaterialTag(Tag.GOLD_ORES, 0);
|
||||
putMaterialTag(Tag.DIAMOND_ORES, 0);
|
||||
putMaterialTag(Tag.REDSTONE_ORES, 0);
|
||||
putMaterialTag(Tag.COPPER_ORES, 0);
|
||||
putMaterialTag(Tag.EMERALD_ORES, 0);
|
||||
putMaterialTag(Tag.LAPIS_ORES, 0);
|
||||
putMaterialTag(Tag.CANDLES, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.CANDLE_CAKES, MODIFIED_ON_RIGHT);
|
||||
putMaterialTag(Tag.CAULDRONS, MODIFIED_ON_RIGHT);
|
||||
|
||||
Stream.concat(Stream.concat(
|
||||
Tag.CORAL_BLOCKS.getValues().stream(),
|
||||
@ -1170,173 +1118,89 @@ public static boolean isInventoryBlock(Material material) {
|
||||
}
|
||||
|
||||
public static boolean isSpawnEgg(Material material) {
|
||||
return switch (material) {
|
||||
case AXOLOTL_SPAWN_EGG, BAT_SPAWN_EGG, BEE_SPAWN_EGG, BLAZE_SPAWN_EGG, CAT_SPAWN_EGG,
|
||||
CAVE_SPIDER_SPAWN_EGG, CHICKEN_SPAWN_EGG, COD_SPAWN_EGG, COW_SPAWN_EGG, CREEPER_SPAWN_EGG,
|
||||
DOLPHIN_SPAWN_EGG, DONKEY_SPAWN_EGG, DROWNED_SPAWN_EGG, ELDER_GUARDIAN_SPAWN_EGG,
|
||||
ENDERMAN_SPAWN_EGG, ENDERMITE_SPAWN_EGG, EVOKER_SPAWN_EGG, FOX_SPAWN_EGG,
|
||||
GHAST_SPAWN_EGG, GLOW_SQUID_SPAWN_EGG, GOAT_SPAWN_EGG, GUARDIAN_SPAWN_EGG,
|
||||
HOGLIN_SPAWN_EGG, HORSE_SPAWN_EGG, HUSK_SPAWN_EGG, LLAMA_SPAWN_EGG, MAGMA_CUBE_SPAWN_EGG,
|
||||
MOOSHROOM_SPAWN_EGG, MULE_SPAWN_EGG, OCELOT_SPAWN_EGG, PANDA_SPAWN_EGG, PARROT_SPAWN_EGG,
|
||||
PHANTOM_SPAWN_EGG, PIGLIN_BRUTE_SPAWN_EGG, PIGLIN_SPAWN_EGG, PIG_SPAWN_EGG, PILLAGER_SPAWN_EGG,
|
||||
POLAR_BEAR_SPAWN_EGG, PUFFERFISH_SPAWN_EGG, RABBIT_SPAWN_EGG, RAVAGER_SPAWN_EGG,
|
||||
SALMON_SPAWN_EGG, SHEEP_SPAWN_EGG, SHULKER_SPAWN_EGG, SILVERFISH_SPAWN_EGG,
|
||||
SKELETON_HORSE_SPAWN_EGG, SKELETON_SPAWN_EGG, SLIME_SPAWN_EGG, SPIDER_SPAWN_EGG,
|
||||
SQUID_SPAWN_EGG, STRAY_SPAWN_EGG, STRIDER_SPAWN_EGG, TRADER_LLAMA_SPAWN_EGG,
|
||||
TROPICAL_FISH_SPAWN_EGG, TURTLE_SPAWN_EGG, VEX_SPAWN_EGG, VILLAGER_SPAWN_EGG,
|
||||
VINDICATOR_SPAWN_EGG, WANDERING_TRADER_SPAWN_EGG, WITCH_SPAWN_EGG, WITHER_SKELETON_SPAWN_EGG,
|
||||
WOLF_SPAWN_EGG, ZOGLIN_SPAWN_EGG, ZOMBIE_HORSE_SPAWN_EGG, ZOMBIFIED_PIGLIN_SPAWN_EGG,
|
||||
ZOMBIE_SPAWN_EGG, ZOMBIE_VILLAGER_SPAWN_EGG, ALLAY_SPAWN_EGG, FROG_SPAWN_EGG, TADPOLE_SPAWN_EGG,
|
||||
WARDEN_SPAWN_EGG ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
return getEntitySpawnEgg(material) != null;
|
||||
}
|
||||
|
||||
public static EntityType getEntitySpawnEgg(Material material) {
|
||||
switch (material) {
|
||||
case ALLAY_SPAWN_EGG:
|
||||
return EntityType.ALLAY;
|
||||
case AXOLOTL_SPAWN_EGG:
|
||||
return EntityType.AXOLOTL;
|
||||
case SPIDER_SPAWN_EGG:
|
||||
return EntityType.SPIDER;
|
||||
case BAT_SPAWN_EGG:
|
||||
return EntityType.BAT;
|
||||
case BEE_SPAWN_EGG:
|
||||
return EntityType.BEE;
|
||||
case BLAZE_SPAWN_EGG:
|
||||
return EntityType.BLAZE;
|
||||
case CAT_SPAWN_EGG:
|
||||
return EntityType.CAT;
|
||||
case CAVE_SPIDER_SPAWN_EGG:
|
||||
return EntityType.CAVE_SPIDER;
|
||||
case CHICKEN_SPAWN_EGG:
|
||||
return EntityType.CHICKEN;
|
||||
case COD_SPAWN_EGG:
|
||||
return EntityType.COD;
|
||||
case COW_SPAWN_EGG:
|
||||
return EntityType.COW;
|
||||
case CREEPER_SPAWN_EGG:
|
||||
return EntityType.CREEPER;
|
||||
case DOLPHIN_SPAWN_EGG:
|
||||
return EntityType.DOLPHIN;
|
||||
case DONKEY_SPAWN_EGG:
|
||||
return EntityType.DONKEY;
|
||||
case DROWNED_SPAWN_EGG:
|
||||
return EntityType.DROWNED;
|
||||
case ELDER_GUARDIAN_SPAWN_EGG:
|
||||
return EntityType.ELDER_GUARDIAN;
|
||||
case ENDERMAN_SPAWN_EGG:
|
||||
return EntityType.ENDERMAN;
|
||||
case ENDERMITE_SPAWN_EGG:
|
||||
return EntityType.ENDERMITE;
|
||||
case EVOKER_SPAWN_EGG:
|
||||
return EntityType.EVOKER;
|
||||
case FOX_SPAWN_EGG:
|
||||
return EntityType.FOX;
|
||||
case FROG_SPAWN_EGG:
|
||||
return EntityType.FROG;
|
||||
case GHAST_SPAWN_EGG:
|
||||
return EntityType.GHAST;
|
||||
case GLOW_SQUID_SPAWN_EGG:
|
||||
return EntityType.GLOW_SQUID;
|
||||
case GOAT_SPAWN_EGG:
|
||||
return EntityType.GOAT;
|
||||
case GUARDIAN_SPAWN_EGG:
|
||||
return EntityType.GUARDIAN;
|
||||
case HOGLIN_SPAWN_EGG:
|
||||
return EntityType.HOGLIN;
|
||||
case HORSE_SPAWN_EGG:
|
||||
return EntityType.HORSE;
|
||||
case HUSK_SPAWN_EGG:
|
||||
return EntityType.HUSK;
|
||||
case LLAMA_SPAWN_EGG:
|
||||
return EntityType.LLAMA;
|
||||
case MAGMA_CUBE_SPAWN_EGG:
|
||||
return EntityType.MAGMA_CUBE;
|
||||
case MOOSHROOM_SPAWN_EGG:
|
||||
return EntityType.MUSHROOM_COW;
|
||||
case MULE_SPAWN_EGG:
|
||||
return EntityType.MULE;
|
||||
case OCELOT_SPAWN_EGG:
|
||||
return EntityType.OCELOT;
|
||||
case PANDA_SPAWN_EGG:
|
||||
return EntityType.PANDA;
|
||||
case PARROT_SPAWN_EGG:
|
||||
return EntityType.PARROT;
|
||||
case PHANTOM_SPAWN_EGG:
|
||||
return EntityType.PHANTOM;
|
||||
case PIGLIN_BRUTE_SPAWN_EGG:
|
||||
return EntityType.PIGLIN_BRUTE;
|
||||
case PIGLIN_SPAWN_EGG:
|
||||
return EntityType.PIGLIN;
|
||||
case PILLAGER_SPAWN_EGG:
|
||||
return EntityType.PILLAGER;
|
||||
case POLAR_BEAR_SPAWN_EGG:
|
||||
return EntityType.POLAR_BEAR;
|
||||
case PUFFERFISH_SPAWN_EGG:
|
||||
return EntityType.PUFFERFISH;
|
||||
case RABBIT_SPAWN_EGG:
|
||||
return EntityType.RABBIT;
|
||||
case RAVAGER_SPAWN_EGG:
|
||||
return EntityType.RAVAGER;
|
||||
case SALMON_SPAWN_EGG:
|
||||
return EntityType.SALMON;
|
||||
case SHEEP_SPAWN_EGG:
|
||||
return EntityType.SHEEP;
|
||||
case SHULKER_SPAWN_EGG:
|
||||
return EntityType.SHULKER;
|
||||
case SILVERFISH_SPAWN_EGG:
|
||||
return EntityType.SILVERFISH;
|
||||
case SKELETON_HORSE_SPAWN_EGG:
|
||||
return EntityType.SKELETON_HORSE;
|
||||
case SKELETON_SPAWN_EGG:
|
||||
return EntityType.SKELETON;
|
||||
case SLIME_SPAWN_EGG:
|
||||
return EntityType.SLIME;
|
||||
case SQUID_SPAWN_EGG:
|
||||
return EntityType.SQUID;
|
||||
case STRAY_SPAWN_EGG:
|
||||
return EntityType.STRAY;
|
||||
case STRIDER_SPAWN_EGG:
|
||||
return EntityType.STRIDER;
|
||||
case TADPOLE_SPAWN_EGG:
|
||||
return EntityType.TADPOLE;
|
||||
case TRADER_LLAMA_SPAWN_EGG:
|
||||
return EntityType.TRADER_LLAMA;
|
||||
case TROPICAL_FISH_SPAWN_EGG:
|
||||
return EntityType.TROPICAL_FISH;
|
||||
case TURTLE_SPAWN_EGG:
|
||||
return EntityType.TURTLE;
|
||||
case VEX_SPAWN_EGG:
|
||||
return EntityType.VEX;
|
||||
case VILLAGER_SPAWN_EGG:
|
||||
return EntityType.VILLAGER;
|
||||
case VINDICATOR_SPAWN_EGG:
|
||||
return EntityType.VINDICATOR;
|
||||
case WANDERING_TRADER_SPAWN_EGG:
|
||||
return EntityType.WANDERING_TRADER;
|
||||
case WARDEN_SPAWN_EGG:
|
||||
return EntityType.WARDEN;
|
||||
case WITCH_SPAWN_EGG:
|
||||
return EntityType.WITCH;
|
||||
case WITHER_SKELETON_SPAWN_EGG:
|
||||
return EntityType.WITHER_SKELETON;
|
||||
case WOLF_SPAWN_EGG:
|
||||
return EntityType.WOLF;
|
||||
case ZOMBIE_HORSE_SPAWN_EGG:
|
||||
return EntityType.ZOMBIE_HORSE;
|
||||
case ZOMBIFIED_PIGLIN_SPAWN_EGG:
|
||||
return EntityType.ZOMBIFIED_PIGLIN;
|
||||
case ZOMBIE_SPAWN_EGG:
|
||||
return EntityType.ZOMBIE;
|
||||
case ZOMBIE_VILLAGER_SPAWN_EGG:
|
||||
return EntityType.ZOMBIE_VILLAGER;
|
||||
case PIG_SPAWN_EGG:
|
||||
default: // Uhh
|
||||
return EntityType.PIG;
|
||||
}
|
||||
return switch (material) {
|
||||
case ALLAY_SPAWN_EGG -> EntityType.ALLAY;
|
||||
case AXOLOTL_SPAWN_EGG -> EntityType.AXOLOTL;
|
||||
case SPIDER_SPAWN_EGG -> EntityType.SPIDER;
|
||||
case BAT_SPAWN_EGG -> EntityType.BAT;
|
||||
case BEE_SPAWN_EGG -> EntityType.BEE;
|
||||
case BLAZE_SPAWN_EGG -> EntityType.BLAZE;
|
||||
case CAT_SPAWN_EGG -> EntityType.CAT;
|
||||
case CAMEL_SPAWN_EGG -> EntityType.CAMEL;
|
||||
case CAVE_SPIDER_SPAWN_EGG -> EntityType.CAVE_SPIDER;
|
||||
case CHICKEN_SPAWN_EGG -> EntityType.CHICKEN;
|
||||
case COD_SPAWN_EGG -> EntityType.COD;
|
||||
case COW_SPAWN_EGG -> EntityType.COW;
|
||||
case CREEPER_SPAWN_EGG -> EntityType.CREEPER;
|
||||
case DOLPHIN_SPAWN_EGG -> EntityType.DOLPHIN;
|
||||
case DONKEY_SPAWN_EGG -> EntityType.DONKEY;
|
||||
case DROWNED_SPAWN_EGG -> EntityType.DROWNED;
|
||||
case ELDER_GUARDIAN_SPAWN_EGG -> EntityType.ELDER_GUARDIAN;
|
||||
case ENDER_DRAGON_SPAWN_EGG -> EntityType.ENDER_DRAGON;
|
||||
case ENDERMAN_SPAWN_EGG -> EntityType.ENDERMAN;
|
||||
case ENDERMITE_SPAWN_EGG -> EntityType.ENDERMITE;
|
||||
case EVOKER_SPAWN_EGG -> EntityType.EVOKER;
|
||||
case FOX_SPAWN_EGG -> EntityType.FOX;
|
||||
case FROG_SPAWN_EGG -> EntityType.FROG;
|
||||
case GHAST_SPAWN_EGG -> EntityType.GHAST;
|
||||
case GLOW_SQUID_SPAWN_EGG -> EntityType.GLOW_SQUID;
|
||||
case GOAT_SPAWN_EGG -> EntityType.GOAT;
|
||||
case GUARDIAN_SPAWN_EGG -> EntityType.GUARDIAN;
|
||||
case HOGLIN_SPAWN_EGG -> EntityType.HOGLIN;
|
||||
case HORSE_SPAWN_EGG -> EntityType.HORSE;
|
||||
case HUSK_SPAWN_EGG -> EntityType.HUSK;
|
||||
case IRON_GOLEM_SPAWN_EGG -> EntityType.IRON_GOLEM;
|
||||
case LLAMA_SPAWN_EGG -> EntityType.LLAMA;
|
||||
case MAGMA_CUBE_SPAWN_EGG -> EntityType.MAGMA_CUBE;
|
||||
case MOOSHROOM_SPAWN_EGG -> EntityType.MUSHROOM_COW;
|
||||
case MULE_SPAWN_EGG -> EntityType.MULE;
|
||||
case OCELOT_SPAWN_EGG -> EntityType.OCELOT;
|
||||
case PANDA_SPAWN_EGG -> EntityType.PANDA;
|
||||
case PARROT_SPAWN_EGG -> EntityType.PARROT;
|
||||
case PHANTOM_SPAWN_EGG -> EntityType.PHANTOM;
|
||||
case PIGLIN_BRUTE_SPAWN_EGG -> EntityType.PIGLIN_BRUTE;
|
||||
case PIGLIN_SPAWN_EGG -> EntityType.PIGLIN;
|
||||
case PILLAGER_SPAWN_EGG -> EntityType.PILLAGER;
|
||||
case POLAR_BEAR_SPAWN_EGG -> EntityType.POLAR_BEAR;
|
||||
case PUFFERFISH_SPAWN_EGG -> EntityType.PUFFERFISH;
|
||||
case RABBIT_SPAWN_EGG -> EntityType.RABBIT;
|
||||
case RAVAGER_SPAWN_EGG -> EntityType.RAVAGER;
|
||||
case SALMON_SPAWN_EGG -> EntityType.SALMON;
|
||||
case SHEEP_SPAWN_EGG -> EntityType.SHEEP;
|
||||
case SHULKER_SPAWN_EGG -> EntityType.SHULKER;
|
||||
case SILVERFISH_SPAWN_EGG -> EntityType.SILVERFISH;
|
||||
case SKELETON_HORSE_SPAWN_EGG -> EntityType.SKELETON_HORSE;
|
||||
case SKELETON_SPAWN_EGG -> EntityType.SKELETON;
|
||||
case SLIME_SPAWN_EGG -> EntityType.SLIME;
|
||||
case SNOW_GOLEM_SPAWN_EGG -> EntityType.SNOWMAN;
|
||||
case SQUID_SPAWN_EGG -> EntityType.SQUID;
|
||||
case STRAY_SPAWN_EGG -> EntityType.STRAY;
|
||||
case STRIDER_SPAWN_EGG -> EntityType.STRIDER;
|
||||
case TADPOLE_SPAWN_EGG -> EntityType.TADPOLE;
|
||||
case TRADER_LLAMA_SPAWN_EGG -> EntityType.TRADER_LLAMA;
|
||||
case TROPICAL_FISH_SPAWN_EGG -> EntityType.TROPICAL_FISH;
|
||||
case TURTLE_SPAWN_EGG -> EntityType.TURTLE;
|
||||
case VEX_SPAWN_EGG -> EntityType.VEX;
|
||||
case VILLAGER_SPAWN_EGG -> EntityType.VILLAGER;
|
||||
case VINDICATOR_SPAWN_EGG -> EntityType.VINDICATOR;
|
||||
case WANDERING_TRADER_SPAWN_EGG -> EntityType.WANDERING_TRADER;
|
||||
case WARDEN_SPAWN_EGG -> EntityType.WARDEN;
|
||||
case WITCH_SPAWN_EGG -> EntityType.WITCH;
|
||||
case WITHER_SPAWN_EGG -> EntityType.WITHER;
|
||||
case WITHER_SKELETON_SPAWN_EGG -> EntityType.WITHER_SKELETON;
|
||||
case WOLF_SPAWN_EGG -> EntityType.WOLF;
|
||||
case ZOGLIN_SPAWN_EGG -> EntityType.ZOGLIN;
|
||||
case ZOMBIE_HORSE_SPAWN_EGG -> EntityType.ZOMBIE_HORSE;
|
||||
case ZOMBIFIED_PIGLIN_SPAWN_EGG -> EntityType.ZOMBIFIED_PIGLIN;
|
||||
case ZOMBIE_SPAWN_EGG -> EntityType.ZOMBIE;
|
||||
case ZOMBIE_VILLAGER_SPAWN_EGG -> EntityType.ZOMBIE_VILLAGER;
|
||||
case PIG_SPAWN_EGG -> EntityType.PIG;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static boolean isBed(Material material) {
|
||||
@ -1360,9 +1224,10 @@ public static boolean isCoral(Material material) {
|
||||
* @return true if the material is a crop
|
||||
*/
|
||||
public static boolean isCrop(Material type) {
|
||||
if (Tag.CROPS.isTagged(type)) return true;
|
||||
// yea, that's not all, there are some more
|
||||
return switch (type) {
|
||||
case WHEAT, CARROTS, POTATOES, BEETROOTS, MELON_STEM, PUMPKIN_STEM,
|
||||
PUMPKIN, MELON, CACTUS, SUGAR_CANE, BAMBOO, BAMBOO_SAPLING,
|
||||
case PUMPKIN, MELON, CACTUS, SUGAR_CANE, BAMBOO, BAMBOO_SAPLING,
|
||||
SWEET_BERRY_BUSH, NETHER_WART, CAVE_VINES, CAVE_VINES_PLANT ->
|
||||
true;
|
||||
default -> false;
|
||||
@ -1517,7 +1382,6 @@ public static boolean isToolApplicable(Material toolMaterial, Material targetMat
|
||||
case NETHERITE_HOE:
|
||||
return switch (targetMaterial) {
|
||||
case GRASS_BLOCK, DIRT, DIRT_PATH, ROOTED_DIRT ->
|
||||
// case COARSE_DIRT: // already handled by the server...
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
@ -1527,11 +1391,10 @@ public static boolean isToolApplicable(Material toolMaterial, Material targetMat
|
||||
case GOLDEN_AXE:
|
||||
case DIAMOND_AXE:
|
||||
case NETHERITE_AXE:
|
||||
if (isWaxedCopper(targetMaterial))
|
||||
return true;
|
||||
if (isWaxedCopper(targetMaterial)) return true;
|
||||
if (Tag.LOGS.isTagged(targetMaterial)) return true;
|
||||
return switch (targetMaterial) {
|
||||
case OAK_LOG, DARK_OAK_LOG, ACACIA_LOG, BIRCH_LOG, SPRUCE_LOG, JUNGLE_LOG,
|
||||
OAK_WOOD, DARK_OAK_WOOD, ACACIA_WOOD, BIRCH_WOOD, SPRUCE_WOOD,
|
||||
case OAK_WOOD, DARK_OAK_WOOD, ACACIA_WOOD, BIRCH_WOOD, SPRUCE_WOOD, PUMPKIN, BAMBOO_BLOCK,
|
||||
JUNGLE_WOOD, CRIMSON_STEM, WARPED_STEM, CRIMSON_HYPHAE, WARPED_HYPHAE ->
|
||||
true;
|
||||
default -> false;
|
||||
@ -1569,7 +1432,7 @@ public static boolean isToolApplicable(Material toolMaterial, Material targetMat
|
||||
case YELLOW_DYE:
|
||||
case GLOW_INK_SAC:
|
||||
case INK_SAC:
|
||||
return Tag.SIGNS.isTagged(targetMaterial);
|
||||
return SIGNS_TAG.isTagged(targetMaterial);
|
||||
case HONEYCOMB:
|
||||
return isUnwaxedCopper(targetMaterial);
|
||||
default:
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* WorldGuard, a suite of tools for Minecraft
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldGuard team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit.util.report;
|
||||
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import io.papermc.paper.datapack.Datapack;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A report for current datapacks with some information. Only available on Paper
|
||||
*/
|
||||
public class DatapackReport extends DataReport {
|
||||
public DatapackReport() {
|
||||
super("DataPacks");
|
||||
|
||||
Collection<Datapack> packs = Bukkit.getDatapackManager().getPacks();
|
||||
|
||||
append("Datapack Count", packs.size());
|
||||
append("Datapack Enabled Count", Bukkit.getDatapackManager().getEnabledPacks().size());
|
||||
|
||||
for (Datapack pack : packs) {
|
||||
DataReport report = new DataReport("DataPack: " + pack.getName());
|
||||
report.append("Enabled?", pack.isEnabled());
|
||||
report.append("Name", pack.getName());
|
||||
report.append("Compatibility", pack.getCompatibility().name());
|
||||
append(report.getTitle(), report);
|
||||
}
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ public ServerReport() {
|
||||
onlineMode.append("BungeeCord support?", Bukkit.spigot().getConfig().getBoolean("settings.bungeecord", false));
|
||||
}
|
||||
if (PaperLib.isPaper()) {
|
||||
onlineMode.append("Velocity support?", Bukkit.spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled", false));
|
||||
onlineMode.append("Velocity support?", Bukkit.spigot().getPaperConfig().getBoolean("proxies.velocity.enabled", false));
|
||||
}
|
||||
append(onlineMode.getTitle(), onlineMode);
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
"api"(project(":worldguard-libs:core"))
|
||||
"api"("com.sk89q.worldedit:worldedit-core:${Versions.WORLDEDIT}")
|
||||
"implementation"("org.flywaydb:flyway-core:3.0")
|
||||
"implementation"("org.yaml:snakeyaml:1.30")
|
||||
"implementation"("org.yaml:snakeyaml:1.33")
|
||||
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
||||
|
||||
"compileOnly"("com.google.code.findbugs:jsr305:${Versions.FINDBUGS}")
|
||||
"testImplementation"("org.hamcrest:hamcrest-library:1.2.1")
|
||||
"testImplementation"("org.hamcrest:hamcrest-library:2.2")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
|
@ -165,6 +165,7 @@ public abstract class WorldConfiguration {
|
||||
public boolean disableSnowmanTrails;
|
||||
public boolean disableSoilDehydration;
|
||||
public boolean disableCoralBlockFade;
|
||||
public boolean disableCopperBlockFade;
|
||||
public Set<String> allowedSnowFallOver;
|
||||
public boolean regionInvinciblityRemovesMobs;
|
||||
public boolean regionCancelEmptyChatEvents;
|
||||
|
@ -125,6 +125,7 @@ public final class Flags {
|
||||
public static final StateFlag CROP_GROWTH = register(new StateFlag("crop-growth", true));
|
||||
public static final StateFlag SOIL_DRY = register(new StateFlag("soil-dry", true));
|
||||
public static final StateFlag CORAL_FADE = register(new StateFlag("coral-fade", true));
|
||||
public static final StateFlag COPPER_FADE = register(new StateFlag("copper-fade", true));
|
||||
public static final StateFlag WATER_FLOW = register(new StateFlag("water-flow", true));
|
||||
public static final StateFlag LAVA_FLOW = register(new StateFlag("lava-flow", true));
|
||||
|
||||
|
@ -3,9 +3,7 @@
|
||||
applyLibrariesConfiguration()
|
||||
|
||||
dependencies {
|
||||
"shade"("org.enginehub:squirrelid:${Versions.SQUIRRELID}") {
|
||||
exclude(group = "com.destroystokyo.paper", module = "paper-api")
|
||||
}
|
||||
"shade"("org.enginehub:squirrelid:${Versions.SQUIRRELID}")
|
||||
"shade"("org.khelekore:prtree:1.5.0")
|
||||
}
|
||||
|
||||
@ -17,4 +15,4 @@
|
||||
|
||||
include(dependency("org.khelekore:prtree"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user