diff --git a/pom.xml b/pom.xml index 48d4e4d8..ff8ddd39 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.bukkit bukkit - 1.17.1-R0.1-SNAPSHOT + 1.18-R0.1-SNAPSHOT jar Bukkit @@ -41,14 +41,14 @@ com.google.guava guava - 21.0 + 31.0.1-jre compile com.google.code.gson gson - 2.8.0 + 2.8.8 compile @@ -142,7 +142,7 @@ org.eclipse.jdt ecj - 3.26.0 + 3.27.0 @@ -189,10 +189,10 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.0 + 3.3.1 - https://guava.dev/releases/21.0/api/docs/ + https://guava.dev/releases/31.0.1-jre/api/docs/ https://javadoc.io/doc/org.yaml/snakeyaml/1.28/ https://javadoc.io/doc/org.jetbrains/annotations-java5/21.0.1/ @@ -229,7 +229,7 @@ com.puppycrawl.tools checkstyle - 8.44 + 8.45.1 diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index e1f7e821..59e93107 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -178,6 +178,15 @@ public final class Bukkit { return server.getViewDistance(); } + /** + * Get the simulation distance from this server. + * + * @return the simulation distance from this server. + */ + public static int getSimulationDistance() { + return server.getSimulationDistance(); + } + /** * Get the IP that this server is bound to, or empty string if not * specified. @@ -903,6 +912,15 @@ public final class Bukkit { server.setSpawnRadius(value); } + /** + * Gets whether the Server hide online players in server status. + * + * @return true if the server hide online players, false otherwise + */ + public static boolean getHideOnlinePlayers() { + return server.getHideOnlinePlayers(); + } + /** * Gets whether the Server is in online mode or not. * diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index 67cbfd10..99217807 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -1044,6 +1044,7 @@ public interface Material extends Keyed, Comparable { Material MUSIC_DISC_WARD = getMaterial("music_disc_ward"); Material MUSIC_DISC_11 = getMaterial("music_disc_11"); Material MUSIC_DISC_WAIT = getMaterial("music_disc_wait"); + Material MUSIC_DISC_OTHERSIDE = getMaterial("music_disc_otherside"); Material MUSIC_DISC_PIGSTEP = getMaterial("music_disc_pigstep"); Material TRIDENT = getMaterial("trident"); Material PHANTOM_MEMBRANE = getMaterial("phantom_membrane"); diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java index c5315ee1..dc514246 100644 --- a/src/main/java/org/bukkit/Particle.java +++ b/src/main/java/org/bukkit/Particle.java @@ -41,7 +41,6 @@ public enum Particle { SNOW_SHOVEL, SLIME, HEART, - BARRIER, ITEM_CRACK(ItemStack.class), BLOCK_CRACK(BlockData.class), BLOCK_DUST(BlockData.class), @@ -82,7 +81,6 @@ public enum Particle { LANDING_OBSIDIAN_TEAR, REVERSE_PORTAL, WHITE_ASH, - LIGHT, DUST_COLOR_TRANSITION(DustTransition.class), VIBRATION(Vibration.class), FALLING_SPORE_BLOSSOM, @@ -99,6 +97,7 @@ public enum Particle { WAX_OFF, ELECTRIC_SPARK, SCRAPE, + BLOCK_MARKER(BlockData.class), // ----- Legacy Separator ----- LEGACY_BLOCK_CRACK(MaterialData.class), LEGACY_BLOCK_DUST(MaterialData.class), diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index fda80f21..51df4019 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -149,6 +149,13 @@ public interface Server extends PluginMessageRecipient { */ public int getViewDistance(); + /** + * Get the simulation distance from this server. + * + * @return the simulation distance from this server. + */ + public int getSimulationDistance(); + /** * Get the IP that this server is bound to, or empty string if not * specified. @@ -761,6 +768,13 @@ public interface Server extends PluginMessageRecipient { */ public void setSpawnRadius(int value); + /** + * Gets whether the Server hide online players in server status. + * + * @return true if the server hide online players, false otherwise + */ + public boolean getHideOnlinePlayers(); + /** * Gets whether the Server is in online mode or not. * diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java index 9dc5f718..597a3d1a 100644 --- a/src/main/java/org/bukkit/Sound.java +++ b/src/main/java/org/bukkit/Sound.java @@ -232,6 +232,7 @@ public abstract class Sound extends OldEnum implements Keyed { public static final Sound BLOCK_GRAVEL_PLACE = getSound("block.gravel.place"); public static final Sound BLOCK_GRAVEL_STEP = getSound("block.gravel.step"); public static final Sound BLOCK_GRINDSTONE_USE = getSound("block.grindstone.use"); + public static final Sound BLOCK_GROWING_PLANT_CROP = getSound("block.growing_plant.crop"); public static final Sound BLOCK_HANGING_ROOTS_BREAK = getSound("block.hanging_roots.break"); public static final Sound BLOCK_HANGING_ROOTS_FALL = getSound("block.hanging_roots.fall"); public static final Sound BLOCK_HANGING_ROOTS_HIT = getSound("block.hanging_roots.hit"); @@ -1133,6 +1134,9 @@ public abstract class Sound extends OldEnum implements Keyed { public static final Sound ITEM_BUCKET_FILL_FISH = getSound("item.bucket.fill_fish"); public static final Sound ITEM_BUCKET_FILL_LAVA = getSound("item.bucket.fill_lava"); public static final Sound ITEM_BUCKET_FILL_POWDER_SNOW = getSound("item.bucket.fill_powder_snow"); + public static final Sound ITEM_BUNDLE_DROP_CONTENTS = getSound("item.bundle.drop_contents"); + public static final Sound ITEM_BUNDLE_INSERT = getSound("item.bundle.insert"); + public static final Sound ITEM_BUNDLE_REMOVE_ONE = getSound("item.bundle.remove_one"); public static final Sound ITEM_CHORUS_FRUIT_TELEPORT = getSound("item.chorus_fruit.teleport"); public static final Sound ITEM_CROP_PLANT = getSound("item.crop.plant"); public static final Sound ITEM_CROSSBOW_HIT = getSound("item.crossbow.hit"); @@ -1178,6 +1182,7 @@ public abstract class Sound extends OldEnum implements Keyed { public static final Sound MUSIC_DISC_FAR = getSound("music_disc.far"); public static final Sound MUSIC_DISC_MALL = getSound("music_disc.mall"); public static final Sound MUSIC_DISC_MELLOHI = getSound("music_disc.mellohi"); + public static final Sound MUSIC_DISC_OTHERSIDE = getSound("music_disc.otherside"); public static final Sound MUSIC_DISC_PIGSTEP = getSound("music_disc.pigstep"); public static final Sound MUSIC_DISC_STAL = getSound("music_disc.stal"); public static final Sound MUSIC_DISC_STRAD = getSound("music_disc.strad"); @@ -1192,6 +1197,14 @@ public abstract class Sound extends OldEnum implements Keyed { public static final Sound MUSIC_NETHER_NETHER_WASTES = getSound("music.nether.nether_wastes"); public static final Sound MUSIC_NETHER_SOUL_SAND_VALLEY = getSound("music.nether.soul_sand_valley"); public static final Sound MUSIC_NETHER_WARPED_FOREST = getSound("music.nether.warped_forest"); + public static final Sound MUSIC_OVERWORLD_DRIPSTONE_CAVES = getSound("music.overworld.dripstone_caves"); + public static final Sound MUSIC_OVERWORLD_FROZEN_PEAKS = getSound("music.overworld.frozen_peaks"); + public static final Sound MUSIC_OVERWORLD_GROVE = getSound("music.overworld.grove"); + public static final Sound MUSIC_OVERWORLD_JAGGED_PEAKS = getSound("music.overworld.jagged_peaks"); + public static final Sound MUSIC_OVERWORLD_LUSH_CAVES = getSound("music.overworld.lush_caves"); + public static final Sound MUSIC_OVERWORLD_MEADOW = getSound("music.overworld.meadow"); + public static final Sound MUSIC_OVERWORLD_SNOWY_SLOPES = getSound("music.overworld.snowy_slopes"); + public static final Sound MUSIC_OVERWORLD_STONY_PEAKS = getSound("music.overworld.stony_peaks"); public static final Sound MUSIC_UNDER_WATER = getSound("music.under_water"); public static final Sound PARTICLE_SOUL_ESCAPE = getSound("particle.soul_escape"); public static final Sound UI_BUTTON_CLICK = getSound("ui.button.click"); diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java index c86ac9f4..5a25301a 100644 --- a/src/main/java/org/bukkit/Tag.java +++ b/src/main/java/org/bukkit/Tag.java @@ -235,6 +235,10 @@ public interface Tag extends Keyed { * Vanilla block tag representing all dirt. */ Tag DIRT = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dirt"), Material.class); + /** + * Vanilla block tag representing all terracotta. + */ + Tag TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), Material.class); /** * Vanilla block tag denoting blocks that enderman may pick up and hold. */ @@ -332,7 +336,8 @@ public interface Tag extends Keyed { */ Tag BEACON_BASE_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("beacon_base_blocks"), Material.class); /** - * Vanilla block tag representing all blocks affected by the soul speed enchantment. + * Vanilla block tag representing all blocks affected by the soul speed + * enchantment. */ Tag SOUL_SPEED_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("soul_speed_blocks"), Material.class); /** @@ -405,7 +410,8 @@ public interface Tag extends Keyed { */ Tag STONE_ORE_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("stone_ore_replaceables"), Material.class); /** - * Vanilla block tag representing all blocks that may be replaced by deepslate ores. + * Vanilla block tag representing all blocks that may be replaced by + * deepslate ores. */ Tag DEEPSLATE_ORE_REPLACEABLES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("deepslate_ore_replaceables"), Material.class); /** @@ -433,7 +439,8 @@ public interface Tag extends Keyed { */ Tag OCCLUDES_VIBRATION_SIGNALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("occludes_vibration_signals"), Material.class); /** - * Vanilla block tag representing all blocks that are replaceable by dripstone. + * Vanilla block tag representing all blocks that are replaceable by + * dripstone. */ Tag DRIPSTONE_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dripstone_replaceable_blocks"), Material.class); /** @@ -449,9 +456,19 @@ public interface Tag extends Keyed { */ Tag LUSH_GROUND_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("lush_ground_replaceable"), Material.class); /** - * Vanilla block tag representing all blocks which small dripleaf can be placed on. + * Vanilla block tag representing all blocks replaceable by azalea root. + */ + Tag AZALEA_ROOT_REPLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("azalea_root_replaceable"), Material.class); + /** + * Vanilla block tag representing all blocks which small dripleaf can be + * placed on. */ Tag SMALL_DRIPLEAF_PLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("small_dripleaf_placeable"), Material.class); + /** + * Vanilla block tag representing all blocks which big dripleaf can be + * placed on. + */ + Tag BIG_DRIPLEAF_PLACEABLE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("big_dripleaf_placeable"), Material.class); /** * Vanilla block tag representing all snow blocks. */ @@ -485,17 +502,64 @@ public interface Tag extends Keyed { */ Tag NEEDS_STONE_TOOL = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("needs_stone_tool"), Material.class); /** - * Vanilla block tag representing all blocks which will not be replaced by world generation features. + * Vanilla block tag representing all blocks which will not be replaced by + * world generation features. */ Tag FEATURES_CANNOT_REPLACE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("features_cannot_replace"), Material.class); /** - * Vanilla block tag representing all blocks which lava pools will not replace. + * Vanilla block tag representing all blocks which lava pools will not + * replace. */ - Tag LAVA_POOL_STONE_CANNOT_REPLACE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("lava_pool_stone_replaceables"), Material.class); + Tag LAVA_POOL_STONE_CANNOT_REPLACE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("lava_pool_stone_cannot_replace"), Material.class); /** * 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 animals will spawn on. + */ + Tag ANIMALS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("animals_spawnable_on"), Material.class); + /** + * Vanilla block tag representing all blocks which axolotls will spawn on. + */ + Tag AXOLOTLS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("axolotls_spawnable_on"), Material.class); + /** + * Vanilla block tag representing all blocks which goats will spawn on. + */ + Tag GOATS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("goats_spawnable_on"), Material.class); + /** + * Vanilla block tag representing all blocks which mooshrooms will spawn on. + */ + Tag MOOSHROOMS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("mooshrooms_spawnable_on"), Material.class); + /** + * Vanilla block tag representing all blocks which parrots will spawn on. + */ + Tag PARROTS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("parrots_spawnable_on"), Material.class); + /** + * 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); + /** + * Vanilla block tag representing all blocks which rabbits will spawn on. + */ + Tag RABBITS_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("rabbits_spawnable_on"), Material.class); + /** + * Vanilla block tag representing all blocks which foxes will spawn on. + */ + Tag FOXES_SPAWNABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("foxes_spawnable_on"), Material.class); + /** + * 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 azaleas will grow on. + */ + Tag AZALEA_GROWS_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("azalea_grows_on"), Material.class); + /** + * Vanilla block tag representing all plant blocks which may be replaced. + */ + Tag REPLACEABLE_PLANTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("replaceable_plants"), Material.class); /** * Key for the built in item registry. */ diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java index f73edddd..0a02b732 100644 --- a/src/main/java/org/bukkit/block/Biome.java +++ b/src/main/java/org/bukkit/block/Biome.java @@ -19,7 +19,7 @@ public abstract class Biome extends OldEnum implements Keyed { public static final Biome OCEAN = getBiome("ocean"); public static final Biome PLAINS = getBiome("plains"); public static final Biome DESERT = getBiome("desert"); - public static final Biome MOUNTAINS = getBiome("mountains"); + public static final Biome WINDSWEPT_HILLS = getBiome("windswept_Hills"); public static final Biome FOREST = getBiome("forest"); public static final Biome TAIGA = getBiome("taiga"); public static final Biome SWAMP = getBiome("swamp"); @@ -28,34 +28,23 @@ public abstract class Biome extends OldEnum implements Keyed { public static final Biome THE_END = getBiome("the_end"); public static final Biome FROZEN_OCEAN = getBiome("frozen_ocean"); public static final Biome FROZEN_RIVER = getBiome("frozen_river"); - public static final Biome SNOWY_TUNDRA = getBiome("snowy_tundra"); - public static final Biome SNOWY_MOUNTAINS = getBiome("snowy_mountains"); + public static final Biome SNOWY_PLAINS = getBiome("snowy_plains"); public static final Biome MUSHROOM_FIELDS = getBiome("mushroom_fields"); - public static final Biome MUSHROOM_FIELD_SHORE = getBiome("mushroom_field_shore"); public static final Biome BEACH = getBiome("beach"); - public static final Biome DESERT_HILLS = getBiome("desert_hills"); - public static final Biome WOODED_HILLS = getBiome("wooded_hills"); - public static final Biome TAIGA_HILLS = getBiome("taiga_hills"); - public static final Biome MOUNTAIN_EDGE = getBiome("mountain_edge"); public static final Biome JUNGLE = getBiome("jungle"); - public static final Biome JUNGLE_HILLS = getBiome("jungle_hills"); - public static final Biome JUNGLE_EDGE = getBiome("jungle_edge"); + public static final Biome SPARSE_JUNGLE = getBiome("sparse_jungle"); public static final Biome DEEP_OCEAN = getBiome("deep_ocean"); - public static final Biome STONE_SHORE = getBiome("stone_shore"); + public static final Biome STONY_SHORE = getBiome("stony_shore"); public static final Biome SNOWY_BEACH = getBiome("snowy_beach"); public static final Biome BIRCH_FOREST = getBiome("birch_forest"); - public static final Biome BIRCH_FOREST_HILLS = getBiome("birch_forest_hills"); public static final Biome DARK_FOREST = getBiome("dark_forest"); public static final Biome SNOWY_TAIGA = getBiome("snowy_taiga"); - public static final Biome SNOWY_TAIGA_HILLS = getBiome("snowy_taiga_hills"); - public static final Biome GIANT_TREE_TAIGA = getBiome("giant_tree_taiga"); - public static final Biome GIANT_TREE_TAIGA_HILLS = getBiome("giant_tree_taiga_hills"); - public static final Biome WOODED_MOUNTAINS = getBiome("wooded_mountains"); + public static final Biome OLD_GROWTH_PINE_TAIGA = getBiome("old_growth_pine_taiga"); + public static final Biome WINDSWEPT_FOREST = getBiome("windswept_forest"); public static final Biome SAVANNA = getBiome("savanna"); public static final Biome SAVANNA_PLATEAU = getBiome("savanna_plateau"); public static final Biome BADLANDS = getBiome("badlands"); - public static final Biome WOODED_BADLANDS_PLATEAU = getBiome("wooded_badlands_plateau"); - public static final Biome BADLANDS_PLATEAU = getBiome("badlands_plateau"); + public static final Biome WOODED_BADLANDS = getBiome("wooded_badlands"); public static final Biome SMALL_END_ISLANDS = getBiome("small_end_islands"); public static final Biome END_MIDLANDS = getBiome("end_midlands"); public static final Biome END_HIGHLANDS = getBiome("end_highlands"); @@ -63,40 +52,31 @@ public abstract class Biome extends OldEnum implements Keyed { public static final Biome WARM_OCEAN = getBiome("warm_ocean"); public static final Biome LUKEWARM_OCEAN = getBiome("lukewarm_ocean"); public static final Biome COLD_OCEAN = getBiome("cold_ocean"); - public static final Biome DEEP_WARM_OCEAN = getBiome("deep_warm_ocean"); public static final Biome DEEP_LUKEWARM_OCEAN = getBiome("deep_lukewarm_ocean"); public static final Biome DEEP_COLD_OCEAN = getBiome("deep_cold_ocean"); public static final Biome DEEP_FROZEN_OCEAN = getBiome("deep_frozen_ocean"); public static final Biome THE_VOID = getBiome("the_void"); public static final Biome SUNFLOWER_PLAINS = getBiome("sunflower_plains"); - public static final Biome DESERT_LAKES = getBiome("desert_lakes"); - public static final Biome GRAVELLY_MOUNTAINS = getBiome("gravelly_mountains"); + public static final Biome WINDSWEPT_GRAVELLY_HILLS = getBiome("windswept_gravelly_hills"); public static final Biome FLOWER_FOREST = getBiome("flower_forest"); - public static final Biome TAIGA_MOUNTAINS = getBiome("taiga_mountains"); - public static final Biome SWAMP_HILLS = getBiome("swamp_hills"); public static final Biome ICE_SPIKES = getBiome("ice_spikes"); - public static final Biome MODIFIED_JUNGLE = getBiome("modified_jungle"); - public static final Biome MODIFIED_JUNGLE_EDGE = getBiome("modified_jungle_edge"); - public static final Biome TALL_BIRCH_FOREST = getBiome("tall_birch_forest"); - public static final Biome TALL_BIRCH_HILLS = getBiome("tall_birch_hills"); - public static final Biome DARK_FOREST_HILLS = getBiome("dark_forest_hills"); - public static final Biome SNOWY_TAIGA_MOUNTAINS = getBiome("snowy_taiga_mountains"); - public static final Biome GIANT_SPRUCE_TAIGA = getBiome("giant_spruce_taiga"); - public static final Biome GIANT_SPRUCE_TAIGA_HILLS = getBiome("giant_spruce_taiga_hills"); - public static final Biome MODIFIED_GRAVELLY_MOUNTAINS = getBiome("modified_gravelly_mountains"); - public static final Biome SHATTERED_SAVANNA = getBiome("shattered_savanna"); - public static final Biome SHATTERED_SAVANNA_PLATEAU = getBiome("shattered_savanna_plateau"); + public static final Biome OLD_GROWTH_BIRCH_FOREST = getBiome("old_growth_birch_forest"); + public static final Biome OLD_GROWTH_SPRUCE_TAIGA = getBiome("old_growth_spruce_taiga"); + public static final Biome WINDSWEPT_SAVANNA = getBiome("windswept_savanna"); public static final Biome ERODED_BADLANDS = getBiome("eroded_badlands"); - public static final Biome MODIFIED_WOODED_BADLANDS_PLATEAU = getBiome("modified_wooded_badlands_plateau"); - public static final Biome MODIFIED_BADLANDS_PLATEAU = getBiome("modified_badlands_plateau"); public static final Biome BAMBOO_JUNGLE = getBiome("bamboo_jungle"); - public static final Biome BAMBOO_JUNGLE_HILLS = getBiome("bamboo_jungle_hills"); public static final Biome SOUL_SAND_VALLEY = getBiome("soul_sand_valley"); public static final Biome CRIMSON_FOREST = getBiome("crimson_forest"); public static final Biome WARPED_FOREST = getBiome("warped_forest"); public static final Biome BASALT_DELTAS = getBiome("basalt_deltas"); public static final Biome DRIPSTONE_CAVES = getBiome("dripstone_caves"); public static final Biome LUSH_CAVES = getBiome("lush_caves"); + public static final Biome MEADOW = getBiome("meadow"); + public static final Biome GROVE = getBiome("grove"); + public static final Biome SNOWY_SLOPES = getBiome("snowy_slopes"); + public static final Biome FROZEN_PEAKS = getBiome("frozen_peaks"); + public static final Biome JAGGED_PEAKS = getBiome("jagged_peaks"); + public static final Biome STONY_PEAKS = getBiome("stony_peaks"); /** * Represents a custom Biome. diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java index da0964b1..ce1e1e6c 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -511,4 +511,13 @@ public interface Block extends Metadatable { */ @NotNull VoxelShape getCollisionShape(); + + /** + * Checks if this block is a valid placement location for the specified + * block data. + * + * @param data the block data to check + * @return true if the block data can be placed here + */ + boolean canPlace(@NotNull BlockData data); } diff --git a/src/main/java/org/bukkit/entity/ItemFrame.java b/src/main/java/org/bukkit/entity/ItemFrame.java index 1568bd66..b688b385 100644 --- a/src/main/java/org/bukkit/entity/ItemFrame.java +++ b/src/main/java/org/bukkit/entity/ItemFrame.java @@ -106,7 +106,7 @@ public interface ItemFrame extends Hanging { * damage, interaction, pistons, or missing supporting blocks), rotate the * item or place/remove items. * - * @param visible whether the item frame is fixed or not + * @param fixed whether the item frame is fixed or not */ - void setFixed(boolean visible); + void setFixed(boolean fixed); } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index cd4599b0..0213fe48 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -21,6 +21,7 @@ import org.bukkit.conversations.Conversable; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDropItemEvent; import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.map.MapView; import org.bukkit.plugin.Plugin; @@ -460,24 +461,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendBlockDamage(@NotNull Location loc, float progress); /** - * Send a chunk change. This fakes a chunk change packet for a user at a - * certain location. The updated cuboid must be entirely within a single - * chunk. This will not actually change the world in any way. - *

