diff --git a/paper-api/pom.xml b/paper-api/pom.xml index 2646ad00d4..9a36457e19 100644 --- a/paper-api/pom.xml +++ b/paper-api/pom.xml @@ -5,7 +5,7 @@ org.bukkit bukkit - 1.18.2-R0.1-SNAPSHOT + 1.19-R0.1-SNAPSHOT jar Bukkit @@ -31,12 +31,6 @@ - - commons-lang - commons-lang - 2.6 - compile - com.google.guava @@ -61,19 +55,19 @@ org.apache.maven maven-resolver-provider - 3.8.4 + 3.8.5 provided org.apache.maven.resolver maven-resolver-connector-basic - 1.7.2 + 1.8.0 provided org.apache.maven.resolver maven-resolver-transport-http - 1.7.2 + 1.8.0 provided @@ -99,7 +93,7 @@ org.ow2.asm asm-tree - 9.2 + 9.3 test @@ -122,7 +116,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 eclipse @@ -131,19 +125,14 @@ org.codehaus.plexus plexus-compiler-eclipse - 2.8.8 - - - org.eclipse.jdt - ecj - 3.28.0 + 2.12.0 org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 @@ -183,7 +172,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.4.0 https://guava.dev/releases/31.0.1-jre/api/docs/ @@ -231,7 +220,7 @@ org.codehaus.mojo animal-sniffer-maven-plugin - 1.20 + 1.21 process-classes diff --git a/paper-api/src/main/java/org/bukkit/Art.java b/paper-api/src/main/java/org/bukkit/Art.java index e7563acf43..ac420f0059 100644 --- a/paper-api/src/main/java/org/bukkit/Art.java +++ b/paper-api/src/main/java/org/bukkit/Art.java @@ -1,8 +1,8 @@ package org.bukkit; +import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import java.util.HashMap; -import org.apache.commons.lang.Validate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,7 +35,11 @@ public enum Art implements Keyed { PIGSCENE(22, 4, 4), BURNING_SKULL(23, 4, 4), SKELETON(24, 4, 3), - DONKEY_KONG(25, 4, 3); + DONKEY_KONG(25, 4, 3), + EARTH(26, 2, 2), + WIND(27, 2, 2), + WATER(28, 2, 2), + FIRE(29, 2, 2); private final int id, width, height; private final NamespacedKey key; @@ -107,7 +111,7 @@ public enum Art implements Keyed { */ @Nullable public static Art getByName(@NotNull String name) { - Validate.notNull(name, "Name cannot be null"); + Preconditions.checkArgument(name != null, "Name cannot be null"); return BY_NAME.get(name.toLowerCase(java.util.Locale.ENGLISH)); } diff --git a/paper-api/src/main/java/org/bukkit/ChatColor.java b/paper-api/src/main/java/org/bukkit/ChatColor.java index 427368a772..623bba2e9d 100644 --- a/paper-api/src/main/java/org/bukkit/ChatColor.java +++ b/paper-api/src/main/java/org/bukkit/ChatColor.java @@ -1,9 +1,9 @@ package org.bukkit; +import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import java.util.Map; import java.util.regex.Pattern; -import org.apache.commons.lang.Validate; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -180,8 +180,8 @@ public enum ChatColor { */ @Nullable public static ChatColor getByChar(@NotNull String code) { - Validate.notNull(code, "Code cannot be null"); - Validate.isTrue(code.length() > 0, "Code must have at least one char"); + Preconditions.checkArgument(code != null, "Code cannot be null"); + Preconditions.checkArgument(code.length() > 0, "Code must have at least one char"); return BY_CHAR.get(code.charAt(0)); } @@ -214,7 +214,7 @@ public enum ChatColor { */ @NotNull public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) { - Validate.notNull(textToTranslate, "Cannot translate null text"); + Preconditions.checkArgument(textToTranslate != null, "Cannot translate null text"); char[] b = textToTranslate.toCharArray(); for (int i = 0; i < b.length - 1; i++) { @@ -234,7 +234,7 @@ public enum ChatColor { */ @NotNull public static String getLastColors(@NotNull String input) { - Validate.notNull(input, "Cannot get last colors from null text"); + Preconditions.checkArgument(input != null, "Cannot get last colors from null text"); String result = ""; int length = input.length(); diff --git a/paper-api/src/main/java/org/bukkit/Color.java b/paper-api/src/main/java/org/bukkit/Color.java index deae003b7e..d2f8f5a8e4 100644 --- a/paper-api/src/main/java/org/bukkit/Color.java +++ b/paper-api/src/main/java/org/bukkit/Color.java @@ -1,8 +1,10 @@ package org.bukkit; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; +import java.util.Arrays; import java.util.Map; -import org.apache.commons.lang.Validate; +import java.util.Objects; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.SerializableAs; import org.jetbrains.annotations.NotNull; @@ -144,7 +146,7 @@ public final class Color implements ConfigurationSerializable { */ @NotNull public static Color fromRGB(int rgb) throws IllegalArgumentException { - Validate.isTrue((rgb >> 24) == 0, "Extrenuous data in: ", rgb); + Preconditions.checkArgument((rgb >> 24) == 0, "Extrenuous data in: ", rgb); return fromRGB(rgb >> 16 & BIT_MASK, rgb >> 8 & BIT_MASK, rgb >> 0 & BIT_MASK); } @@ -159,14 +161,14 @@ public final class Color implements ConfigurationSerializable { */ @NotNull public static Color fromBGR(int bgr) throws IllegalArgumentException { - Validate.isTrue((bgr >> 24) == 0, "Extrenuous data in: ", bgr); + Preconditions.checkArgument((bgr >> 24) == 0, "Extrenuous data in: ", bgr); return fromBGR(bgr >> 16 & BIT_MASK, bgr >> 8 & BIT_MASK, bgr >> 0 & BIT_MASK); } private Color(int red, int green, int blue) { - Validate.isTrue(red >= 0 && red <= BIT_MASK, "Red is not between 0-255: ", red); - Validate.isTrue(green >= 0 && green <= BIT_MASK, "Green is not between 0-255: ", green); - Validate.isTrue(blue >= 0 && blue <= BIT_MASK, "Blue is not between 0-255: ", blue); + Preconditions.checkArgument(red >= 0 && red <= BIT_MASK, "Red is not between 0-255: ", red); + Preconditions.checkArgument(green >= 0 && green <= BIT_MASK, "Green is not between 0-255: ", green); + Preconditions.checkArgument(blue >= 0 && blue <= BIT_MASK, "Blue is not between 0-255: ", blue); this.red = (byte) red; this.green = (byte) green; @@ -261,7 +263,7 @@ public final class Color implements ConfigurationSerializable { // TODO: Javadoc what this method does, not what it mimics. API != Implementation @NotNull public Color mixDyes(@NotNull DyeColor... colors) { - Validate.noNullElements(colors, "Colors cannot be null"); + Preconditions.checkArgument(colors != null && Arrays.stream(colors).allMatch(Objects::nonNull), "Colors cannot be null"); Color[] toPass = new Color[colors.length]; for (int i = 0; i < colors.length; i++) { @@ -281,7 +283,7 @@ public final class Color implements ConfigurationSerializable { // TODO: Javadoc what this method does, not what it mimics. API != Implementation @NotNull public Color mixColors(@NotNull Color... colors) { - Validate.noNullElements(colors, "Colors cannot be null"); + Preconditions.checkArgument(colors != null && Arrays.stream(colors).allMatch(Objects::nonNull), "Colors cannot be null"); int totalRed = this.getRed(); int totalGreen = this.getGreen(); diff --git a/paper-api/src/main/java/org/bukkit/FireworkEffect.java b/paper-api/src/main/java/org/bukkit/FireworkEffect.java index 4a97e73ce5..bf7db5b3e7 100644 --- a/paper-api/src/main/java/org/bukkit/FireworkEffect.java +++ b/paper-api/src/main/java/org/bukkit/FireworkEffect.java @@ -1,10 +1,10 @@ package org.bukkit; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.SerializableAs; import org.jetbrains.annotations.NotNull; @@ -75,7 +75,7 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder with(@NotNull Type type) throws IllegalArgumentException { - Validate.notNull(type, "Cannot have null type"); + Preconditions.checkArgument(type != null, "Cannot have null type"); this.type = type; return this; } @@ -135,7 +135,7 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder withColor(@NotNull Color color) throws IllegalArgumentException { - Validate.notNull(color, "Cannot have null color"); + Preconditions.checkArgument(color != null, "Cannot have null color"); colors.add(color); @@ -153,14 +153,14 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder withColor(@NotNull Color... colors) throws IllegalArgumentException { - Validate.notNull(colors, "Cannot have null colors"); + Preconditions.checkArgument(colors != null, "Cannot have null colors"); if (colors.length == 0) { return this; } ImmutableList.Builder list = this.colors; for (Color color : colors) { - Validate.notNull(color, "Color cannot be null"); + Preconditions.checkArgument(color != null, "Color cannot be null"); list.add(color); } @@ -179,7 +179,7 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder withColor(@NotNull Iterable colors) throws IllegalArgumentException { - Validate.notNull(colors, "Cannot have null colors"); + Preconditions.checkArgument(colors != null, "Cannot have null colors"); ImmutableList.Builder list = this.colors; for (Object color : colors) { @@ -203,7 +203,7 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder withFade(@NotNull Color color) throws IllegalArgumentException { - Validate.notNull(color, "Cannot have null color"); + Preconditions.checkArgument(color != null, "Cannot have null color"); if (fadeColors == null) { fadeColors = ImmutableList.builder(); @@ -225,7 +225,7 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder withFade(@NotNull Color... colors) throws IllegalArgumentException { - Validate.notNull(colors, "Cannot have null colors"); + Preconditions.checkArgument(colors != null, "Cannot have null colors"); if (colors.length == 0) { return this; } @@ -236,7 +236,7 @@ public final class FireworkEffect implements ConfigurationSerializable { } for (Color color : colors) { - Validate.notNull(color, "Color cannot be null"); + Preconditions.checkArgument(color != null, "Color cannot be null"); list.add(color); } @@ -255,7 +255,7 @@ public final class FireworkEffect implements ConfigurationSerializable { */ @NotNull public Builder withFade(@NotNull Iterable colors) throws IllegalArgumentException { - Validate.notNull(colors, "Cannot have null colors"); + Preconditions.checkArgument(colors != null, "Cannot have null colors"); ImmutableList.Builder list = this.fadeColors; if (list == null) { diff --git a/paper-api/src/main/java/org/bukkit/GameEvent.java b/paper-api/src/main/java/org/bukkit/GameEvent.java index b50ba6463b..97858a8d09 100644 --- a/paper-api/src/main/java/org/bukkit/GameEvent.java +++ b/paper-api/src/main/java/org/bukkit/GameEvent.java @@ -14,51 +14,80 @@ public final class GameEvent implements Keyed { private static final Map GAME_EVENTS = new HashMap<>(); // + public static final GameEvent BLOCK_ACTIVATE = getEvent("block_activate"); public static final GameEvent BLOCK_ATTACH = getEvent("block_attach"); public static final GameEvent BLOCK_CHANGE = getEvent("block_change"); public static final GameEvent BLOCK_CLOSE = getEvent("block_close"); + public static final GameEvent BLOCK_DEACTIVATE = getEvent("block_deactivate"); public static final GameEvent BLOCK_DESTROY = getEvent("block_destroy"); public static final GameEvent BLOCK_DETACH = getEvent("block_detach"); public static final GameEvent BLOCK_OPEN = getEvent("block_open"); public static final GameEvent BLOCK_PLACE = getEvent("block_place"); - public static final GameEvent BLOCK_PRESS = getEvent("block_press"); - public static final GameEvent BLOCK_SWITCH = getEvent("block_switch"); - public static final GameEvent BLOCK_UNPRESS = getEvent("block_unpress"); - public static final GameEvent BLOCK_UNSWITCH = getEvent("block_unswitch"); + @Deprecated + public static final GameEvent BLOCK_PRESS = getEvent("block_activate"); + @Deprecated + public static final GameEvent BLOCK_SWITCH = getEvent("block_activate"); + @Deprecated + public static final GameEvent BLOCK_UNPRESS = getEvent("block_deactivate"); + @Deprecated + public static final GameEvent BLOCK_UNSWITCH = getEvent("block_deactivate"); public static final GameEvent CONTAINER_CLOSE = getEvent("container_close"); public static final GameEvent CONTAINER_OPEN = getEvent("container_open"); public static final GameEvent DISPENSE_FAIL = getEvent("dispense_fail"); - public static final GameEvent DRINKING_FINISH = getEvent("drinking_finish"); + public static final GameEvent DRINK = getEvent("drink"); + @Deprecated + public static final GameEvent DRINKING_FINISH = getEvent("drink"); public static final GameEvent EAT = getEvent("eat"); - public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_free_fall"); - public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damaged"); - public static final GameEvent ENTITY_KILLED = getEvent("entity_killed"); + @Deprecated + public static final GameEvent ELYTRA_FREE_FALL = getEvent("elytra_glide"); + public static final GameEvent ELYTRA_GLIDE = getEvent("elytra_glide"); + public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage"); + @Deprecated + public static final GameEvent ENTITY_DAMAGED = getEvent("entity_damage"); + public static final GameEvent ENTITY_DIE = getEvent("entity_die"); + @Deprecated + public static final GameEvent ENTITY_DYING = getEvent("entity_die"); + public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact"); + @Deprecated + public static final GameEvent ENTITY_KILLED = getEvent("entity_die"); public static final GameEvent ENTITY_PLACE = getEvent("entity_place"); + public static final GameEvent ENTITY_ROAR = getEvent("entity_roar"); + public static final GameEvent ENTITY_SHAKE = getEvent("entity_shake"); public static final GameEvent EQUIP = getEvent("equip"); public static final GameEvent EXPLODE = getEvent("explode"); - public static final GameEvent FISHING_ROD_CAST = getEvent("fishing_rod_cast"); - public static final GameEvent FISHING_ROD_REEL_IN = getEvent("fishing_rod_reel_in"); public static final GameEvent FLAP = getEvent("flap"); public static final GameEvent FLUID_PICKUP = getEvent("fluid_pickup"); public static final GameEvent FLUID_PLACE = getEvent("fluid_place"); public static final GameEvent HIT_GROUND = getEvent("hit_ground"); + public static final GameEvent INSTRUMENT_PLAY = getEvent("instrument_play"); + public static final GameEvent ITEM_INTERACT_FINISH = getEvent("item_interact_finish"); + public static final GameEvent ITEM_INTERACT_START = getEvent("item_interact_start"); public static final GameEvent LIGHTNING_STRIKE = getEvent("lightning_strike"); - public static final GameEvent MINECART_MOVING = getEvent("minecart_moving"); - public static final GameEvent MOB_INTERACT = getEvent("mob_interact"); + @Deprecated + public static final GameEvent MOB_INTERACT = getEvent("entity_interact"); + public static final GameEvent NOTE_BLOCK_PLAY = getEvent("note_block_play"); public static final GameEvent PISTON_CONTRACT = getEvent("piston_contract"); public static final GameEvent PISTON_EXTEND = getEvent("piston_extend"); public static final GameEvent PRIME_FUSE = getEvent("prime_fuse"); public static final GameEvent PROJECTILE_LAND = getEvent("projectile_land"); public static final GameEvent PROJECTILE_SHOOT = getEvent("projectile_shoot"); - public static final GameEvent RAVAGER_ROAR = getEvent("ravager_roar"); - public static final GameEvent RING_BELL = getEvent("ring_bell"); + @Deprecated + public static final GameEvent RAVAGER_ROAR = getEvent("entity_roar"); + @Deprecated + public static final GameEvent RING_BELL = getEvent("block_change"); + public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking"); public static final GameEvent SHEAR = getEvent("shear"); - public static final GameEvent SHULKER_CLOSE = getEvent("shulker_close"); - public static final GameEvent SHULKER_OPEN = getEvent("shulker_open"); + public static final GameEvent SHRIEK = getEvent("shriek"); + @Deprecated + public static final GameEvent SHULKER_CLOSE = getEvent("container_close"); + @Deprecated + public static final GameEvent SHULKER_OPEN = getEvent("container_open"); public static final GameEvent SPLASH = getEvent("splash"); public static final GameEvent STEP = getEvent("step"); public static final GameEvent SWIM = getEvent("swim"); - public static final GameEvent WOLF_SHAKING = getEvent("wolf_shaking"); + public static final GameEvent TELEPORT = getEvent("teleport"); + @Deprecated + public static final GameEvent WOLF_SHAKING = getEvent("entity_shake"); // private final NamespacedKey key; diff --git a/paper-api/src/main/java/org/bukkit/GameRule.java b/paper-api/src/main/java/org/bukkit/GameRule.java index 442db40bc6..dddc450e13 100644 --- a/paper-api/src/main/java/org/bukkit/GameRule.java +++ b/paper-api/src/main/java/org/bukkit/GameRule.java @@ -163,6 +163,11 @@ public final class GameRule { */ public static final GameRule DO_TRADER_SPAWNING = new GameRule<>("doTraderSpawning", Boolean.class); + /** + * Whether wardens should naturally spawn. + */ + public static final GameRule DO_WARDEN_SPAWNING = new GameRule<>("doWardenSpawning", Boolean.class); + /** * Whether mobs should cease being angry at a player once they die. */ diff --git a/paper-api/src/main/java/org/bukkit/Material.java b/paper-api/src/main/java/org/bukkit/Material.java index df3f240660..2f53bb42dc 100644 --- a/paper-api/src/main/java/org/bukkit/Material.java +++ b/paper-api/src/main/java/org/bukkit/Material.java @@ -1,12 +1,12 @@ package org.bukkit; +import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import java.lang.reflect.Constructor; import java.util.Locale; import java.util.Map; import java.util.function.Consumer; -import org.apache.commons.lang.Validate; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.block.data.Ageable; @@ -65,6 +65,7 @@ import org.bukkit.block.data.type.Leaves; import org.bukkit.block.data.type.Lectern; import org.bukkit.block.data.type.Light; import org.bukkit.block.data.type.LightningRod; +import org.bukkit.block.data.type.MangrovePropagule; import org.bukkit.block.data.type.NoteBlock; import org.bukkit.block.data.type.Observer; import org.bukkit.block.data.type.Piston; @@ -77,7 +78,9 @@ import org.bukkit.block.data.type.Repeater; import org.bukkit.block.data.type.RespawnAnchor; import org.bukkit.block.data.type.Sapling; import org.bukkit.block.data.type.Scaffolding; +import org.bukkit.block.data.type.SculkCatalyst; import org.bukkit.block.data.type.SculkSensor; +import org.bukkit.block.data.type.SculkShrieker; import org.bukkit.block.data.type.SeaPickle; import org.bukkit.block.data.type.Sign; import org.bukkit.block.data.type.Slab; @@ -133,6 +136,7 @@ public enum Material implements Keyed { */ PODZOL(24068, Snowable.class), ROOTED_DIRT(11410), + MUD(32418), CRIMSON_NYLIUM(18139), WARPED_NYLIUM(26396), COBBLESTONE(32147), @@ -142,6 +146,7 @@ public enum Material implements Keyed { JUNGLE_PLANKS(26445), ACACIA_PLANKS(31312), DARK_OAK_PLANKS(20869), + MANGROVE_PLANKS(7078), CRIMSON_PLANKS(18812), WARPED_PLANKS(16045), /** @@ -168,6 +173,10 @@ public enum Material implements Keyed { * BlockData: {@link Sapling} */ DARK_OAK_SAPLING(14933, Sapling.class), + /** + * BlockData: {@link MangrovePropagule} + */ + MANGROVE_PROPAGULE(18688, MangrovePropagule.class), BEDROCK(23130), SAND(11542), RED_SAND(16279), @@ -311,6 +320,18 @@ public enum Material implements Keyed { * BlockData: {@link Orientable} */ DARK_OAK_LOG(14831, Orientable.class), + /** + * BlockData: {@link Orientable} + */ + MANGROVE_LOG(23890, Orientable.class), + /** + * BlockData: {@link Waterlogged} + */ + MANGROVE_ROOTS(22124, Waterlogged.class), + /** + * BlockData: {@link Orientable} + */ + MUDDY_MANGROVE_ROOTS(23244, Orientable.class), /** * BlockData: {@link Orientable} */ @@ -343,6 +364,10 @@ public enum Material implements Keyed { * BlockData: {@link Orientable} */ STRIPPED_DARK_OAK_LOG(6492, Orientable.class), + /** + * BlockData: {@link Orientable} + */ + STRIPPED_MANGROVE_LOG(15197, Orientable.class), /** * BlockData: {@link Orientable} */ @@ -375,6 +400,10 @@ public enum Material implements Keyed { * BlockData: {@link Orientable} */ STRIPPED_DARK_OAK_WOOD(16000, Orientable.class), + /** + * BlockData: {@link Orientable} + */ + STRIPPED_MANGROVE_WOOD(4828, Orientable.class), /** * BlockData: {@link Orientable} */ @@ -407,6 +436,10 @@ public enum Material implements Keyed { * BlockData: {@link Orientable} */ DARK_OAK_WOOD(16995, Orientable.class), + /** + * BlockData: {@link Orientable} + */ + MANGROVE_WOOD(25484, Orientable.class), /** * BlockData: {@link Orientable} */ @@ -439,6 +472,10 @@ public enum Material implements Keyed { * BlockData: {@link Leaves} */ DARK_OAK_LEAVES(22254, Leaves.class), + /** + * BlockData: {@link Leaves} + */ + MANGROVE_LEAVES(15310, Leaves.class), /** * BlockData: {@link Leaves} */ @@ -561,6 +598,10 @@ public enum Material implements Keyed { * BlockData: {@link Slab} */ DARK_OAK_SLAB(28852, Slab.class), + /** + * BlockData: {@link Slab} + */ + MANGROVE_SLAB(13704, Slab.class), /** * BlockData: {@link Slab} */ @@ -601,6 +642,10 @@ public enum Material implements Keyed { * BlockData: {@link Slab} */ STONE_BRICK_SLAB(19676, Slab.class), + /** + * BlockData: {@link Slab} + */ + MUD_BRICK_SLAB(10611, Slab.class), /** * BlockData: {@link Slab} */ @@ -664,10 +709,6 @@ public enum Material implements Keyed { */ PURPUR_STAIRS(8921, Stairs.class), SPAWNER(7018), - /** - * BlockData: {@link Stairs} - */ - OAK_STAIRS(5449, Stairs.class), /** * BlockData: {@link Chest} */ @@ -728,6 +769,10 @@ public enum Material implements Keyed { * BlockData: {@link Fence} */ DARK_OAK_FENCE(21767, Fence.class), + /** + * BlockData: {@link Fence} + */ + MANGROVE_FENCE(15021, Fence.class), /** * BlockData: {@link Fence} */ @@ -773,11 +818,14 @@ public enum Material implements Keyed { MOSSY_STONE_BRICKS(16415), CRACKED_STONE_BRICKS(27869), CHISELED_STONE_BRICKS(9087), + PACKED_MUD(7472), + MUD_BRICKS(29168), DEEPSLATE_BRICKS(13193), CRACKED_DEEPSLATE_BRICKS(17105), DEEPSLATE_TILES(11250), CRACKED_DEEPSLATE_TILES(26249), CHISELED_DEEPSLATE(23825), + REINFORCED_DEEPSLATE(10949), /** * BlockData: {@link MultipleFacing} */ @@ -819,6 +867,10 @@ public enum Material implements Keyed { * BlockData: {@link Stairs} */ STONE_BRICK_STAIRS(27032, Stairs.class), + /** + * BlockData: {@link Stairs} + */ + MUD_BRICK_STAIRS(13620, Stairs.class), /** * BlockData: {@link Snowable} */ @@ -835,6 +887,19 @@ public enum Material implements Keyed { * BlockData: {@link Stairs} */ NETHER_BRICK_STAIRS(12085, Stairs.class), + SCULK(17870), + /** + * BlockData: {@link Waterlogged} + */ + SCULK_VEIN(11615, Waterlogged.class), + /** + * BlockData: {@link SculkCatalyst} + */ + SCULK_CATALYST(12017, SculkCatalyst.class), + /** + * BlockData: {@link SculkShrieker} + */ + SCULK_SHRIEKER(20985, SculkShrieker.class), ENCHANTING_TABLE(16255), /** * BlockData: {@link EndPortalFrame} @@ -852,6 +917,10 @@ public enum Material implements Keyed { */ ENDER_CHEST(32349, EnderChest.class), EMERALD_BLOCK(9914), + /** + * BlockData: {@link Stairs} + */ + OAK_STAIRS(5449, Stairs.class), /** * BlockData: {@link Stairs} */ @@ -864,6 +933,18 @@ public enum Material implements Keyed { * BlockData: {@link Stairs} */ JUNGLE_STAIRS(20636, Stairs.class), + /** + * BlockData: {@link Stairs} + */ + ACACIA_STAIRS(17453, Stairs.class), + /** + * BlockData: {@link Stairs} + */ + DARK_OAK_STAIRS(22921, Stairs.class), + /** + * BlockData: {@link Stairs} + */ + MANGROVE_STAIRS(27641, Stairs.class), /** * BlockData: {@link Stairs} */ @@ -909,6 +990,10 @@ public enum Material implements Keyed { * BlockData: {@link Wall} */ STONE_BRICK_WALL(29073, Wall.class), + /** + * BlockData: {@link Wall} + */ + MUD_BRICK_WALL(18292, Wall.class), /** * BlockData: {@link Wall} */ @@ -1027,14 +1112,6 @@ public enum Material implements Keyed { BLACK_CARPET(6056), TERRACOTTA(16544), PACKED_ICE(28993), - /** - * BlockData: {@link Stairs} - */ - ACACIA_STAIRS(17453, Stairs.class), - /** - * BlockData: {@link Stairs} - */ - DARK_OAK_STAIRS(22921, Stairs.class), DIRT_PATH(10846), /** * BlockData: {@link Bisected} @@ -1703,6 +1780,10 @@ public enum Material implements Keyed { * BlockData: {@link Switch} */ DARK_OAK_BUTTON(6214, Switch.class), + /** + * BlockData: {@link Switch} + */ + MANGROVE_BUTTON(17207, Switch.class), /** * BlockData: {@link Switch} */ @@ -1751,6 +1832,10 @@ public enum Material implements Keyed { * BlockData: {@link Powerable} */ DARK_OAK_PRESSURE_PLATE(31375, Powerable.class), + /** + * BlockData: {@link Powerable} + */ + MANGROVE_PRESSURE_PLATE(9748, Powerable.class), /** * BlockData: {@link Powerable} */ @@ -1787,6 +1872,10 @@ public enum Material implements Keyed { * BlockData: {@link Door} */ DARK_OAK_DOOR(10669, Door.class), + /** + * BlockData: {@link Door} + */ + MANGROVE_DOOR(18964, Door.class), /** * BlockData: {@link Door} */ @@ -1823,6 +1912,10 @@ public enum Material implements Keyed { * BlockData: {@link TrapDoor} */ DARK_OAK_TRAPDOOR(10355, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + MANGROVE_TRAPDOOR(17066, TrapDoor.class), /** * BlockData: {@link TrapDoor} */ @@ -1855,6 +1948,10 @@ public enum Material implements Keyed { * BlockData: {@link Gate} */ DARK_OAK_FENCE_GATE(10679, Gate.class), + /** + * BlockData: {@link Gate} + */ + MANGROVE_FENCE_GATE(28476, Gate.class), /** * BlockData: {@link Gate} */ @@ -1889,11 +1986,19 @@ public enum Material implements Keyed { WARPED_FUNGUS_ON_A_STICK(11706, 1, 100), ELYTRA(23829, 1, 432), OAK_BOAT(17570, 1), + OAK_CHEST_BOAT(7765, 1), SPRUCE_BOAT(31427, 1), + SPRUCE_CHEST_BOAT(30841, 1), BIRCH_BOAT(28104, 1), + BIRCH_CHEST_BOAT(18546, 1), JUNGLE_BOAT(4495, 1), + JUNGLE_CHEST_BOAT(20133, 1), ACACIA_BOAT(27326, 1), + ACACIA_CHEST_BOAT(28455, 1), DARK_OAK_BOAT(28618, 1), + DARK_OAK_CHEST_BOAT(8733, 1), + MANGROVE_BOAT(20792, 1), + MANGROVE_CHEST_BOAT(18572, 1), /** * BlockData: {@link StructureBlock} */ @@ -2019,6 +2124,10 @@ public enum Material implements Keyed { * BlockData: {@link Sign} */ DARK_OAK_SIGN(15127, 16, Sign.class), + /** + * BlockData: {@link Sign} + */ + MANGROVE_SIGN(21975, 16, Sign.class), /** * BlockData: {@link Sign} */ @@ -2039,6 +2148,7 @@ public enum Material implements Keyed { COD_BUCKET(28601, 1), TROPICAL_FISH_BUCKET(29995, 1), AXOLOTL_BUCKET(20669, 1), + TADPOLE_BUCKET(9731, 1), BRICK(6820), CLAY_BALL(24603), DRIED_KELP_BLOCK(12966), @@ -2047,6 +2157,7 @@ public enum Material implements Keyed { SLIME_BALL(5242), EGG(21603, 16), COMPASS(24139), + RECOVERY_COMPASS(12710), BUNDLE(16835, 1), FISHING_ROD(4167, 1, 64), CLOCK(14980), @@ -2181,6 +2292,7 @@ public enum Material implements Keyed { CAULDRON(26531), ENDER_EYE(24860), GLISTERING_MELON_SLICE(20158), + ALLAY_SPAWN_EGG(7909), AXOLOTL_SPAWN_EGG(30381), BAT_SPAWN_EGG(14607), BEE_SPAWN_EGG(22924), @@ -2199,6 +2311,7 @@ public enum Material implements Keyed { ENDERMITE_SPAWN_EGG(16617), EVOKER_SPAWN_EGG(21271), FOX_SPAWN_EGG(22376), + FROG_SPAWN_EGG(26682), GHAST_SPAWN_EGG(9970), GLOW_SQUID_SPAWN_EGG(31578), GOAT_SPAWN_EGG(30639), @@ -2233,6 +2346,7 @@ public enum Material implements Keyed { SQUID_SPAWN_EGG(10682), STRAY_SPAWN_EGG(30153), STRIDER_SPAWN_EGG(6203), + TADPOLE_SPAWN_EGG(32467), TRADER_LLAMA_SPAWN_EGG(8439), TROPICAL_FISH_SPAWN_EGG(19713), TURTLE_SPAWN_EGG(17324), @@ -2240,6 +2354,7 @@ public enum Material implements Keyed { VILLAGER_SPAWN_EGG(30348), VINDICATOR_SPAWN_EGG(25324), WANDERING_TRADER_SPAWN_EGG(17904), + WARDEN_SPAWN_EGG(27553), WITCH_SPAWN_EGG(11837), WITHER_SKELETON_SPAWN_EGG(10073), WOLF_SPAWN_EGG(21692), @@ -2295,7 +2410,7 @@ public enum Material implements Keyed { PRISMARINE_CRYSTALS(31546), RABBIT(23068), COOKED_RABBIT(4454), - RABBIT_STEW(10611, 1), + RABBIT_STEW(25318, 1), RABBIT_FOOT(13864), RABBIT_HIDE(12467), ARMOR_STAND(12852, 16), @@ -2402,7 +2517,9 @@ public enum Material implements Keyed { MUSIC_DISC_11(27426, 1), MUSIC_DISC_WAIT(26499, 1), MUSIC_DISC_OTHERSIDE(12974, 1), + MUSIC_DISC_5(9212, 1), MUSIC_DISC_PIGSTEP(21323, 1), + DISC_FRAGMENT_5(29729), TRIDENT(7534, 1, 250), PHANTOM_MEMBRANE(18398), NAUTILUS_SHELL(19989), @@ -2419,6 +2536,7 @@ public enum Material implements Keyed { MOJANG_BANNER_PATTERN(11903, 1), GLOBE_BANNER_PATTERN(27753, 1), PIGLIN_BANNER_PATTERN(22028, 1), + GOAT_HORN(28237, 1), /** * BlockData: {@link Levelled} */ @@ -2604,6 +2722,20 @@ public enum Material implements Keyed { * BlockData: {@link PointedDripstone} */ POINTED_DRIPSTONE(18755, PointedDripstone.class), + /** + * BlockData: {@link Orientable} + */ + OCHRE_FROGLIGHT(25330, Orientable.class), + /** + * BlockData: {@link Orientable} + */ + VERDANT_FROGLIGHT(22793, Orientable.class), + /** + * BlockData: {@link Orientable} + */ + PEARLESCENT_FROGLIGHT(21441, Orientable.class), + FROGSPAWN(8350), + ECHO_SHARD(12529), /** * BlockData: {@link Levelled} */ @@ -2661,6 +2793,10 @@ public enum Material implements Keyed { * BlockData: {@link WallSign} */ DARK_OAK_WALL_SIGN(9508, 16, WallSign.class), + /** + * BlockData: {@link WallSign} + */ + MANGROVE_WALL_SIGN(27203, 16, WallSign.class), /** * BlockData: {@link RedstoneWallTorch} */ @@ -2713,6 +2849,7 @@ public enum Material implements Keyed { POTTED_JUNGLE_SAPLING(7525), POTTED_ACACIA_SAPLING(14096), POTTED_DARK_OAK_SAPLING(6486), + POTTED_MANGROVE_PROPAGULE(22003), POTTED_FERN(23315), POTTED_DANDELION(9727), POTTED_POPPY(7457), @@ -3981,7 +4118,7 @@ public enum Material implements Keyed { */ @Deprecated public int getId() { - Validate.isTrue(legacy, "Cannot get ID of Modern Material"); + Preconditions.checkArgument(legacy, "Cannot get ID of Modern Material"); return id; } @@ -3998,7 +4135,7 @@ public enum Material implements Keyed { @NotNull @Override public NamespacedKey getKey() { - Validate.isTrue(!legacy, "Cannot get key of Legacy Material"); + Preconditions.checkArgument(!legacy, "Cannot get key of Legacy Material"); return key; } @@ -4064,7 +4201,7 @@ public enum Material implements Keyed { */ @NotNull public Class getData() { - Validate.isTrue(legacy, "Cannot get data class of Modern Material"); + Preconditions.checkArgument(legacy, "Cannot get data class of Modern Material"); return ctor.getDeclaringClass(); } @@ -4079,7 +4216,7 @@ public enum Material implements Keyed { @Deprecated @NotNull public MaterialData getNewData(final byte raw) { - Validate.isTrue(legacy, "Cannot get new data of Modern Material"); + Preconditions.checkArgument(legacy, "Cannot get new data of Modern Material"); try { return ctor.newInstance(this, raw); } catch (InstantiationException ex) { @@ -4427,6 +4564,7 @@ public enum Material implements Keyed { case FLOWERING_AZALEA: case FLOWERING_AZALEA_LEAVES: case FLOWER_POT: + case FROGSPAWN: case FROSTED_ICE: case FURNACE: case GILDED_BLACKSTONE: @@ -4590,6 +4728,22 @@ public enum Material implements Keyed { case MAGENTA_WALL_BANNER: case MAGENTA_WOOL: case MAGMA_BLOCK: + case MANGROVE_BUTTON: + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_LEAVES: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_PRESSURE_PLATE: + case MANGROVE_PROPAGULE: + case MANGROVE_ROOTS: + case MANGROVE_SIGN: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_TRAPDOOR: + case MANGROVE_WALL_SIGN: + case MANGROVE_WOOD: case MEDIUM_AMETHYST_BUD: case MELON: case MELON_STEM: @@ -4604,6 +4758,12 @@ public enum Material implements Keyed { case MOSS_BLOCK: case MOSS_CARPET: case MOVING_PISTON: + case MUD: + case MUDDY_MANGROVE_ROOTS: + case MUD_BRICKS: + case MUD_BRICK_SLAB: + case MUD_BRICK_STAIRS: + case MUD_BRICK_WALL: case MUSHROOM_STEM: case MYCELIUM: case NETHERITE_BLOCK: @@ -4637,6 +4797,7 @@ public enum Material implements Keyed { case OAK_WOOD: case OBSERVER: case OBSIDIAN: + case OCHRE_FROGLIGHT: case ORANGE_BANNER: case ORANGE_BED: case ORANGE_CANDLE: @@ -4658,6 +4819,8 @@ public enum Material implements Keyed { case OXIDIZED_CUT_COPPER_SLAB: case OXIDIZED_CUT_COPPER_STAIRS: case PACKED_ICE: + case PACKED_MUD: + case PEARLESCENT_FROGLIGHT: case PEONY: case PETRIFIED_OAK_SLAB: case PINK_BANNER: @@ -4726,6 +4889,7 @@ public enum Material implements Keyed { case POTTED_FLOWERING_AZALEA_BUSH: case POTTED_JUNGLE_SAPLING: case POTTED_LILY_OF_THE_VALLEY: + case POTTED_MANGROVE_PROPAGULE: case POTTED_OAK_SAPLING: case POTTED_ORANGE_TULIP: case POTTED_OXEYE_DAISY: @@ -4809,6 +4973,7 @@ public enum Material implements Keyed { case RED_TULIP: case RED_WALL_BANNER: case RED_WOOL: + case REINFORCED_DEEPSLATE: case REPEATER: case REPEATING_COMMAND_BLOCK: case RESPAWN_ANCHOR: @@ -4820,7 +4985,11 @@ public enum Material implements Keyed { case SANDSTONE_STAIRS: case SANDSTONE_WALL: case SCAFFOLDING: + case SCULK: + case SCULK_CATALYST: case SCULK_SENSOR: + case SCULK_SHRIEKER: + case SCULK_VEIN: case SEAGRASS: case SEA_LANTERN: case SEA_PICKLE: @@ -4893,6 +5062,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -4922,6 +5093,7 @@ public enum Material implements Keyed { case TURTLE_EGG: case TWISTING_VINES: case TWISTING_VINES_PLANT: + case VERDANT_FROGLIGHT: case VINE: case VOID_AIR: case WALL_TORCH: @@ -5167,7 +5339,7 @@ public enum Material implements Keyed { */ @Nullable public static Material matchMaterial(@NotNull final String name, boolean legacyName) { - Validate.notNull(name, "Name cannot be null"); + Preconditions.checkArgument(name != null, "Name cannot be null"); String filtered = name; if (filtered.startsWith(NamespacedKey.MINECRAFT + ":")) { @@ -5192,6 +5364,7 @@ public enum Material implements Keyed { public boolean isRecord() { switch (this) { // + case MUSIC_DISC_5: case MUSIC_DISC_11: case MUSIC_DISC_13: case MUSIC_DISC_BLOCKS: @@ -5615,6 +5788,20 @@ public enum Material implements Keyed { case MAGENTA_WALL_BANNER: case MAGENTA_WOOL: case MAGMA_BLOCK: + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_LEAVES: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_PRESSURE_PLATE: + case MANGROVE_ROOTS: + case MANGROVE_SIGN: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_TRAPDOOR: + case MANGROVE_WALL_SIGN: + case MANGROVE_WOOD: case MEDIUM_AMETHYST_BUD: case MELON: case MOSSY_COBBLESTONE: @@ -5627,6 +5814,12 @@ public enum Material implements Keyed { case MOSSY_STONE_BRICK_WALL: case MOSS_BLOCK: case MOVING_PISTON: + case MUD: + case MUDDY_MANGROVE_ROOTS: + case MUD_BRICKS: + case MUD_BRICK_SLAB: + case MUD_BRICK_STAIRS: + case MUD_BRICK_WALL: case MUSHROOM_STEM: case MYCELIUM: case NETHERITE_BLOCK: @@ -5655,6 +5848,7 @@ public enum Material implements Keyed { case OAK_WOOD: case OBSERVER: case OBSIDIAN: + case OCHRE_FROGLIGHT: case ORANGE_BANNER: case ORANGE_BED: case ORANGE_CANDLE_CAKE: @@ -5672,6 +5866,8 @@ public enum Material implements Keyed { case OXIDIZED_CUT_COPPER_SLAB: case OXIDIZED_CUT_COPPER_STAIRS: case PACKED_ICE: + case PACKED_MUD: + case PEARLESCENT_FROGLIGHT: case PETRIFIED_OAK_SLAB: case PINK_BANNER: case PINK_BED: @@ -5770,6 +5966,7 @@ public enum Material implements Keyed { case RED_TERRACOTTA: case RED_WALL_BANNER: case RED_WOOL: + case REINFORCED_DEEPSLATE: case REPEATING_COMMAND_BLOCK: case RESPAWN_ANCHOR: case ROOTED_DIRT: @@ -5778,7 +5975,11 @@ public enum Material implements Keyed { case SANDSTONE_SLAB: case SANDSTONE_STAIRS: case SANDSTONE_WALL: + case SCULK: + case SCULK_CATALYST: case SCULK_SENSOR: + case SCULK_SHRIEKER: + case SCULK_VEIN: case SEA_LANTERN: case SHROOMLIGHT: case SHULKER_BOX: @@ -5838,6 +6039,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -5853,6 +6056,7 @@ public enum Material implements Keyed { case TUBE_CORAL_BLOCK: case TUFF: case TURTLE_EGG: + case VERDANT_FROGLIGHT: case WARPED_DOOR: case WARPED_FENCE: case WARPED_FENCE_GATE: @@ -6478,6 +6682,20 @@ public enum Material implements Keyed { case MAGENTA_CARPET: case MAGENTA_WALL_BANNER: case MAGENTA_WOOL: + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_LEAVES: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_PRESSURE_PLATE: + case MANGROVE_ROOTS: + case MANGROVE_SIGN: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_TRAPDOOR: + case MANGROVE_WALL_SIGN: + case MANGROVE_WOOD: case MUSHROOM_STEM: case NOTE_BLOCK: case OAK_DOOR: @@ -6539,6 +6757,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -6714,6 +6934,15 @@ public enum Material implements Keyed { case LIME_WOOL: case MAGENTA_CARPET: case MAGENTA_WOOL: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_LEAVES: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_ROOTS: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_WOOD: case OAK_FENCE: case OAK_FENCE_GATE: case OAK_LEAVES: @@ -6756,6 +6985,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -6827,6 +7058,7 @@ public enum Material implements Keyed { // case ACACIA_BOAT: case ACACIA_BUTTON: + case ACACIA_CHEST_BOAT: case ACACIA_DOOR: case ACACIA_FENCE: case ACACIA_FENCE_GATE: @@ -6844,6 +7076,7 @@ public enum Material implements Keyed { case BARREL: case BIRCH_BOAT: case BIRCH_BUTTON: + case BIRCH_CHEST_BOAT: case BIRCH_DOOR: case BIRCH_FENCE: case BIRCH_FENCE_GATE: @@ -6882,6 +7115,7 @@ public enum Material implements Keyed { case CYAN_WOOL: case DARK_OAK_BOAT: case DARK_OAK_BUTTON: + case DARK_OAK_CHEST_BOAT: case DARK_OAK_DOOR: case DARK_OAK_FENCE: case DARK_OAK_FENCE_GATE: @@ -6909,6 +7143,7 @@ public enum Material implements Keyed { case JUKEBOX: case JUNGLE_BOAT: case JUNGLE_BUTTON: + case JUNGLE_CHEST_BOAT: case JUNGLE_DOOR: case JUNGLE_FENCE: case JUNGLE_FENCE_GATE: @@ -6937,9 +7172,26 @@ public enum Material implements Keyed { case MAGENTA_BANNER: case MAGENTA_CARPET: case MAGENTA_WOOL: + case MANGROVE_BOAT: + case MANGROVE_BUTTON: + case MANGROVE_CHEST_BOAT: + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_PRESSURE_PLATE: + case MANGROVE_PROPAGULE: + case MANGROVE_ROOTS: + case MANGROVE_SIGN: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_TRAPDOOR: + case MANGROVE_WOOD: case NOTE_BLOCK: case OAK_BOAT: case OAK_BUTTON: + case OAK_CHEST_BOAT: case OAK_DOOR: case OAK_FENCE: case OAK_FENCE_GATE: @@ -6968,6 +7220,7 @@ public enum Material implements Keyed { case SMITHING_TABLE: case SPRUCE_BOAT: case SPRUCE_BUTTON: + case SPRUCE_CHEST_BOAT: case SPRUCE_DOOR: case SPRUCE_FENCE: case SPRUCE_FENCE_GATE: @@ -6989,6 +7242,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -7272,10 +7527,17 @@ public enum Material implements Keyed { case MAGENTA_TERRACOTTA: case MAGENTA_WOOL: case MAGMA_BLOCK: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_ROOTS: + case MANGROVE_WOOD: case MELON: case MOSSY_COBBLESTONE: case MOSSY_STONE_BRICKS: case MOSS_BLOCK: + case MUD: + case MUDDY_MANGROVE_ROOTS: + case MUD_BRICKS: case MUSHROOM_STEM: case MYCELIUM: case NETHERITE_BLOCK: @@ -7289,6 +7551,7 @@ public enum Material implements Keyed { case OAK_PLANKS: case OAK_WOOD: case OBSIDIAN: + case OCHRE_FROGLIGHT: case ORANGE_CONCRETE: case ORANGE_CONCRETE_POWDER: case ORANGE_GLAZED_TERRACOTTA: @@ -7298,6 +7561,8 @@ public enum Material implements Keyed { case OXIDIZED_COPPER: case OXIDIZED_CUT_COPPER: case PACKED_ICE: + case PACKED_MUD: + case PEARLESCENT_FROGLIGHT: case PINK_CONCRETE: case PINK_CONCRETE_POWDER: case PINK_GLAZED_TERRACOTTA: @@ -7341,11 +7606,14 @@ public enum Material implements Keyed { case RED_SHULKER_BOX: case RED_TERRACOTTA: case RED_WOOL: + case REINFORCED_DEEPSLATE: case REPEATING_COMMAND_BLOCK: case RESPAWN_ANCHOR: case ROOTED_DIRT: case SAND: case SANDSTONE: + case SCULK: + case SCULK_CATALYST: case SHROOMLIGHT: case SHULKER_BOX: case SLIME_BLOCK: @@ -7376,6 +7644,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -7387,6 +7657,7 @@ public enum Material implements Keyed { case TERRACOTTA: case TUBE_CORAL_BLOCK: case TUFF: + case VERDANT_FROGLIGHT: case WARPED_HYPHAE: case WARPED_NYLIUM: case WARPED_PLANKS: @@ -7628,6 +7899,7 @@ public enum Material implements Keyed { case LIME_WALL_BANNER: case MAGENTA_CANDLE_CAKE: case MAGENTA_WALL_BANNER: + case MANGROVE_WALL_SIGN: case MELON_STEM: case MOVING_PISTON: case NETHER_PORTAL: @@ -7658,6 +7930,7 @@ public enum Material implements Keyed { case POTTED_FLOWERING_AZALEA_BUSH: case POTTED_JUNGLE_SAPLING: case POTTED_LILY_OF_THE_VALLEY: + case POTTED_MANGROVE_PROPAGULE: case POTTED_OAK_SAPLING: case POTTED_ORANGE_TULIP: case POTTED_OXEYE_DAISY: @@ -7917,9 +8190,18 @@ public enum Material implements Keyed { case MAGENTA_CANDLE: case MAGENTA_CANDLE_CAKE: case MAGENTA_SHULKER_BOX: + case MANGROVE_BUTTON: + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_SIGN: + case MANGROVE_STAIRS: + case MANGROVE_TRAPDOOR: + case MANGROVE_WALL_SIGN: case MOSSY_COBBLESTONE_STAIRS: case MOSSY_STONE_BRICK_STAIRS: case MOVING_PISTON: + case MUD_BRICK_STAIRS: case NETHER_BRICK_FENCE: case NETHER_BRICK_STAIRS: case NOTE_BLOCK: @@ -7966,6 +8248,7 @@ public enum Material implements Keyed { case POTTED_FLOWERING_AZALEA_BUSH: case POTTED_JUNGLE_SAPLING: case POTTED_LILY_OF_THE_VALLEY: + case POTTED_MANGROVE_PROPAGULE: case POTTED_OAK_SAPLING: case POTTED_ORANGE_TULIP: case POTTED_OXEYE_DAISY: @@ -8062,7 +8345,7 @@ public enum Material implements Keyed { * @return the hardness of that material. */ public float getHardness() { - Validate.isTrue(isBlock(), "The Material is not a block!"); + Preconditions.checkArgument(isBlock(), "The Material is not a block!"); switch (this) { // case BARRIER: @@ -8138,6 +8421,7 @@ public enum Material implements Keyed { case LIGHT_GRAY_BED: case LIME_BED: case MAGENTA_BED: + case MANGROVE_LEAVES: case MUSHROOM_STEM: case OAK_LEAVES: case ORANGE_BED: @@ -8145,6 +8429,8 @@ public enum Material implements Keyed { case PURPLE_BED: case RED_BED: case RED_MUSHROOM_BLOCK: + case SCULK: + case SCULK_VEIN: case SNOW_BLOCK: case SPRUCE_LEAVES: case VINE: @@ -8177,8 +8463,10 @@ public enum Material implements Keyed { case LIME_STAINED_GLASS_PANE: case MAGENTA_STAINED_GLASS: case MAGENTA_STAINED_GLASS_PANE: + case OCHRE_FROGLIGHT: case ORANGE_STAINED_GLASS: case ORANGE_STAINED_GLASS_PANE: + case PEARLESCENT_FROGLIGHT: case PINK_STAINED_GLASS: case PINK_STAINED_GLASS_PANE: case PURPLE_STAINED_GLASS: @@ -8188,6 +8476,7 @@ public enum Material implements Keyed { case RED_STAINED_GLASS_PANE: case SEA_LANTERN: case TINTED_GLASS: + case VERDANT_FROGLIGHT: case WHITE_STAINED_GLASS: case WHITE_STAINED_GLASS_PANE: case YELLOW_STAINED_GLASS: @@ -8244,6 +8533,9 @@ public enum Material implements Keyed { case MAGENTA_CANDLE_CAKE: case MAGENTA_CONCRETE_POWDER: case MAGMA_BLOCK: + case MANGROVE_BUTTON: + case MANGROVE_PRESSURE_PLATE: + case MUD: case OAK_BUTTON: case OAK_PRESSURE_PLATE: case ORANGE_CANDLE_CAKE: @@ -8291,6 +8583,8 @@ public enum Material implements Keyed { return 0.65F; case ACTIVATOR_RAIL: case DETECTOR_RAIL: + case MANGROVE_ROOTS: + case MUDDY_MANGROVE_ROOTS: case POWERED_RAIL: case RAIL: return 0.7F; @@ -8373,12 +8667,15 @@ public enum Material implements Keyed { case LIME_WALL_BANNER: case MAGENTA_BANNER: case MAGENTA_WALL_BANNER: + case MANGROVE_SIGN: + case MANGROVE_WALL_SIGN: case MELON: case NETHER_WART_BLOCK: case OAK_SIGN: case OAK_WALL_SIGN: case ORANGE_BANNER: case ORANGE_WALL_BANNER: + case PACKED_MUD: case PINK_BANNER: case PINK_WALL_BANNER: case PLAYER_HEAD: @@ -8487,6 +8784,10 @@ public enum Material implements Keyed { case MOSSY_STONE_BRICK_SLAB: case MOSSY_STONE_BRICK_STAIRS: case MOSSY_STONE_BRICK_WALL: + case MUD_BRICKS: + case MUD_BRICK_SLAB: + case MUD_BRICK_STAIRS: + case MUD_BRICK_WALL: case PISTON: case PISTON_HEAD: case POINTED_DRIPSTONE: @@ -8604,6 +8905,13 @@ public enum Material implements Keyed { case LIGHT_GRAY_SHULKER_BOX: case LIME_SHULKER_BOX: case MAGENTA_SHULKER_BOX: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_LOG: + case MANGROVE_PLANKS: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_WOOD: case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE_SLAB: case MOSSY_COBBLESTONE_STAIRS: @@ -8671,6 +8979,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -8738,6 +9048,8 @@ public enum Material implements Keyed { case LAPIS_BLOCK: case LAPIS_ORE: case LIGHTNING_ROD: + case MANGROVE_DOOR: + case MANGROVE_TRAPDOOR: case NETHER_GOLD_ORE: case NETHER_QUARTZ_ORE: case OAK_DOOR: @@ -8748,6 +9060,8 @@ public enum Material implements Keyed { case OXIDIZED_CUT_COPPER_SLAB: case OXIDIZED_CUT_COPPER_STAIRS: case REDSTONE_ORE: + case SCULK_CATALYST: + case SCULK_SHRIEKER: case SPRUCE_DOOR: case SPRUCE_TRAPDOOR: case WARPED_DOOR: @@ -8841,6 +9155,8 @@ public enum Material implements Keyed { case OBSIDIAN: case RESPAWN_ANCHOR: return 50.0F; + case REINFORCED_DEEPSLATE: + return 55.0F; case LAVA: case WATER: return 100.0F; @@ -8861,7 +9177,7 @@ public enum Material implements Keyed { * @return the blast resistance of that material. */ public float getBlastResistance() { - Validate.isTrue(isBlock(), "The Material is not a block!"); + Preconditions.checkArgument(isBlock(), "The Material is not a block!"); switch (this) { // case BIG_DRIPLEAF: @@ -8922,6 +9238,7 @@ public enum Material implements Keyed { case LIGHT_GRAY_BED: case LIME_BED: case MAGENTA_BED: + case MANGROVE_LEAVES: case MUSHROOM_STEM: case OAK_LEAVES: case ORANGE_BED: @@ -8929,6 +9246,8 @@ public enum Material implements Keyed { case PURPLE_BED: case RED_BED: case RED_MUSHROOM_BLOCK: + case SCULK: + case SCULK_VEIN: case SNOW_BLOCK: case SPRUCE_LEAVES: case VINE: @@ -8961,8 +9280,10 @@ public enum Material implements Keyed { case LIME_STAINED_GLASS_PANE: case MAGENTA_STAINED_GLASS: case MAGENTA_STAINED_GLASS_PANE: + case OCHRE_FROGLIGHT: case ORANGE_STAINED_GLASS: case ORANGE_STAINED_GLASS_PANE: + case PEARLESCENT_FROGLIGHT: case PINK_STAINED_GLASS: case PINK_STAINED_GLASS_PANE: case PURPLE_STAINED_GLASS: @@ -8972,6 +9293,7 @@ public enum Material implements Keyed { case RED_STAINED_GLASS_PANE: case SEA_LANTERN: case TINTED_GLASS: + case VERDANT_FROGLIGHT: case WHITE_STAINED_GLASS: case WHITE_STAINED_GLASS_PANE: case YELLOW_STAINED_GLASS: @@ -9027,6 +9349,9 @@ public enum Material implements Keyed { case MAGENTA_CANDLE_CAKE: case MAGENTA_CONCRETE_POWDER: case MAGMA_BLOCK: + case MANGROVE_BUTTON: + case MANGROVE_PRESSURE_PLATE: + case MUD: case OAK_BUTTON: case OAK_PRESSURE_PLATE: case ORANGE_CANDLE_CAKE: @@ -9074,6 +9399,8 @@ public enum Material implements Keyed { return 0.65F; case ACTIVATOR_RAIL: case DETECTOR_RAIL: + case MANGROVE_ROOTS: + case MUDDY_MANGROVE_ROOTS: case POWERED_RAIL: case RAIL: return 0.7F; @@ -9158,6 +9485,8 @@ public enum Material implements Keyed { case LIME_WALL_BANNER: case MAGENTA_BANNER: case MAGENTA_WALL_BANNER: + case MANGROVE_SIGN: + case MANGROVE_WALL_SIGN: case MELON: case NETHER_WART_BLOCK: case OAK_SIGN: @@ -9260,6 +9589,8 @@ public enum Material implements Keyed { case LIGHT_GRAY_SHULKER_BOX: case LIME_SHULKER_BOX: case MAGENTA_SHULKER_BOX: + case MANGROVE_LOG: + case MANGROVE_WOOD: case OAK_LOG: case OAK_WOOD: case ORANGE_SHULKER_BOX: @@ -9281,6 +9612,8 @@ public enum Material implements Keyed { case STRIPPED_DARK_OAK_WOOD: case STRIPPED_JUNGLE_LOG: case STRIPPED_JUNGLE_WOOD: + case STRIPPED_MANGROVE_LOG: + case STRIPPED_MANGROVE_WOOD: case STRIPPED_OAK_LOG: case STRIPPED_OAK_WOOD: case STRIPPED_SPRUCE_LOG: @@ -9360,6 +9693,17 @@ public enum Material implements Keyed { case JUNGLE_TRAPDOOR: case LAPIS_BLOCK: case LAPIS_ORE: + case MANGROVE_DOOR: + case MANGROVE_FENCE: + case MANGROVE_FENCE_GATE: + case MANGROVE_PLANKS: + case MANGROVE_SLAB: + case MANGROVE_STAIRS: + case MANGROVE_TRAPDOOR: + case MUD_BRICKS: + case MUD_BRICK_SLAB: + case MUD_BRICK_STAIRS: + case MUD_BRICK_WALL: case NETHER_GOLD_ORE: case NETHER_QUARTZ_ORE: case OAK_DOOR: @@ -9370,8 +9714,11 @@ public enum Material implements Keyed { case OAK_STAIRS: case OAK_TRAPDOOR: case OBSERVER: + case PACKED_MUD: case POINTED_DRIPSTONE: case REDSTONE_ORE: + case SCULK_CATALYST: + case SCULK_SHRIEKER: case SPRUCE_DOOR: case SPRUCE_FENCE: case SPRUCE_FENCE_GATE: @@ -9628,6 +9975,7 @@ public enum Material implements Keyed { case ENCHANTING_TABLE: case NETHERITE_BLOCK: case OBSIDIAN: + case REINFORCED_DEEPSLATE: case RESPAWN_ANCHOR: return 1200.0F; case BEDROCK: @@ -9662,7 +10010,7 @@ public enum Material implements Keyed { * @return the slipperiness of this block */ public float getSlipperiness() { - Validate.isTrue(isBlock(), "The Material is not a block!"); + Preconditions.checkArgument(isBlock(), "The Material is not a block!"); switch (this) { // default: @@ -9689,7 +10037,7 @@ public enum Material implements Keyed { */ @Nullable public Material getCraftingRemainingItem() { - Validate.isTrue(isItem(), "The Material is not an item!"); + Preconditions.checkArgument(isItem(), "The Material is not an item!"); switch (this) { // case WATER_BUCKET: @@ -9714,7 +10062,7 @@ public enum Material implements Keyed { */ @NotNull public EquipmentSlot getEquipmentSlot() { - Validate.isTrue(isItem(), "The Material is not an item!"); + Preconditions.checkArgument(isItem(), "The Material is not an item!"); switch (this) { // case CARVED_PUMPKIN: @@ -9777,7 +10125,7 @@ public enum Material implements Keyed { */ @NotNull public Multimap getDefaultAttributeModifiers(@NotNull EquipmentSlot slot) { - Validate.isTrue(isItem(), "The Material is not an item!"); + Preconditions.checkArgument(isItem(), "The Material is not an item!"); return Bukkit.getUnsafe().getDefaultAttributeModifiers(this, slot); } diff --git a/paper-api/src/main/java/org/bukkit/Note.java b/paper-api/src/main/java/org/bukkit/Note.java index b1c86aefb6..fc3da7ce6f 100644 --- a/paper-api/src/main/java/org/bukkit/Note.java +++ b/paper-api/src/main/java/org/bukkit/Note.java @@ -1,8 +1,8 @@ package org.bukkit; +import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import java.util.Map; -import org.apache.commons.lang.Validate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -127,7 +127,7 @@ public class Note { * value. The value has to be in the interval [0; 24]. */ public Note(int note) { - Validate.isTrue(note >= 0 && note <= 24, "The note value has to be between 0 and 24."); + Preconditions.checkArgument(note >= 0 && note <= 24, "The note value has to be between 0 and 24."); this.note = (byte) note; } @@ -161,7 +161,7 @@ public class Note { */ @NotNull public static Note flat(int octave, @NotNull Tone tone) { - Validate.isTrue(octave != 2, "Octave cannot be 2 for flats"); + Preconditions.checkArgument(octave != 2, "Octave cannot be 2 for flats"); tone = tone == Tone.G ? Tone.F : Tone.values()[tone.ordinal() - 1]; return new Note(octave, tone, tone.isSharpable()); } @@ -188,7 +188,7 @@ public class Note { */ @NotNull public static Note natural(int octave, @NotNull Tone tone) { - Validate.isTrue(octave != 2, "Octave cannot be 2 for naturals"); + Preconditions.checkArgument(octave != 2, "Octave cannot be 2 for naturals"); return new Note(octave, tone, false); } @@ -197,7 +197,7 @@ public class Note { */ @NotNull public Note sharped() { - Validate.isTrue(note < 24, "This note cannot be sharped because it is the highest known note!"); + Preconditions.checkArgument(note < 24, "This note cannot be sharped because it is the highest known note!"); return new Note(note + 1); } @@ -206,7 +206,7 @@ public class Note { */ @NotNull public Note flattened() { - Validate.isTrue(note > 0, "This note cannot be flattened because it is the lowest known note!"); + Preconditions.checkArgument(note > 0, "This note cannot be flattened because it is the lowest known note!"); return new Note(note - 1); } diff --git a/paper-api/src/main/java/org/bukkit/Particle.java b/paper-api/src/main/java/org/bukkit/Particle.java index 8d048a8f14..9f646171b3 100644 --- a/paper-api/src/main/java/org/bukkit/Particle.java +++ b/paper-api/src/main/java/org/bukkit/Particle.java @@ -118,6 +118,11 @@ public enum Particle { WAX_OFF, ELECTRIC_SPARK, SCRAPE, + SONIC_BOOM, + SCULK_SOUL, + SCULK_CHARGE(Float.class), + SCULK_CHARGE_POP, + SHRIEK(Integer.class), /** * Uses {@link BlockData} as DataType */ diff --git a/paper-api/src/main/java/org/bukkit/Registry.java b/paper-api/src/main/java/org/bukkit/Registry.java index a696fcaffa..2796c5375a 100644 --- a/paper-api/src/main/java/org/bukkit/Registry.java +++ b/paper-api/src/main/java/org/bukkit/Registry.java @@ -12,6 +12,7 @@ import org.bukkit.block.Biome; import org.bukkit.boss.KeyedBossBar; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Frog; import org.bukkit.entity.Villager; import org.bukkit.entity.memory.MemoryKey; import org.bukkit.loot.LootTables; @@ -170,6 +171,12 @@ public interface Registry extends Iterable { * @see Fluid */ Registry FLUID = new SimpleRegistry<>(Fluid.class); + /** + * Frog variants. + * + * @see Frog.Variant + */ + Registry FROG_VARIANT = new SimpleRegistry<>(Frog.Variant.class); /** * Game events. * diff --git a/paper-api/src/main/java/org/bukkit/Sound.java b/paper-api/src/main/java/org/bukkit/Sound.java index 77553fe2e7..21b95d404f 100644 --- a/paper-api/src/main/java/org/bukkit/Sound.java +++ b/paper-api/src/main/java/org/bukkit/Sound.java @@ -202,6 +202,17 @@ public enum Sound implements Keyed { BLOCK_FLOWERING_AZALEA_HIT("block.flowering_azalea.hit"), BLOCK_FLOWERING_AZALEA_PLACE("block.flowering_azalea.place"), BLOCK_FLOWERING_AZALEA_STEP("block.flowering_azalea.step"), + BLOCK_FROGLIGHT_BREAK("block.froglight.break"), + BLOCK_FROGLIGHT_FALL("block.froglight.fall"), + BLOCK_FROGLIGHT_HIT("block.froglight.hit"), + BLOCK_FROGLIGHT_PLACE("block.froglight.place"), + BLOCK_FROGLIGHT_STEP("block.froglight.step"), + BLOCK_FROGSPAWN_BREAK("block.frogspawn.break"), + BLOCK_FROGSPAWN_FALL("block.frogspawn.fall"), + BLOCK_FROGSPAWN_HATCH("block.frogspawn.hatch"), + BLOCK_FROGSPAWN_HIT("block.frogspawn.hit"), + BLOCK_FROGSPAWN_PLACE("block.frogspawn.place"), + BLOCK_FROGSPAWN_STEP("block.frogspawn.step"), BLOCK_FUNGUS_BREAK("block.fungus.break"), BLOCK_FUNGUS_FALL("block.fungus.fall"), BLOCK_FUNGUS_HIT("block.fungus.hit"), @@ -267,6 +278,11 @@ public enum Sound implements Keyed { BLOCK_LODESTONE_HIT("block.lodestone.hit"), BLOCK_LODESTONE_PLACE("block.lodestone.place"), BLOCK_LODESTONE_STEP("block.lodestone.step"), + BLOCK_MANGROVE_ROOTS_BREAK("block.mangrove_roots.break"), + BLOCK_MANGROVE_ROOTS_FALL("block.mangrove_roots.fall"), + BLOCK_MANGROVE_ROOTS_HIT("block.mangrove_roots.hit"), + BLOCK_MANGROVE_ROOTS_PLACE("block.mangrove_roots.place"), + BLOCK_MANGROVE_ROOTS_STEP("block.mangrove_roots.step"), BLOCK_MEDIUM_AMETHYST_BUD_BREAK("block.medium_amethyst_bud.break"), BLOCK_MEDIUM_AMETHYST_BUD_PLACE("block.medium_amethyst_bud.place"), BLOCK_METAL_BREAK("block.metal.break"), @@ -286,6 +302,21 @@ public enum Sound implements Keyed { BLOCK_MOSS_HIT("block.moss.hit"), BLOCK_MOSS_PLACE("block.moss.place"), BLOCK_MOSS_STEP("block.moss.step"), + BLOCK_MUDDY_MANGROVE_ROOTS_BREAK("block.muddy_mangrove_roots.break"), + BLOCK_MUDDY_MANGROVE_ROOTS_FALL("block.muddy_mangrove_roots.fall"), + BLOCK_MUDDY_MANGROVE_ROOTS_HIT("block.muddy_mangrove_roots.hit"), + BLOCK_MUDDY_MANGROVE_ROOTS_PLACE("block.muddy_mangrove_roots.place"), + BLOCK_MUDDY_MANGROVE_ROOTS_STEP("block.muddy_mangrove_roots.step"), + BLOCK_MUD_BREAK("block.mud.break"), + BLOCK_MUD_BRICKS_BREAK("block.mud_bricks.break"), + BLOCK_MUD_BRICKS_FALL("block.mud_bricks.fall"), + BLOCK_MUD_BRICKS_HIT("block.mud_bricks.hit"), + BLOCK_MUD_BRICKS_PLACE("block.mud_bricks.place"), + BLOCK_MUD_BRICKS_STEP("block.mud_bricks.step"), + BLOCK_MUD_FALL("block.mud.fall"), + BLOCK_MUD_HIT("block.mud.hit"), + BLOCK_MUD_PLACE("block.mud.place"), + BLOCK_MUD_STEP("block.mud.step"), BLOCK_NETHERITE_BLOCK_BREAK("block.netherite_block.break"), BLOCK_NETHERITE_BLOCK_FALL("block.netherite_block.fall"), BLOCK_NETHERITE_BLOCK_HIT("block.netherite_block.hit"), @@ -338,6 +369,11 @@ public enum Sound implements Keyed { BLOCK_NYLIUM_HIT("block.nylium.hit"), BLOCK_NYLIUM_PLACE("block.nylium.place"), BLOCK_NYLIUM_STEP("block.nylium.step"), + BLOCK_PACKED_MUD_BREAK("block.packed_mud.break"), + BLOCK_PACKED_MUD_FALL("block.packed_mud.fall"), + BLOCK_PACKED_MUD_HIT("block.packed_mud.hit"), + BLOCK_PACKED_MUD_PLACE("block.packed_mud.place"), + BLOCK_PACKED_MUD_STEP("block.packed_mud.step"), BLOCK_PISTON_CONTRACT("block.piston.contract"), BLOCK_PISTON_EXTEND("block.piston.extend"), BLOCK_POINTED_DRIPSTONE_BREAK("block.pointed_dripstone.break"), @@ -389,6 +425,17 @@ public enum Sound implements Keyed { BLOCK_SCAFFOLDING_HIT("block.scaffolding.hit"), BLOCK_SCAFFOLDING_PLACE("block.scaffolding.place"), BLOCK_SCAFFOLDING_STEP("block.scaffolding.step"), + BLOCK_SCULK_BREAK("block.sculk.break"), + BLOCK_SCULK_CATALYST_BLOOM("block.sculk_catalyst.bloom"), + BLOCK_SCULK_CATALYST_BREAK("block.sculk_catalyst.break"), + BLOCK_SCULK_CATALYST_FALL("block.sculk_catalyst.fall"), + BLOCK_SCULK_CATALYST_HIT("block.sculk_catalyst.hit"), + BLOCK_SCULK_CATALYST_PLACE("block.sculk_catalyst.place"), + BLOCK_SCULK_CATALYST_STEP("block.sculk_catalyst.step"), + BLOCK_SCULK_CHARGE("block.sculk.charge"), + BLOCK_SCULK_FALL("block.sculk.fall"), + BLOCK_SCULK_HIT("block.sculk.hit"), + BLOCK_SCULK_PLACE("block.sculk.place"), BLOCK_SCULK_SENSOR_BREAK("block.sculk_sensor.break"), BLOCK_SCULK_SENSOR_CLICKING("block.sculk_sensor.clicking"), BLOCK_SCULK_SENSOR_CLICKING_STOP("block.sculk_sensor.clicking_stop"), @@ -396,6 +443,19 @@ public enum Sound implements Keyed { BLOCK_SCULK_SENSOR_HIT("block.sculk_sensor.hit"), BLOCK_SCULK_SENSOR_PLACE("block.sculk_sensor.place"), BLOCK_SCULK_SENSOR_STEP("block.sculk_sensor.step"), + BLOCK_SCULK_SHRIEKER_BREAK("block.sculk_shrieker.break"), + BLOCK_SCULK_SHRIEKER_FALL("block.sculk_shrieker.fall"), + BLOCK_SCULK_SHRIEKER_HIT("block.sculk_shrieker.hit"), + BLOCK_SCULK_SHRIEKER_PLACE("block.sculk_shrieker.place"), + BLOCK_SCULK_SHRIEKER_SHRIEK("block.sculk_shrieker.shriek"), + BLOCK_SCULK_SHRIEKER_STEP("block.sculk_shrieker.step"), + BLOCK_SCULK_SPREAD("block.sculk.spread"), + BLOCK_SCULK_STEP("block.sculk.step"), + BLOCK_SCULK_VEIN_BREAK("block.sculk_vein.break"), + BLOCK_SCULK_VEIN_FALL("block.sculk_vein.fall"), + BLOCK_SCULK_VEIN_HIT("block.sculk_vein.hit"), + BLOCK_SCULK_VEIN_PLACE("block.sculk_vein.place"), + BLOCK_SCULK_VEIN_STEP("block.sculk_vein.step"), BLOCK_SHROOMLIGHT_BREAK("block.shroomlight.break"), BLOCK_SHROOMLIGHT_FALL("block.shroomlight.fall"), BLOCK_SHROOMLIGHT_HIT("block.shroomlight.hit"), @@ -503,6 +563,13 @@ public enum Sound implements Keyed { BLOCK_WOOL_PLACE("block.wool.place"), BLOCK_WOOL_STEP("block.wool.step"), ENCHANT_THORNS_HIT("enchant.thorns.hit"), + ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM("entity.allay.ambient_without_item"), + ENTITY_ALLAY_AMBIENT_WITH_ITEM("entity.allay.ambient_with_item"), + ENTITY_ALLAY_DEATH("entity.allay.death"), + ENTITY_ALLAY_HURT("entity.allay.hurt"), + ENTITY_ALLAY_ITEM_GIVEN("entity.allay.item_given"), + ENTITY_ALLAY_ITEM_TAKEN("entity.allay.item_taken"), + ENTITY_ALLAY_ITEM_THROWN("entity.allay.item_thrown"), ENTITY_ARMOR_STAND_BREAK("entity.armor_stand.break"), ENTITY_ARMOR_STAND_FALL("entity.armor_stand.fall"), ENTITY_ARMOR_STAND_HIT("entity.armor_stand.hit"), @@ -649,6 +716,14 @@ public enum Sound implements Keyed { ENTITY_FOX_SNIFF("entity.fox.sniff"), ENTITY_FOX_SPIT("entity.fox.spit"), ENTITY_FOX_TELEPORT("entity.fox.teleport"), + ENTITY_FROG_AMBIENT("entity.frog.ambient"), + ENTITY_FROG_DEATH("entity.frog.death"), + ENTITY_FROG_EAT("entity.frog.eat"), + ENTITY_FROG_HURT("entity.frog.hurt"), + ENTITY_FROG_LAY_SPAWN("entity.frog.lay_spawn"), + ENTITY_FROG_LONG_JUMP("entity.frog.long_jump"), + ENTITY_FROG_STEP("entity.frog.step"), + ENTITY_FROG_TONGUE("entity.frog.tongue"), ENTITY_GENERIC_BIG_FALL("entity.generic.big_fall"), ENTITY_GENERIC_BURN("entity.generic.burn"), ENTITY_GENERIC_DEATH("entity.generic.death"), @@ -678,6 +753,7 @@ public enum Sound implements Keyed { ENTITY_GOAT_AMBIENT("entity.goat.ambient"), ENTITY_GOAT_DEATH("entity.goat.death"), ENTITY_GOAT_EAT("entity.goat.eat"), + ENTITY_GOAT_HORN_BREAK("entity.goat.horn_break"), ENTITY_GOAT_HURT("entity.goat.hurt"), ENTITY_GOAT_LONG_JUMP("entity.goat.long_jump"), ENTITY_GOAT_MILK("entity.goat.milk"), @@ -686,6 +762,7 @@ public enum Sound implements Keyed { ENTITY_GOAT_SCREAMING_AMBIENT("entity.goat.screaming.ambient"), ENTITY_GOAT_SCREAMING_DEATH("entity.goat.screaming.death"), ENTITY_GOAT_SCREAMING_EAT("entity.goat.screaming.eat"), + ENTITY_GOAT_SCREAMING_HORN_BREAK("entity.goat.screaming.horn_break"), ENTITY_GOAT_SCREAMING_HURT("entity.goat.screaming.hurt"), ENTITY_GOAT_SCREAMING_LONG_JUMP("entity.goat.screaming.long_jump"), ENTITY_GOAT_SCREAMING_MILK("entity.goat.screaming.milk"), @@ -834,6 +911,7 @@ public enum Sound implements Keyed { ENTITY_PARROT_IMITATE_STRAY("entity.parrot.imitate.stray"), ENTITY_PARROT_IMITATE_VEX("entity.parrot.imitate.vex"), ENTITY_PARROT_IMITATE_VINDICATOR("entity.parrot.imitate.vindicator"), + ENTITY_PARROT_IMITATE_WARDEN("entity.parrot.imitate.warden"), ENTITY_PARROT_IMITATE_WITCH("entity.parrot.imitate.witch"), ENTITY_PARROT_IMITATE_WITHER("entity.parrot.imitate.wither"), ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"), @@ -993,6 +1071,10 @@ public enum Sound implements Keyed { ENTITY_STRIDER_SADDLE("entity.strider.saddle"), ENTITY_STRIDER_STEP("entity.strider.step"), ENTITY_STRIDER_STEP_LAVA("entity.strider.step_lava"), + ENTITY_TADPOLE_DEATH("entity.tadpole.death"), + ENTITY_TADPOLE_FLOP("entity.tadpole.flop"), + ENTITY_TADPOLE_GROW_UP("entity.tadpole.grow_up"), + ENTITY_TADPOLE_HURT("entity.tadpole.hurt"), ENTITY_TNT_PRIMED("entity.tnt.primed"), ENTITY_TROPICAL_FISH_AMBIENT("entity.tropical_fish.ambient"), ENTITY_TROPICAL_FISH_DEATH("entity.tropical_fish.death"), @@ -1048,6 +1130,26 @@ public enum Sound implements Keyed { ENTITY_WANDERING_TRADER_REAPPEARED("entity.wandering_trader.reappeared"), ENTITY_WANDERING_TRADER_TRADE("entity.wandering_trader.trade"), ENTITY_WANDERING_TRADER_YES("entity.wandering_trader.yes"), + ENTITY_WARDEN_AGITATED("entity.warden.agitated"), + ENTITY_WARDEN_AMBIENT("entity.warden.ambient"), + ENTITY_WARDEN_ANGRY("entity.warden.angry"), + ENTITY_WARDEN_ATTACK_IMPACT("entity.warden.attack_impact"), + ENTITY_WARDEN_DEATH("entity.warden.death"), + ENTITY_WARDEN_DIG("entity.warden.dig"), + ENTITY_WARDEN_EMERGE("entity.warden.emerge"), + ENTITY_WARDEN_HEARTBEAT("entity.warden.heartbeat"), + ENTITY_WARDEN_HURT("entity.warden.hurt"), + ENTITY_WARDEN_LISTENING("entity.warden.listening"), + ENTITY_WARDEN_LISTENING_ANGRY("entity.warden.listening_angry"), + ENTITY_WARDEN_NEARBY_CLOSE("entity.warden.nearby_close"), + ENTITY_WARDEN_NEARBY_CLOSER("entity.warden.nearby_closer"), + ENTITY_WARDEN_NEARBY_CLOSEST("entity.warden.nearby_closest"), + ENTITY_WARDEN_ROAR("entity.warden.roar"), + ENTITY_WARDEN_SNIFF("entity.warden.sniff"), + ENTITY_WARDEN_SONIC_BOOM("entity.warden.sonic_boom"), + ENTITY_WARDEN_SONIC_CHARGE("entity.warden.sonic_charge"), + ENTITY_WARDEN_STEP("entity.warden.step"), + ENTITY_WARDEN_TENDRIL_CLICKS("entity.warden.tendril_clicks"), ENTITY_WITCH_AMBIENT("entity.witch.ambient"), ENTITY_WITCH_CELEBRATE("entity.witch.celebrate"), ENTITY_WITCH_DEATH("entity.witch.death"), @@ -1126,11 +1228,13 @@ public enum Sound implements Keyed { ITEM_BUCKET_EMPTY_FISH("item.bucket.empty_fish"), ITEM_BUCKET_EMPTY_LAVA("item.bucket.empty_lava"), ITEM_BUCKET_EMPTY_POWDER_SNOW("item.bucket.empty_powder_snow"), + ITEM_BUCKET_EMPTY_TADPOLE("item.bucket.empty_tadpole"), ITEM_BUCKET_FILL("item.bucket.fill"), ITEM_BUCKET_FILL_AXOLOTL("item.bucket.fill_axolotl"), ITEM_BUCKET_FILL_FISH("item.bucket.fill_fish"), ITEM_BUCKET_FILL_LAVA("item.bucket.fill_lava"), ITEM_BUCKET_FILL_POWDER_SNOW("item.bucket.fill_powder_snow"), + ITEM_BUCKET_FILL_TADPOLE("item.bucket.fill_tadpole"), ITEM_BUNDLE_DROP_CONTENTS("item.bundle.drop_contents"), ITEM_BUNDLE_INSERT("item.bundle.insert"), ITEM_BUNDLE_REMOVE_ONE("item.bundle.remove_one"), @@ -1149,6 +1253,15 @@ public enum Sound implements Keyed { ITEM_FIRECHARGE_USE("item.firecharge.use"), ITEM_FLINTANDSTEEL_USE("item.flintandsteel.use"), ITEM_GLOW_INK_SAC_USE("item.glow_ink_sac.use"), + ITEM_GOAT_HORN_PLAY("item.goat_horn.play"), + ITEM_GOAT_HORN_SOUND_0("item.goat_horn.sound.0"), + ITEM_GOAT_HORN_SOUND_1("item.goat_horn.sound.1"), + ITEM_GOAT_HORN_SOUND_2("item.goat_horn.sound.2"), + ITEM_GOAT_HORN_SOUND_3("item.goat_horn.sound.3"), + ITEM_GOAT_HORN_SOUND_4("item.goat_horn.sound.4"), + ITEM_GOAT_HORN_SOUND_5("item.goat_horn.sound.5"), + ITEM_GOAT_HORN_SOUND_6("item.goat_horn.sound.6"), + ITEM_GOAT_HORN_SOUND_7("item.goat_horn.sound.7"), ITEM_HOE_TILL("item.hoe.till"), ITEM_HONEYCOMB_WAX_ON("item.honeycomb.wax_on"), ITEM_HONEY_BOTTLE_DRINK("item.honey_bottle.drink"), @@ -1173,6 +1286,7 @@ public enum Sound implements Keyed { MUSIC_CREDITS("music.credits"), MUSIC_DISC_11("music_disc.11"), MUSIC_DISC_13("music_disc.13"), + MUSIC_DISC_5("music_disc.5"), MUSIC_DISC_BLOCKS("music_disc.blocks"), MUSIC_DISC_CAT("music_disc.cat"), MUSIC_DISC_CHIRP("music_disc.chirp"), @@ -1194,14 +1308,18 @@ public enum Sound implements Keyed { MUSIC_NETHER_NETHER_WASTES("music.nether.nether_wastes"), MUSIC_NETHER_SOUL_SAND_VALLEY("music.nether.soul_sand_valley"), MUSIC_NETHER_WARPED_FOREST("music.nether.warped_forest"), + MUSIC_OVERWORLD_DEEP_DARK("music.overworld.deep_dark"), MUSIC_OVERWORLD_DRIPSTONE_CAVES("music.overworld.dripstone_caves"), MUSIC_OVERWORLD_FROZEN_PEAKS("music.overworld.frozen_peaks"), MUSIC_OVERWORLD_GROVE("music.overworld.grove"), MUSIC_OVERWORLD_JAGGED_PEAKS("music.overworld.jagged_peaks"), + MUSIC_OVERWORLD_JUNGLE_AND_FOREST("music.overworld.jungle_and_forest"), MUSIC_OVERWORLD_LUSH_CAVES("music.overworld.lush_caves"), MUSIC_OVERWORLD_MEADOW("music.overworld.meadow"), + MUSIC_OVERWORLD_OLD_GROWTH_TAIGA("music.overworld.old_growth_taiga"), MUSIC_OVERWORLD_SNOWY_SLOPES("music.overworld.snowy_slopes"), MUSIC_OVERWORLD_STONY_PEAKS("music.overworld.stony_peaks"), + MUSIC_OVERWORLD_SWAMP("music.overworld.swamp"), MUSIC_UNDER_WATER("music.under_water"), PARTICLE_SOUL_ESCAPE("particle.soul_escape"), UI_BUTTON_CLICK("ui.button.click"), diff --git a/paper-api/src/main/java/org/bukkit/StructureType.java b/paper-api/src/main/java/org/bukkit/StructureType.java index 9d96f4b3c1..ce4ffebc5f 100644 --- a/paper-api/src/main/java/org/bukkit/StructureType.java +++ b/paper-api/src/main/java/org/bukkit/StructureType.java @@ -1,11 +1,11 @@ package org.bukkit; import com.google.common.base.Preconditions; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import java.util.HashMap; import java.util.Map; import java.util.Objects; -import org.apache.commons.lang.Validate; import org.bukkit.map.MapCursor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -111,7 +111,7 @@ public final class StructureType implements Keyed { * They consist primarily of end stone bricks, purpur blocks, and end rods. * They are the only place where shulkers can be found. */ - public static final StructureType END_CITY = register(new StructureType("endcity", MapCursor.Type.RED_X)); + public static final StructureType END_CITY = register(new StructureType("end_city", MapCursor.Type.RED_X)); /** * Mansions (also known as woodland mansions) are massive house structures @@ -175,7 +175,7 @@ public final class StructureType implements Keyed { * not be compatible with explorer maps. */ private StructureType(@NotNull String name, @Nullable MapCursor.Type mapIcon) { - Validate.notEmpty(name, "Structure name cannot be empty"); + Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "Structure name cannot be empty"); this.key = NamespacedKey.minecraft(name); this.mapCursor = mapIcon; } diff --git a/paper-api/src/main/java/org/bukkit/Tag.java b/paper-api/src/main/java/org/bukkit/Tag.java index 107d12d447..7e3c881224 100644 --- a/paper-api/src/main/java/org/bukkit/Tag.java +++ b/paper-api/src/main/java/org/bukkit/Tag.java @@ -44,7 +44,12 @@ public interface Tag extends Keyed { /** * Vanilla block tag representing all colors of carpet. */ - Tag CARPETS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("carpets"), Material.class); + Tag WOOL_CARPETS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wool_carpets"), Material.class); + /** + * @deprecated {@link #WOOL_CARPETS}. + */ + @Deprecated + Tag CARPETS = WOOL_CARPETS; /** * Vanilla block tag representing all wooden doors. */ @@ -90,6 +95,11 @@ public interface Tag extends Keyed { * Vanilla block tag representing all log and bark variants that burn. */ Tag LOGS_THAT_BURN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("logs_that_burn"), Material.class); + /** + * Vanilla block tag representing all log bark variants that appear + * naturally in the overworld. + */ + Tag OVERWORLD_NATURAL_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("overworld_natural_logs"), Material.class); /** * Vanilla block tag representing all log and bark variants. */ @@ -118,6 +128,10 @@ public interface Tag extends Keyed { * Vanilla block tag representing all spruce log and bark variants. */ Tag SPRUCE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("spruce_logs"), Material.class); + /** + * Vanilla block tag representing all mangrove log and bark variants. + */ + Tag MANGROVE_LOGS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_logs"), Material.class); /** * Vanilla block tag representing all crimson stems. */ @@ -239,6 +253,11 @@ public interface Tag extends Keyed { * Vanilla block tag representing all terracotta. */ Tag TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), Material.class); + /** + * Vanilla block tag representing all blocks which complete the find tree + * tutorial. + */ + Tag COMPLETES_FIND_TREE_TUTORIAL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("completes_find_tree_tutorial"), Material.class); /** * Vanilla block tag denoting blocks that enderman may pick up and hold. */ @@ -295,6 +314,11 @@ public interface Tag extends Keyed { * Vanilla block tag representing all blocks immune to dragons. */ Tag DRAGON_IMMUNE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dragon_immune"), Material.class); + /** + * Vanilla block tag representing all blocks transparent to the ender + * dragon. + */ + Tag DRAGON_TRANSPARENT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dragon_transparent"), Material.class); /** * Vanilla block tag representing all blocks immune to withers. */ @@ -422,6 +446,16 @@ public interface Tag extends Keyed { * Vanilla block tag representing the nether base material. */ Tag BASE_STONE_NETHER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("base_stone_nether"), Material.class); + /** + * Vanilla block tag representing all blocks replaceable by the overworld + * carver. + */ + Tag OVERWORLD_CARVER_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("overworld_carver_replaceables"), Material.class); + /** + * Vanilla block tag representing all blocks replaceable by the nether + * carver. + */ + Tag NETHER_CARVER_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("nether_carver_replaceables"), Material.class); /** * Vanilla block tag representing all candle cakes. */ @@ -442,6 +476,11 @@ public interface Tag extends Keyed { * Vanilla block tag representing all blocks that block vibration signals. */ Tag OCCLUDES_VIBRATION_SIGNALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("occludes_vibration_signals"), Material.class); + /** + * Vanilla block tag representing all blocks that dampen the propagation of + * vibration signals. + */ + Tag DAMPENS_VIBRATIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dampens_vibrations"), Material.class); /** * Vanilla block tag representing all blocks that are replaceable by * dripstone. @@ -519,6 +558,24 @@ public interface Tag extends Keyed { * Vanilla block tag representing all blocks which geodes will not spawn in. */ Tag GEODE_INVALID_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("geode_invalid_blocks"), Material.class); + /** + * Vanilla block tag representing all blocks which frogs prefer to jump to. + */ + Tag FROG_PREFER_JUMP_TO = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("frog_prefer_jump_to"), Material.class); + /** + * Vanilla block tag representing all blocks which can be replaced by skulk. + */ + Tag SCULK_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sculk_replaceable"), Material.class); + /** + * Vanilla block tag representing all blocks which can be replaced by skulk + * during world generation. + */ + Tag SCULK_REPLACEABLE_WORLD_GEN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("sculk_replaceable_world_gen"), Material.class); + /** + * Vanilla block tag representing all blocks which can be replaced by + * ancient cities. + */ + Tag ANCIENT_CITY_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("ancient_city_replaceable"), Material.class); /** * Vanilla block tag representing all blocks which animals will spawn on. */ @@ -543,7 +600,12 @@ public interface Tag extends Keyed { * Vanilla block tag representing all blocks which polar bears will spawn * on. */ - Tag POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("polar_bears_spawnable_on_in_frozen_ocean"), Material.class); + Tag POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("polar_bears_spawnable_on_alternate"), Material.class); + /** + * @deprecated {@link #POLAR_BEARS_SPAWNABLE_ON_ALTERNATE} + */ + @Deprecated + Tag POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN = POLAR_BEARS_SPAWNABLE_ON_ALTERNATE; /** * Vanilla block tag representing all blocks which rabbits will spawn on. */ @@ -556,6 +618,10 @@ public interface Tag extends Keyed { * Vanilla block tag representing all blocks which wolves will spawn on. */ Tag WOLVES_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wolves_spawnable_on"), Material.class); + /** + * Vanilla block tag representing all blocks which frogs will spawn on. + */ + Tag FROGS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("frogs_spawnable_on"), Material.class); /** * Vanilla block tag representing all blocks which azaleas will grow on. */ @@ -564,6 +630,37 @@ public interface Tag extends Keyed { * Vanilla block tag representing all plant blocks which may be replaced. */ Tag REPLACEABLE_PLANTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable_plants"), Material.class); + /** + * Vanilla block tag representing all blocks which may be converted to mud. + */ + Tag CONVERTABLE_TO_MUD = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("convertable_to_mud"), Material.class); + /** + * Vanilla block tag representing all blocks which mangrove logs can grow + * through. + */ + Tag MANGROVE_LOGS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_logs_can_grow_through"), Material.class); + /** + * Vanilla block tag representing all blocks which mangrove roots can grow + * through. + */ + Tag MANGROVE_ROOTS_CAN_GROW_THROUGH = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mangrove_roots_can_grow_through"), Material.class); + /** + * Vanilla block tag representing all blocks which dead bushes may be placed + * on. + */ + Tag DEAD_BUSH_MAY_PLACE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dead_bush_may_place_on"), Material.class); + /** + * Vanilla block tag representing all blocks which snap dropped goat horns. + */ + Tag SNAPS_GOAT_HORN = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snaps_goat_horn"), Material.class); + /** + * Vanilla block tag representing blocks which snow cannot survive on. + */ + Tag SNOW_LAYER_CANNOT_SURVIVE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow_layer_cannot_survive_on"), Material.class); + /** + * Vanilla block tag representing blocks which snow can survive on. + */ + Tag SNOW_LAYER_CAN_SURVIVE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("snow_layer_can_survive_on"), Material.class); /** * Key for the built in item registry. */ @@ -592,6 +689,10 @@ public interface Tag extends Keyed { * Vanilla item tag representing all boat items. */ Tag ITEMS_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("boats"), Material.class); + /** + * Vanilla item tag representing all chest boat items. + */ + Tag ITEMS_CHEST_BOATS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("chest_boats"), Material.class); /** * Vanilla item tag representing all fish items. */ @@ -628,6 +729,10 @@ public interface Tag extends Keyed { * Vanilla item tag representing all furnace materials. */ Tag ITEMS_FURNACE_MATERIALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("furnace_materials"), Material.class); + /** + * Vanilla item tag representing all compasses. + */ + Tag ITEMS_COMPASSES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("compasses"), Material.class); /** * Vanilla item tag representing all items that confer freeze immunity on * the wearer. @@ -698,6 +803,10 @@ public interface Tag extends Keyed { * Vanilla tag representing entities extra susceptible to freezing. */ Tag ENTITY_TYPES_FREEZE_HURTS_EXTRA_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_hurts_extra_types"), EntityType.class); + /** + * Vanilla tag representing entities which can be eaten by frogs. + */ + Tag ENTITY_TYPES_FROG_FOOD = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("frog_food"), EntityType.class); /** * Returns whether or not this tag has an entry for the specified item. diff --git a/paper-api/src/main/java/org/bukkit/TreeType.java b/paper-api/src/main/java/org/bukkit/TreeType.java index fec99b03bb..0104e464cf 100644 --- a/paper-api/src/main/java/org/bukkit/TreeType.java +++ b/paper-api/src/main/java/org/bukkit/TreeType.java @@ -84,5 +84,13 @@ public enum TreeType { /** * Tree with large roots which grows above lush caves */ - AZALEA + AZALEA, + /** + * Mangrove tree + */ + MANGROVE, + /** + * Tall mangrove tree + */ + TALL_MANGROVE, } diff --git a/paper-api/src/main/java/org/bukkit/attribute/AttributeModifier.java b/paper-api/src/main/java/org/bukkit/attribute/AttributeModifier.java index ff8f1231f3..d124768378 100644 --- a/paper-api/src/main/java/org/bukkit/attribute/AttributeModifier.java +++ b/paper-api/src/main/java/org/bukkit/attribute/AttributeModifier.java @@ -1,10 +1,10 @@ package org.bukkit.attribute; +import com.google.common.base.Preconditions; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.UUID; -import org.apache.commons.lang.Validate; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.util.NumberConversions; @@ -31,9 +31,9 @@ public class AttributeModifier implements ConfigurationSerializable { } public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) { - Validate.notNull(uuid, "UUID cannot be null"); - Validate.notNull(name, "Name cannot be null"); - Validate.notNull(operation, "Operation cannot be null"); + Preconditions.checkArgument(uuid != null, "UUID cannot be null"); + Preconditions.checkArgument(name != null, "Name cannot be null"); + Preconditions.checkArgument(operation != null, "Operation cannot be null"); this.uuid = uuid; this.name = name; this.amount = amount; diff --git a/paper-api/src/main/java/org/bukkit/block/Biome.java b/paper-api/src/main/java/org/bukkit/block/Biome.java index d14102bdc9..02c5fcbc76 100644 --- a/paper-api/src/main/java/org/bukkit/block/Biome.java +++ b/paper-api/src/main/java/org/bukkit/block/Biome.java @@ -16,6 +16,7 @@ public enum Biome implements Keyed { FOREST, TAIGA, SWAMP, + MANGROVE_SWAMP, RIVER, NETHER_WASTES, THE_END, @@ -64,6 +65,7 @@ public enum Biome implements Keyed { BASALT_DELTAS, DRIPSTONE_CAVES, LUSH_CAVES, + DEEP_DARK, MEADOW, GROVE, SNOWY_SLOPES, diff --git a/paper-api/src/main/java/org/bukkit/block/SculkCatalyst.java b/paper-api/src/main/java/org/bukkit/block/SculkCatalyst.java new file mode 100644 index 0000000000..ed94fbc0dd --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/SculkCatalyst.java @@ -0,0 +1,7 @@ +package org.bukkit.block; + +/** + * Represents a captured state of a sculk catalyst. + */ +public interface SculkCatalyst extends TileState { +} diff --git a/paper-api/src/main/java/org/bukkit/block/SculkShrieker.java b/paper-api/src/main/java/org/bukkit/block/SculkShrieker.java new file mode 100644 index 0000000000..044823a32b --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/SculkShrieker.java @@ -0,0 +1,27 @@ +package org.bukkit.block; + +/** + * Represents a captured state of a sculk shrieker. + */ +public interface SculkShrieker extends TileState { + + /** + * Gets the most recent warning level of this block. + * + * When the warning level reaches 4, the shrieker will attempt to spawn a + * Warden. + * + * @return current warning level + */ + int getWarningLevel(); + + /** + * Sets the most recent warning level of this block. + * + * When the warning level reaches 4, the shrieker will attempt to spawn a + * Warden. + * + * @param level new warning level + */ + void setWarningLevel(int level); +} diff --git a/paper-api/src/main/java/org/bukkit/block/data/Hangable.java b/paper-api/src/main/java/org/bukkit/block/data/Hangable.java new file mode 100644 index 0000000000..d0aa6a84be --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/data/Hangable.java @@ -0,0 +1,21 @@ +package org.bukkit.block.data; + +/** + * 'hanging' denotes whether the lantern is hanging from a block. + */ +public interface Hangable extends BlockData { + + /** + * Gets the value of the 'hanging' property. + * + * @return the 'hanging' value + */ + boolean isHanging(); + + /** + * Sets the value of the 'hanging' property. + * + * @param hanging the new 'hanging' value + */ + void setHanging(boolean hanging); +} diff --git a/paper-api/src/main/java/org/bukkit/block/data/type/Lantern.java b/paper-api/src/main/java/org/bukkit/block/data/type/Lantern.java index debb26d9b7..d1627f3473 100644 --- a/paper-api/src/main/java/org/bukkit/block/data/type/Lantern.java +++ b/paper-api/src/main/java/org/bukkit/block/data/type/Lantern.java @@ -1,23 +1,7 @@ package org.bukkit.block.data.type; +import org.bukkit.block.data.Hangable; import org.bukkit.block.data.Waterlogged; -/** - * 'hanging' denotes whether the lantern is hanging from a block. - */ -public interface Lantern extends Waterlogged { - - /** - * Gets the value of the 'hanging' property. - * - * @return the 'hanging' value - */ - boolean isHanging(); - - /** - * Sets the value of the 'hanging' property. - * - * @param hanging the new 'hanging' value - */ - void setHanging(boolean hanging); +public interface Lantern extends Hangable, Waterlogged { } diff --git a/paper-api/src/main/java/org/bukkit/block/data/type/MangrovePropagule.java b/paper-api/src/main/java/org/bukkit/block/data/type/MangrovePropagule.java new file mode 100644 index 0000000000..dbb3e385d5 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/data/type/MangrovePropagule.java @@ -0,0 +1,7 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Ageable; +import org.bukkit.block.data.Waterlogged; + +public interface MangrovePropagule extends Ageable, Sapling, Waterlogged { +} diff --git a/paper-api/src/main/java/org/bukkit/block/data/type/SculkCatalyst.java b/paper-api/src/main/java/org/bukkit/block/data/type/SculkCatalyst.java new file mode 100644 index 0000000000..72adcba38d --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/data/type/SculkCatalyst.java @@ -0,0 +1,24 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.BlockData; + +/** + * 'bloom' indicates whether the sculk catalyst is actively spreading the sculk + * or not. + */ +public interface SculkCatalyst extends BlockData { + + /** + * Gets the value of the 'bloom' property. + * + * @return the 'bloom' value + */ + boolean isBloom(); + + /** + * Sets the value of the 'bloom' property. + * + * @param bloom the new 'bloom' value + */ + void setBloom(boolean bloom); +} diff --git a/paper-api/src/main/java/org/bukkit/block/data/type/SculkShrieker.java b/paper-api/src/main/java/org/bukkit/block/data/type/SculkShrieker.java new file mode 100644 index 0000000000..746fb4c577 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/block/data/type/SculkShrieker.java @@ -0,0 +1,39 @@ +package org.bukkit.block.data.type; + +import org.bukkit.block.data.Waterlogged; + +/** + * 'can_summon' indicates whether the sculk shrieker can summon the warden. + *

