diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 39d5fe98..2fefee73 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,9 +1,10 @@ object Versions { -// const val PISTON = "0.4.3" -// const val AUTO_VALUE = "1.6.5" - const val WORLDEDIT = "7.2.10" - const val JUNIT = "5.7.0" - const val SQUIRRELID = "0.3.0" - const val GUAVA = "31.0.1-jre" - const val MOCKITO = "3.7.7" + // 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.1" + const val GUAVA = "31.1-jre" + const val FINDBUGS = "3.0.2" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f..943f0cbf 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e..f398c33c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..65dcd68d 100755 --- a/gradlew +++ b/gradlew @@ -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. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..93e3f59f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 diff --git a/worldguard-bukkit/build.gradle.kts b/worldguard-bukkit/build.gradle.kts index 0a0a41f2..b3046540 100644 --- a/worldguard-bukkit/build.gradle.kts +++ b/worldguard-bukkit/build.gradle.kts @@ -28,15 +28,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"("org.bstats:bstats-bukkit:3.0.0") "shadeOnly"("co.aikar:minecraft-timings:1.0.4") } diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index ed9f72c4..b716f01a 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -1197,9 +1197,12 @@ private static 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 diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java index 1763121d..90c30f79 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java @@ -52,6 +52,11 @@ public final class Materials { private static final Map MATERIAL_FLAGS = new EnumMap<>(Material.class); private static final Set DAMAGE_EFFECTS = new HashSet<>(); + private static void putMaterialTag(Tag tag, Integer value) { + tag.getValues().forEach(mat -> MATERIAL_FLAGS.put(mat, value)); + } + private static Tag 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: diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java index 300f809e..fd069f78 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/report/ServerReport.java @@ -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); diff --git a/worldguard-core/build.gradle.kts b/worldguard-core/build.gradle.kts index 35e2a22b..a7283a2c 100644 --- a/worldguard-core/build.gradle.kts +++ b/worldguard-core/build.gradle.kts @@ -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.29") + "implementation"("org.yaml:snakeyaml:1.33") "implementation"("com.google.guava:guava:${Versions.GUAVA}") - "compileOnly"("com.google.code.findbugs:jsr305:1.3.9") - "testImplementation"("org.hamcrest:hamcrest-library:1.2.1") + "compileOnly"("com.google.code.findbugs:jsr305:${Versions.FINDBUGS}") + "testImplementation"("org.hamcrest:hamcrest-library:2.2") } tasks.withType().configureEach {