- * At least one of the dimensions of the cuboid must be even. The size of - * the data buffer must be 2.5*sx*sy*sz and formatted in accordance with - * the Packet51 format. + * Send the equipment change of an entity. This fakes the equipment change + * of an entity for a user. This will not actually change the inventory of + * the specified entity in any way. * - * @param loc The location of the cuboid - * @param sx The x size of the cuboid - * @param sy The y size of the cuboid - * @param sz The z size of the cuboid - * @param data The data to be sent - * @return true if the chunk change packet was sent - * @deprecated Magic value + * @param entity The entity that the player will see the change for + * @param slot The slot of the spoofed equipment change + * @param item The ItemStack to display for the player */ - @Deprecated - public boolean sendChunkChange(@NotNull Location loc, int sx, int sy, int sz, @NotNull byte[] data); + public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull EquipmentSlot slot, @NotNull ItemStack item); /** * Send a sign change. This fakes a sign change packet for a user at @@ -778,6 +770,39 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public boolean canSee(@NotNull Player player); + /** + * Visually hides an entity from this player. + * + * @param plugin Plugin that wants to hide the entity + * @param entity Entity to hide + * @deprecated draft API + */ + @Deprecated + public void hideEntity(@NotNull Plugin plugin, @NotNull Entity entity); + + /** + * Allows this player to see an entity that was previously hidden. If + * another another plugin had hidden the entity too, then the entity will + * remain hidden until the other plugin calls this method too. + * + * @param plugin Plugin that wants to show the entity + * @param entity Entity to show + * @deprecated draft API + */ + @Deprecated + public void showEntity(@NotNull Plugin plugin, @NotNull Entity entity); + + /** + * Checks to see if an entity has been visually hidden from this player. + * + * @param entity Entity to check + * @return True if the provided entity is not being hidden from this + * player + * @deprecated draft API + */ + @Deprecated + public boolean canSee(@NotNull Entity entity); + /** * Checks to see if this player is currently flying or not. * @@ -1275,13 +1300,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Gets the player's estimated ping in milliseconds. * - * In Vanilla this value represents the average of the response time to the - * last four application layer ping packets sent. This value does not - * represent the network round trip time and as such may have less - * granularity and be impacted by other sources. For these reasons it - * should not be used for anti-cheat purposes. Its recommended use is - * only as a qualitative indicator of connection quality (Vanilla - * uses it for this purpose in the tab list). + * In Vanilla this value represents a weighted average of the response time + * to application layer ping packets sent. This value does not represent the + * network round trip time and as such may have less granularity and be + * impacted by other sources. For these reasons it should not be used + * for anti-cheat purposes. Its recommended use is only as a + * qualitative indicator of connection quality (Vanilla uses it for + * this purpose in the tab list). * * @return player ping */ @@ -1315,4 +1340,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param book The book to open for this player */ public void openBook(@NotNull ItemStack book); + + /** + * Shows the demo screen to the player, this screen is normally only seen in + * the demo version of the game. + *
+ * Servers can modify the text on this screen using a resource pack. + */ + public void showDemoScreen(); + + /** + * Gets whether the player has the "Allow Server Listings" setting enabled. + * + * @return whether the player allows server listings + */ + public boolean isAllowingServerListings(); } diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java index 7a2a58ba..cc5e2fef 100644 --- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java @@ -3,6 +3,7 @@ package org.bukkit.event.server; 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; import org.bukkit.event.HandlerList; @@ -12,6 +13,9 @@ import org.jetbrains.annotations.NotNull; /** * Called when a server list ping is coming in. Displayed players can be * checked and removed by {@link #iterator() iterating} over this event. + *
+ * Note: The players in {@link #iterator()} will not be shown in the + * server info if {@link Bukkit#getHideOnlinePlayers()} is true. */ public class ServerListPingEvent extends ServerEvent implements Iterable { private static final int MAGIC_PLAYER_COUNT = Integer.MIN_VALUE; @@ -142,6 +146,9 @@ public class ServerListPingEvent extends ServerEvent implements Iterable * player to not be displayed on the player list, decrease the size * returned by {@link #getNumPlayers()}, and will not be returned again by * any new iterator. + *
+ * Note: The players here will not be shown in the server info if + * {@link Bukkit#getHideOnlinePlayers()} is true. * * @throws UnsupportedOperationException if the caller of this event does * not support removing players diff --git a/src/main/java/org/bukkit/map/MapFont.java b/src/main/java/org/bukkit/map/MapFont.java index 2d599c8f..a45ce819 100644 --- a/src/main/java/org/bukkit/map/MapFont.java +++ b/src/main/java/org/bukkit/map/MapFont.java @@ -63,7 +63,14 @@ public class MapFont { int result = 0; for (int i = 0; i < text.length(); ++i) { char ch = text.charAt(i); - if (ch == ChatColor.COLOR_CHAR) continue; + if (ch == ChatColor.COLOR_CHAR) { + int j = text.indexOf(';', i); + if (j >= 0) { + i = j; + continue; + } + throw new IllegalArgumentException("Text contains unterminated color string"); + } result += chars.get(ch).getWidth(); } result += text.length() - 1; // Account for 1px spacing between characters diff --git a/src/main/java/org/bukkit/permissions/PermissibleBase.java b/src/main/java/org/bukkit/permissions/PermissibleBase.java index 497775f7..728fc46d 100644 --- a/src/main/java/org/bukkit/permissions/PermissibleBase.java +++ b/src/main/java/org/bukkit/permissions/PermissibleBase.java @@ -16,17 +16,14 @@ import org.jetbrains.annotations.Nullable; * Base Permissible for use in any Permissible object via proxy or extension */ public class PermissibleBase implements Permissible { - private ServerOperator opable; - private Permissible parent = this; + private final ServerOperator opable; + private final Permissible parent; private final List attachments = new LinkedList(); private final Map permissions = new HashMap(); public PermissibleBase(@Nullable ServerOperator opable) { this.opable = opable; - - if (opable instanceof Permissible) { - this.parent = (Permissible) opable; - } + this.parent = (opable instanceof Permissible) ? (Permissible) opable : this; recalculatePermissions(); } @@ -144,8 +141,7 @@ public class PermissibleBase implements Permissible { throw new IllegalArgumentException("Attachment cannot be null"); } - if (attachments.contains(attachment)) { - attachments.remove(attachment); + if (attachments.remove(attachment)) { PermissionRemovedExecutor ex = attachment.getRemovalCallback(); if (ex != null) { @@ -253,7 +249,7 @@ public class PermissibleBase implements Permissible { } private static class RemoveAttachmentRunnable implements Runnable { - private PermissionAttachment attachment; + private final PermissionAttachment attachment; public RemoveAttachmentRunnable(@NotNull PermissionAttachment attachment) { this.attachment = attachment; diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java index 939afec1..6d634b0e 100644 --- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java @@ -121,7 +121,7 @@ class LibraryLoader } ); } - URLClassLoader loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ) ); + URLClassLoader loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() ); return loader; } diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java index 00f71139..e451957c 100644 --- a/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/src/main/java/org/bukkit/potion/PotionEffectType.java @@ -9,6 +9,7 @@ import org.bukkit.Color; import org.bukkit.Keyed; import org.bukkit.NamespacedKey; import org.bukkit.Registry; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -21,166 +22,166 @@ public abstract class PotionEffectType implements Keyed { /** * Increases movement speed. */ - public static final PotionEffectType SPEED = getPotionEffectType("speed", 1); + public static final PotionEffectType SPEED = getPotionEffectType(1, "speed"); /** * Decreases movement speed. */ - public static final PotionEffectType SLOWNESS = getPotionEffectType("slowness", 2); + public static final PotionEffectType SLOWNESS = getPotionEffectType(2, "slowness"); /** * Increases dig speed. */ - public static final PotionEffectType HASTE = getPotionEffectType("haste", 3); + public static final PotionEffectType HASTE = getPotionEffectType(3, "haste"); /** * Decreases dig speed. */ - public static final PotionEffectType MINING_FATIGUE = getPotionEffectType("mining_fatigue", 4); + public static final PotionEffectType MINING_FATIGUE = getPotionEffectType(4, "mining_fatigue"); /** * Increases damage dealt. */ - public static final PotionEffectType STRENGTH = getPotionEffectType("strength", 5); + public static final PotionEffectType STRENGTH = getPotionEffectType(5, "strength"); /** * Heals an entity. */ - public static final PotionEffectType INSTANT_HEALTH = getPotionEffectType("instant_health", 6); + public static final PotionEffectType INSTANT_HEALTH = getPotionEffectType(6, "instant_health"); /** * Hurts an entity. */ - public static final PotionEffectType INSTANT_DAMAGE = getPotionEffectType("instant_damage", 7); + public static final PotionEffectType INSTANT_DAMAGE = getPotionEffectType(7, "instant_damage"); /** * Increases jump height. */ - public static final PotionEffectType JUMP_BOOST = getPotionEffectType("jump_boost", 8); + public static final PotionEffectType JUMP_BOOST = getPotionEffectType(8, "jump_boost"); /** * Warps vision on the client. */ - public static final PotionEffectType NAUSEA = getPotionEffectType("nausea", 9); + public static final PotionEffectType NAUSEA = getPotionEffectType(9, "nausea"); /** * Regenerates health. */ - public static final PotionEffectType REGENERATION = getPotionEffectType("regeneration", 10); + public static final PotionEffectType REGENERATION = getPotionEffectType(10, "regeneration"); /** * Decreases damage dealt to an entity. */ - public static final PotionEffectType RESISTANCE = getPotionEffectType("resistance", 11); + public static final PotionEffectType RESISTANCE = getPotionEffectType(11, "resistance"); /** * Stops fire damage. */ - public static final PotionEffectType FIRE_RESISTANCE = getPotionEffectType("fire_resistance", 12); + public static final PotionEffectType FIRE_RESISTANCE = getPotionEffectType(12, "fire_resistance"); /** * Allows breathing underwater. */ - public static final PotionEffectType WATER_BREATHING = getPotionEffectType("water_breathing", 13); + public static final PotionEffectType WATER_BREATHING = getPotionEffectType(13, "water_breathing"); /** * Grants invisibility. */ - public static final PotionEffectType INVISIBILITY = getPotionEffectType("invisibility", 14); + public static final PotionEffectType INVISIBILITY = getPotionEffectType(14, "invisibility"); /** * Blinds an entity. */ - public static final PotionEffectType BLINDNESS = getPotionEffectType("blindness", 15); + public static final PotionEffectType BLINDNESS = getPotionEffectType(15, "blindness"); /** * Allows an entity to see in the dark. */ - public static final PotionEffectType NIGHT_VISION = getPotionEffectType("night_vision", 16); + public static final PotionEffectType NIGHT_VISION = getPotionEffectType(16, "night_vision"); /** * Increases hunger. */ - public static final PotionEffectType HUNGER = getPotionEffectType("hunger", 17); + public static final PotionEffectType HUNGER = getPotionEffectType(17, "hunger"); /** * Decreases damage dealt by an entity. */ - public static final PotionEffectType WEAKNESS = getPotionEffectType("weakness", 18); + public static final PotionEffectType WEAKNESS = getPotionEffectType(18, "weakness"); /** * Deals damage to an entity over time. */ - public static final PotionEffectType POISON = getPotionEffectType("poison", 19); + public static final PotionEffectType POISON = getPotionEffectType(19, "poison"); /** * Deals damage to an entity over time and gives the health to the * shooter. */ - public static final PotionEffectType WITHER = getPotionEffectType("wither", 20); + public static final PotionEffectType WITHER = getPotionEffectType(20, "wither"); /** * Increases the maximum health of an entity. */ - public static final PotionEffectType HEALTH_BOOST = getPotionEffectType("health_boost", 21); + public static final PotionEffectType HEALTH_BOOST = getPotionEffectType(21, "health_boost"); /** * Increases the maximum health of an entity with health that cannot be * regenerated, but is refilled every 30 seconds. */ - public static final PotionEffectType ABSORPTION = getPotionEffectType("absorption", 22); + public static final PotionEffectType ABSORPTION = getPotionEffectType(22, "absorption"); /** * Increases the food level of an entity each tick. */ - public static final PotionEffectType SATURATION = getPotionEffectType("saturation", 23); + public static final PotionEffectType SATURATION = getPotionEffectType(23, "saturation"); /** * Outlines the entity so that it can be seen from afar. */ - public static final PotionEffectType GLOWING = getPotionEffectType("glowing", 24); + public static final PotionEffectType GLOWING = getPotionEffectType(24, "glowing"); /** * Causes the entity to float into the air. */ - public static final PotionEffectType LEVITATION = getPotionEffectType("levitation", 25); + public static final PotionEffectType LEVITATION = getPotionEffectType(25, "levitation"); /** * Loot table luck. */ - public static final PotionEffectType LUCK = getPotionEffectType("luck", 26); + public static final PotionEffectType LUCK = getPotionEffectType(26, "luck"); /** * Loot table unluck. */ - public static final PotionEffectType UNLUCK = getPotionEffectType("unluck", 27); + public static final PotionEffectType UNLUCK = getPotionEffectType(27, "unluck"); /** * Slows entity fall rate. */ - public static final PotionEffectType SLOW_FALLING = getPotionEffectType("slow_falling", 28); + public static final PotionEffectType SLOW_FALLING = getPotionEffectType(28, "slow_falling"); /** * Effects granted by a nearby conduit. Includes enhanced underwater abilities. */ - public static final PotionEffectType CONDUIT_POWER = getPotionEffectType("conduit_power", 29); + public static final PotionEffectType CONDUIT_POWER = getPotionEffectType(29, "conduit_power"); /** * Squee'ek uh'k kk'kkkk squeek eee'eek. */ - public static final PotionEffectType DOLPHINS_GRACE = getPotionEffectType("dolphins_grace", 30); + public static final PotionEffectType DOLPHINS_GRACE = getPotionEffectType(30, "dolphins_grace"); /** * oof. */ - public static final PotionEffectType BAD_OMEN = getPotionEffectType("bad_omen", 31); + public static final PotionEffectType BAD_OMEN = getPotionEffectType(31, "bad_omen"); /** * \o/. */ - public static final PotionEffectType HERO_OF_THE_VILLAGE = getPotionEffectType("hero_of_the_village", 32); + public static final PotionEffectType HERO_OF_THE_VILLAGE = getPotionEffectType(32, "hero_of_the_village"); - private static PotionEffectType getPotionEffectType(@NotNull String key, int typeId) { + private static PotionEffectType getPotionEffectType(int typeId, @NotNull String key) { NamespacedKey namespacedKey = NamespacedKey.minecraft(key); PotionEffectType potionEffectType = Registry.POTION_EFFECT_TYPE.get(namespacedKey); Preconditions.checkNotNull(potionEffectType, "No PotionEffectType found for %s. This is a bug.", namespacedKey); @@ -247,6 +248,18 @@ public abstract class PotionEffectType implements Keyed { @Deprecated public abstract String getName(); + /** + * Gets the PotionEffectType at the specified key + * + * @param key key to fetch + * @return Resulting PotionEffectType, or null if not found + */ + @Contract("null -> null") + @Nullable + public static PotionEffectType getByKey(@Nullable NamespacedKey key) { + return Registry.POTION_EFFECT_TYPE.get(key); + } + /** * Gets the effect type specified by the unique id. * diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java index 7277f62d..ff3fcb26 100644 --- a/src/main/java/org/bukkit/scoreboard/Objective.java +++ b/src/main/java/org/bukkit/scoreboard/Objective.java @@ -130,7 +130,7 @@ public interface Objective { * @return Score tracking the Objective and entry specified * @throws IllegalArgumentException if entry is null * @throws IllegalStateException if this objective has been unregistered - * @throws IllegalArgumentException if entry is longer than 40 characters. + * @throws IllegalArgumentException if entry is longer than 32767 characters. */ @NotNull Score getScore(@NotNull String entry) throws IllegalArgumentException, IllegalStateException; diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java index d283f694..5c855dbd 100644 --- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java +++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java @@ -17,7 +17,7 @@ public interface Scoreboard { * @param criteria Criteria for the Objective * @return The registered Objective * @throws IllegalArgumentException if name is null - * @throws IllegalArgumentException if name is longer than 16 + * @throws IllegalArgumentException if name is longer than 32767 * characters. * @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if an objective by that name already @@ -36,7 +36,7 @@ public interface Scoreboard { * @param displayName Name displayed to players for the Objective. * @return The registered Objective * @throws IllegalArgumentException if name is null - * @throws IllegalArgumentException if name is longer than 16 + * @throws IllegalArgumentException if name is longer than 32767 * characters. * @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if displayName is null @@ -57,7 +57,7 @@ public interface Scoreboard { * @param renderType Manner of rendering the Objective * @return The registered Objective * @throws IllegalArgumentException if name is null - * @throws IllegalArgumentException if name is longer than 16 + * @throws IllegalArgumentException if name is longer than 32767 * characters. * @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if displayName is null