+ * 'shrieking' indicated whether the sculk shrieker is shrieking or not. + */ +public interface SculkShrieker extends Waterlogged { + + /** + * Gets the value of the 'can_summon' property. + * + * @return the 'can_summon' value + */ + boolean isCanSummon(); + + /** + * Sets the value of the 'can_summon' property. + * + * @param can_summon the new 'can_summon' value + */ + void setCanSummon(boolean can_summon); + + /** + * Gets the value of the 'shrieking' property. + * + * @return the 'shrieking' value + */ + boolean isShrieking(); + + /** + * Sets the value of the 'shrieking' property. + * + * @param shrieking the new 'shrieking' value + */ + void setShrieking(boolean shrieking); +} diff --git a/paper-api/src/main/java/org/bukkit/command/Command.java b/paper-api/src/main/java/org/bukkit/command/Command.java index 03d801a9e0..0577d80a21 100644 --- a/paper-api/src/main/java/org/bukkit/command/Command.java +++ b/paper-api/src/main/java/org/bukkit/command/Command.java @@ -1,11 +1,11 @@ package org.bukkit.command; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameRule; @@ -93,9 +93,9 @@ public abstract class Command { @NotNull private List tabComplete0(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args, @Nullable Location location) throws IllegalArgumentException { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(args, "Arguments cannot be null"); - Validate.notNull(alias, "Alias cannot be null"); + Preconditions.checkArgument(sender != null, "Sender cannot be null"); + Preconditions.checkArgument(args != null, "Arguments cannot be null"); + Preconditions.checkArgument(alias != null, "Alias cannot be null"); if (args.length == 0) { return ImmutableList.of(); diff --git a/paper-api/src/main/java/org/bukkit/command/PluginCommand.java b/paper-api/src/main/java/org/bukkit/command/PluginCommand.java index 7f153000ee..1dbbc24430 100644 --- a/paper-api/src/main/java/org/bukkit/command/PluginCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/PluginCommand.java @@ -1,7 +1,7 @@ package org.bukkit.command; +import com.google.common.base.Preconditions; import java.util.List; -import org.apache.commons.lang.Validate; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -128,9 +128,9 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo @NotNull @Override public java.util.List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws CommandException, IllegalArgumentException { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(args, "Arguments cannot be null"); - Validate.notNull(alias, "Alias cannot be null"); + Preconditions.checkArgument(sender != null, "Sender cannot be null"); + Preconditions.checkArgument(args != null, "Arguments cannot be null"); + Preconditions.checkArgument(alias != null, "Alias cannot be null"); List completions = null; try { diff --git a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java index 95bfced676..73906146e8 100644 --- a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -1,5 +1,6 @@ package org.bukkit.command; +import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -8,7 +9,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.command.defaults.BukkitCommand; @@ -181,8 +181,8 @@ public class SimpleCommandMap implements CommandMap { @Override @Nullable public List tabComplete(@NotNull CommandSender sender, @NotNull String cmdLine, @Nullable Location location) { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(cmdLine, "Command line cannot null"); + Preconditions.checkArgument(sender != null, "Sender cannot be null"); + Preconditions.checkArgument(cmdLine != null, "Command line cannot null"); int spaceIndex = cmdLine.indexOf(' '); diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/HelpCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/HelpCommand.java index 80ffb7194f..a1699aa93c 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/HelpCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/HelpCommand.java @@ -1,5 +1,7 @@ package org.bukkit.command.defaults; +import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.Arrays; @@ -8,10 +10,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; -import org.apache.commons.lang.math.NumberUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -45,10 +43,10 @@ public class HelpCommand extends BukkitCommand { if (args.length == 0) { command = ""; pageNumber = 1; - } else if (NumberUtils.isDigits(args[args.length - 1])) { - command = StringUtils.join(ArrayUtils.subarray(args, 0, args.length - 1), " "); + } else if (args[args.length - 1].chars().allMatch(Character::isDigit)) { + command = Joiner.on(" ").join(Arrays.copyOfRange(args, 0, args.length - 1)); try { - pageNumber = NumberUtils.createInteger(args[args.length - 1]); + pageNumber = Integer.decode(args[args.length - 1]); } catch (NumberFormatException exception) { pageNumber = 1; } @@ -56,7 +54,7 @@ public class HelpCommand extends BukkitCommand { pageNumber = 1; } } else { - command = StringUtils.join(args, " "); + command = Joiner.on(" ").join(args); pageNumber = 1; } @@ -114,9 +112,9 @@ public class HelpCommand extends BukkitCommand { @NotNull @Override public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(args, "Arguments cannot be null"); - Validate.notNull(alias, "Alias cannot be null"); + Preconditions.checkArgument(sender != null, "Sender cannot be null"); + Preconditions.checkArgument(args != null, "Arguments cannot be null"); + Preconditions.checkArgument(alias != null, "Alias cannot be null"); if (args.length == 1) { List matchedTopics = new ArrayList(); diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/TimingsCommand.java index cb020d681d..ed4cbce773 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/TimingsCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/TimingsCommand.java @@ -1,12 +1,12 @@ package org.bukkit.command.defaults; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -113,9 +113,9 @@ public class TimingsCommand extends BukkitCommand { @NotNull @Override public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(args, "Arguments cannot be null"); - Validate.notNull(alias, "Alias cannot be null"); + Preconditions.checkArgument(sender != null, "Sender cannot be null"); + Preconditions.checkArgument(args != null, "Arguments cannot be null"); + Preconditions.checkArgument(alias != null, "Alias cannot be null"); if (args.length == 1) { return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, new ArrayList(TIMINGS_SUBCOMMANDS.size())); diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java index 2305eb4083..04b4fb6859 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/VersionCommand.java @@ -1,6 +1,7 @@ package org.bukkit.command.defaults; import com.google.common.base.Charsets; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.io.Resources; import com.google.gson.Gson; @@ -16,7 +17,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -127,9 +127,9 @@ public class VersionCommand extends BukkitCommand { @NotNull @Override public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(args, "Arguments cannot be null"); - Validate.notNull(alias, "Alias cannot be null"); + Preconditions.checkArgument(sender != null, "Sender cannot be null"); + Preconditions.checkArgument(args != null, "Arguments cannot be null"); + Preconditions.checkArgument(alias != null, "Alias cannot be null"); if (args.length == 1) { List completions = new ArrayList(); diff --git a/paper-api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java b/paper-api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java index 47dbd5c6a4..2eef233d1e 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java +++ b/paper-api/src/main/java/org/bukkit/configuration/MemoryConfiguration.java @@ -1,7 +1,7 @@ package org.bukkit.configuration; +import com.google.common.base.Preconditions; import java.util.Map; -import org.apache.commons.lang.Validate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,7 +32,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration @Override public void addDefault(@NotNull String path, @Nullable Object value) { - Validate.notNull(path, "Path may not be null"); + Preconditions.checkArgument(path != null, "Path may not be null"); if (defaults == null) { defaults = new MemoryConfiguration(); @@ -43,7 +43,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration @Override public void addDefaults(@NotNull Map defaults) { - Validate.notNull(defaults, "Defaults may not be null"); + Preconditions.checkArgument(defaults != null, "Defaults may not be null"); for (Map.Entry entry : defaults.entrySet()) { addDefault(entry.getKey(), entry.getValue()); @@ -52,7 +52,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration @Override public void addDefaults(@NotNull Configuration defaults) { - Validate.notNull(defaults, "Defaults may not be null"); + Preconditions.checkArgument(defaults != null, "Defaults may not be null"); for (String key : defaults.getKeys(true)) { if (!defaults.isConfigurationSection(key)) { @@ -63,7 +63,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration @Override public void setDefaults(@NotNull Configuration defaults) { - Validate.notNull(defaults, "Defaults may not be null"); + Preconditions.checkArgument(defaults != null, "Defaults may not be null"); this.defaults = defaults; } diff --git a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java index 28b171984e..90751edd74 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java +++ b/paper-api/src/main/java/org/bukkit/configuration/MemorySection.java @@ -1,6 +1,8 @@ package org.bukkit.configuration; import static org.bukkit.util.NumberConversions.*; +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; @@ -8,7 +10,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.lang.Validate; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.OfflinePlayer; @@ -60,14 +61,14 @@ public class MemorySection implements ConfigurationSection { * if parent contains no root Configuration. */ protected MemorySection(@NotNull ConfigurationSection parent, @NotNull String path) { - Validate.notNull(parent, "Parent cannot be null"); - Validate.notNull(path, "Path cannot be null"); + Preconditions.checkArgument(parent != null, "Parent cannot be null"); + Preconditions.checkArgument(path != null, "Path cannot be null"); this.path = path; this.parent = parent; this.root = parent.getRoot(); - Validate.notNull(root, "Path cannot be orphaned"); + Preconditions.checkArgument(root != null, "Path cannot be orphaned"); this.fullPath = createPath(parent, path); } @@ -158,7 +159,7 @@ public class MemorySection implements ConfigurationSection { @Override public void addDefault(@NotNull String path, @Nullable Object value) { - Validate.notNull(path, "Path cannot be null"); + Preconditions.checkArgument(path != null, "Path cannot be null"); Configuration root = getRoot(); if (root == null) { @@ -187,7 +188,7 @@ public class MemorySection implements ConfigurationSection { @Override public void set(@NotNull String path, @Nullable Object value) { - Validate.notEmpty(path, "Cannot set to an empty path"); + Preconditions.checkArgument(!Strings.isNullOrEmpty(path), "Cannot set to an empty path"); Configuration root = getRoot(); if (root == null) { @@ -240,7 +241,7 @@ public class MemorySection implements ConfigurationSection { @Contract("_, !null -> !null") @Nullable public Object get(@NotNull String path, @Nullable Object def) { - Validate.notNull(path, "Path cannot be null"); + Preconditions.checkArgument(path != null, "Path cannot be null"); if (path.length() == 0) { return this; @@ -278,7 +279,7 @@ public class MemorySection implements ConfigurationSection { @Override @NotNull public ConfigurationSection createSection(@NotNull String path) { - Validate.notEmpty(path, "Cannot create section at empty path"); + Preconditions.checkArgument(!Strings.isNullOrEmpty(path), "Cannot create section at empty path"); Configuration root = getRoot(); if (root == null) { throw new IllegalStateException("Cannot create section without a root"); @@ -711,7 +712,7 @@ public class MemorySection implements ConfigurationSection { @Nullable @Override public T getObject(@NotNull String path, @NotNull Class clazz) { - Validate.notNull(clazz, "Class cannot be null"); + Preconditions.checkArgument(clazz != null, "Class cannot be null"); Object def = getDefault(path); return getObject(path, clazz, (def != null && clazz.isInstance(def)) ? clazz.cast(def) : null); } @@ -720,7 +721,7 @@ public class MemorySection implements ConfigurationSection { @Nullable @Override public T getObject(@NotNull String path, @NotNull Class clazz, @Nullable T def) { - Validate.notNull(clazz, "Class cannot be null"); + Preconditions.checkArgument(clazz != null, "Class cannot be null"); Object val = get(path, def); return (val != null && clazz.isInstance(val)) ? clazz.cast(val) : def; } @@ -855,7 +856,7 @@ public class MemorySection implements ConfigurationSection { @Nullable protected Object getDefault(@NotNull String path) { - Validate.notNull(path, "Path cannot be null"); + Preconditions.checkArgument(path != null, "Path cannot be null"); Configuration root = getRoot(); Configuration defaults = root == null ? null : root.getDefaults(); @@ -940,7 +941,7 @@ public class MemorySection implements ConfigurationSection { */ @NotNull public static String createPath(@NotNull ConfigurationSection section, @Nullable String key, @Nullable ConfigurationSection relativeTo) { - Validate.notNull(section, "Cannot create path without a section"); + Preconditions.checkArgument(section != null, "Cannot create path without a section"); Configuration root = section.getRoot(); if (root == null) { throw new IllegalStateException("Cannot create path without a root"); @@ -998,7 +999,7 @@ public class MemorySection implements ConfigurationSection { @Nullable private SectionPathData getSectionPathData(@NotNull String path) { - Validate.notNull(path, "Path cannot be null"); + Preconditions.checkArgument(path != null, "Path cannot be null"); Configuration root = getRoot(); if (root == null) { diff --git a/paper-api/src/main/java/org/bukkit/configuration/file/FileConfiguration.java b/paper-api/src/main/java/org/bukkit/configuration/file/FileConfiguration.java index 50c58f1585..70284de18d 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/file/FileConfiguration.java +++ b/paper-api/src/main/java/org/bukkit/configuration/file/FileConfiguration.java @@ -1,6 +1,7 @@ package org.bukkit.configuration.file; import com.google.common.base.Charsets; +import com.google.common.base.Preconditions; import com.google.common.io.Files; import java.io.BufferedReader; import java.io.File; @@ -12,7 +13,6 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; -import org.apache.commons.lang.Validate; import org.bukkit.configuration.Configuration; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.MemoryConfiguration; @@ -58,7 +58,7 @@ public abstract class FileConfiguration extends MemoryConfiguration { * @throws IllegalArgumentException Thrown when file is null. */ public void save(@NotNull File file) throws IOException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); Files.createParentDirs(file); @@ -89,7 +89,7 @@ public abstract class FileConfiguration extends MemoryConfiguration { * @throws IllegalArgumentException Thrown when file is null. */ public void save(@NotNull String file) throws IOException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); save(new File(file)); } @@ -121,7 +121,7 @@ public abstract class FileConfiguration extends MemoryConfiguration { * @throws IllegalArgumentException Thrown when file is null. */ public void load(@NotNull File file) throws FileNotFoundException, IOException, InvalidConfigurationException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); final FileInputStream stream = new FileInputStream(file); @@ -179,7 +179,7 @@ public abstract class FileConfiguration extends MemoryConfiguration { * @throws IllegalArgumentException Thrown when file is null. */ public void load(@NotNull String file) throws FileNotFoundException, IOException, InvalidConfigurationException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); load(new File(file)); } diff --git a/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java b/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java index f9abe6991d..21d73587e5 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java +++ b/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java @@ -1,5 +1,6 @@ package org.bukkit.configuration.file; +import com.google.common.base.Preconditions; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileNotFoundException; @@ -12,7 +13,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Level; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.configuration.Configuration; import org.bukkit.configuration.ConfigurationSection; @@ -94,7 +94,7 @@ public class YamlConfiguration extends FileConfiguration { @Override public void loadFromString(@NotNull String contents) throws InvalidConfigurationException { - Validate.notNull(contents, "String cannot be null"); + Preconditions.checkArgument(contents != null, "Contents cannot be null"); yamlLoaderOptions.setProcessComments(options().parseComments()); MappingNode node; @@ -296,7 +296,7 @@ public class YamlConfiguration extends FileConfiguration { */ @NotNull public static YamlConfiguration loadConfiguration(@NotNull File file) { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); YamlConfiguration config = new YamlConfiguration(); @@ -325,7 +325,7 @@ public class YamlConfiguration extends FileConfiguration { */ @NotNull public static YamlConfiguration loadConfiguration(@NotNull Reader reader) { - Validate.notNull(reader, "Stream cannot be null"); + Preconditions.checkArgument(reader != null, "Stream cannot be null"); YamlConfiguration config = new YamlConfiguration(); diff --git a/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java b/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java index 7d244fab46..3f7f6caf5f 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java +++ b/paper-api/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java @@ -1,7 +1,7 @@ package org.bukkit.configuration.file; +import com.google.common.base.Preconditions; import java.util.List; -import org.apache.commons.lang.Validate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -95,8 +95,8 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { */ @NotNull public YamlConfigurationOptions indent(int value) { - Validate.isTrue(value >= 2, "Indent must be at least 2 characters"); - Validate.isTrue(value <= 9, "Indent cannot be greater than 9 characters"); + Preconditions.checkArgument(value >= 2, "Indent must be at least 2 characters"); + Preconditions.checkArgument(value <= 9, "Indent cannot be greater than 9 characters"); this.indent = value; return this; diff --git a/paper-api/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java b/paper-api/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java index 8c9b4f6967..2c04706294 100644 --- a/paper-api/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java +++ b/paper-api/src/main/java/org/bukkit/configuration/serialization/ConfigurationSerialization.java @@ -1,5 +1,6 @@ package org.bukkit.configuration.serialization; +import com.google.common.base.Preconditions; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -8,7 +9,6 @@ import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import org.apache.commons.lang.Validate; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Location; @@ -115,7 +115,7 @@ public class ConfigurationSerialization { @Nullable public ConfigurationSerializable deserialize(@NotNull Map args) { - Validate.notNull(args, "Args must not be null"); + Preconditions.checkArgument(args != null, "Args must not be null"); ConfigurationSerializable result = null; Method method = null; diff --git a/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java b/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java index de60fa65f4..38ed0d4580 100644 --- a/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java +++ b/paper-api/src/main/java/org/bukkit/conversations/BooleanPrompt.java @@ -1,7 +1,8 @@ package org.bukkit.conversations; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.BooleanUtils; +import com.google.common.collect.ImmutableSet; +import java.util.Locale; +import java.util.Set; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -11,21 +12,23 @@ import org.jetbrains.annotations.Nullable; */ public abstract class BooleanPrompt extends ValidatingPrompt { + private static final Set TRUE_INPUTS = ImmutableSet.of("true", "on", "yes", "y", "1", "right", "correct", "valid"); + private static final Set FALSE_INPUTS = ImmutableSet.of("false", "off", "no", "n", "0", "wrong", "incorrect", "invalid"); + private static final Set VALID_INPUTS = ImmutableSet.builder().addAll(TRUE_INPUTS).addAll(FALSE_INPUTS).build(); + public BooleanPrompt() { super(); } @Override protected boolean isInputValid(@NotNull ConversationContext context, @NotNull String input) { - String[] accepted = {/* Apache values: */ "true", "false", "on", "off", "yes", "no", /* Additional values: */ "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"}; - return ArrayUtils.contains(accepted, input.toLowerCase()); + return VALID_INPUTS.contains(input.toLowerCase(Locale.ROOT)); } @Nullable @Override protected Prompt acceptValidatedInput(@NotNull ConversationContext context, @NotNull String input) { - if (input.equalsIgnoreCase("y") || input.equals("1") || input.equalsIgnoreCase("right") || input.equalsIgnoreCase("correct") || input.equalsIgnoreCase("valid")) input = "true"; - return acceptValidatedInput(context, BooleanUtils.toBoolean(input)); + return acceptValidatedInput(context, TRUE_INPUTS.contains(input.toLowerCase(Locale.ROOT))); } /** diff --git a/paper-api/src/main/java/org/bukkit/conversations/FixedSetPrompt.java b/paper-api/src/main/java/org/bukkit/conversations/FixedSetPrompt.java index 9bf3336fae..df92081ad2 100644 --- a/paper-api/src/main/java/org/bukkit/conversations/FixedSetPrompt.java +++ b/paper-api/src/main/java/org/bukkit/conversations/FixedSetPrompt.java @@ -1,8 +1,8 @@ package org.bukkit.conversations; +import com.google.common.base.Joiner; import java.util.Arrays; import java.util.List; -import org.apache.commons.lang.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -42,6 +42,6 @@ public abstract class FixedSetPrompt extends ValidatingPrompt { */ @NotNull protected String formatFixedSet() { - return "[" + StringUtils.join(fixedSet, ", ") + "]"; + return "[" + Joiner.on(", ").join(fixedSet) + "]"; } } diff --git a/paper-api/src/main/java/org/bukkit/conversations/NumericPrompt.java b/paper-api/src/main/java/org/bukkit/conversations/NumericPrompt.java index 5da28a3b43..67134fa384 100644 --- a/paper-api/src/main/java/org/bukkit/conversations/NumericPrompt.java +++ b/paper-api/src/main/java/org/bukkit/conversations/NumericPrompt.java @@ -1,6 +1,6 @@ package org.bukkit.conversations; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java index b833ef63fb..e2800dc97a 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -205,6 +205,11 @@ public abstract class Enchantment implements Keyed { */ public static final Enchantment SOUL_SPEED = new EnchantmentWrapper("soul_speed"); + /** + * Walk quicker while sneaking + */ + public static final Enchantment SWIFT_SNEAK = new EnchantmentWrapper("swift_sneak"); + private static final Map byKey = new HashMap(); private static final Map byName = new HashMap(); private static boolean acceptingNew = true; diff --git a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java index 76761b4b4a..8111acaa1a 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java @@ -1,6 +1,6 @@ package org.bukkit.enchantments; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; /** @@ -34,7 +34,7 @@ public class EnchantmentOffer { * @param enchantment type of the enchantment */ public void setEnchantment(@NotNull Enchantment enchantment) { - Validate.notNull(enchantment, "The enchantment may not be null!"); + Preconditions.checkArgument(enchantment != null, "The enchantment may not be null!"); this.enchantment = enchantment; } @@ -54,7 +54,7 @@ public class EnchantmentOffer { * @param enchantmentLevel level of the enchantment */ public void setEnchantmentLevel(int enchantmentLevel) { - Validate.isTrue(enchantmentLevel > 0, "The enchantment level must be greater than 0!"); + Preconditions.checkArgument(enchantmentLevel > 0, "The enchantment level must be greater than 0!"); this.enchantmentLevel = enchantmentLevel; } @@ -76,7 +76,7 @@ public class EnchantmentOffer { * @param cost cost for this enchantment */ public void setCost(int cost) { - Validate.isTrue(cost > 0, "The cost must be greater than 0!"); + Preconditions.checkArgument(cost > 0, "The cost must be greater than 0!"); this.cost = cost; } diff --git a/paper-api/src/main/java/org/bukkit/entity/Allay.java b/paper-api/src/main/java/org/bukkit/entity/Allay.java new file mode 100644 index 0000000000..608cd38cb2 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/entity/Allay.java @@ -0,0 +1,9 @@ +package org.bukkit.entity; + +import org.bukkit.inventory.InventoryHolder; + +/** + * An Allay. + */ +public interface Allay extends Creature, InventoryHolder { +} diff --git a/paper-api/src/main/java/org/bukkit/entity/ChestBoat.java b/paper-api/src/main/java/org/bukkit/entity/ChestBoat.java new file mode 100644 index 0000000000..5b5c3be107 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/entity/ChestBoat.java @@ -0,0 +1,10 @@ +package org.bukkit.entity; + +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.loot.Lootable; + +/** + * A {@link Boat} with a chest. + */ +public interface ChestBoat extends Boat, InventoryHolder, Lootable { +} diff --git a/paper-api/src/main/java/org/bukkit/entity/EntityType.java b/paper-api/src/main/java/org/bukkit/entity/EntityType.java index 9be5371c7f..e4a1dac898 100644 --- a/paper-api/src/main/java/org/bukkit/entity/EntityType.java +++ b/paper-api/src/main/java/org/bukkit/entity/EntityType.java @@ -271,6 +271,11 @@ public enum EntityType implements Keyed { GLOW_SQUID("glow_squid", GlowSquid.class, -1), GOAT("goat", Goat.class, -1), MARKER("marker", Marker.class, -1), + ALLAY("allay", Allay.class, -1), + CHEST_BOAT("chest_boat", ChestBoat.class, -1), + FROG("frog", Frog.class, -1), + TADPOLE("tadpole", Tadpole.class, -1), + WARDEN("warden", Warden.class, -1), /** * A fishing line and bobber. */ diff --git a/paper-api/src/main/java/org/bukkit/entity/Frog.java b/paper-api/src/main/java/org/bukkit/entity/Frog.java new file mode 100644 index 0000000000..0960bdbb32 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/entity/Frog.java @@ -0,0 +1,73 @@ +package org.bukkit.entity; + +import java.util.Locale; +import org.bukkit.Keyed; +import org.bukkit.NamespacedKey; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A Frog. + */ +public interface Frog extends Animals { + + /** + * Gets the tongue target of this frog. + * + * @return tongue target or null if not set + */ + @Nullable + Entity getTongueTarget(); + + /** + * Sets the tongue target of this frog. + * + * @param target tongue target or null to clear + */ + void setTongueTarget(@Nullable Entity target); + + /** + * Get the variant of this frog. + * + * @return frog variant + */ + @NotNull + Variant getVariant(); + + /** + * Set the variant of this frog. + * + * @param variant frog variant + */ + void setVariant(@NotNull Variant variant); + + /** + * Represents the variant of a frog - ie its color. + */ + public enum Variant implements Keyed { + + /** + * Temperate (brown-orange) frog. + */ + TEMPERATE, + /** + * Warm (gray) frog. + */ + WARM, + /** + * Cold (green) frog. + */ + COLD; + private final NamespacedKey key; + + private Variant() { + this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT)); + } + + @NotNull + @Override + public NamespacedKey getKey() { + return key; + } + } +} diff --git a/paper-api/src/main/java/org/bukkit/entity/Goat.java b/paper-api/src/main/java/org/bukkit/entity/Goat.java index 90e9028b5e..3a24f8cc7a 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Goat.java +++ b/paper-api/src/main/java/org/bukkit/entity/Goat.java @@ -5,6 +5,34 @@ package org.bukkit.entity; */ public interface Goat extends Animals { + /** + * Gets if this goat has its left horn. + * + * @return left horn status + */ + boolean hasLeftHorn(); + + /** + * Sets if this goat has its left horn. + * + * @param hasHorn left horn status + */ + void setLeftHorn(boolean hasHorn); + + /** + * Gets if this goat has its right horn. + * + * @return right horn status + */ + boolean hasRightHorn(); + + /** + * Sets if this goat has its right horn. + * + * @param hasHorn right horn status + */ + void setRightHorn(boolean hasHorn); + /** * Gets if this is a screaming goat. * diff --git a/paper-api/src/main/java/org/bukkit/entity/Pose.java b/paper-api/src/main/java/org/bukkit/entity/Pose.java index b236da56d5..af1acfa183 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Pose.java +++ b/paper-api/src/main/java/org/bukkit/entity/Pose.java @@ -37,5 +37,29 @@ public enum Pose { /** * Entity is dead. */ - DYING; + DYING, + /** + * Entity is croaking. + */ + CROAKING, + /** + * Entity is using its tongue. + */ + USING_TONGUE, + /** + * Entity is roaring. + */ + ROARING, + /** + * Entity is sniffing. + */ + SNIFFING, + /** + * Entity is emerging. + */ + EMERGING, + /** + * Entity is digging. + */ + DIGGING; } diff --git a/paper-api/src/main/java/org/bukkit/entity/Tadpole.java b/paper-api/src/main/java/org/bukkit/entity/Tadpole.java new file mode 100644 index 0000000000..d64979ebdd --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/entity/Tadpole.java @@ -0,0 +1,21 @@ +package org.bukkit.entity; + +/** + * A baby {@link Frog}. + */ +public interface Tadpole extends Fish { + + /** + * Gets the age of this mob. + * + * @return Age + */ + public int getAge(); + + /** + * Sets the age of this mob. + * + * @param age New age + */ + public void setAge(int age); +} diff --git a/paper-api/src/main/java/org/bukkit/entity/Warden.java b/paper-api/src/main/java/org/bukkit/entity/Warden.java new file mode 100644 index 0000000000..25bbecc89b --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/entity/Warden.java @@ -0,0 +1,38 @@ +package org.bukkit.entity; + +import org.jetbrains.annotations.NotNull; + +/** + * A Warden. + */ +public interface Warden extends Monster { + + /** + * Gets the anger level of this warden. + * + * Anger is an integer from 0 to 150. Once a Warden reaches 80 anger at a + * target it will actively pursue it. + * + * @param entity target + * @return anger level + */ + int getAnger(@NotNull Entity entity); + + /** + * Increases the anger level of this warden. + * + * @param entity target + * @param increase number to increase by + * @see #getAnger(org.bukkit.entity.Entity) + */ + void increaseAnger(@NotNull Entity entity, int increase); + + /** + * Sets the anger level of this warden. + * + * @param entity target + * @param anger new anger level + * @see #getAnger(org.bukkit.entity.Entity) + */ + void setAnger(@NotNull Entity entity, int anger); +} diff --git a/paper-api/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/paper-api/src/main/java/org/bukkit/entity/memory/MemoryKey.java index d023b6497c..147714f3a2 100644 --- a/paper-api/src/main/java/org/bukkit/entity/memory/MemoryKey.java +++ b/paper-api/src/main/java/org/bukkit/entity/memory/MemoryKey.java @@ -65,6 +65,10 @@ public final class MemoryKey implements Keyed { public static final MemoryKey LONG_JUMP_COOLING_DOWN = new MemoryKey<>(NamespacedKey.minecraft("long_jump_cooling_down"), Integer.class); public static final MemoryKey HAS_HUNTING_COOLDOWN = new MemoryKey<>(NamespacedKey.minecraft("has_hunting_cooldown"), Boolean.class); public static final MemoryKey RAM_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("ram_cooldown_ticks"), Integer.class); + public static final MemoryKey LIKED_PLAYER = new MemoryKey<>(NamespacedKey.minecraft("liked_player"), UUID.class); + public static final MemoryKey LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class); + public static final MemoryKey LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class); + public static final MemoryKey ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class); /** * Returns a {@link MemoryKey} by a {@link NamespacedKey}. diff --git a/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java b/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java index b898fdefc7..5a3e74f90c 100644 --- a/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java @@ -1,8 +1,8 @@ package org.bukkit.event.enchantment; +import com.google.common.base.Preconditions; import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; @@ -85,7 +85,7 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { * @param level - cost in levels */ public void setExpLevelCost(int level) { - Validate.isTrue(level > 0, "The cost must be greater than 0!"); + Preconditions.checkArgument(level > 0, "The cost must be greater than 0!"); this.level = level; } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EnderDragonChangePhaseEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EnderDragonChangePhaseEvent.java index 631ca54dc9..498609bb1b 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EnderDragonChangePhaseEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EnderDragonChangePhaseEvent.java @@ -1,6 +1,6 @@ package org.bukkit.event.entity; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.bukkit.entity.EnderDragon; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -56,7 +56,7 @@ public class EnderDragonChangePhaseEvent extends EntityEvent implements Cancella * @param newPhase the new dragon phase */ public void setNewPhase(@NotNull EnderDragon.Phase newPhase) { - Validate.notNull(newPhase, "New dragon phase cannot be null"); + Preconditions.checkArgument(newPhase != null, "New dragon phase cannot be null"); this.newPhase = newPhase; } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityBreedEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityBreedEvent.java index ded0693f90..4863877891 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityBreedEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityBreedEvent.java @@ -1,6 +1,6 @@ package org.bukkit.event.entity; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.bukkit.entity.LivingEntity; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -26,9 +26,9 @@ public class EntityBreedEvent extends EntityEvent implements Cancellable { public EntityBreedEvent(@NotNull LivingEntity child, @NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable LivingEntity breeder, @Nullable ItemStack bredWith, int experience) { super(child); - Validate.notNull(child, "Cannot have null child"); - Validate.notNull(mother, "Cannot have null mother"); - Validate.notNull(father, "Cannot have null father"); + Preconditions.checkArgument(child != null, "Cannot have null child"); + Preconditions.checkArgument(mother != null, "Cannot have null mother"); + Preconditions.checkArgument(father != null, "Cannot have null father"); // Breeder can be null in the case of spontaneous conception this.mother = mother; @@ -101,7 +101,7 @@ public class EntityBreedEvent extends EntityEvent implements Cancellable { * @param experience experience amount */ public void setExperience(int experience) { - Validate.isTrue(experience >= 0, "Experience cannot be negative"); + Preconditions.checkArgument(experience >= 0, "Experience cannot be negative"); this.experience = experience; } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java index 07538e1b94..8c9a8cac42 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java @@ -2,10 +2,11 @@ package org.bukkit.event.entity; import com.google.common.base.Function; import com.google.common.base.Functions; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import java.util.EnumMap; import java.util.Map; -import org.apache.commons.lang.Validate; +import java.util.Objects; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -32,11 +33,11 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { public EntityDamageEvent(@NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { super(damagee); - Validate.isTrue(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing"); - Validate.isTrue(!modifiers.containsKey(null), "Cannot have null DamageModifier"); - Validate.noNullElements(modifiers.values(), "Cannot have null modifier values"); - Validate.isTrue(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier"); - Validate.noNullElements(modifierFunctions.values(), "Cannot have null modifier function"); + Preconditions.checkArgument(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing"); + Preconditions.checkArgument(!modifiers.containsKey(null), "Cannot have null DamageModifier"); + Preconditions.checkArgument(modifiers.values().stream().allMatch(Objects::nonNull), "Cannot have null modifier values"); + Preconditions.checkArgument(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier"); + Preconditions.checkArgument(modifierFunctions.values().stream().allMatch(Objects::nonNull), "Cannot have null modifier function"); this.originals = new EnumMap(modifiers); this.cause = cause; this.modifiers = modifiers; @@ -99,7 +100,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { * @see DamageModifier#BASE */ public double getDamage(@NotNull DamageModifier type) throws IllegalArgumentException { - Validate.notNull(type, "Cannot have null DamageModifier"); + Preconditions.checkArgument(type != null, "Cannot have null DamageModifier"); final Double damage = modifiers.get(type); return damage == null ? 0 : damage; } @@ -116,7 +117,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable { * @throws IllegalArgumentException if type is null */ public boolean isApplicable(@NotNull DamageModifier type) throws IllegalArgumentException { - Validate.notNull(type, "Cannot have null DamageModifier"); + Preconditions.checkArgument(type != null, "Cannot have null DamageModifier"); return modifiers.containsKey(type); } diff --git a/paper-api/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java index 90d7e8141a..80f31a267e 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java @@ -1,9 +1,9 @@ package org.bukkit.event.entity; +import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.Collection; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.ThrownPotion; import org.bukkit.event.Cancellable; @@ -70,7 +70,7 @@ public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable * @param intensity relative to maximum effect */ public void setIntensity(@NotNull LivingEntity entity, double intensity) { - Validate.notNull(entity, "You must specify a valid entity."); + Preconditions.checkArgument(entity != null, "You must specify a valid entity."); if (intensity <= 0.0) { affectedEntities.remove(entity); } else { diff --git a/paper-api/src/main/java/org/bukkit/event/inventory/InventoryDragEvent.java b/paper-api/src/main/java/org/bukkit/event/inventory/InventoryDragEvent.java index 856e945c51..da37e0ddf9 100644 --- a/paper-api/src/main/java/org/bukkit/event/inventory/InventoryDragEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/inventory/InventoryDragEvent.java @@ -1,10 +1,10 @@ package org.bukkit.event.inventory; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import java.util.Collections; import java.util.Map; import java.util.Set; -import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; @@ -65,8 +65,8 @@ public class InventoryDragEvent extends InventoryInteractEvent { public InventoryDragEvent(@NotNull InventoryView what, @Nullable ItemStack newCursor, @NotNull ItemStack oldCursor, boolean right, @NotNull Map slots) { super(what); - Validate.notNull(oldCursor); - Validate.notNull(slots); + Preconditions.checkArgument(oldCursor != null); + Preconditions.checkArgument(slots != null); type = right ? DragType.SINGLE : DragType.EVEN; this.newCursor = newCursor; diff --git a/paper-api/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java b/paper-api/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java index a8c48f5a41..919cc993e3 100644 --- a/paper-api/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java @@ -1,6 +1,6 @@ package org.bukkit.event.inventory; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; @@ -33,7 +33,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable { private final boolean didSourceInitiate; public InventoryMoveItemEvent(@NotNull final Inventory sourceInventory, @NotNull final ItemStack itemStack, @NotNull final Inventory destinationInventory, final boolean didSourceInitiate) { - Validate.notNull(itemStack, "ItemStack cannot be null"); + Preconditions.checkArgument(itemStack != null, "ItemStack cannot be null"); this.sourceInventory = sourceInventory; this.itemStack = itemStack; this.destinationInventory = destinationInventory; @@ -69,7 +69,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable { * @param itemStack The ItemStack */ public void setItem(@NotNull ItemStack itemStack) { - Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred."); + Preconditions.checkArgument(itemStack != null, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred."); this.itemStack = itemStack.clone(); } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java index 8ea56aac75..a1f4261eaa 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerChatEvent.java @@ -1,8 +1,8 @@ package org.bukkit.event.player; +import com.google.common.base.Preconditions; import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.Validate; import org.bukkit.Warning; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -78,7 +78,7 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable { * @param player New player which this event will execute as */ public void setPlayer(@NotNull final Player player) { - Validate.notNull(player, "Player cannot be null"); + Preconditions.checkArgument(player != null, "Player cannot be null"); this.player = player; } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerChatTabCompleteEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerChatTabCompleteEvent.java index 0b99c7fb22..93191b7e32 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerChatTabCompleteEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerChatTabCompleteEvent.java @@ -1,7 +1,7 @@ package org.bukkit.event.player; +import com.google.common.base.Preconditions; import java.util.Collection; -import org.apache.commons.lang.Validate; import org.bukkit.Warning; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; @@ -22,8 +22,8 @@ public class PlayerChatTabCompleteEvent extends PlayerEvent { public PlayerChatTabCompleteEvent(@NotNull final Player who, @NotNull final String message, @NotNull final Collection completions) { super(who); - Validate.notNull(message, "Message cannot be null"); - Validate.notNull(completions, "Completions cannot be null"); + Preconditions.checkArgument(message != null, "Message cannot be null"); + Preconditions.checkArgument(completions != null, "Completions cannot be null"); this.message = message; int i = message.lastIndexOf(' '); if (i < 0) { diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java index 35614db423..48a00fb50f 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java @@ -1,8 +1,8 @@ package org.bukkit.event.player; +import com.google.common.base.Preconditions; import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.Validate; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -96,8 +96,8 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell * @throws IllegalArgumentException if command is null or empty */ public void setMessage(@NotNull String command) throws IllegalArgumentException { - Validate.notNull(command, "Command cannot be null"); - Validate.notEmpty(command, "Command cannot be empty"); + Preconditions.checkArgument(command != null, "Command cannot be null"); + Preconditions.checkArgument(!command.isEmpty(), "Command cannot be empty"); this.message = command; } @@ -108,7 +108,7 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell * @throws IllegalArgumentException if the player provided is null */ public void setPlayer(@NotNull final Player player) throws IllegalArgumentException { - Validate.notNull(player, "Player cannot be null"); + Preconditions.checkArgument(player != null, "Player cannot be null"); this.player = player; } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerEditBookEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerEditBookEvent.java index c8fda418bd..8c5f1f5892 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerEditBookEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerEditBookEvent.java @@ -1,6 +1,6 @@ package org.bukkit.event.player; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -24,9 +24,9 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable { public PlayerEditBookEvent(@NotNull Player who, int slot, @NotNull BookMeta previousBookMeta, @NotNull BookMeta newBookMeta, boolean isSigning) { super(who); - Validate.isTrue(slot >= -1 && slot <= 8, "Slot must be in range (-1)-8 inclusive"); - Validate.notNull(previousBookMeta, "Previous book meta must not be null"); - Validate.notNull(newBookMeta, "New book meta must not be null"); + Preconditions.checkArgument(slot >= -1 && slot <= 8, "Slot must be in range (-1)-8 inclusive"); + Preconditions.checkArgument(previousBookMeta != null, "Previous book meta must not be null"); + Preconditions.checkArgument(newBookMeta != null, "New book meta must not be null"); Bukkit.getItemFactory().equals(previousBookMeta, newBookMeta); @@ -86,7 +86,7 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable { * @throws IllegalArgumentException if the new book meta is null */ public void setNewBookMeta(@NotNull BookMeta newBookMeta) throws IllegalArgumentException { - Validate.notNull(newBookMeta, "New book meta must not be null"); + Preconditions.checkArgument(newBookMeta != null, "New book meta must not be null"); Bukkit.getItemFactory().equals(newBookMeta, null); this.newBookMeta = newBookMeta.clone(); } diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java index d2be2ad2e3..7c2cec60cb 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java @@ -1,6 +1,6 @@ package org.bukkit.event.player; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; @@ -43,8 +43,8 @@ public class PlayerRespawnEvent extends PlayerEvent { * @param respawnLocation new location for the respawn */ public void setRespawnLocation(@NotNull Location respawnLocation) { - Validate.notNull(respawnLocation, "Respawn location can not be null"); - Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null"); + Preconditions.checkArgument(respawnLocation != null, "Respawn location can not be null"); + Preconditions.checkArgument(respawnLocation.getWorld() != null, "Respawn world can not be null"); this.respawnLocation = respawnLocation; } diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java index cc5e2fef75..b9abfdc61f 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java @@ -1,8 +1,8 @@ package org.bukkit.event.server; +import com.google.common.base.Preconditions; import java.net.InetAddress; import java.util.Iterator; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.UndefinedNullability; import org.bukkit.entity.Player; @@ -27,7 +27,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) { super(true); - Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); + Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); this.address = address; this.motd = motd; this.numPlayers = numPlayers; diff --git a/paper-api/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/paper-api/src/main/java/org/bukkit/event/server/TabCompleteEvent.java index d1a9956a15..270e6d8ad4 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/TabCompleteEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/TabCompleteEvent.java @@ -1,7 +1,7 @@ package org.bukkit.event.server; +import com.google.common.base.Preconditions; import java.util.List; -import org.apache.commons.lang.Validate; import org.bukkit.command.CommandSender; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; @@ -29,9 +29,9 @@ public class TabCompleteEvent extends Event implements Cancellable { private boolean cancelled; public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List completions) { - Validate.notNull(sender, "sender"); - Validate.notNull(buffer, "buffer"); - Validate.notNull(completions, "completions"); + Preconditions.checkArgument(sender != null, "sender"); + Preconditions.checkArgument(buffer != null, "buffer"); + Preconditions.checkArgument(completions != null, "completions"); this.sender = sender; this.buffer = buffer; @@ -75,7 +75,7 @@ public class TabCompleteEvent extends Event implements Cancellable { * @param completions the new completions */ public void setCompletions(@NotNull List completions) { - Validate.notNull(completions); + Preconditions.checkArgument(completions != null); this.completions = completions; } diff --git a/paper-api/src/main/java/org/bukkit/event/world/GenericGameEvent.java b/paper-api/src/main/java/org/bukkit/event/world/GenericGameEvent.java index 1746b66510..2a2a329877 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/GenericGameEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/GenericGameEvent.java @@ -24,8 +24,8 @@ public class GenericGameEvent extends WorldEvent implements Cancellable { private int radius; private boolean cancelled; - public GenericGameEvent(@NotNull GameEvent event, @NotNull Location location, @Nullable Entity entity, int radius) { - super(location.getWorld()); + public GenericGameEvent(@NotNull GameEvent event, @NotNull Location location, @Nullable Entity entity, int radius, boolean isAsync) { + super(location.getWorld(), isAsync); this.event = event; this.location = location; this.entity = entity; diff --git a/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java b/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java index cffeff33f0..6d58b4adb6 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/WorldEvent.java @@ -11,6 +11,11 @@ public abstract class WorldEvent extends Event { private final World world; public WorldEvent(@NotNull final World world) { + this(world, false); + } + + public WorldEvent(@NotNull World world, boolean isAsync) { + super(isAsync); this.world = world; } diff --git a/paper-api/src/main/java/org/bukkit/help/GenericCommandHelpTopic.java b/paper-api/src/main/java/org/bukkit/help/GenericCommandHelpTopic.java index 1d862c23d4..8d0196a064 100644 --- a/paper-api/src/main/java/org/bukkit/help/GenericCommandHelpTopic.java +++ b/paper-api/src/main/java/org/bukkit/help/GenericCommandHelpTopic.java @@ -1,6 +1,6 @@ package org.bukkit.help; -import org.apache.commons.lang.StringUtils; +import com.google.common.base.Joiner; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -54,7 +54,7 @@ public class GenericCommandHelpTopic extends HelpTopic { sb.append(ChatColor.GOLD); sb.append("Aliases: "); sb.append(ChatColor.WHITE); - sb.append(ChatColor.WHITE + StringUtils.join(command.getAliases(), ", ")); + sb.append(Joiner.on(", ").join(command.getAliases())); } fullText = sb.toString(); } diff --git a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java index f70a6a22b8..7b904dd2c0 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ItemStack.java @@ -1,9 +1,9 @@ package org.bukkit.inventory; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import java.util.LinkedHashMap; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Utility; @@ -79,7 +79,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { */ @Deprecated public ItemStack(@NotNull final Material type, final int amount, final short damage, @Nullable final Byte data) { - Validate.notNull(type, "Material cannot be null"); + Preconditions.checkArgument(type != null, "Material cannot be null"); this.type = type; this.amount = amount; if (damage != 0) { @@ -98,7 +98,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { * returns an item meta not created by the item factory */ public ItemStack(@NotNull final ItemStack stack) throws IllegalArgumentException { - Validate.notNull(stack, "Cannot copy null stack"); + Preconditions.checkArgument(stack != null, "Cannot copy null stack"); this.type = stack.getType(); this.amount = stack.getAmount(); if (this.type.isLegacy()) { @@ -133,7 +133,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { */ @Utility public void setType(@NotNull Material type) { - Validate.notNull(type, "Material cannot be null"); + Preconditions.checkArgument(type != null, "Material cannot be null"); this.type = type; if (this.meta != null) { this.meta = Bukkit.getItemFactory().asMetaFor(meta, type); @@ -368,7 +368,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { */ @Utility public void addEnchantments(@NotNull Map enchantments) { - Validate.notNull(enchantments, "Enchantments cannot be null"); + Preconditions.checkArgument(enchantments != null, "Enchantments cannot be null"); for (Map.Entry entry : enchantments.entrySet()) { addEnchantment(entry.getKey(), entry.getValue()); } @@ -387,7 +387,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable { */ @Utility public void addEnchantment(@NotNull Enchantment ench, int level) { - Validate.notNull(ench, "Enchantment cannot be null"); + Preconditions.checkArgument(ench != null, "Enchantment cannot be null"); if ((level < ench.getStartLevel()) || (level > ench.getMaxLevel())) { throw new IllegalArgumentException("Enchantment level is either too low or too high (given " + level + ", bounds are " + ench.getStartLevel() + " to " + ench.getMaxLevel() + ")"); } else if (!ench.canEnchantItem(this)) { diff --git a/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java index d74b3114f5..fde34da0f7 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ShapedRecipe.java @@ -4,7 +4,6 @@ import com.google.common.base.Preconditions; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.Keyed; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -61,15 +60,15 @@ public class ShapedRecipe implements Recipe, Keyed { */ @NotNull public ShapedRecipe shape(@NotNull final String... shape) { - Validate.notNull(shape, "Must provide a shape"); - Validate.isTrue(shape.length > 0 && shape.length < 4, "Crafting recipes should be 1, 2 or 3 rows, not ", shape.length); + Preconditions.checkArgument(shape != null, "Must provide a shape"); + Preconditions.checkArgument(shape.length > 0 && shape.length < 4, "Crafting recipes should be 1, 2 or 3 rows, not ", shape.length); int lastLen = -1; for (String row : shape) { - Validate.notNull(row, "Shape cannot have null rows"); - Validate.isTrue(row.length() > 0 && row.length() < 4, "Crafting rows should be 1, 2, or 3 characters, not ", row.length()); + Preconditions.checkArgument(row != null, "Shape cannot have null rows"); + Preconditions.checkArgument(row.length() > 0 && row.length() < 4, "Crafting rows should be 1, 2, or 3 characters, not ", row.length()); - Validate.isTrue(lastLen == -1 || lastLen == row.length(), "Crafting recipes must be rectangular"); + Preconditions.checkArgument(lastLen == -1 || lastLen == row.length(), "Crafting recipes must be rectangular"); lastLen = row.length(); } this.rows = new String[shape.length]; @@ -125,7 +124,7 @@ public class ShapedRecipe implements Recipe, Keyed { @Deprecated @NotNull public ShapedRecipe setIngredient(char key, @NotNull Material ingredient, int raw) { - Validate.isTrue(ingredients.containsKey(key), "Symbol does not appear in the shape:", key); + Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key); // -1 is the old wildcard, map to Short.MAX_VALUE as the new one if (raw == -1) { @@ -138,7 +137,7 @@ public class ShapedRecipe implements Recipe, Keyed { @NotNull public ShapedRecipe setIngredient(char key, @NotNull RecipeChoice ingredient) { - Validate.isTrue(ingredients.containsKey(key), "Symbol does not appear in the shape:", key); + Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key); ingredients.put(key, ingredient); return this; diff --git a/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java index 68447fb8c1..cc3f7cccfa 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ShapelessRecipe.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; -import org.apache.commons.lang.Validate; import org.bukkit.Keyed; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -121,7 +120,7 @@ public class ShapelessRecipe implements Recipe, Keyed { @Deprecated @NotNull public ShapelessRecipe addIngredient(int count, @NotNull Material ingredient, int rawdata) { - Validate.isTrue(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); + Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); // -1 is the old wildcard, map to Short.MAX_VALUE as the new one if (rawdata == -1) { @@ -136,7 +135,7 @@ public class ShapelessRecipe implements Recipe, Keyed { @NotNull public ShapelessRecipe addIngredient(@NotNull RecipeChoice ingredient) { - Validate.isTrue(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients"); + Preconditions.checkArgument(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients"); ingredients.add(ingredient); return this; diff --git a/paper-api/src/main/java/org/bukkit/loot/LootContext.java b/paper-api/src/main/java/org/bukkit/loot/LootContext.java index e307f9fc45..71b7aa9d67 100644 --- a/paper-api/src/main/java/org/bukkit/loot/LootContext.java +++ b/paper-api/src/main/java/org/bukkit/loot/LootContext.java @@ -1,6 +1,6 @@ package org.bukkit.loot; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.HumanEntity; @@ -22,8 +22,8 @@ public final class LootContext { private final HumanEntity killer; private LootContext(@NotNull Location location, float luck, int lootingModifier, @Nullable Entity lootedEntity, @Nullable HumanEntity killer) { - Validate.notNull(location, "LootContext location cannot be null"); - Validate.notNull(location.getWorld(), "LootContext World cannot be null"); + Preconditions.checkArgument(location != null, "LootContext location cannot be null"); + Preconditions.checkArgument(location.getWorld() != null, "LootContext World cannot be null"); this.location = location; this.luck = luck; this.lootingModifier = lootingModifier; diff --git a/paper-api/src/main/java/org/bukkit/loot/LootTables.java b/paper-api/src/main/java/org/bukkit/loot/LootTables.java index 036da4056d..b76a5b28ac 100644 --- a/paper-api/src/main/java/org/bukkit/loot/LootTables.java +++ b/paper-api/src/main/java/org/bukkit/loot/LootTables.java @@ -30,6 +30,8 @@ public enum LootTables implements Keyed { BASTION_OTHER("chests/bastion_other"), BASTION_BRIDGE("chests/bastion_bridge"), BASTION_HOGLIN_STABLE("chests/bastion_hoglin_stable"), + ANCIENT_CITY("chests/ancient_city"), + ANCIENT_CITY_ICE_BOX("chests/ancient_city_ice_box"), RUINED_PORTAL("chests/ruined_portal"), SHIPWRECK_MAP("chests/shipwreck_map"), SHIPWRECK_SUPPLY("chests/shipwreck_supply"), diff --git a/paper-api/src/main/java/org/bukkit/material/Mushroom.java b/paper-api/src/main/java/org/bukkit/material/Mushroom.java index 543b76c8a6..8927b307ad 100644 --- a/paper-api/src/main/java/org/bukkit/material/Mushroom.java +++ b/paper-api/src/main/java/org/bukkit/material/Mushroom.java @@ -1,8 +1,8 @@ package org.bukkit.material; +import com.google.common.base.Preconditions; import java.util.EnumSet; import java.util.Set; -import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.material.types.MushroomBlockTexture; @@ -37,7 +37,7 @@ public class Mushroom extends MaterialData { */ public Mushroom(Material shroom) { super(shroom); - Validate.isTrue(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!"); + Preconditions.checkArgument(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!"); } /** @@ -82,7 +82,7 @@ public class Mushroom extends MaterialData { @Deprecated public Mushroom(Material shroom, byte data) { super(shroom, data); - Validate.isTrue(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!"); + Preconditions.checkArgument(shroom == Material.LEGACY_HUGE_MUSHROOM_1 || shroom == Material.LEGACY_HUGE_MUSHROOM_2, "Not a mushroom!"); } /** diff --git a/paper-api/src/main/java/org/bukkit/metadata/LazyMetadataValue.java b/paper-api/src/main/java/org/bukkit/metadata/LazyMetadataValue.java index 86e0e3767e..12ba7489fa 100644 --- a/paper-api/src/main/java/org/bukkit/metadata/LazyMetadataValue.java +++ b/paper-api/src/main/java/org/bukkit/metadata/LazyMetadataValue.java @@ -1,8 +1,8 @@ package org.bukkit.metadata; +import com.google.common.base.Preconditions; import java.lang.ref.SoftReference; import java.util.concurrent.Callable; -import org.apache.commons.lang.Validate; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,8 +47,8 @@ public class LazyMetadataValue extends MetadataValueAdapter { */ public LazyMetadataValue(@NotNull Plugin owningPlugin, @NotNull CacheStrategy cacheStrategy, @NotNull Callable lazyValue) { super(owningPlugin); - Validate.notNull(cacheStrategy, "cacheStrategy cannot be null"); - Validate.notNull(lazyValue, "lazyValue cannot be null"); + Preconditions.checkArgument(cacheStrategy != null, "cacheStrategy cannot be null"); + Preconditions.checkArgument(lazyValue != null, "lazyValue cannot be null"); this.internalValue = new SoftReference(null); this.lazyValue = lazyValue; this.cacheStrategy = cacheStrategy; diff --git a/paper-api/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/paper-api/src/main/java/org/bukkit/metadata/MetadataStoreBase.java index baf850226a..6886a7003f 100644 --- a/paper-api/src/main/java/org/bukkit/metadata/MetadataStoreBase.java +++ b/paper-api/src/main/java/org/bukkit/metadata/MetadataStoreBase.java @@ -1,5 +1,6 @@ package org.bukkit.metadata; +import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -7,7 +8,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; -import org.apache.commons.lang.Validate; import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; @@ -37,9 +37,9 @@ public abstract class MetadataStoreBase { * @see MetadataStore#setMetadata(Object, String, MetadataValue) */ public synchronized void setMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) { - Validate.notNull(newMetadataValue, "Value cannot be null"); + Preconditions.checkArgument(newMetadataValue != null, "Value cannot be null"); Plugin owningPlugin = newMetadataValue.getOwningPlugin(); - Validate.notNull(owningPlugin, "Plugin cannot be null"); + Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null"); String key = disambiguate(subject, metadataKey); Map entry = metadataMap.get(key); if (entry == null) { @@ -95,7 +95,7 @@ public abstract class MetadataStoreBase { * org.bukkit.plugin.Plugin) */ public synchronized void removeMetadata(@NotNull T subject, @NotNull String metadataKey, @NotNull Plugin owningPlugin) { - Validate.notNull(owningPlugin, "Plugin cannot be null"); + Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null"); String key = disambiguate(subject, metadataKey); Map entry = metadataMap.get(key); if (entry == null) { @@ -118,7 +118,7 @@ public abstract class MetadataStoreBase { * @see MetadataStore#invalidateAll(org.bukkit.plugin.Plugin) */ public synchronized void invalidateAll(@NotNull Plugin owningPlugin) { - Validate.notNull(owningPlugin, "Plugin cannot be null"); + Preconditions.checkArgument(owningPlugin != null, "Plugin cannot be null"); for (Map values : metadataMap.values()) { if (values.containsKey(owningPlugin)) { values.get(owningPlugin).invalidate(); diff --git a/paper-api/src/main/java/org/bukkit/metadata/MetadataValueAdapter.java b/paper-api/src/main/java/org/bukkit/metadata/MetadataValueAdapter.java index b90d09f57b..162aedc984 100644 --- a/paper-api/src/main/java/org/bukkit/metadata/MetadataValueAdapter.java +++ b/paper-api/src/main/java/org/bukkit/metadata/MetadataValueAdapter.java @@ -1,7 +1,7 @@ package org.bukkit.metadata; +import com.google.common.base.Preconditions; import java.lang.ref.WeakReference; -import org.apache.commons.lang.Validate; import org.bukkit.plugin.Plugin; import org.bukkit.util.NumberConversions; import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ public abstract class MetadataValueAdapter implements MetadataValue { protected final WeakReference owningPlugin; protected MetadataValueAdapter(@NotNull Plugin owningPlugin) { - Validate.notNull(owningPlugin, "owningPlugin cannot be null"); + Preconditions.checkArgument(owningPlugin != null, "owningPlugin cannot be null"); this.owningPlugin = new WeakReference(owningPlugin); } diff --git a/paper-api/src/main/java/org/bukkit/permissions/Permission.java b/paper-api/src/main/java/org/bukkit/permissions/Permission.java index 6a14a22b7c..894f07b91d 100644 --- a/paper-api/src/main/java/org/bukkit/permissions/Permission.java +++ b/paper-api/src/main/java/org/bukkit/permissions/Permission.java @@ -1,12 +1,12 @@ package org.bukkit.permissions; +import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; -import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.plugin.PluginManager; import org.jetbrains.annotations.NotNull; @@ -53,7 +53,7 @@ public class Permission { } public Permission(@NotNull String name, @Nullable String description, @Nullable PermissionDefault defaultValue, @Nullable Map children) { - Validate.notNull(name, "Name cannot be null"); + Preconditions.checkArgument(name != null, "Name cannot be null"); this.name = name; this.description = (description == null) ? "" : description; @@ -288,8 +288,8 @@ public class Permission { */ @NotNull public static Permission loadPermission(@NotNull String name, @NotNull Map data, @Nullable PermissionDefault def, @Nullable List output) { - Validate.notNull(name, "Name cannot be null"); - Validate.notNull(data, "Data cannot be null"); + Preconditions.checkArgument(name != null, "Name cannot be null"); + Preconditions.checkArgument(data != null, "Data cannot be null"); String desc = null; Map children = null; diff --git a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java index 95f4a4d3b5..5bec3c948b 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/paper-api/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -23,7 +23,6 @@ import java.util.WeakHashMap; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang.Validate; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.command.Command; @@ -111,8 +110,8 @@ public final class SimplePluginManager implements PluginManager { @Override @NotNull public Plugin[] loadPlugins(@NotNull File directory) { - Validate.notNull(directory, "Directory cannot be null"); - Validate.isTrue(directory.isDirectory(), "Directory must be a directory"); + Preconditions.checkArgument(directory != null, "Directory cannot be null"); + Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory"); List result = new ArrayList(); Set filters = fileAssociations.keySet(); @@ -376,7 +375,7 @@ public final class SimplePluginManager implements PluginManager { @Override @Nullable public synchronized Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); checkUpdate(file); @@ -636,10 +635,10 @@ public final class SimplePluginManager implements PluginManager { */ @Override public void registerEvent(@NotNull Class event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) { - Validate.notNull(listener, "Listener cannot be null"); - Validate.notNull(priority, "Priority cannot be null"); - Validate.notNull(executor, "Executor cannot be null"); - Validate.notNull(plugin, "Plugin cannot be null"); + Preconditions.checkArgument(listener != null, "Listener cannot be null"); + Preconditions.checkArgument(priority != null, "Priority cannot be null"); + Preconditions.checkArgument(executor != null, "Executor cannot be null"); + Preconditions.checkArgument(plugin != null, "Plugin cannot be null"); if (!plugin.isEnabled()) { throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java index 50a4794889..669a70faa9 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java @@ -1,6 +1,7 @@ package org.bukkit.plugin.java; import com.google.common.base.Charsets; +import com.google.common.base.Preconditions; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -13,7 +14,6 @@ import java.net.URLConnection; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import org.apache.commons.lang.Validate; import org.bukkit.Server; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -389,7 +389,7 @@ public abstract class JavaPlugin extends PluginBase { */ @NotNull public static T getPlugin(@NotNull Class clazz) { - Validate.notNull(clazz, "Null class cannot have a plugin"); + Preconditions.checkArgument(clazz != null, "Null class cannot have a plugin"); if (!JavaPlugin.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException(clazz + " does not extend " + JavaPlugin.class); } @@ -418,7 +418,7 @@ public abstract class JavaPlugin extends PluginBase { */ @NotNull public static JavaPlugin getProvidingPlugin(@NotNull Class clazz) { - Validate.notNull(clazz, "Null class cannot have a plugin"); + Preconditions.checkArgument(clazz != null, "Null class cannot have a plugin"); final ClassLoader cl = clazz.getClassLoader(); if (!(cl instanceof PluginClassLoader)) { throw new IllegalArgumentException(clazz + " is not provided by " + PluginClassLoader.class); diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 390abd5115..39b991ff7e 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -1,5 +1,6 @@ package org.bukkit.plugin.java; +import com.google.common.base.Preconditions; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -18,7 +19,6 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.logging.Level; import java.util.regex.Pattern; -import org.apache.commons.lang.Validate; import org.bukkit.Server; import org.bukkit.Warning; import org.bukkit.Warning.WarningState; @@ -61,7 +61,7 @@ public final class JavaPluginLoader implements PluginLoader { */ @Deprecated public JavaPluginLoader(@NotNull Server instance) { - Validate.notNull(instance, "Server cannot be null"); + Preconditions.checkArgument(instance != null, "Server cannot be null"); server = instance; LibraryLoader libraryLoader = null; @@ -77,7 +77,7 @@ public final class JavaPluginLoader implements PluginLoader { @Override @NotNull public Plugin loadPlugin(@NotNull final File file) throws InvalidPluginException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); if (!file.exists()) { throw new InvalidPluginException(new FileNotFoundException(file.getPath() + " does not exist")); @@ -155,7 +155,7 @@ public final class JavaPluginLoader implements PluginLoader { @Override @NotNull public PluginDescriptionFile getPluginDescription(@NotNull File file) throws InvalidDescriptionException { - Validate.notNull(file, "File cannot be null"); + Preconditions.checkArgument(file != null, "File cannot be null"); JarFile jar = null; InputStream stream = null; @@ -226,8 +226,8 @@ public final class JavaPluginLoader implements PluginLoader { @Override @NotNull public Map, Set> createRegisteredListeners(@NotNull Listener listener, @NotNull final Plugin plugin) { - Validate.notNull(plugin, "Plugin can not be null"); - Validate.notNull(listener, "Listener can not be null"); + Preconditions.checkArgument(plugin != null, "Plugin can not be null"); + Preconditions.checkArgument(listener != null, "Listener can not be null"); boolean useTimings = server.getPluginManager().useTimings(); Map, Set> ret = new HashMap, Set>(); @@ -316,7 +316,7 @@ public final class JavaPluginLoader implements PluginLoader { @Override public void enablePlugin(@NotNull final Plugin plugin) { - Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); + Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (!plugin.isEnabled()) { plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName()); @@ -344,7 +344,7 @@ public final class JavaPluginLoader implements PluginLoader { @Override public void disablePlugin(@NotNull Plugin plugin) { - Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); + Preconditions.checkArgument(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader"); if (plugin.isEnabled()) { String message = String.format("Disabling %s", plugin.getDescription().getFullName()); diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 930f3fe08c..2f74ec96ec 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -1,5 +1,6 @@ package org.bukkit.plugin.java; +import com.google.common.base.Preconditions; import com.google.common.io.ByteStreams; import java.io.File; import java.io.IOException; @@ -19,7 +20,6 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.logging.Level; -import org.apache.commons.lang.Validate; import org.bukkit.plugin.InvalidPluginException; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.SimplePluginManager; @@ -50,7 +50,7 @@ final class PluginClassLoader extends URLClassLoader { PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException { super(new URL[] {file.toURI().toURL()}, parent); - Validate.notNull(loader, "Loader cannot be null"); + Preconditions.checkArgument(loader != null, "Loader cannot be null"); this.loader = loader; this.description = description; @@ -219,8 +219,8 @@ final class PluginClassLoader extends URLClassLoader { } synchronized void initialize(@NotNull JavaPlugin javaPlugin) { - Validate.notNull(javaPlugin, "Initializing plugin cannot be null"); - Validate.isTrue(javaPlugin.getClass().getClassLoader() == this, "Cannot initialize plugin outside of this class loader"); + Preconditions.checkArgument(javaPlugin != null, "Initializing plugin cannot be null"); + Preconditions.checkArgument(javaPlugin.getClass().getClassLoader() == this, "Cannot initialize plugin outside of this class loader"); if (this.plugin != null || this.pluginInit != null) { throw new IllegalArgumentException("Plugin already initialized!", pluginState); } diff --git a/paper-api/src/main/java/org/bukkit/potion/Potion.java b/paper-api/src/main/java/org/bukkit/potion/Potion.java index 2184c8620c..266547c6da 100644 --- a/paper-api/src/main/java/org/bukkit/potion/Potion.java +++ b/paper-api/src/main/java/org/bukkit/potion/Potion.java @@ -1,7 +1,7 @@ package org.bukkit.potion; +import com.google.common.base.Preconditions; import java.util.Collection; -import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.inventory.ItemStack; @@ -28,7 +28,7 @@ public class Potion { * @param type The potion type */ public Potion(@NotNull PotionType type) { - Validate.notNull(type, "Null PotionType"); + Preconditions.checkArgument(type != null, "Null PotionType"); this.type = type; } @@ -40,8 +40,8 @@ public class Potion { */ public Potion(@NotNull PotionType type, int level) { this(type); - Validate.notNull(type, "Type cannot be null"); - Validate.isTrue(level > 0 && level < 3, "Level must be 1 or 2"); + Preconditions.checkArgument(type != null, "Type cannot be null"); + Preconditions.checkArgument(level > 0 && level < 3, "Level must be 1 or 2"); this.level = level; } @@ -105,9 +105,9 @@ public class Potion { * @param to The itemstack to apply to */ public void apply(@NotNull ItemStack to) { - Validate.notNull(to, "itemstack cannot be null"); - Validate.isTrue(to.hasItemMeta(), "given itemstack is not a potion"); - Validate.isTrue(to.getItemMeta() instanceof PotionMeta, "given itemstack is not a potion"); + Preconditions.checkArgument(to != null, "itemstack cannot be null"); + Preconditions.checkArgument(to.hasItemMeta(), "given itemstack is not a potion"); + Preconditions.checkArgument(to.getItemMeta() instanceof PotionMeta, "given itemstack is not a potion"); PotionMeta meta = (PotionMeta) to.getItemMeta(); meta.setBasePotionData(new PotionData(type, extended, level == 2)); to.setItemMeta(meta); @@ -121,7 +121,7 @@ public class Potion { * @see LivingEntity#addPotionEffects(Collection) */ public void apply(@NotNull LivingEntity to) { - Validate.notNull(to, "entity cannot be null"); + Preconditions.checkArgument(to != null, "entity cannot be null"); to.addPotionEffects(getEffects()); } @@ -204,7 +204,7 @@ public class Potion { * @param isExtended Whether the potion should have extended duration */ public void setHasExtendedDuration(boolean isExtended) { - Validate.isTrue(type == null || !type.isInstant(), "Instant potions cannot be extended"); + Preconditions.checkArgument(type == null || !type.isInstant(), "Instant potions cannot be extended"); extended = isExtended; } @@ -233,8 +233,8 @@ public class Potion { * @param level The new level of this potion */ public void setLevel(int level) { - Validate.notNull(this.type, "No-effect potions don't have a level."); - Validate.isTrue(level > 0 && level <= 2, "Level must be between 1 and 2 for this potion"); + Preconditions.checkArgument(this.type != null, "No-effect potions don't have a level."); + Preconditions.checkArgument(level > 0 && level <= 2, "Level must be between 1 and 2 for this potion"); this.level = level; } @@ -354,7 +354,7 @@ public class Potion { @NotNull public static Potion fromItemStack(@NotNull ItemStack item) { - Validate.notNull(item, "item cannot be null"); + Preconditions.checkArgument(item != null, "item cannot be null"); if (item.getType() != Material.POTION) throw new IllegalArgumentException("item is not a potion"); return fromDamage(item.getDurability()); diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionData.java b/paper-api/src/main/java/org/bukkit/potion/PotionData.java index ba0d671165..ef5fe586a7 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionData.java +++ b/paper-api/src/main/java/org/bukkit/potion/PotionData.java @@ -1,6 +1,6 @@ package org.bukkit.potion; -import org.apache.commons.lang.Validate; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; public final class PotionData { @@ -20,10 +20,10 @@ public final class PotionData { * must be true */ public PotionData(@NotNull PotionType type, boolean extended, boolean upgraded) { - Validate.notNull(type, "Potion Type must not be null"); - Validate.isTrue(!upgraded || type.isUpgradeable(), "Potion Type is not upgradable"); - Validate.isTrue(!extended || type.isExtendable(), "Potion Type is not extendable"); - Validate.isTrue(!upgraded || !extended, "Potion cannot be both extended and upgraded"); + Preconditions.checkArgument(type != null, "Potion Type must not be null"); + Preconditions.checkArgument(!upgraded || type.isUpgradeable(), "Potion Type is not upgradable"); + Preconditions.checkArgument(!extended || type.isExtendable(), "Potion Type is not extendable"); + Preconditions.checkArgument(!upgraded || !extended, "Potion cannot be both extended and upgraded"); this.type = type; this.extended = extended; this.upgraded = upgraded; diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionEffect.java b/paper-api/src/main/java/org/bukkit/potion/PotionEffect.java index 60716c627d..1f0faf1607 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionEffect.java +++ b/paper-api/src/main/java/org/bukkit/potion/PotionEffect.java @@ -1,9 +1,9 @@ package org.bukkit.potion; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import java.util.Map; import java.util.NoSuchElementException; -import org.apache.commons.lang.Validate; import org.bukkit.Color; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.SerializableAs; @@ -44,7 +44,7 @@ public class PotionEffect implements ConfigurationSerializable { * @param icon the icon status, see {@link PotionEffect#hasIcon()} */ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { - Validate.notNull(type, "effect type cannot be null"); + Preconditions.checkArgument(type != null, "effect type cannot be null"); this.type = type; this.duration = duration; this.amplifier = amplifier; diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java b/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java index 22c28a5037..5f3aa6fd18 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java @@ -1,9 +1,9 @@ package org.bukkit.potion; +import com.google.common.base.Preconditions; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang.Validate; import org.bukkit.Color; import org.bukkit.Keyed; import org.bukkit.NamespacedKey; @@ -180,6 +180,11 @@ public abstract class PotionEffectType implements Keyed { */ public static final PotionEffectType HERO_OF_THE_VILLAGE = new PotionEffectTypeWrapper(32, "hero_of_the_village"); + /** + * Causes the player's vision to dim occasionally. + */ + public static final PotionEffectType DARKNESS = new PotionEffectTypeWrapper(33, "darkness"); + private final int id; private final NamespacedKey key; @@ -276,7 +281,7 @@ public abstract class PotionEffectType implements Keyed { return "PotionEffectType[" + id + ", " + getName() + "]"; } - private static final PotionEffectType[] byId = new PotionEffectType[33]; + private static final PotionEffectType[] byId = new PotionEffectType[34]; private static final Map byName = new HashMap(); private static final Map byKey = new HashMap(); // will break on updates. @@ -317,7 +322,7 @@ public abstract class PotionEffectType implements Keyed { */ @Nullable public static PotionEffectType getByName(@NotNull String name) { - Validate.notNull(name, "name cannot be null"); + Preconditions.checkArgument(name != null, "name cannot be null"); return byName.get(name.toLowerCase(java.util.Locale.ENGLISH)); } diff --git a/paper-api/src/main/java/org/bukkit/util/BoundingBox.java b/paper-api/src/main/java/org/bukkit/util/BoundingBox.java index 01f80020b1..9883983c33 100644 --- a/paper-api/src/main/java/org/bukkit/util/BoundingBox.java +++ b/paper-api/src/main/java/org/bukkit/util/BoundingBox.java @@ -1,9 +1,9 @@ package org.bukkit.util; +import com.google.common.base.Preconditions; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; -import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -39,8 +39,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public static BoundingBox of(@NotNull Vector corner1, @NotNull Vector corner2) { - Validate.notNull(corner1, "Corner1 is null!"); - Validate.notNull(corner2, "Corner2 is null!"); + Preconditions.checkArgument(corner1 != null, "Corner1 is null!"); + Preconditions.checkArgument(corner2 != null, "Corner2 is null!"); return new BoundingBox(corner1.getX(), corner1.getY(), corner1.getZ(), corner2.getX(), corner2.getY(), corner2.getZ()); } @@ -54,9 +54,9 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public static BoundingBox of(@NotNull Location corner1, @NotNull Location corner2) { - Validate.notNull(corner1, "Corner1 is null!"); - Validate.notNull(corner2, "Corner2 is null!"); - Validate.isTrue(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Locations from different worlds!"); + Preconditions.checkArgument(corner1 != null, "Corner1 is null!"); + Preconditions.checkArgument(corner2 != null, "Corner2 is null!"); + Preconditions.checkArgument(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Locations from different worlds!"); return new BoundingBox(corner1.getX(), corner1.getY(), corner1.getZ(), corner2.getX(), corner2.getY(), corner2.getZ()); } @@ -72,9 +72,9 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public static BoundingBox of(@NotNull Block corner1, @NotNull Block corner2) { - Validate.notNull(corner1, "Corner1 is null!"); - Validate.notNull(corner2, "Corner2 is null!"); - Validate.isTrue(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Blocks from different worlds!"); + Preconditions.checkArgument(corner1 != null, "Corner1 is null!"); + Preconditions.checkArgument(corner2 != null, "Corner2 is null!"); + Preconditions.checkArgument(Objects.equals(corner1.getWorld(), corner2.getWorld()), "Blocks from different worlds!"); int x1 = corner1.getX(); int y1 = corner1.getY(); @@ -101,7 +101,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public static BoundingBox of(@NotNull Block block) { - Validate.notNull(block, "Block is null!"); + Preconditions.checkArgument(block != null, "Block is null!"); return new BoundingBox(block.getX(), block.getY(), block.getZ(), block.getX() + 1, block.getY() + 1, block.getZ() + 1); } @@ -116,7 +116,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public static BoundingBox of(@NotNull Vector center, double x, double y, double z) { - Validate.notNull(center, "Center is null!"); + Preconditions.checkArgument(center != null, "Center is null!"); return new BoundingBox(center.getX() - x, center.getY() - y, center.getZ() - z, center.getX() + x, center.getY() + y, center.getZ() + z); } @@ -131,7 +131,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public static BoundingBox of(@NotNull Location center, double x, double y, double z) { - Validate.notNull(center, "Center is null!"); + Preconditions.checkArgument(center != null, "Center is null!"); return new BoundingBox(center.getX() - x, center.getY() - y, center.getZ() - z, center.getX() + x, center.getY() + y, center.getZ() + z); } @@ -348,7 +348,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox copy(@NotNull BoundingBox other) { - Validate.notNull(other, "Other bounding box is null!"); + Preconditions.checkArgument(other != null, "Other bounding box is null!"); return this.resize(other.getMinX(), other.getMinY(), other.getMinZ(), other.getMaxX(), other.getMaxY(), other.getMaxZ()); } @@ -449,7 +449,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox expand(@NotNull Vector expansion) { - Validate.notNull(expansion, "Expansion is null!"); + Preconditions.checkArgument(expansion != null, "Expansion is null!"); double x = expansion.getX(); double y = expansion.getY(); double z = expansion.getZ(); @@ -510,7 +510,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox expand(@NotNull Vector direction, double expansion) { - Validate.notNull(direction, "Direction is null!"); + Preconditions.checkArgument(direction != null, "Direction is null!"); return this.expand(direction.getX(), direction.getY(), direction.getZ(), expansion); } @@ -527,7 +527,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox expand(@NotNull BlockFace blockFace, double expansion) { - Validate.notNull(blockFace, "Block face is null!"); + Preconditions.checkArgument(blockFace != null, "Block face is null!"); if (blockFace == BlockFace.SELF) return this; return this.expand(blockFace.getDirection(), expansion); @@ -563,7 +563,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox expandDirectional(@NotNull Vector direction) { - Validate.notNull(direction, "Expansion is null!"); + Preconditions.checkArgument(direction != null, "Expansion is null!"); return this.expand(direction.getX(), direction.getY(), direction.getZ(), 1.0D); } @@ -599,7 +599,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox union(@NotNull Vector position) { - Validate.notNull(position, "Position is null!"); + Preconditions.checkArgument(position != null, "Position is null!"); return this.union(position.getX(), position.getY(), position.getZ()); } @@ -612,7 +612,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox union(@NotNull Location position) { - Validate.notNull(position, "Position is null!"); + Preconditions.checkArgument(position != null, "Position is null!"); return this.union(position.getX(), position.getY(), position.getZ()); } @@ -625,7 +625,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox union(@NotNull BoundingBox other) { - Validate.notNull(other, "Other bounding box is null!"); + Preconditions.checkArgument(other != null, "Other bounding box is null!"); if (this.contains(other)) return this; double newMinX = Math.min(this.minX, other.minX); double newMinY = Math.min(this.minY, other.minY); @@ -646,8 +646,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox intersection(@NotNull BoundingBox other) { - Validate.notNull(other, "Other bounding box is null!"); - Validate.isTrue(this.overlaps(other), "The bounding boxes do not overlap!"); + Preconditions.checkArgument(other != null, "Other bounding box is null!"); + Preconditions.checkArgument(this.overlaps(other), "The bounding boxes do not overlap!"); double newMinX = Math.max(this.minX, other.minX); double newMinY = Math.max(this.minY, other.minY); double newMinZ = Math.max(this.minZ, other.minZ); @@ -680,7 +680,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox shift(@NotNull Vector shift) { - Validate.notNull(shift, "Shift is null!"); + Preconditions.checkArgument(shift != null, "Shift is null!"); return this.shift(shift.getX(), shift.getY(), shift.getZ()); } @@ -692,7 +692,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @NotNull public BoundingBox shift(@NotNull Location shift) { - Validate.notNull(shift, "Shift is null!"); + Preconditions.checkArgument(shift != null, "Shift is null!"); return this.shift(shift.getX(), shift.getY(), shift.getZ()); } @@ -712,7 +712,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { * @return true if overlapping */ public boolean overlaps(@NotNull BoundingBox other) { - Validate.notNull(other, "Other bounding box is null!"); + Preconditions.checkArgument(other != null, "Other bounding box is null!"); return this.overlaps(other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ); } @@ -728,8 +728,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { * @return true if overlapping */ public boolean overlaps(@NotNull Vector min, @NotNull Vector max) { - Validate.notNull(min, "Min is null!"); - Validate.notNull(max, "Max is null!"); + Preconditions.checkArgument(min != null, "Min is null!"); + Preconditions.checkArgument(max != null, "Max is null!"); double x1 = min.getX(); double y1 = min.getY(); double z1 = min.getZ(); @@ -773,7 +773,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { * @return true if the bounding box contains the position */ public boolean contains(@NotNull Vector position) { - Validate.notNull(position, "Position is null!"); + Preconditions.checkArgument(position != null, "Position is null!"); return this.contains(position.getX(), position.getY(), position.getZ()); } @@ -791,7 +791,7 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { * box */ public boolean contains(@NotNull BoundingBox other) { - Validate.notNull(other, "Other bounding box is null!"); + Preconditions.checkArgument(other != null, "Other bounding box is null!"); return this.contains(other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ); } @@ -805,8 +805,8 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { * bounding box */ public boolean contains(@NotNull Vector min, @NotNull Vector max) { - Validate.notNull(min, "Min is null!"); - Validate.notNull(max, "Max is null!"); + Preconditions.checkArgument(min != null, "Min is null!"); + Preconditions.checkArgument(max != null, "Max is null!"); double x1 = min.getX(); double y1 = min.getY(); double z1 = min.getZ(); @@ -831,11 +831,11 @@ public class BoundingBox implements Cloneable, ConfigurationSerializable { */ @Nullable public RayTraceResult rayTrace(@NotNull Vector start, @NotNull Vector direction, double maxDistance) { - Validate.notNull(start, "Start is null!"); + Preconditions.checkArgument(start != null, "Start is null!"); start.checkFinite(); - Validate.notNull(direction, "Direction is null!"); + Preconditions.checkArgument(direction != null, "Direction is null!"); direction.checkFinite(); - Validate.isTrue(direction.lengthSquared() > 0, "Direction's magnitude is 0!"); + Preconditions.checkArgument(direction.lengthSquared() > 0, "Direction's magnitude is 0!"); if (maxDistance < 0.0D) return null; // ray start: diff --git a/paper-api/src/main/java/org/bukkit/util/RayTraceResult.java b/paper-api/src/main/java/org/bukkit/util/RayTraceResult.java index 19c52a2a62..ccda3b3bc6 100644 --- a/paper-api/src/main/java/org/bukkit/util/RayTraceResult.java +++ b/paper-api/src/main/java/org/bukkit/util/RayTraceResult.java @@ -1,7 +1,7 @@ package org.bukkit.util; +import com.google.common.base.Preconditions; import java.util.Objects; -import org.apache.commons.lang.Validate; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Entity; @@ -24,7 +24,7 @@ public class RayTraceResult { private final Entity hitEntity; private RayTraceResult(@NotNull Vector hitPosition, @Nullable Block hitBlock, @Nullable BlockFace hitBlockFace, @Nullable Entity hitEntity) { - Validate.notNull(hitPosition, "Hit position is null!"); + Preconditions.checkArgument(hitPosition != null, "Hit position is null!"); this.hitPosition = hitPosition.clone(); this.hitBlock = hitBlock; this.hitBlockFace = hitBlockFace; diff --git a/paper-api/src/main/java/org/bukkit/util/StringUtil.java b/paper-api/src/main/java/org/bukkit/util/StringUtil.java index 458d5ebdf6..adac718562 100644 --- a/paper-api/src/main/java/org/bukkit/util/StringUtil.java +++ b/paper-api/src/main/java/org/bukkit/util/StringUtil.java @@ -1,7 +1,7 @@ package org.bukkit.util; +import com.google.common.base.Preconditions; import java.util.Collection; -import org.apache.commons.lang.Validate; import org.jetbrains.annotations.NotNull; public class StringUtil { @@ -25,9 +25,9 @@ public class StringUtil { */ @NotNull public static > T copyPartialMatches(@NotNull final String token, @NotNull final Iterable originals, @NotNull final T collection) throws UnsupportedOperationException, IllegalArgumentException { - Validate.notNull(token, "Search token cannot be null"); - Validate.notNull(collection, "Collection cannot be null"); - Validate.notNull(originals, "Originals cannot be null"); + Preconditions.checkArgument(token != null, "Search token cannot be null"); + Preconditions.checkArgument(collection != null, "Collection cannot be null"); + Preconditions.checkArgument(originals != null, "Originals cannot be null"); for (String string : originals) { if (startsWithIgnoreCase(string, token)) { @@ -51,7 +51,7 @@ public class StringUtil { * @throws IllegalArgumentException if string is null */ public static boolean startsWithIgnoreCase(@NotNull final String string, @NotNull final String prefix) throws IllegalArgumentException, NullPointerException { - Validate.notNull(string, "Cannot check a null string for a match"); + Preconditions.checkArgument(string != null, "Cannot check a null string for a match"); if (string.length() < prefix.length()) { return false; }