From 348c8550967380d9843e365e769f67eee8a8e474 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 27 Oct 2024 09:43:00 +0100 Subject: Readd last API patch (with TODO) --- .../0400-API-for-updating-recipes-on-clients.patch | 169 + patches/api/0400-Add-PlayerFailMoveEvent.patch | 125 - patches/api/0401-Add-PlayerFailMoveEvent.patch | 125 + ...01-Fix-custom-statistic-criteria-creation.patch | 30 - ...02-Fix-custom-statistic-criteria-creation.patch | 30 + patches/api/0402-SculkCatalyst-bloom-API.patch | 25 - .../0403-API-for-an-entity-s-scoreboard-name.patch | 28 - patches/api/0403-SculkCatalyst-bloom-API.patch | 25 + .../0404-API-for-an-entity-s-scoreboard-name.patch | 28 + ...nd-replace-methods-with-old-StructureType.patch | 159 - patches/api/0405-Add-Listing-API-for-Player.patch | 43 - ...nd-replace-methods-with-old-StructureType.patch | 159 + patches/api/0406-Add-Listing-API-for-Player.patch | 43 + ...clicked-BlockFace-during-BlockDamageEvent.patch | 52 - ...clicked-BlockFace-during-BlockDamageEvent.patch | 52 + patches/api/0407-Fix-NPE-on-Boat-getStatus.patch | 18 - patches/api/0408-Expand-Pose-API.patch | 53 - patches/api/0408-Fix-NPE-on-Boat-getStatus.patch | 18 + patches/api/0409-Expand-Pose-API.patch | 53 + .../0409-MerchantRecipe-add-copy-constructor.patch | 24 - .../0410-MerchantRecipe-add-copy-constructor.patch | 24 + patches/api/0410-More-DragonBattle-API.patch | 55 - patches/api/0411-Add-PlayerPickItemEvent.patch | 105 - patches/api/0411-More-DragonBattle-API.patch | 55 + patches/api/0412-Add-PlayerPickItemEvent.patch | 105 + patches/api/0412-Allow-trident-custom-damage.patch | 34 - patches/api/0413-Allow-trident-custom-damage.patch | 34 + ...413-Expose-hand-during-BlockCanBuildEvent.patch | 54 - ...414-Expose-hand-during-BlockCanBuildEvent.patch | 54 + ...4-Limit-setBurnTime-to-valid-short-values.patch | 21 - .../api/0415-Add-OfflinePlayer-isConnected.patch | 38 - ...5-Limit-setBurnTime-to-valid-short-values.patch | 21 + .../api/0416-Add-OfflinePlayer-isConnected.patch | 38 + ...6-Add-titleOverride-to-InventoryOpenEvent.patch | 52 - ...7-Add-titleOverride-to-InventoryOpenEvent.patch | 52 + ...llow-proper-checking-of-empty-item-stacks.patch | 36 - ...llow-proper-checking-of-empty-item-stacks.patch | 36 + ...wapHandItemsEvent-throwing-exception-when.patch | 47 - .../api/0419-Add-player-idle-duration-API.patch | 41 - ...wapHandItemsEvent-throwing-exception-when.patch | 47 + ...get-the-collision-shape-of-a-block-before.patch | 31 - .../api/0420-Add-player-idle-duration-API.patch | 41 + ...get-the-collision-shape-of-a-block-before.patch | 31 + ...-Add-predicate-for-blocks-when-raytracing.patch | 116 - ...to-fish-event-for-all-player-interactions.patch | 22 - ...-Add-predicate-for-blocks-when-raytracing.patch | 116 + ...to-fish-event-for-all-player-interactions.patch | 22 + .../0423-Attribute-Modifier-API-improvements.patch | 88 - .../0424-Attribute-Modifier-API-improvements.patch | 88 + patches/api/0424-Expand-LingeringPotion-API.patch | 45 - patches/api/0425-Expand-LingeringPotion-API.patch | 45 + ...cessary-durability-check-in-ItemStack-isS.patch | 23 - patches/api/0426-Add-Structure-check-API.patch | 41 - ...cessary-durability-check-in-ItemStack-isS.patch | 23 + patches/api/0427-Add-Structure-check-API.patch | 41 + .../api/0427-Experimental-annotations-change.patch | 203 - patches/api/0428-Add-more-scoreboard-API.patch | 90 - .../api/0428-Experimental-annotations-change.patch | 203 + patches/api/0429-Add-more-scoreboard-API.patch | 90 + patches/api/0429-Improve-Registry.patch | 239 - patches/api/0430-Add-experience-points-API.patch | 56 - patches/api/0430-Improve-Registry.patch | 239 + patches/api/0431-Add-experience-points-API.patch | 56 + patches/api/0431-Add-missing-InventoryType.patch | 24 - patches/api/0432-Add-drops-to-shear-events.patch | 103 - patches/api/0432-Add-missing-InventoryType.patch | 24 + patches/api/0433-Add-HiddenPotionEffect-API.patch | 170 - patches/api/0433-Add-drops-to-shear-events.patch | 103 + patches/api/0434-Add-HiddenPotionEffect-API.patch | 170 + .../api/0434-Add-PlayerShieldDisableEvent.patch | 113 - .../api/0435-Add-PlayerShieldDisableEvent.patch | 113 + ...-for-empty-String-in-NamespacedKey.fromSt.patch | 60 - .../0436-Add-BlockStateMeta-clearBlockState.patch | 24 - ...-for-empty-String-in-NamespacedKey.fromSt.patch | 60 + .../0437-Add-BlockStateMeta-clearBlockState.patch | 24 + .../0437-Expose-LootTable-of-DecoratedPot.patch | 19 - patches/api/0438-Add-ShulkerDuplicateEvent.patch | 80 - .../0438-Expose-LootTable-of-DecoratedPot.patch | 19 + patches/api/0439-Add-ShulkerDuplicateEvent.patch | 80 + ...0439-Add-api-for-spawn-egg-texture-colors.patch | 28 - patches/api/0440-Add-Lifecycle-Event-system.patch | 646 - ...0440-Add-api-for-spawn-egg-texture-colors.patch | 28 + patches/api/0441-Add-Lifecycle-Event-system.patch | 646 + patches/api/0441-ItemStack-Tooltip-API.patch | 148 - ...tChunkSnapshot-includeLightData-parameter.patch | 34 - patches/api/0442-ItemStack-Tooltip-API.patch | 148 + patches/api/0443-Add-FluidState-API.patch | 165 - ...tChunkSnapshot-includeLightData-parameter.patch | 34 + patches/api/0444-Add-FluidState-API.patch | 165 + patches/api/0444-add-number-format-api.patch | 234 - patches/api/0445-add-number-format-api.patch | 234 + patches/api/0445-improve-BanList-types.patch | 133 - patches/api/0446-Suspicious-Effect-Entry-API.patch | 220 - patches/api/0446-improve-BanList-types.patch | 133 + patches/api/0447-Fix-DamageSource-API.patch | 31 - patches/api/0447-Suspicious-Effect-Entry-API.patch | 220 + patches/api/0448-Expanded-Hopper-API.patch | 32 - patches/api/0448-Fix-DamageSource-API.patch | 31 + ...one-mutables-to-prevent-unexpected-issues.patch | 151 - patches/api/0449-Expanded-Hopper-API.patch | 32 + .../0450-Add-BlockBreakProgressUpdateEvent.patch | 69 - ...one-mutables-to-prevent-unexpected-issues.patch | 151 + .../0451-Add-BlockBreakProgressUpdateEvent.patch | 69 + patches/api/0451-Deprecate-ItemStack-setType.patch | 54 - patches/api/0452-Deprecate-ItemStack-setType.patch | 54 + patches/api/0452-Item-Mutation-Fixes.patch | 50 - .../api/0453-API-for-checking-sent-chunks.patch | 58 - patches/api/0453-Item-Mutation-Fixes.patch | 50 + .../api/0454-API-for-checking-sent-chunks.patch | 58 + patches/api/0454-Add-CartographyItemEvent.patch | 45 - patches/api/0455-Add-CartographyItemEvent.patch | 45 + patches/api/0455-More-Raid-API.patch | 62 - .../api/0456-Fix-SpawnerEntry-Equipment-API.patch | 45 - patches/api/0456-More-Raid-API.patch | 62 + patches/api/0457-Fix-ItemFlags.patch | 66 - .../api/0457-Fix-SpawnerEntry-Equipment-API.patch | 45 + ...ow-modifying-library-loader-jars-bytecode.patch | 34 - patches/api/0458-Fix-ItemFlags.patch | 66 + .../api/0459-Add-hook-to-remap-library-jars.patch | 38 - ...ow-modifying-library-loader-jars-bytecode.patch | 34 + patches/api/0460-Add-GameMode-isInvulnerable.patch | 27 - .../api/0460-Add-hook-to-remap-library-jars.patch | 38 + patches/api/0461-Add-GameMode-isInvulnerable.patch | 27 + .../0461-Expose-hasColor-to-leather-armor.patch | 24 - ...-Added-API-to-get-player-ha-proxy-address.patch | 27 - .../0462-Expose-hasColor-to-leather-armor.patch | 24 + ...-Added-API-to-get-player-ha-proxy-address.patch | 27 + patches/api/0463-More-Chest-Block-API.patch | 44 - patches/api/0464-Brigadier-based-command-API.patch | 2073 -- patches/api/0464-More-Chest-Block-API.patch | 44 + patches/api/0465-Brigadier-based-command-API.patch | 2073 ++ patches/api/0465-Fix-issues-with-recipe-API.patch | 443 - .../0466-Fix-equipment-slot-and-group-API.patch | 125 - patches/api/0466-Fix-issues-with-recipe-API.patch | 443 + ...kkit-plugin-to-use-Paper-PluginLoader-API.patch | 91 - .../0467-Fix-equipment-slot-and-group-API.patch | 125 + ...kkit-plugin-to-use-Paper-PluginLoader-API.patch | 91 + patches/api/0468-General-ItemMeta-fixes.patch | 129 - .../api/0469-Add-missing-fishing-event-state.patch | 24 - patches/api/0469-General-ItemMeta-fixes.patch | 129 + .../api/0470-Add-missing-fishing-event-state.patch | 24 + ...Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch | 20 - ...Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch | 20 + patches/api/0471-Registry-Modification-API.patch | 912 - ...472-Introduce-registry-entry-and-builders.patch | 501 - patches/api/0472-Registry-Modification-API.patch | 912 + ...473-Introduce-registry-entry-and-builders.patch | 501 + .../0473-Proxy-ItemStack-to-CraftItemStack.patch | 474 - ...C-view-accessible-directly-from-ItemStack.patch | 428 - .../0474-Proxy-ItemStack-to-CraftItemStack.patch | 474 + patches/api/0475-Fix-HelpCommand-searching.patch | 46 - ...C-view-accessible-directly-from-ItemStack.patch | 428 + patches/api/0476-Fix-HelpCommand-searching.patch | 46 + patches/api/0476-add-Plugin-getDataPath.patch | 30 - .../api/0477-Fix-PickupStatus-getting-reset.patch | 25 - patches/api/0477-add-Plugin-getDataPath.patch | 30 + ...-for-CanPlaceOn-and-CanDestroy-NBT-values.patch | 332 - .../api/0478-Fix-PickupStatus-getting-reset.patch | 25 + ...-for-CanPlaceOn-and-CanDestroy-NBT-values.patch | 332 + ...rove-StandardMessenger-exception-messages.patch | 56 - .../api/0480-Add-even-more-Enchantment-API.patch | 69 - ...rove-StandardMessenger-exception-messages.patch | 56 + .../api/0481-Add-even-more-Enchantment-API.patch | 69 + patches/api/0481-Leashable-API.patch | 75 - .../api/0482-Add-enchantment-seed-update-API.patch | 26 - patches/api/0482-Leashable-API.patch | 75 + .../api/0483-Add-enchantment-seed-update-API.patch | 26 + ...e-for-removal-all-OldEnum-related-methods.patch | 173 - patches/api/0484-Add-FeatureFlag-API.patch | 373 - ...e-for-removal-all-OldEnum-related-methods.patch | 173 + patches/api/0485-Add-FeatureFlag-API.patch | 373 + patches/api/0485-Tag-Lifecycle-Events.patch | 412 - patches/api/0486-Item-serialization-as-json.patch | 47 - patches/api/0486-Tag-Lifecycle-Events.patch | 412 + patches/api/0487-Item-serialization-as-json.patch | 47 + .../api/0487-create-TileStateInventoryHolder.patch | 227 - ...tWithLevels-with-enchantment-registry-set.patch | 60 - .../api/0488-create-TileStateInventoryHolder.patch | 227 + ...tWithLevels-with-enchantment-registry-set.patch | 60 + patches/api/0489-Improve-entity-effect-API.patch | 140 - patches/api/0490-Add-recipeBrewTime.patch | 158 - patches/api/0490-Improve-entity-effect-API.patch | 140 + .../0491-Add-PlayerInsertLecternBookEvent.patch | 108 - patches/api/0491-Add-recipeBrewTime.patch | 158 + .../0492-Add-PlayerInsertLecternBookEvent.patch | 108 + .../api/0492-Void-damage-configuration-API.patch | 65 - patches/api/0493-Add-Offline-PDC-API.patch | 40 - .../api/0493-Void-damage-configuration-API.patch | 65 + ...vilView-bypassEnchantmentLevelRestriction.patch | 42 - patches/api/0494-Add-Offline-PDC-API.patch | 40 + ...vilView-bypassEnchantmentLevelRestriction.patch | 42 + patches/api/0495-fix-DamageTypeTags-init.patch | 21 - patches/api/0496-fix-DamageTypeTags-init.patch | 21 + .../0845-API-for-updating-recipes-on-clients.patch | 112 + ...45-Fix-custom-statistic-criteria-creation.patch | 25 - patches/server/0846-Bandaid-fix-for-Effect.patch | 179 - ...46-Fix-custom-statistic-criteria-creation.patch | 25 + patches/server/0847-Bandaid-fix-for-Effect.patch | 179 + patches/server/0847-SculkCatalyst-bloom-API.patch | 33 - .../0848-API-for-an-entity-s-scoreboard-name.patch | 24 - patches/server/0848-SculkCatalyst-bloom-API.patch | 33 + .../0849-API-for-an-entity-s-scoreboard-name.patch | 24 + ...nd-replace-methods-with-old-StructureType.patch | 54 - ...nd-replace-methods-with-old-StructureType.patch | 54 + ...omplete-namespaced-commands-if-send-names.patch | 28 - ...omplete-namespaced-commands-if-send-names.patch | 28 + ...operly-handle-BlockBreakEvent-isDropItems.patch | 162 - ...-Fire-entity-death-event-for-ender-dragon.patch | 25 - ...operly-handle-BlockBreakEvent-isDropItems.patch | 162 + ...ble-entity-tracking-range-by-Y-coordinate.patch | 30 - ...-Fire-entity-death-event-for-ender-dragon.patch | 25 + .../server/0854-Add-Listing-API-for-Player.patch | 186 - ...ble-entity-tracking-range-by-Y-coordinate.patch | 30 + .../server/0855-Add-Listing-API-for-Player.patch | 186 + ...55-Configurable-Region-Compression-Format.patch | 39 - .../0856-Add-BlockFace-to-BlockDamageEvent.patch | 39 - ...56-Configurable-Region-Compression-Format.patch | 39 + .../0857-Add-BlockFace-to-BlockDamageEvent.patch | 39 + .../server/0857-Fix-NPE-on-Boat-getStatus.patch | 32 - patches/server/0858-Expand-Pose-API.patch | 51 - .../server/0858-Fix-NPE-on-Boat-getStatus.patch | 32 + patches/server/0859-Expand-Pose-API.patch | 51 + patches/server/0859-More-DragonBattle-API.patch | 91 - patches/server/0860-Add-PlayerPickItemEvent.patch | 48 - patches/server/0860-More-DragonBattle-API.patch | 91 + patches/server/0861-Add-PlayerPickItemEvent.patch | 48 + .../server/0861-Allow-trident-custom-damage.patch | 39 - .../server/0862-Allow-trident-custom-damage.patch | 39 + .../0862-Expose-hand-in-BlockCanBuildEvent.patch | 32 - .../0863-Expose-hand-in-BlockCanBuildEvent.patch | 32 + ...timize-nearest-structure-border-iteration.patch | 39 - .../0864-Implement-OfflinePlayer-isConnected.patch | 42 - ...timize-nearest-structure-border-iteration.patch | 39 + patches/server/0865-Fix-slot-desync.patch | 129 - .../0865-Implement-OfflinePlayer-isConnected.patch | 42 + ...6-Add-titleOverride-to-InventoryOpenEvent.patch | 120 - patches/server/0866-Fix-slot-desync.patch | 129 + ...7-Add-titleOverride-to-InventoryOpenEvent.patch | 120 + .../0867-Configure-sniffer-egg-hatch-time.patch | 28 - .../0868-Configure-sniffer-egg-hatch-time.patch | 28 + ...portal-proximity-check-before-entity-look.patch | 75 - ...portal-proximity-check-before-entity-look.patch | 75 + ...0869-Skip-POI-finding-if-stuck-in-vehicle.patch | 32 - ...dd-slot-sanity-checks-in-container-clicks.patch | 43 - ...0870-Skip-POI-finding-if-stuck-in-vehicle.patch | 32 + ...dd-slot-sanity-checks-in-container-clicks.patch | 43 + ...871-Call-BlockRedstoneEvents-for-lecterns.patch | 27 - ...llow-proper-checking-of-empty-item-stacks.patch | 31 - ...872-Call-BlockRedstoneEvents-for-lecterns.patch | 27 + ...llow-proper-checking-of-empty-item-stacks.patch | 31 + ...0873-Fix-silent-equipment-change-for-mobs.patch | 113 - ...0874-Fix-silent-equipment-change-for-mobs.patch | 113 + .../server/0874-Fix-spigot-s-Forced-Stats.patch | 54 - ...d-missing-InventoryHolders-to-inventories.patch | 314 - .../server/0875-Fix-spigot-s-Forced-Stats.patch | 54 + ...d-missing-InventoryHolders-to-inventories.patch | 314 + ...-tile-entities-in-chunks-that-are-positio.patch | 43 - ...dd-missing-logs-for-log-ips-config-option.patch | 37 - ...-tile-entities-in-chunks-that-are-positio.patch | 43 + ...dd-missing-logs-for-log-ips-config-option.patch | 37 + ...ndition-on-UpgradeData.BlockFixers-class-.patch | 27 - ...NPE-in-AdvancementProgress-getDateAwarded.patch | 19 - ...ndition-on-UpgradeData.BlockFixers-class-.patch | 27 + ...NPE-in-AdvancementProgress-getDateAwarded.patch | 19 + ...team-sidebar-objectives-not-being-cleared.patch | 25 - ...881-Fix-missing-map-initialize-event-call.patch | 48 - ...team-sidebar-objectives-not-being-cleared.patch | 25 + ...882-Fix-missing-map-initialize-event-call.patch | 48 + ...ty-data-when-attaching-firework-to-entity.patch | 23 - .../0883-Fix-UnsafeValues-loadAdvancement.patch | 43 - ...ty-data-when-attaching-firework-to-entity.patch | 23 + .../server/0884-Add-player-idle-duration-API.patch | 30 - .../0884-Fix-UnsafeValues-loadAdvancement.patch | 43 + .../server/0885-Add-player-idle-duration-API.patch | 30 + ...-check-if-we-can-see-non-visible-entities.patch | 19 - ...-check-if-we-can-see-non-visible-entities.patch | 19 + ...6-Fix-NPE-in-SculkBloomEvent-world-access.patch | 43 - ...-itemstack-for-Player-sendEquipmentChange.patch | 19 - ...7-Fix-NPE-in-SculkBloomEvent-world-access.patch | 43 + ...-itemstack-for-Player-sendEquipmentChange.patch | 19 + patches/server/0888-Optimize-VarInts.patch | 52 - ...get-the-collision-shape-of-a-block-before.patch | 32 - patches/server/0889-Optimize-VarInts.patch | 52 + ...get-the-collision-shape-of-a-block-before.patch | 32 + ...-Add-predicate-for-blocks-when-raytracing.patch | 116 - ...-Add-predicate-for-blocks-when-raytracing.patch | 116 + ...ake-item-packets-with-collector-as-source.patch | 20 - ...ake-item-packets-with-collector-as-source.patch | 20 + .../server/0892-Expand-LingeringPotion-API.patch | 19 - .../server/0893-Expand-LingeringPotion-API.patch | 19 + ...ightningEffect-powers-lightning-rods-and-.patch | 72 - ...to-fish-event-for-all-player-interactions.patch | 75 - ...ightningEffect-powers-lightning-rods-and-.patch | 72 + ...to-fish-event-for-all-player-interactions.patch | 75 + ...-Fix-several-issues-with-EntityBreedEvent.patch | 118 - .../0896-Add-UUID-attribute-modifier-API.patch | 142 - ...-Fix-several-issues-with-EntityBreedEvent.patch | 118 + .../0897-Add-UUID-attribute-modifier-API.patch | 142 + ...issing-event-call-for-entity-teleport-API.patch | 28 - ...issing-event-call-for-entity-teleport-API.patch | 28 + ...-Lazily-create-LootContext-for-criterions.patch | 30 - ...99-Don-t-fire-sync-events-during-worldgen.patch | 208 - ...-Lazily-create-LootContext-for-criterions.patch | 30 + patches/server/0900-Add-Structure-check-API.patch | 26 - ...00-Don-t-fire-sync-events-during-worldgen.patch | 208 + patches/server/0901-Add-Structure-check-API.patch | 26 + ...taItem-getAttributeModifier-duplication-c.patch | 19 - ...taItem-getAttributeModifier-duplication-c.patch | 19 + ...902-Restore-vanilla-entity-drops-behavior.patch | 269 - .../0903-Dont-resend-blocks-on-interactions.patch | 171 - ...903-Restore-vanilla-entity-drops-behavior.patch | 269 + .../0904-Dont-resend-blocks-on-interactions.patch | 171 + patches/server/0904-add-more-scoreboard-API.patch | 79 - patches/server/0905-Improve-Registry.patch | 102 - patches/server/0905-add-more-scoreboard-API.patch | 79 + ...x-NPE-on-null-loc-for-EntityTeleportEvent.patch | 66 - patches/server/0906-Improve-Registry.patch | 102 + .../server/0907-Add-experience-points-API.patch | 73 - ...x-NPE-on-null-loc-for-EntityTeleportEvent.patch | 66 + .../server/0908-Add-drops-to-shear-events.patch | 400 - .../server/0908-Add-experience-points-API.patch | 73 + .../server/0909-Add-PlayerShieldDisableEvent.patch | 53 - .../server/0909-Add-drops-to-shear-events.patch | 400 + .../server/0910-Add-PlayerShieldDisableEvent.patch | 53 + ...-Validate-ResourceLocation-in-NBT-reading.patch | 173 - ...handle-experience-dropping-on-block-break.patch | 94 - ...-Validate-ResourceLocation-in-NBT-reading.patch | 173 + .../server/0912-Fixup-NamespacedKey-handling.patch | 170 - ...handle-experience-dropping-on-block-break.patch | 94 + .../0913-Expose-LootTable-of-DecoratedPot.patch | 44 - .../server/0913-Fixup-NamespacedKey-handling.patch | 170 + .../0914-Expose-LootTable-of-DecoratedPot.patch | 44 + ...uce-allocation-of-Vec3D-by-entity-tracker.patch | 59 - ...-PlayerTradeEvent-and-PlayerPurchaseEvent.patch | 240 - ...uce-allocation-of-Vec3D-by-entity-tracker.patch | 59 + ...-PlayerTradeEvent-and-PlayerPurchaseEvent.patch | 240 + .../server/0916-Add-ShulkerDuplicateEvent.patch | 22 - .../server/0917-Add-ShulkerDuplicateEvent.patch | 22 + ...0917-Add-api-for-spawn-egg-texture-colors.patch | 26 - .../server/0918-Add-Lifecycle-Event-system.patch | 785 - ...0918-Add-api-for-spawn-egg-texture-colors.patch | 26 + .../server/0919-Add-Lifecycle-Event-system.patch | 785 + patches/server/0919-ItemStack-Tooltip-API.patch | 32 - ...tChunkSnapshot-includeLightData-parameter.patch | 70 - patches/server/0920-ItemStack-Tooltip-API.patch | 32 + patches/server/0921-Add-FluidState-API.patch | 208 - ...tChunkSnapshot-includeLightData-parameter.patch | 70 + patches/server/0922-Add-FluidState-API.patch | 208 + patches/server/0922-add-number-format-api.patch | 138 - patches/server/0923-add-number-format-api.patch | 138 + patches/server/0923-improve-BanList-types.patch | 32 - patches/server/0924-Expanded-Hopper-API.patch | 31 - patches/server/0924-improve-BanList-types.patch | 32 + .../0925-Add-BlockBreakProgressUpdateEvent.patch | 28 - patches/server/0925-Expanded-Hopper-API.patch | 31 + .../0926-Add-BlockBreakProgressUpdateEvent.patch | 28 + .../server/0926-Deprecate-ItemStack-setType.patch | 35 - patches/server/0927-Add-CartographyItemEvent.patch | 43 - .../server/0927-Deprecate-ItemStack-setType.patch | 35 + patches/server/0928-Add-CartographyItemEvent.patch | 43 + patches/server/0928-More-Raid-API.patch | 106 - ...boarding-message-for-initial-server-start.patch | 103 - patches/server/0929-More-Raid-API.patch | 106 + ...boarding-message-for-initial-server-start.patch | 103 + .../0930-Configurable-max-block-fluid-ticks.patch | 22 - .../0931-Configurable-max-block-fluid-ticks.patch | 22 + .../server/0931-Fix-bees-aging-inside-hives.patch | 41 - .../0932-Disable-memory-reserve-allocating.patch | 19 - .../server/0932-Fix-bees-aging-inside-hives.patch | 41 + .../0933-Disable-memory-reserve-allocating.patch | 19 + ...DamageByEntityEvent-for-unowned-wither-sk.patch | 19 - ...DamageByEntityEvent-for-unowned-wither-sk.patch | 19 + patches/server/0934-Fix-DamageSource-API.patch | 234 - patches/server/0935-Fix-DamageSource-API.patch | 234 + ...n-of-invalid-block-entity-during-world-ge.patch | 59 - ...n-of-invalid-block-entity-during-world-ge.patch | 59 + ...ble-StackOverflowError-for-some-dispenses.patch | 95 - ...ble-StackOverflowError-for-some-dispenses.patch | 95 + .../server/0937-Improve-tag-parser-handling.patch | 285 - .../server/0938-Improve-tag-parser-handling.patch | 285 + patches/server/0938-Item-Mutation-Fixes.patch | 38 - patches/server/0939-Item-Mutation-Fixes.patch | 38 + .../0939-Per-world-ticks-per-spawn-settings.patch | 35 - .../0940-Per-world-ticks-per-spawn-settings.patch | 35 + ...ack-the-changed-item-from-dispense-events.patch | 104 - ...ack-the-changed-item-from-dispense-events.patch | 104 + ...rock-and-End-Portal-Frames-from-being-des.patch | 169 - ...config-for-mobs-immune-to-default-effects.patch | 44 - ...rock-and-End-Portal-Frames-from-being-des.patch | 169 + ...config-for-mobs-immune-to-default-effects.patch | 44 + .../server/0943-Deep-clone-nbt-tags-in-PDC.patch | 45 - .../server/0944-Deep-clone-nbt-tags-in-PDC.patch | 45 + .../0944-Support-old-UUID-format-for-NBT.patch | 63 - .../0945-Fix-shield-disable-inconsistency.patch | 22 - .../0945-Support-old-UUID-format-for-NBT.patch | 63 + .../0946-Fix-shield-disable-inconsistency.patch | 22 + ...Handle-Large-Packets-disconnecting-client.patch | 135 - patches/server/0947-Fix-ItemFlags.patch | 199 - ...Handle-Large-Packets-disconnecting-client.patch | 135 + patches/server/0948-Fix-ItemFlags.patch | 199 + ...x-helmet-damage-reduction-inconsistencies.patch | 21 - ...x-helmet-damage-reduction-inconsistencies.patch | 21 + ...anilla-handling-of-LivingEntity-actuallyH.patch | 50 - ...anilla-handling-of-LivingEntity-actuallyH.patch | 50 + ...improve-checking-handled-tags-in-itemmeta.patch | 887 - .../0951-Expose-hasColor-to-leather-armor.patch | 38 - ...improve-checking-handled-tags-in-itemmeta.patch | 887 + ...-Added-API-to-get-player-ha-proxy-address.patch | 65 - .../0952-Expose-hasColor-to-leather-armor.patch | 38 + ...-Added-API-to-get-player-ha-proxy-address.patch | 65 + patches/server/0953-General-ItemMeta-fixes.patch | 2152 -- patches/server/0954-General-ItemMeta-fixes.patch | 2152 ++ patches/server/0954-More-Chest-Block-API.patch | 73 - patches/server/0955-More-Chest-Block-API.patch | 73 + ...int-data-component-type-on-encoding-error.patch | 24 - .../server/0956-Brigadier-based-command-API.patch | 2831 -- ...int-data-component-type-on-encoding-error.patch | 24 + .../server/0957-Brigadier-based-command-API.patch | 2831 ++ .../server/0957-Fix-issues-with-Recipe-API.patch | 102 - .../0958-Fix-equipment-slot-and-group-API.patch | 136 - .../server/0958-Fix-issues-with-Recipe-API.patch | 102 + ...kkit-plugin-to-use-Paper-PluginLoader-API.patch | 130 - .../0959-Fix-equipment-slot-and-group-API.patch | 136 + ...kkit-plugin-to-use-Paper-PluginLoader-API.patch | 130 + ...ding-oversized-item-data-in-equipment-and.patch | 236 - ...-Prevent-NPE-if-hooked-entity-was-cleared.patch | 24 - ...ding-oversized-item-data-in-equipment-and.patch | 236 + ...ncelling-BlockPlaceEvent-calling-onRemove.patch | 47 - ...-Prevent-NPE-if-hooked-entity-was-cleared.patch | 24 + .../0963-Add-missing-fishing-event-state.patch | 26 - ...ncelling-BlockPlaceEvent-calling-onRemove.patch | 47 + .../0964-Add-missing-fishing-event-state.patch | 26 + ...Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch | 26 - ...Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch | 26 + ...-disconnect-packet-in-phases-where-it-doe.patch | 21 - patches/server/0966-Adopt-MaterialRerouting.patch | 134 - ...-disconnect-packet-in-phases-where-it-doe.patch | 21 + patches/server/0967-Adopt-MaterialRerouting.patch | 134 + .../server/0967-Suspicious-Effect-Entry-API.patch | 231 - .../server/0968-Suspicious-Effect-Entry-API.patch | 231 + ...968-check-if-itemstack-is-stackable-first.patch | 19 - ...-Fix-removing-recipes-from-RecipeIterator.patch | 39 - ...969-check-if-itemstack-is-stackable-first.patch | 19 + ...ble-damage-tick-when-blocking-with-shield.patch | 19 - ...-Fix-removing-recipes-from-RecipeIterator.patch | 39 + ...ble-damage-tick-when-blocking-with-shield.patch | 19 + ...move-the-experimental-smithing-inventory-.patch | 26 - ...move-the-experimental-smithing-inventory-.patch | 26 + .../0972-disable-forced-empty-world-ticks.patch | 19 - ...InWorldBounds-and-getBlockState-for-inlin.patch | 99 - .../0973-disable-forced-empty-world-ticks.patch | 19 + ...s-in-item-frames-performance-and-bug-fixe.patch | 137 - ...InWorldBounds-and-getBlockState-for-inlin.patch | 99 + ...s-in-item-frames-performance-and-bug-fixe.patch | 137 + ...twork-Manager-and-add-advanced-packet-sup.patch | 395 - .../0976-Allow-Saving-of-Oversized-Chunks.patch | 204 - ...twork-Manager-and-add-advanced-packet-sup.patch | 395 + .../0977-Allow-Saving-of-Oversized-Chunks.patch | 204 + .../0977-Flat-bedrock-generator-settings.patch | 292 - .../server/0978-Entity-Activation-Range-2.0.patch | 807 - .../0978-Flat-bedrock-generator-settings.patch | 292 + patches/server/0979-Anti-Xray.patch | 1663 - .../server/0979-Entity-Activation-Range-2.0.patch | 807 + patches/server/0980-Anti-Xray.patch | 1663 + ...e-Velocity-compression-and-cipher-natives.patch | 375 - ...981-Optimize-Collision-to-not-load-chunks.patch | 108 - ...e-Velocity-compression-and-cipher-natives.patch | 375 + ...982-Optimize-Collision-to-not-load-chunks.patch | 108 + ...ize-GoalSelector-Goal.Flag-Set-operations.patch | 160 - ...ize-GoalSelector-Goal.Flag-Set-operations.patch | 160 + patches/server/0983-Optimize-Hoppers.patch | 664 - patches/server/0984-Optimize-Hoppers.patch | 664 + .../server/0984-Optimize-Voxel-Shape-Merging.patch | 123 - .../0985-Optimize-Bit-Operations-by-inlining.patch | 213 - .../server/0985-Optimize-Voxel-Shape-Merging.patch | 123 + .../0986-Optimize-Bit-Operations-by-inlining.patch | 213 + .../server/0986-Remove-streams-from-hot-code.patch | 215 - ...thfinder-Remove-Streams-Optimized-collect.patch | 134 - .../server/0987-Remove-streams-from-hot-code.patch | 215 + ...entity-type-tags-suggestions-in-selectors.patch | 152 - ...thfinder-Remove-Streams-Optimized-collect.patch | 134 + ...entity-type-tags-suggestions-in-selectors.patch | 152 + ...Handle-Oversized-block-entities-in-chunks.patch | 64 - ...990-Check-distance-in-entity-interactions.patch | 68 - ...Handle-Oversized-block-entities-in-chunks.patch | 64 + ...991-Check-distance-in-entity-interactions.patch | 68 + patches/server/0991-Configurable-Sand-Duping.patch | 19 - patches/server/0992-Configurable-Sand-Duping.patch | 19 + patches/server/0992-Properly-resend-entities.patch | 272 - patches/server/0993-Properly-resend-entities.patch | 272 + .../server/0993-Registry-Modification-API.patch | 1499 - .../0994-Add-registry-entry-and-builders.patch | 484 - .../server/0994-Registry-Modification-API.patch | 1499 + .../0995-Add-registry-entry-and-builders.patch | 484 + .../0995-Proxy-ItemStack-to-CraftItemStack.patch | 302 - ...C-view-accessible-directly-from-ItemStack.patch | 271 - .../0996-Proxy-ItemStack-to-CraftItemStack.patch | 302 + ...C-view-accessible-directly-from-ItemStack.patch | 271 + ...Minecraft-commands-in-function-parsing-an.patch | 135 - ...Minecraft-commands-in-function-parsing-an.patch | 135 + .../0998-optimize-dirt-and-snow-spreading.patch | 78 - .../0999-Fix-NPE-for-Jukebox-setRecord.patch | 20 - .../0999-optimize-dirt-and-snow-spreading.patch | 78 + .../1000-Fix-NPE-for-Jukebox-setRecord.patch | 20 + patches/server/1000-fix-horse-inventories.patch | 215 - ...ll-EntityDamageEvents-before-actuallyHurt.patch | 73 - patches/server/1001-fix-horse-inventories.patch | 215 + .../server/1002-Add-ItemType-getItemRarity.patch | 23 - ...ll-EntityDamageEvents-before-actuallyHurt.patch | 73 + .../server/1003-Add-ItemType-getItemRarity.patch | 23 + .../server/1003-Add-plugin-info-at-startup.patch | 64 - .../server/1004-Add-plugin-info-at-startup.patch | 64 + ...nteraction-leniency-distance-configurable.patch | 26 - .../1005-Fix-PickupStatus-getting-reset.patch | 65 - ...nteraction-leniency-distance-configurable.patch | 26 + ...lock-type-in-SculkSensorBlock-canActivate.patch | 19 - .../1006-Fix-PickupStatus-getting-reset.patch | 65 + ...-for-CanPlaceOn-and-CanDestroy-NBT-values.patch | 157 - ...lock-type-in-SculkSensorBlock-canActivate.patch | 19 + ...-for-CanPlaceOn-and-CanDestroy-NBT-values.patch | 157 + ...guration-for-horizontal-only-item-merging.patch | 28 - .../1009-Add-skipping-world-symlink-scan.patch | 21 - ...guration-for-horizontal-only-item-merging.patch | 28 + .../1010-Add-even-more-Enchantment-API.patch | 47 - .../1010-Add-skipping-world-symlink-scan.patch | 21 + .../1011-Add-even-more-Enchantment-API.patch | 47 + patches/server/1011-Leashable-API.patch | 161 - .../server/1012-Fix-CraftBukkit-drag-system.patch | 54 - patches/server/1012-Leashable-API.patch | 161 + .../server/1013-Fix-CraftBukkit-drag-system.patch | 54 + ...loomEvent-firing-for-block-entity-loading.patch | 39 - ...loomEvent-firing-for-block-entity-loading.patch | 39 + ...damage-lootable-item-function-from-compas.patch | 41 - .../1015-Add-enchantment-seed-update-API.patch | 39 - ...damage-lootable-item-function-from-compas.patch | 41 + .../1016-Add-enchantment-seed-update-API.patch | 39 + ...nise-sending-chat-to-client-with-updating.patch | 27 - .../1017-Fix-InventoryOpenEvent-cancellation.patch | 352 - ...nise-sending-chat-to-client-with-updating.patch | 27 + ...1018-Fire-BlockExpEvent-on-grindstone-use.patch | 23 - .../1018-Fix-InventoryOpenEvent-cancellation.patch | 352 + .../server/1019-Check-dead-flag-in-isAlive.patch | 29 - ...1019-Fire-BlockExpEvent-on-grindstone-use.patch | 23 + patches/server/1020-Add-FeatureFlag-API.patch | 430 - .../server/1020-Check-dead-flag-in-isAlive.patch | 29 + patches/server/1021-Add-FeatureFlag-API.patch | 430 + patches/server/1021-Tag-Lifecycle-Events.patch | 595 - .../server/1022-Item-serialization-as-json.patch | 73 - patches/server/1022-Tag-Lifecycle-Events.patch | 595 + .../server/1023-Item-serialization-as-json.patch | 73 + ...-Validate-slot-in-PlayerInventory-setSlot.patch | 26 - ...ove-wall-time-unused-skip-tick-protection.patch | 163 - ...-Validate-slot-in-PlayerInventory-setSlot.patch | 26 + ...le-pretty-printing-for-advancement-saving.patch | 22 - ...ove-wall-time-unused-skip-tick-protection.patch | 163 + ...le-pretty-printing-for-advancement-saving.patch | 22 + ...CommandPreprocessEvent-on-signed-commands.patch | 52 - ...tWithLevels-with-enchantment-registry-set.patch | 33 - ...CommandPreprocessEvent-on-signed-commands.patch | 52 + ...tWithLevels-with-enchantment-registry-set.patch | 33 + .../server/1028-Improve-entity-effect-API.patch | 154 - patches/server/1029-Add-recipeBrewTime.patch | 181 - .../server/1029-Improve-entity-effect-API.patch | 154 + patches/server/1030-Add-recipeBrewTime.patch | 181 + .../1030-Call-bucket-events-for-cauldrons.patch | 203 - .../1031-Add-PlayerInsertLecternBookEvent.patch | 36 - .../1031-Call-bucket-events-for-cauldrons.patch | 203 + .../1032-Add-PlayerInsertLecternBookEvent.patch | 36 + .../1032-Void-damage-configuration-API.patch | 93 - patches/server/1033-Add-Offline-PDC-API.patch | 45 - .../1033-Void-damage-configuration-API.patch | 93 + ...vilView-bypassEnchantmentLevelRestriction.patch | 53 - patches/server/1034-Add-Offline-PDC-API.patch | 45 + ...vilView-bypassEnchantmentLevelRestriction.patch | 53 + ...35-Add-proper-async-player-disconnections.patch | 168 - ...36-Add-proper-async-player-disconnections.patch | 168 + ...Always-send-Banner-patterns-to-the-client.patch | 42 - ...Always-send-Banner-patterns-to-the-client.patch | 42 + .../server/1037-Rewrite-dataconverter-system.patch | 30407 ---------------- .../1038-Moonrise-optimisation-patches.patch | 36236 ------------------- .../server/1038-Rewrite-dataconverter-system.patch | 30407 ++++++++++++++++ .../server/1039-API-for-checking-sent-chunks.patch | 46 - .../1039-Moonrise-optimisation-patches.patch | 36236 +++++++++++++++++++ .../server/1040-API-for-checking-sent-chunks.patch | 46 + .../1040-Fix-CraftWorld-isChunkGenerated.patch | 44 - ...d-startup-flag-to-disable-gamerule-limits.patch | 38 - .../1041-Fix-CraftWorld-isChunkGenerated.patch | 44 + ...d-startup-flag-to-disable-gamerule-limits.patch | 38 + .../server/1042-Improved-Watchdog-Support.patch | 473 - ...Detail-more-information-in-watchdog-dumps.patch | 296 - .../server/1043-Improved-Watchdog-Support.patch | 473 + ...Detail-more-information-in-watchdog-dumps.patch | 296 + .../1044-Entity-load-save-limit-per-chunk.patch | 81 - ...recalculate-regionfile-header-if-it-is-co.patch | 742 - .../1045-Entity-load-save-limit-per-chunk.patch | 81 + ...recalculate-regionfile-header-if-it-is-co.patch | 742 + patches/server/1046-Bundle-spark.patch | 371 - patches/server/1047-Bundle-spark.patch | 371 + .../1047-Improve-performance-of-mass-crafts.patch | 92 - .../1048-Improve-performance-of-mass-crafts.patch | 92 + .../0400-API-for-updating-recipes-on-clients.patch | 169 - .../0845-API-for-updating-recipes-on-clients.patch | 114 - 602 files changed, 110882 insertions(+), 110884 deletions(-) create mode 100644 patches/api/0400-API-for-updating-recipes-on-clients.patch delete mode 100644 patches/api/0400-Add-PlayerFailMoveEvent.patch create mode 100644 patches/api/0401-Add-PlayerFailMoveEvent.patch delete mode 100644 patches/api/0401-Fix-custom-statistic-criteria-creation.patch create mode 100644 patches/api/0402-Fix-custom-statistic-criteria-creation.patch delete mode 100644 patches/api/0402-SculkCatalyst-bloom-API.patch delete mode 100644 patches/api/0403-API-for-an-entity-s-scoreboard-name.patch create mode 100644 patches/api/0403-SculkCatalyst-bloom-API.patch create mode 100644 patches/api/0404-API-for-an-entity-s-scoreboard-name.patch delete mode 100644 patches/api/0404-Deprecate-and-replace-methods-with-old-StructureType.patch delete mode 100644 patches/api/0405-Add-Listing-API-for-Player.patch create mode 100644 patches/api/0405-Deprecate-and-replace-methods-with-old-StructureType.patch create mode 100644 patches/api/0406-Add-Listing-API-for-Player.patch delete mode 100644 patches/api/0406-Expose-clicked-BlockFace-during-BlockDamageEvent.patch create mode 100644 patches/api/0407-Expose-clicked-BlockFace-during-BlockDamageEvent.patch delete mode 100644 patches/api/0407-Fix-NPE-on-Boat-getStatus.patch delete mode 100644 patches/api/0408-Expand-Pose-API.patch create mode 100644 patches/api/0408-Fix-NPE-on-Boat-getStatus.patch create mode 100644 patches/api/0409-Expand-Pose-API.patch delete mode 100644 patches/api/0409-MerchantRecipe-add-copy-constructor.patch create mode 100644 patches/api/0410-MerchantRecipe-add-copy-constructor.patch delete mode 100644 patches/api/0410-More-DragonBattle-API.patch delete mode 100644 patches/api/0411-Add-PlayerPickItemEvent.patch create mode 100644 patches/api/0411-More-DragonBattle-API.patch create mode 100644 patches/api/0412-Add-PlayerPickItemEvent.patch delete mode 100644 patches/api/0412-Allow-trident-custom-damage.patch create mode 100644 patches/api/0413-Allow-trident-custom-damage.patch delete mode 100644 patches/api/0413-Expose-hand-during-BlockCanBuildEvent.patch create mode 100644 patches/api/0414-Expose-hand-during-BlockCanBuildEvent.patch delete mode 100644 patches/api/0414-Limit-setBurnTime-to-valid-short-values.patch delete mode 100644 patches/api/0415-Add-OfflinePlayer-isConnected.patch create mode 100644 patches/api/0415-Limit-setBurnTime-to-valid-short-values.patch create mode 100644 patches/api/0416-Add-OfflinePlayer-isConnected.patch delete mode 100644 patches/api/0416-Add-titleOverride-to-InventoryOpenEvent.patch create mode 100644 patches/api/0417-Add-titleOverride-to-InventoryOpenEvent.patch delete mode 100644 patches/api/0417-Allow-proper-checking-of-empty-item-stacks.patch create mode 100644 patches/api/0418-Allow-proper-checking-of-empty-item-stacks.patch delete mode 100644 patches/api/0418-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch delete mode 100644 patches/api/0419-Add-player-idle-duration-API.patch create mode 100644 patches/api/0419-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch delete mode 100644 patches/api/0420-Add-API-to-get-the-collision-shape-of-a-block-before.patch create mode 100644 patches/api/0420-Add-player-idle-duration-API.patch create mode 100644 patches/api/0421-Add-API-to-get-the-collision-shape-of-a-block-before.patch delete mode 100644 patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch delete mode 100644 patches/api/0422-Add-hand-to-fish-event-for-all-player-interactions.patch create mode 100644 patches/api/0422-Add-predicate-for-blocks-when-raytracing.patch create mode 100644 patches/api/0423-Add-hand-to-fish-event-for-all-player-interactions.patch delete mode 100644 patches/api/0423-Attribute-Modifier-API-improvements.patch create mode 100644 patches/api/0424-Attribute-Modifier-API-improvements.patch delete mode 100644 patches/api/0424-Expand-LingeringPotion-API.patch create mode 100644 patches/api/0425-Expand-LingeringPotion-API.patch delete mode 100644 patches/api/0425-Remove-unnecessary-durability-check-in-ItemStack-isS.patch delete mode 100644 patches/api/0426-Add-Structure-check-API.patch create mode 100644 patches/api/0426-Remove-unnecessary-durability-check-in-ItemStack-isS.patch create mode 100644 patches/api/0427-Add-Structure-check-API.patch delete mode 100644 patches/api/0427-Experimental-annotations-change.patch delete mode 100644 patches/api/0428-Add-more-scoreboard-API.patch create mode 100644 patches/api/0428-Experimental-annotations-change.patch create mode 100644 patches/api/0429-Add-more-scoreboard-API.patch delete mode 100644 patches/api/0429-Improve-Registry.patch delete mode 100644 patches/api/0430-Add-experience-points-API.patch create mode 100644 patches/api/0430-Improve-Registry.patch create mode 100644 patches/api/0431-Add-experience-points-API.patch delete mode 100644 patches/api/0431-Add-missing-InventoryType.patch delete mode 100644 patches/api/0432-Add-drops-to-shear-events.patch create mode 100644 patches/api/0432-Add-missing-InventoryType.patch delete mode 100644 patches/api/0433-Add-HiddenPotionEffect-API.patch create mode 100644 patches/api/0433-Add-drops-to-shear-events.patch create mode 100644 patches/api/0434-Add-HiddenPotionEffect-API.patch delete mode 100644 patches/api/0434-Add-PlayerShieldDisableEvent.patch create mode 100644 patches/api/0435-Add-PlayerShieldDisableEvent.patch delete mode 100644 patches/api/0435-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch delete mode 100644 patches/api/0436-Add-BlockStateMeta-clearBlockState.patch create mode 100644 patches/api/0436-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch create mode 100644 patches/api/0437-Add-BlockStateMeta-clearBlockState.patch delete mode 100644 patches/api/0437-Expose-LootTable-of-DecoratedPot.patch delete mode 100644 patches/api/0438-Add-ShulkerDuplicateEvent.patch create mode 100644 patches/api/0438-Expose-LootTable-of-DecoratedPot.patch create mode 100644 patches/api/0439-Add-ShulkerDuplicateEvent.patch delete mode 100644 patches/api/0439-Add-api-for-spawn-egg-texture-colors.patch delete mode 100644 patches/api/0440-Add-Lifecycle-Event-system.patch create mode 100644 patches/api/0440-Add-api-for-spawn-egg-texture-colors.patch create mode 100644 patches/api/0441-Add-Lifecycle-Event-system.patch delete mode 100644 patches/api/0441-ItemStack-Tooltip-API.patch delete mode 100644 patches/api/0442-Add-getChunkSnapshot-includeLightData-parameter.patch create mode 100644 patches/api/0442-ItemStack-Tooltip-API.patch delete mode 100644 patches/api/0443-Add-FluidState-API.patch create mode 100644 patches/api/0443-Add-getChunkSnapshot-includeLightData-parameter.patch create mode 100644 patches/api/0444-Add-FluidState-API.patch delete mode 100644 patches/api/0444-add-number-format-api.patch create mode 100644 patches/api/0445-add-number-format-api.patch delete mode 100644 patches/api/0445-improve-BanList-types.patch delete mode 100644 patches/api/0446-Suspicious-Effect-Entry-API.patch create mode 100644 patches/api/0446-improve-BanList-types.patch delete mode 100644 patches/api/0447-Fix-DamageSource-API.patch create mode 100644 patches/api/0447-Suspicious-Effect-Entry-API.patch delete mode 100644 patches/api/0448-Expanded-Hopper-API.patch create mode 100644 patches/api/0448-Fix-DamageSource-API.patch delete mode 100644 patches/api/0449-Clone-mutables-to-prevent-unexpected-issues.patch create mode 100644 patches/api/0449-Expanded-Hopper-API.patch delete mode 100644 patches/api/0450-Add-BlockBreakProgressUpdateEvent.patch create mode 100644 patches/api/0450-Clone-mutables-to-prevent-unexpected-issues.patch create mode 100644 patches/api/0451-Add-BlockBreakProgressUpdateEvent.patch delete mode 100644 patches/api/0451-Deprecate-ItemStack-setType.patch create mode 100644 patches/api/0452-Deprecate-ItemStack-setType.patch delete mode 100644 patches/api/0452-Item-Mutation-Fixes.patch delete mode 100644 patches/api/0453-API-for-checking-sent-chunks.patch create mode 100644 patches/api/0453-Item-Mutation-Fixes.patch create mode 100644 patches/api/0454-API-for-checking-sent-chunks.patch delete mode 100644 patches/api/0454-Add-CartographyItemEvent.patch create mode 100644 patches/api/0455-Add-CartographyItemEvent.patch delete mode 100644 patches/api/0455-More-Raid-API.patch delete mode 100644 patches/api/0456-Fix-SpawnerEntry-Equipment-API.patch create mode 100644 patches/api/0456-More-Raid-API.patch delete mode 100644 patches/api/0457-Fix-ItemFlags.patch create mode 100644 patches/api/0457-Fix-SpawnerEntry-Equipment-API.patch delete mode 100644 patches/api/0458-Allow-modifying-library-loader-jars-bytecode.patch create mode 100644 patches/api/0458-Fix-ItemFlags.patch delete mode 100644 patches/api/0459-Add-hook-to-remap-library-jars.patch create mode 100644 patches/api/0459-Allow-modifying-library-loader-jars-bytecode.patch delete mode 100644 patches/api/0460-Add-GameMode-isInvulnerable.patch create mode 100644 patches/api/0460-Add-hook-to-remap-library-jars.patch create mode 100644 patches/api/0461-Add-GameMode-isInvulnerable.patch delete mode 100644 patches/api/0461-Expose-hasColor-to-leather-armor.patch delete mode 100644 patches/api/0462-Added-API-to-get-player-ha-proxy-address.patch create mode 100644 patches/api/0462-Expose-hasColor-to-leather-armor.patch create mode 100644 patches/api/0463-Added-API-to-get-player-ha-proxy-address.patch delete mode 100644 patches/api/0463-More-Chest-Block-API.patch delete mode 100644 patches/api/0464-Brigadier-based-command-API.patch create mode 100644 patches/api/0464-More-Chest-Block-API.patch create mode 100644 patches/api/0465-Brigadier-based-command-API.patch delete mode 100644 patches/api/0465-Fix-issues-with-recipe-API.patch delete mode 100644 patches/api/0466-Fix-equipment-slot-and-group-API.patch create mode 100644 patches/api/0466-Fix-issues-with-recipe-API.patch delete mode 100644 patches/api/0467-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch create mode 100644 patches/api/0467-Fix-equipment-slot-and-group-API.patch create mode 100644 patches/api/0468-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch delete mode 100644 patches/api/0468-General-ItemMeta-fixes.patch delete mode 100644 patches/api/0469-Add-missing-fishing-event-state.patch create mode 100644 patches/api/0469-General-ItemMeta-fixes.patch create mode 100644 patches/api/0470-Add-missing-fishing-event-state.patch delete mode 100644 patches/api/0470-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch create mode 100644 patches/api/0471-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch delete mode 100644 patches/api/0471-Registry-Modification-API.patch delete mode 100644 patches/api/0472-Introduce-registry-entry-and-builders.patch create mode 100644 patches/api/0472-Registry-Modification-API.patch create mode 100644 patches/api/0473-Introduce-registry-entry-and-builders.patch delete mode 100644 patches/api/0473-Proxy-ItemStack-to-CraftItemStack.patch delete mode 100644 patches/api/0474-Make-a-PDC-view-accessible-directly-from-ItemStack.patch create mode 100644 patches/api/0474-Proxy-ItemStack-to-CraftItemStack.patch delete mode 100644 patches/api/0475-Fix-HelpCommand-searching.patch create mode 100644 patches/api/0475-Make-a-PDC-view-accessible-directly-from-ItemStack.patch create mode 100644 patches/api/0476-Fix-HelpCommand-searching.patch delete mode 100644 patches/api/0476-add-Plugin-getDataPath.patch delete mode 100644 patches/api/0477-Fix-PickupStatus-getting-reset.patch create mode 100644 patches/api/0477-add-Plugin-getDataPath.patch delete mode 100644 patches/api/0478-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch create mode 100644 patches/api/0478-Fix-PickupStatus-getting-reset.patch create mode 100644 patches/api/0479-Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch delete mode 100644 patches/api/0479-Improve-StandardMessenger-exception-messages.patch delete mode 100644 patches/api/0480-Add-even-more-Enchantment-API.patch create mode 100644 patches/api/0480-Improve-StandardMessenger-exception-messages.patch create mode 100644 patches/api/0481-Add-even-more-Enchantment-API.patch delete mode 100644 patches/api/0481-Leashable-API.patch delete mode 100644 patches/api/0482-Add-enchantment-seed-update-API.patch create mode 100644 patches/api/0482-Leashable-API.patch create mode 100644 patches/api/0483-Add-enchantment-seed-update-API.patch delete mode 100644 patches/api/0483-Deprecate-for-removal-all-OldEnum-related-methods.patch delete mode 100644 patches/api/0484-Add-FeatureFlag-API.patch create mode 100644 patches/api/0484-Deprecate-for-removal-all-OldEnum-related-methods.patch create mode 100644 patches/api/0485-Add-FeatureFlag-API.patch delete mode 100644 patches/api/0485-Tag-Lifecycle-Events.patch delete mode 100644 patches/api/0486-Item-serialization-as-json.patch create mode 100644 patches/api/0486-Tag-Lifecycle-Events.patch create mode 100644 patches/api/0487-Item-serialization-as-json.patch delete mode 100644 patches/api/0487-create-TileStateInventoryHolder.patch delete mode 100644 patches/api/0488-Add-enchantWithLevels-with-enchantment-registry-set.patch create mode 100644 patches/api/0488-create-TileStateInventoryHolder.patch create mode 100644 patches/api/0489-Add-enchantWithLevels-with-enchantment-registry-set.patch delete mode 100644 patches/api/0489-Improve-entity-effect-API.patch delete mode 100644 patches/api/0490-Add-recipeBrewTime.patch create mode 100644 patches/api/0490-Improve-entity-effect-API.patch delete mode 100644 patches/api/0491-Add-PlayerInsertLecternBookEvent.patch create mode 100644 patches/api/0491-Add-recipeBrewTime.patch create mode 100644 patches/api/0492-Add-PlayerInsertLecternBookEvent.patch delete mode 100644 patches/api/0492-Void-damage-configuration-API.patch delete mode 100644 patches/api/0493-Add-Offline-PDC-API.patch create mode 100644 patches/api/0493-Void-damage-configuration-API.patch delete mode 100644 patches/api/0494-Add-AnvilView-bypassEnchantmentLevelRestriction.patch create mode 100644 patches/api/0494-Add-Offline-PDC-API.patch create mode 100644 patches/api/0495-Add-AnvilView-bypassEnchantmentLevelRestriction.patch delete mode 100644 patches/api/0495-fix-DamageTypeTags-init.patch create mode 100644 patches/api/0496-fix-DamageTypeTags-init.patch create mode 100644 patches/server/0845-API-for-updating-recipes-on-clients.patch delete mode 100644 patches/server/0845-Fix-custom-statistic-criteria-creation.patch delete mode 100644 patches/server/0846-Bandaid-fix-for-Effect.patch create mode 100644 patches/server/0846-Fix-custom-statistic-criteria-creation.patch create mode 100644 patches/server/0847-Bandaid-fix-for-Effect.patch delete mode 100644 patches/server/0847-SculkCatalyst-bloom-API.patch delete mode 100644 patches/server/0848-API-for-an-entity-s-scoreboard-name.patch create mode 100644 patches/server/0848-SculkCatalyst-bloom-API.patch create mode 100644 patches/server/0849-API-for-an-entity-s-scoreboard-name.patch delete mode 100644 patches/server/0849-Deprecate-and-replace-methods-with-old-StructureType.patch create mode 100644 patches/server/0850-Deprecate-and-replace-methods-with-old-StructureType.patch delete mode 100644 patches/server/0850-Don-t-tab-complete-namespaced-commands-if-send-names.patch create mode 100644 patches/server/0851-Don-t-tab-complete-namespaced-commands-if-send-names.patch delete mode 100644 patches/server/0851-Properly-handle-BlockBreakEvent-isDropItems.patch delete mode 100644 patches/server/0852-Fire-entity-death-event-for-ender-dragon.patch create mode 100644 patches/server/0852-Properly-handle-BlockBreakEvent-isDropItems.patch delete mode 100644 patches/server/0853-Configurable-entity-tracking-range-by-Y-coordinate.patch create mode 100644 patches/server/0853-Fire-entity-death-event-for-ender-dragon.patch delete mode 100644 patches/server/0854-Add-Listing-API-for-Player.patch create mode 100644 patches/server/0854-Configurable-entity-tracking-range-by-Y-coordinate.patch create mode 100644 patches/server/0855-Add-Listing-API-for-Player.patch delete mode 100644 patches/server/0855-Configurable-Region-Compression-Format.patch delete mode 100644 patches/server/0856-Add-BlockFace-to-BlockDamageEvent.patch create mode 100644 patches/server/0856-Configurable-Region-Compression-Format.patch create mode 100644 patches/server/0857-Add-BlockFace-to-BlockDamageEvent.patch delete mode 100644 patches/server/0857-Fix-NPE-on-Boat-getStatus.patch delete mode 100644 patches/server/0858-Expand-Pose-API.patch create mode 100644 patches/server/0858-Fix-NPE-on-Boat-getStatus.patch create mode 100644 patches/server/0859-Expand-Pose-API.patch delete mode 100644 patches/server/0859-More-DragonBattle-API.patch delete mode 100644 patches/server/0860-Add-PlayerPickItemEvent.patch create mode 100644 patches/server/0860-More-DragonBattle-API.patch create mode 100644 patches/server/0861-Add-PlayerPickItemEvent.patch delete mode 100644 patches/server/0861-Allow-trident-custom-damage.patch create mode 100644 patches/server/0862-Allow-trident-custom-damage.patch delete mode 100644 patches/server/0862-Expose-hand-in-BlockCanBuildEvent.patch create mode 100644 patches/server/0863-Expose-hand-in-BlockCanBuildEvent.patch delete mode 100644 patches/server/0863-Optimize-nearest-structure-border-iteration.patch delete mode 100644 patches/server/0864-Implement-OfflinePlayer-isConnected.patch create mode 100644 patches/server/0864-Optimize-nearest-structure-border-iteration.patch delete mode 100644 patches/server/0865-Fix-slot-desync.patch create mode 100644 patches/server/0865-Implement-OfflinePlayer-isConnected.patch delete mode 100644 patches/server/0866-Add-titleOverride-to-InventoryOpenEvent.patch create mode 100644 patches/server/0866-Fix-slot-desync.patch create mode 100644 patches/server/0867-Add-titleOverride-to-InventoryOpenEvent.patch delete mode 100644 patches/server/0867-Configure-sniffer-egg-hatch-time.patch create mode 100644 patches/server/0868-Configure-sniffer-egg-hatch-time.patch delete mode 100644 patches/server/0868-Do-crystal-portal-proximity-check-before-entity-look.patch create mode 100644 patches/server/0869-Do-crystal-portal-proximity-check-before-entity-look.patch delete mode 100644 patches/server/0869-Skip-POI-finding-if-stuck-in-vehicle.patch delete mode 100644 patches/server/0870-Add-slot-sanity-checks-in-container-clicks.patch create mode 100644 patches/server/0870-Skip-POI-finding-if-stuck-in-vehicle.patch create mode 100644 patches/server/0871-Add-slot-sanity-checks-in-container-clicks.patch delete mode 100644 patches/server/0871-Call-BlockRedstoneEvents-for-lecterns.patch delete mode 100644 patches/server/0872-Allow-proper-checking-of-empty-item-stacks.patch create mode 100644 patches/server/0872-Call-BlockRedstoneEvents-for-lecterns.patch create mode 100644 patches/server/0873-Allow-proper-checking-of-empty-item-stacks.patch delete mode 100644 patches/server/0873-Fix-silent-equipment-change-for-mobs.patch create mode 100644 patches/server/0874-Fix-silent-equipment-change-for-mobs.patch delete mode 100644 patches/server/0874-Fix-spigot-s-Forced-Stats.patch delete mode 100644 patches/server/0875-Add-missing-InventoryHolders-to-inventories.patch create mode 100644 patches/server/0875-Fix-spigot-s-Forced-Stats.patch create mode 100644 patches/server/0876-Add-missing-InventoryHolders-to-inventories.patch delete mode 100644 patches/server/0876-Do-not-read-tile-entities-in-chunks-that-are-positio.patch delete mode 100644 patches/server/0877-Add-missing-logs-for-log-ips-config-option.patch create mode 100644 patches/server/0877-Do-not-read-tile-entities-in-chunks-that-are-positio.patch create mode 100644 patches/server/0878-Add-missing-logs-for-log-ips-config-option.patch delete mode 100644 patches/server/0878-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch delete mode 100644 patches/server/0879-Fix-NPE-in-AdvancementProgress-getDateAwarded.patch create mode 100644 patches/server/0879-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch create mode 100644 patches/server/0880-Fix-NPE-in-AdvancementProgress-getDateAwarded.patch delete mode 100644 patches/server/0880-Fix-team-sidebar-objectives-not-being-cleared.patch delete mode 100644 patches/server/0881-Fix-missing-map-initialize-event-call.patch create mode 100644 patches/server/0881-Fix-team-sidebar-objectives-not-being-cleared.patch create mode 100644 patches/server/0882-Fix-missing-map-initialize-event-call.patch delete mode 100644 patches/server/0882-Update-entity-data-when-attaching-firework-to-entity.patch delete mode 100644 patches/server/0883-Fix-UnsafeValues-loadAdvancement.patch create mode 100644 patches/server/0883-Update-entity-data-when-attaching-firework-to-entity.patch delete mode 100644 patches/server/0884-Add-player-idle-duration-API.patch create mode 100644 patches/server/0884-Fix-UnsafeValues-loadAdvancement.patch create mode 100644 patches/server/0885-Add-player-idle-duration-API.patch delete mode 100644 patches/server/0885-Don-t-check-if-we-can-see-non-visible-entities.patch create mode 100644 patches/server/0886-Don-t-check-if-we-can-see-non-visible-entities.patch delete mode 100644 patches/server/0886-Fix-NPE-in-SculkBloomEvent-world-access.patch delete mode 100644 patches/server/0887-Allow-null-itemstack-for-Player-sendEquipmentChange.patch create mode 100644 patches/server/0887-Fix-NPE-in-SculkBloomEvent-world-access.patch create mode 100644 patches/server/0888-Allow-null-itemstack-for-Player-sendEquipmentChange.patch delete mode 100644 patches/server/0888-Optimize-VarInts.patch delete mode 100644 patches/server/0889-Add-API-to-get-the-collision-shape-of-a-block-before.patch create mode 100644 patches/server/0889-Optimize-VarInts.patch create mode 100644 patches/server/0890-Add-API-to-get-the-collision-shape-of-a-block-before.patch delete mode 100644 patches/server/0890-Add-predicate-for-blocks-when-raytracing.patch create mode 100644 patches/server/0891-Add-predicate-for-blocks-when-raytracing.patch delete mode 100644 patches/server/0891-Broadcast-take-item-packets-with-collector-as-source.patch create mode 100644 patches/server/0892-Broadcast-take-item-packets-with-collector-as-source.patch delete mode 100644 patches/server/0892-Expand-LingeringPotion-API.patch create mode 100644 patches/server/0893-Expand-LingeringPotion-API.patch delete mode 100644 patches/server/0893-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch delete mode 100644 patches/server/0894-Add-hand-to-fish-event-for-all-player-interactions.patch create mode 100644 patches/server/0894-Fix-strikeLightningEffect-powers-lightning-rods-and-.patch create mode 100644 patches/server/0895-Add-hand-to-fish-event-for-all-player-interactions.patch delete mode 100644 patches/server/0895-Fix-several-issues-with-EntityBreedEvent.patch delete mode 100644 patches/server/0896-Add-UUID-attribute-modifier-API.patch create mode 100644 patches/server/0896-Fix-several-issues-with-EntityBreedEvent.patch create mode 100644 patches/server/0897-Add-UUID-attribute-modifier-API.patch delete mode 100644 patches/server/0897-Fix-missing-event-call-for-entity-teleport-API.patch create mode 100644 patches/server/0898-Fix-missing-event-call-for-entity-teleport-API.patch delete mode 100644 patches/server/0898-Lazily-create-LootContext-for-criterions.patch delete mode 100644 patches/server/0899-Don-t-fire-sync-events-during-worldgen.patch create mode 100644 patches/server/0899-Lazily-create-LootContext-for-criterions.patch delete mode 100644 patches/server/0900-Add-Structure-check-API.patch create mode 100644 patches/server/0900-Don-t-fire-sync-events-during-worldgen.patch create mode 100644 patches/server/0901-Add-Structure-check-API.patch delete mode 100644 patches/server/0901-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch create mode 100644 patches/server/0902-Fix-CraftMetaItem-getAttributeModifier-duplication-c.patch delete mode 100644 patches/server/0902-Restore-vanilla-entity-drops-behavior.patch delete mode 100644 patches/server/0903-Dont-resend-blocks-on-interactions.patch create mode 100644 patches/server/0903-Restore-vanilla-entity-drops-behavior.patch create mode 100644 patches/server/0904-Dont-resend-blocks-on-interactions.patch delete mode 100644 patches/server/0904-add-more-scoreboard-API.patch delete mode 100644 patches/server/0905-Improve-Registry.patch create mode 100644 patches/server/0905-add-more-scoreboard-API.patch delete mode 100644 patches/server/0906-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch create mode 100644 patches/server/0906-Improve-Registry.patch delete mode 100644 patches/server/0907-Add-experience-points-API.patch create mode 100644 patches/server/0907-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch delete mode 100644 patches/server/0908-Add-drops-to-shear-events.patch create mode 100644 patches/server/0908-Add-experience-points-API.patch delete mode 100644 patches/server/0909-Add-PlayerShieldDisableEvent.patch create mode 100644 patches/server/0909-Add-drops-to-shear-events.patch create mode 100644 patches/server/0910-Add-PlayerShieldDisableEvent.patch delete mode 100644 patches/server/0910-Validate-ResourceLocation-in-NBT-reading.patch delete mode 100644 patches/server/0911-Properly-handle-experience-dropping-on-block-break.patch create mode 100644 patches/server/0911-Validate-ResourceLocation-in-NBT-reading.patch delete mode 100644 patches/server/0912-Fixup-NamespacedKey-handling.patch create mode 100644 patches/server/0912-Properly-handle-experience-dropping-on-block-break.patch delete mode 100644 patches/server/0913-Expose-LootTable-of-DecoratedPot.patch create mode 100644 patches/server/0913-Fixup-NamespacedKey-handling.patch create mode 100644 patches/server/0914-Expose-LootTable-of-DecoratedPot.patch delete mode 100644 patches/server/0914-Reduce-allocation-of-Vec3D-by-entity-tracker.patch delete mode 100644 patches/server/0915-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch create mode 100644 patches/server/0915-Reduce-allocation-of-Vec3D-by-entity-tracker.patch create mode 100644 patches/server/0916-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch delete mode 100644 patches/server/0916-Add-ShulkerDuplicateEvent.patch create mode 100644 patches/server/0917-Add-ShulkerDuplicateEvent.patch delete mode 100644 patches/server/0917-Add-api-for-spawn-egg-texture-colors.patch delete mode 100644 patches/server/0918-Add-Lifecycle-Event-system.patch create mode 100644 patches/server/0918-Add-api-for-spawn-egg-texture-colors.patch create mode 100644 patches/server/0919-Add-Lifecycle-Event-system.patch delete mode 100644 patches/server/0919-ItemStack-Tooltip-API.patch delete mode 100644 patches/server/0920-Add-getChunkSnapshot-includeLightData-parameter.patch create mode 100644 patches/server/0920-ItemStack-Tooltip-API.patch delete mode 100644 patches/server/0921-Add-FluidState-API.patch create mode 100644 patches/server/0921-Add-getChunkSnapshot-includeLightData-parameter.patch create mode 100644 patches/server/0922-Add-FluidState-API.patch delete mode 100644 patches/server/0922-add-number-format-api.patch create mode 100644 patches/server/0923-add-number-format-api.patch delete mode 100644 patches/server/0923-improve-BanList-types.patch delete mode 100644 patches/server/0924-Expanded-Hopper-API.patch create mode 100644 patches/server/0924-improve-BanList-types.patch delete mode 100644 patches/server/0925-Add-BlockBreakProgressUpdateEvent.patch create mode 100644 patches/server/0925-Expanded-Hopper-API.patch create mode 100644 patches/server/0926-Add-BlockBreakProgressUpdateEvent.patch delete mode 100644 patches/server/0926-Deprecate-ItemStack-setType.patch delete mode 100644 patches/server/0927-Add-CartographyItemEvent.patch create mode 100644 patches/server/0927-Deprecate-ItemStack-setType.patch create mode 100644 patches/server/0928-Add-CartographyItemEvent.patch delete mode 100644 patches/server/0928-More-Raid-API.patch delete mode 100644 patches/server/0929-Add-onboarding-message-for-initial-server-start.patch create mode 100644 patches/server/0929-More-Raid-API.patch create mode 100644 patches/server/0930-Add-onboarding-message-for-initial-server-start.patch delete mode 100644 patches/server/0930-Configurable-max-block-fluid-ticks.patch create mode 100644 patches/server/0931-Configurable-max-block-fluid-ticks.patch delete mode 100644 patches/server/0931-Fix-bees-aging-inside-hives.patch delete mode 100644 patches/server/0932-Disable-memory-reserve-allocating.patch create mode 100644 patches/server/0932-Fix-bees-aging-inside-hives.patch create mode 100644 patches/server/0933-Disable-memory-reserve-allocating.patch delete mode 100644 patches/server/0933-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch create mode 100644 patches/server/0934-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch delete mode 100644 patches/server/0934-Fix-DamageSource-API.patch create mode 100644 patches/server/0935-Fix-DamageSource-API.patch delete mode 100644 patches/server/0935-Fix-creation-of-invalid-block-entity-during-world-ge.patch create mode 100644 patches/server/0936-Fix-creation-of-invalid-block-entity-during-world-ge.patch delete mode 100644 patches/server/0936-Fix-possible-StackOverflowError-for-some-dispenses.patch create mode 100644 patches/server/0937-Fix-possible-StackOverflowError-for-some-dispenses.patch delete mode 100644 patches/server/0937-Improve-tag-parser-handling.patch create mode 100644 patches/server/0938-Improve-tag-parser-handling.patch delete mode 100644 patches/server/0938-Item-Mutation-Fixes.patch create mode 100644 patches/server/0939-Item-Mutation-Fixes.patch delete mode 100644 patches/server/0939-Per-world-ticks-per-spawn-settings.patch create mode 100644 patches/server/0940-Per-world-ticks-per-spawn-settings.patch delete mode 100644 patches/server/0940-Properly-track-the-changed-item-from-dispense-events.patch create mode 100644 patches/server/0941-Properly-track-the-changed-item-from-dispense-events.patch delete mode 100644 patches/server/0941-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch delete mode 100644 patches/server/0942-Add-config-for-mobs-immune-to-default-effects.patch create mode 100644 patches/server/0942-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch create mode 100644 patches/server/0943-Add-config-for-mobs-immune-to-default-effects.patch delete mode 100644 patches/server/0943-Deep-clone-nbt-tags-in-PDC.patch create mode 100644 patches/server/0944-Deep-clone-nbt-tags-in-PDC.patch delete mode 100644 patches/server/0944-Support-old-UUID-format-for-NBT.patch delete mode 100644 patches/server/0945-Fix-shield-disable-inconsistency.patch create mode 100644 patches/server/0945-Support-old-UUID-format-for-NBT.patch create mode 100644 patches/server/0946-Fix-shield-disable-inconsistency.patch delete mode 100644 patches/server/0946-Handle-Large-Packets-disconnecting-client.patch delete mode 100644 patches/server/0947-Fix-ItemFlags.patch create mode 100644 patches/server/0947-Handle-Large-Packets-disconnecting-client.patch create mode 100644 patches/server/0948-Fix-ItemFlags.patch delete mode 100644 patches/server/0948-Fix-helmet-damage-reduction-inconsistencies.patch create mode 100644 patches/server/0949-Fix-helmet-damage-reduction-inconsistencies.patch delete mode 100644 patches/server/0949-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch create mode 100644 patches/server/0950-Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch delete mode 100644 patches/server/0950-improve-checking-handled-tags-in-itemmeta.patch delete mode 100644 patches/server/0951-Expose-hasColor-to-leather-armor.patch create mode 100644 patches/server/0951-improve-checking-handled-tags-in-itemmeta.patch delete mode 100644 patches/server/0952-Added-API-to-get-player-ha-proxy-address.patch create mode 100644 patches/server/0952-Expose-hasColor-to-leather-armor.patch create mode 100644 patches/server/0953-Added-API-to-get-player-ha-proxy-address.patch delete mode 100644 patches/server/0953-General-ItemMeta-fixes.patch create mode 100644 patches/server/0954-General-ItemMeta-fixes.patch delete mode 100644 patches/server/0954-More-Chest-Block-API.patch create mode 100644 patches/server/0955-More-Chest-Block-API.patch delete mode 100644 patches/server/0955-Print-data-component-type-on-encoding-error.patch delete mode 100644 patches/server/0956-Brigadier-based-command-API.patch create mode 100644 patches/server/0956-Print-data-component-type-on-encoding-error.patch create mode 100644 patches/server/0957-Brigadier-based-command-API.patch delete mode 100644 patches/server/0957-Fix-issues-with-Recipe-API.patch delete mode 100644 patches/server/0958-Fix-equipment-slot-and-group-API.patch create mode 100644 patches/server/0958-Fix-issues-with-Recipe-API.patch delete mode 100644 patches/server/0959-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch create mode 100644 patches/server/0959-Fix-equipment-slot-and-group-API.patch create mode 100644 patches/server/0960-Allow-Bukkit-plugin-to-use-Paper-PluginLoader-API.patch delete mode 100644 patches/server/0960-Prevent-sending-oversized-item-data-in-equipment-and.patch delete mode 100644 patches/server/0961-Prevent-NPE-if-hooked-entity-was-cleared.patch create mode 100644 patches/server/0961-Prevent-sending-oversized-item-data-in-equipment-and.patch delete mode 100644 patches/server/0962-Fix-cancelling-BlockPlaceEvent-calling-onRemove.patch create mode 100644 patches/server/0962-Prevent-NPE-if-hooked-entity-was-cleared.patch delete mode 100644 patches/server/0963-Add-missing-fishing-event-state.patch create mode 100644 patches/server/0963-Fix-cancelling-BlockPlaceEvent-calling-onRemove.patch create mode 100644 patches/server/0964-Add-missing-fishing-event-state.patch delete mode 100644 patches/server/0964-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch create mode 100644 patches/server/0965-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch delete mode 100644 patches/server/0965-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch delete mode 100644 patches/server/0966-Adopt-MaterialRerouting.patch create mode 100644 patches/server/0966-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch create mode 100644 patches/server/0967-Adopt-MaterialRerouting.patch delete mode 100644 patches/server/0967-Suspicious-Effect-Entry-API.patch create mode 100644 patches/server/0968-Suspicious-Effect-Entry-API.patch delete mode 100644 patches/server/0968-check-if-itemstack-is-stackable-first.patch delete mode 100644 patches/server/0969-Fix-removing-recipes-from-RecipeIterator.patch create mode 100644 patches/server/0969-check-if-itemstack-is-stackable-first.patch delete mode 100644 patches/server/0970-Configurable-damage-tick-when-blocking-with-shield.patch create mode 100644 patches/server/0970-Fix-removing-recipes-from-RecipeIterator.patch create mode 100644 patches/server/0971-Configurable-damage-tick-when-blocking-with-shield.patch delete mode 100644 patches/server/0971-Properly-remove-the-experimental-smithing-inventory-.patch create mode 100644 patches/server/0972-Properly-remove-the-experimental-smithing-inventory-.patch delete mode 100644 patches/server/0972-disable-forced-empty-world-ticks.patch delete mode 100644 patches/server/0973-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch create mode 100644 patches/server/0973-disable-forced-empty-world-ticks.patch delete mode 100644 patches/server/0974-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch create mode 100644 patches/server/0974-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch create mode 100644 patches/server/0975-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch delete mode 100644 patches/server/0975-Optimize-Network-Manager-and-add-advanced-packet-sup.patch delete mode 100644 patches/server/0976-Allow-Saving-of-Oversized-Chunks.patch create mode 100644 patches/server/0976-Optimize-Network-Manager-and-add-advanced-packet-sup.patch create mode 100644 patches/server/0977-Allow-Saving-of-Oversized-Chunks.patch delete mode 100644 patches/server/0977-Flat-bedrock-generator-settings.patch delete mode 100644 patches/server/0978-Entity-Activation-Range-2.0.patch create mode 100644 patches/server/0978-Flat-bedrock-generator-settings.patch delete mode 100644 patches/server/0979-Anti-Xray.patch create mode 100644 patches/server/0979-Entity-Activation-Range-2.0.patch create mode 100644 patches/server/0980-Anti-Xray.patch delete mode 100644 patches/server/0980-Use-Velocity-compression-and-cipher-natives.patch delete mode 100644 patches/server/0981-Optimize-Collision-to-not-load-chunks.patch create mode 100644 patches/server/0981-Use-Velocity-compression-and-cipher-natives.patch create mode 100644 patches/server/0982-Optimize-Collision-to-not-load-chunks.patch delete mode 100644 patches/server/0982-Optimize-GoalSelector-Goal.Flag-Set-operations.patch create mode 100644 patches/server/0983-Optimize-GoalSelector-Goal.Flag-Set-operations.patch delete mode 100644 patches/server/0983-Optimize-Hoppers.patch create mode 100644 patches/server/0984-Optimize-Hoppers.patch delete mode 100644 patches/server/0984-Optimize-Voxel-Shape-Merging.patch delete mode 100644 patches/server/0985-Optimize-Bit-Operations-by-inlining.patch create mode 100644 patches/server/0985-Optimize-Voxel-Shape-Merging.patch create mode 100644 patches/server/0986-Optimize-Bit-Operations-by-inlining.patch delete mode 100644 patches/server/0986-Remove-streams-from-hot-code.patch delete mode 100644 patches/server/0987-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch create mode 100644 patches/server/0987-Remove-streams-from-hot-code.patch delete mode 100644 patches/server/0988-Fix-entity-type-tags-suggestions-in-selectors.patch create mode 100644 patches/server/0988-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch create mode 100644 patches/server/0989-Fix-entity-type-tags-suggestions-in-selectors.patch delete mode 100644 patches/server/0989-Handle-Oversized-block-entities-in-chunks.patch delete mode 100644 patches/server/0990-Check-distance-in-entity-interactions.patch create mode 100644 patches/server/0990-Handle-Oversized-block-entities-in-chunks.patch create mode 100644 patches/server/0991-Check-distance-in-entity-interactions.patch delete mode 100644 patches/server/0991-Configurable-Sand-Duping.patch create mode 100644 patches/server/0992-Configurable-Sand-Duping.patch delete mode 100644 patches/server/0992-Properly-resend-entities.patch create mode 100644 patches/server/0993-Properly-resend-entities.patch delete mode 100644 patches/server/0993-Registry-Modification-API.patch delete mode 100644 patches/server/0994-Add-registry-entry-and-builders.patch create mode 100644 patches/server/0994-Registry-Modification-API.patch create mode 100644 patches/server/0995-Add-registry-entry-and-builders.patch delete mode 100644 patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch delete mode 100644 patches/server/0996-Make-a-PDC-view-accessible-directly-from-ItemStack.patch create mode 100644 patches/server/0996-Proxy-ItemStack-to-CraftItemStack.patch create mode 100644 patches/server/0997-Make-a-PDC-view-accessible-directly-from-ItemStack.patch delete mode 100644 patches/server/0997-Prioritize-Minecraft-commands-in-function-parsing-an.patch create mode 100644 patches/server/0998-Prioritize-Minecraft-commands-in-function-parsing-an.patch delete mode 100644 patches/server/0998-optimize-dirt-and-snow-spreading.patch delete mode 100644 patches/server/0999-Fix-NPE-for-Jukebox-setRecord.patch create mode 100644 patches/server/0999-optimize-dirt-and-snow-spreading.patch create mode 100644 patches/server/1000-Fix-NPE-for-Jukebox-setRecord.patch delete mode 100644 patches/server/1000-fix-horse-inventories.patch delete mode 100644 patches/server/1001-Only-call-EntityDamageEvents-before-actuallyHurt.patch create mode 100644 patches/server/1001-fix-horse-inventories.patch delete mode 100644 patches/server/1002-Add-ItemType-getItemRarity.patch create mode 100644 patches/server/1002-Only-call-EntityDamageEvents-before-actuallyHurt.patch create mode 100644 patches/server/1003-Add-ItemType-getItemRarity.patch delete mode 100644 patches/server/1003-Add-plugin-info-at-startup.patch create mode 100644 patches/server/1004-Add-plugin-info-at-startup.patch delete mode 100644 patches/server/1004-Make-interaction-leniency-distance-configurable.patch delete mode 100644 patches/server/1005-Fix-PickupStatus-getting-reset.patch create mode 100644 patches/server/1005-Make-interaction-leniency-distance-configurable.patch delete mode 100644 patches/server/1006-Check-for-block-type-in-SculkSensorBlock-canActivate.patch create mode 100644 patches/server/1006-Fix-PickupStatus-getting-reset.patch delete mode 100644 patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch create mode 100644 patches/server/1007-Check-for-block-type-in-SculkSensorBlock-canActivate.patch create mode 100644 patches/server/1008-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch delete mode 100644 patches/server/1008-Configuration-for-horizontal-only-item-merging.patch delete mode 100644 patches/server/1009-Add-skipping-world-symlink-scan.patch create mode 100644 patches/server/1009-Configuration-for-horizontal-only-item-merging.patch delete mode 100644 patches/server/1010-Add-even-more-Enchantment-API.patch create mode 100644 patches/server/1010-Add-skipping-world-symlink-scan.patch create mode 100644 patches/server/1011-Add-even-more-Enchantment-API.patch delete mode 100644 patches/server/1011-Leashable-API.patch delete mode 100644 patches/server/1012-Fix-CraftBukkit-drag-system.patch create mode 100644 patches/server/1012-Leashable-API.patch create mode 100644 patches/server/1013-Fix-CraftBukkit-drag-system.patch delete mode 100644 patches/server/1013-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch create mode 100644 patches/server/1014-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch delete mode 100644 patches/server/1014-Remove-set-damage-lootable-item-function-from-compas.patch delete mode 100644 patches/server/1015-Add-enchantment-seed-update-API.patch create mode 100644 patches/server/1015-Remove-set-damage-lootable-item-function-from-compas.patch create mode 100644 patches/server/1016-Add-enchantment-seed-update-API.patch delete mode 100644 patches/server/1016-Fix-synchronise-sending-chat-to-client-with-updating.patch delete mode 100644 patches/server/1017-Fix-InventoryOpenEvent-cancellation.patch create mode 100644 patches/server/1017-Fix-synchronise-sending-chat-to-client-with-updating.patch delete mode 100644 patches/server/1018-Fire-BlockExpEvent-on-grindstone-use.patch create mode 100644 patches/server/1018-Fix-InventoryOpenEvent-cancellation.patch delete mode 100644 patches/server/1019-Check-dead-flag-in-isAlive.patch create mode 100644 patches/server/1019-Fire-BlockExpEvent-on-grindstone-use.patch delete mode 100644 patches/server/1020-Add-FeatureFlag-API.patch create mode 100644 patches/server/1020-Check-dead-flag-in-isAlive.patch create mode 100644 patches/server/1021-Add-FeatureFlag-API.patch delete mode 100644 patches/server/1021-Tag-Lifecycle-Events.patch delete mode 100644 patches/server/1022-Item-serialization-as-json.patch create mode 100644 patches/server/1022-Tag-Lifecycle-Events.patch create mode 100644 patches/server/1023-Item-serialization-as-json.patch delete mode 100644 patches/server/1023-Validate-slot-in-PlayerInventory-setSlot.patch delete mode 100644 patches/server/1024-Remove-wall-time-unused-skip-tick-protection.patch create mode 100644 patches/server/1024-Validate-slot-in-PlayerInventory-setSlot.patch delete mode 100644 patches/server/1025-Disable-pretty-printing-for-advancement-saving.patch create mode 100644 patches/server/1025-Remove-wall-time-unused-skip-tick-protection.patch create mode 100644 patches/server/1026-Disable-pretty-printing-for-advancement-saving.patch delete mode 100644 patches/server/1026-Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch delete mode 100644 patches/server/1027-Add-enchantWithLevels-with-enchantment-registry-set.patch create mode 100644 patches/server/1027-Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch create mode 100644 patches/server/1028-Add-enchantWithLevels-with-enchantment-registry-set.patch delete mode 100644 patches/server/1028-Improve-entity-effect-API.patch delete mode 100644 patches/server/1029-Add-recipeBrewTime.patch create mode 100644 patches/server/1029-Improve-entity-effect-API.patch create mode 100644 patches/server/1030-Add-recipeBrewTime.patch delete mode 100644 patches/server/1030-Call-bucket-events-for-cauldrons.patch delete mode 100644 patches/server/1031-Add-PlayerInsertLecternBookEvent.patch create mode 100644 patches/server/1031-Call-bucket-events-for-cauldrons.patch create mode 100644 patches/server/1032-Add-PlayerInsertLecternBookEvent.patch delete mode 100644 patches/server/1032-Void-damage-configuration-API.patch delete mode 100644 patches/server/1033-Add-Offline-PDC-API.patch create mode 100644 patches/server/1033-Void-damage-configuration-API.patch delete mode 100644 patches/server/1034-Add-AnvilView-bypassEnchantmentLevelRestriction.patch create mode 100644 patches/server/1034-Add-Offline-PDC-API.patch create mode 100644 patches/server/1035-Add-AnvilView-bypassEnchantmentLevelRestriction.patch delete mode 100644 patches/server/1035-Add-proper-async-player-disconnections.patch create mode 100644 patches/server/1036-Add-proper-async-player-disconnections.patch delete mode 100644 patches/server/1036-Always-send-Banner-patterns-to-the-client.patch create mode 100644 patches/server/1037-Always-send-Banner-patterns-to-the-client.patch delete mode 100644 patches/server/1037-Rewrite-dataconverter-system.patch delete mode 100644 patches/server/1038-Moonrise-optimisation-patches.patch create mode 100644 patches/server/1038-Rewrite-dataconverter-system.patch delete mode 100644 patches/server/1039-API-for-checking-sent-chunks.patch create mode 100644 patches/server/1039-Moonrise-optimisation-patches.patch create mode 100644 patches/server/1040-API-for-checking-sent-chunks.patch delete mode 100644 patches/server/1040-Fix-CraftWorld-isChunkGenerated.patch delete mode 100644 patches/server/1041-Add-startup-flag-to-disable-gamerule-limits.patch create mode 100644 patches/server/1041-Fix-CraftWorld-isChunkGenerated.patch create mode 100644 patches/server/1042-Add-startup-flag-to-disable-gamerule-limits.patch delete mode 100644 patches/server/1042-Improved-Watchdog-Support.patch delete mode 100644 patches/server/1043-Detail-more-information-in-watchdog-dumps.patch create mode 100644 patches/server/1043-Improved-Watchdog-Support.patch create mode 100644 patches/server/1044-Detail-more-information-in-watchdog-dumps.patch delete mode 100644 patches/server/1044-Entity-load-save-limit-per-chunk.patch delete mode 100644 patches/server/1045-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch create mode 100644 patches/server/1045-Entity-load-save-limit-per-chunk.patch create mode 100644 patches/server/1046-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch delete mode 100644 patches/server/1046-Bundle-spark.patch create mode 100644 patches/server/1047-Bundle-spark.patch delete mode 100644 patches/server/1047-Improve-performance-of-mass-crafts.patch create mode 100644 patches/server/1048-Improve-performance-of-mass-crafts.patch delete mode 100644 patches/unapplied/api/0400-API-for-updating-recipes-on-clients.patch delete mode 100644 patches/unapplied/server/0845-API-for-updating-recipes-on-clients.patch diff --git a/patches/api/0400-API-for-updating-recipes-on-clients.patch b/patches/api/0400-API-for-updating-recipes-on-clients.patch new file mode 100644 index 0000000000..4a98cf2e1e --- /dev/null +++ b/patches/api/0400-API-for-updating-recipes-on-clients.patch @@ -0,0 +1,169 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 21 Aug 2021 17:25:54 -0700 +Subject: [PATCH] API for updating recipes on clients + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 50efe16bb80c618c3dfae03b70c8c165183af8ec..52c601328bbf5c1642aa620c8bb466a9d2d231be 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1004,6 +1004,26 @@ public final class Bukkit { + server.reloadData(); + } + ++ // Paper start - update reloadable data ++ /** ++ * Updates all advancement, tag, and recipe data for all connected clients. ++ * Useful for updating clients to new advancements/recipes/tags. ++ * @see #updateRecipes() ++ */ ++ public static void updateResources() { ++ server.updateResources(); ++ } ++ ++ /** ++ * Updates recipe data and the recipe book for all connected clients. Useful for ++ * updating clients to new recipes. ++ * @see #updateResources() ++ */ ++ public static void updateRecipes() { ++ server.updateRecipes(); ++ } ++ // Paper end - update reloadable data ++ + /** + * Returns the primary logger associated with this server instance. + * +@@ -1064,6 +1084,20 @@ public final class Bukkit { + return server.addRecipe(recipe); + } + ++ // Paper start - method to send recipes immediately ++ /** ++ * Adds a recipe to the crafting manager. ++ * ++ * @param recipe the recipe to add ++ * @param resendRecipes true to update the client with the full set of recipes ++ * @return true if the recipe was added, false if it wasn't for some reason ++ */ ++ @Contract("null, _ -> false") ++ public static boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes) { ++ return server.addRecipe(recipe, resendRecipes); ++ } ++ // Paper end - method to send recipes immediately ++ + /** + * Get a list of all recipes for a given item. The stack size is ignored + * in comparisons. If the durability is -1, it will match any data value. +@@ -1255,6 +1289,24 @@ public final class Bukkit { + return server.removeRecipe(key); + } + ++ // Paper start - method to resend recipes ++ /** ++ * Remove a recipe from the server. ++ *

++ * Note that removing a recipe may cause permanent loss of data ++ * associated with that recipe (eg whether it has been discovered by ++ * players). ++ * ++ * @param key NamespacedKey of recipe to remove. ++ * @param resendRecipes true to update all clients on the new recipe list. ++ * Will only update if a recipe was actually removed ++ * @return True if recipe was removed ++ */ ++ public static boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes) { ++ return server.removeRecipe(key, resendRecipes); ++ } ++ // Paper end - method to resend recipes ++ + /** + * Gets a list of command aliases defined in the server properties. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 1b8d6a3333a4fa9155b79644e683e2343c134e12..8ba2fbaab7428a42b506fd000fbc162f68ddaed1 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -853,6 +853,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + public void reloadData(); + ++ // Paper start - update reloadable data ++ /** ++ * Updates all advancement, tag, and recipe data to all connected clients. ++ * Useful for updating clients to new advancements/recipes/tags. ++ * @see #updateRecipes() ++ */ ++ void updateResources(); ++ ++ /** ++ * Updates recipe data and the recipe book to each player. Useful for ++ * updating clients to new recipes. ++ * @see #updateResources() ++ */ ++ void updateRecipes(); ++ // Paper end - update reloadable data ++ + /** + * Returns the primary logger associated with this server instance. + * +@@ -894,15 +910,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException; + + /** +- * Adds a recipe to the crafting manager. ++ * Adds a recipe to the crafting manager. Recipes added with ++ * this method won't be sent to the client automatically. Use ++ * {@link #updateRecipes()} or {@link #updateResources()} to ++ * update clients to new recipes added. ++ *

++ * Player's still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)} ++ * before seeing them in their recipe book. + * + * @param recipe the recipe to add + * @return true if the recipe was added, false if it wasn't for some + * reason ++ * @see #addRecipe(Recipe, boolean) + */ + @Contract("null -> false") + public boolean addRecipe(@Nullable Recipe recipe); + ++ // Paper start - method to send recipes immediately ++ /** ++ * Adds a recipe to the crafting manager. ++ * ++ * @param recipe the recipe to add ++ * @param resendRecipes true to update the client with the full set of recipes ++ * @return true if the recipe was added, false if it wasn't for some reason ++ */ ++ @Contract("null, _ -> false") ++ boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes); ++ // Paper end - method to send recipes immediately ++ + /** + * Get a list of all recipes for a given item. The stack size is ignored + * in comparisons. If the durability is -1, it will match any data value. +@@ -1071,6 +1106,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + public boolean removeRecipe(@NotNull NamespacedKey key); + ++ // Paper start - method to resend recipes ++ /** ++ * Remove a recipe from the server. ++ *

++ * Note that removing a recipe may cause permanent loss of data ++ * associated with that recipe (eg whether it has been discovered by ++ * players). ++ * ++ * @param key NamespacedKey of recipe to remove. ++ * @param resendRecipes true to update all clients on the new recipe list. ++ * Will only update if a recipe was actually removed ++ * @return True if recipe was removed ++ */ ++ boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes); ++ // Paper end - method to resend recipes ++ + /** + * Gets a list of command aliases defined in the server properties. + * diff --git a/patches/api/0400-Add-PlayerFailMoveEvent.patch b/patches/api/0400-Add-PlayerFailMoveEvent.patch deleted file mode 100644 index e6903a2b56..0000000000 --- a/patches/api/0400-Add-PlayerFailMoveEvent.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Moulberry -Date: Wed, 26 Jul 2023 20:57:11 +0800 -Subject: [PATCH] Add PlayerFailMoveEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c7380874f99cd2aa28a24bbb0dd3375e8842dd0d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java -@@ -0,0 +1,113 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Runs when a player attempts to move, but is prevented from doing so by the server -+ */ -+@NullMarked -+public class PlayerFailMoveEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final FailReason failReason; -+ private final Location from; -+ private final Location to; -+ private boolean allowed; -+ private boolean logWarning; -+ -+ @ApiStatus.Internal -+ public PlayerFailMoveEvent(final Player player, final FailReason failReason, final boolean allowed, final boolean logWarning, final Location from, final Location to) { -+ super(player); -+ this.failReason = failReason; -+ this.allowed = allowed; -+ this.logWarning = logWarning; -+ this.from = from; -+ this.to = to; -+ } -+ -+ /** -+ * Gets the reason this movement was prevented by the server -+ * -+ * @return The reason the movement was prevented -+ */ -+ public FailReason getFailReason() { -+ return this.failReason; -+ } -+ -+ /** -+ * Gets the location this player moved from -+ * -+ * @return Location the player moved from -+ */ -+ public Location getFrom() { -+ return this.from.clone(); -+ } -+ -+ /** -+ * Gets the location this player tried to move to -+ * -+ * @return Location the player tried to move to -+ */ -+ public Location getTo() { -+ return this.to.clone(); -+ } -+ -+ /** -+ * Gets if the check should be bypassed, allowing the movement -+ * -+ * @return whether to bypass the check -+ */ -+ public boolean isAllowed() { -+ return this.allowed; -+ } -+ -+ /** -+ * Set if the check should be bypassed and the movement should be allowed -+ * -+ * @param allowed whether to bypass the check -+ */ -+ public void setAllowed(final boolean allowed) { -+ this.allowed = allowed; -+ } -+ -+ /** -+ * Gets if warnings will be printed to console. e.g. "Player123 moved too quickly!" -+ * -+ * @return whether to log warnings -+ */ -+ public boolean getLogWarning() { -+ return this.logWarning; -+ } -+ -+ /** -+ * Set if a warning is printed to console. e.g. "Player123 moved too quickly!" -+ * -+ * @param logWarning whether to log warnings -+ */ -+ public void setLogWarning(final boolean logWarning) { -+ this.logWarning = logWarning; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum FailReason { -+ MOVED_INTO_UNLOADED_CHUNK, // Only fired if the world setting prevent-moving-into-unloaded-chunks is true -+ MOVED_TOO_QUICKLY, -+ MOVED_WRONGLY, -+ CLIPPED_INTO_BLOCK -+ } -+ -+} diff --git a/patches/api/0401-Add-PlayerFailMoveEvent.patch b/patches/api/0401-Add-PlayerFailMoveEvent.patch new file mode 100644 index 0000000000..e6903a2b56 --- /dev/null +++ b/patches/api/0401-Add-PlayerFailMoveEvent.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Moulberry +Date: Wed, 26 Jul 2023 20:57:11 +0800 +Subject: [PATCH] Add PlayerFailMoveEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c7380874f99cd2aa28a24bbb0dd3375e8842dd0d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java +@@ -0,0 +1,113 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.Location; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Runs when a player attempts to move, but is prevented from doing so by the server ++ */ ++@NullMarked ++public class PlayerFailMoveEvent extends PlayerEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final FailReason failReason; ++ private final Location from; ++ private final Location to; ++ private boolean allowed; ++ private boolean logWarning; ++ ++ @ApiStatus.Internal ++ public PlayerFailMoveEvent(final Player player, final FailReason failReason, final boolean allowed, final boolean logWarning, final Location from, final Location to) { ++ super(player); ++ this.failReason = failReason; ++ this.allowed = allowed; ++ this.logWarning = logWarning; ++ this.from = from; ++ this.to = to; ++ } ++ ++ /** ++ * Gets the reason this movement was prevented by the server ++ * ++ * @return The reason the movement was prevented ++ */ ++ public FailReason getFailReason() { ++ return this.failReason; ++ } ++ ++ /** ++ * Gets the location this player moved from ++ * ++ * @return Location the player moved from ++ */ ++ public Location getFrom() { ++ return this.from.clone(); ++ } ++ ++ /** ++ * Gets the location this player tried to move to ++ * ++ * @return Location the player tried to move to ++ */ ++ public Location getTo() { ++ return this.to.clone(); ++ } ++ ++ /** ++ * Gets if the check should be bypassed, allowing the movement ++ * ++ * @return whether to bypass the check ++ */ ++ public boolean isAllowed() { ++ return this.allowed; ++ } ++ ++ /** ++ * Set if the check should be bypassed and the movement should be allowed ++ * ++ * @param allowed whether to bypass the check ++ */ ++ public void setAllowed(final boolean allowed) { ++ this.allowed = allowed; ++ } ++ ++ /** ++ * Gets if warnings will be printed to console. e.g. "Player123 moved too quickly!" ++ * ++ * @return whether to log warnings ++ */ ++ public boolean getLogWarning() { ++ return this.logWarning; ++ } ++ ++ /** ++ * Set if a warning is printed to console. e.g. "Player123 moved too quickly!" ++ * ++ * @param logWarning whether to log warnings ++ */ ++ public void setLogWarning(final boolean logWarning) { ++ this.logWarning = logWarning; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ public enum FailReason { ++ MOVED_INTO_UNLOADED_CHUNK, // Only fired if the world setting prevent-moving-into-unloaded-chunks is true ++ MOVED_TOO_QUICKLY, ++ MOVED_WRONGLY, ++ CLIPPED_INTO_BLOCK ++ } ++ ++} diff --git a/patches/api/0401-Fix-custom-statistic-criteria-creation.patch b/patches/api/0401-Fix-custom-statistic-criteria-creation.patch deleted file mode 100644 index 5e3f26f4f3..0000000000 --- a/patches/api/0401-Fix-custom-statistic-criteria-creation.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa -Date: Sat, 12 Aug 2023 15:33:55 +0200 -Subject: [PATCH] Fix custom statistic criteria creation - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 4f3e6e2698b28922e7b6448eddd5b166f4631759..334e392800803816cf502c2920c4a85774d6b0b2 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -258,4 +258,6 @@ public interface UnsafeValues { - */ - void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); - // Paper end - namespaced key biome methods -+ -+ String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation - } -diff --git a/src/main/java/org/bukkit/scoreboard/Criteria.java b/src/main/java/org/bukkit/scoreboard/Criteria.java -index 7d79d7fadab19bfbefc4797d7e5bbd3e9d733b53..3bc3abaf093d13e22b6ac2ee59ab584c92b4666a 100644 ---- a/src/main/java/org/bukkit/scoreboard/Criteria.java -+++ b/src/main/java/org/bukkit/scoreboard/Criteria.java -@@ -335,7 +335,7 @@ public interface Criteria { - @NotNull - public static Criteria statistic(@NotNull Statistic statistic) { - Preconditions.checkArgument(statistic != null, "statistic must not be null"); -- return Bukkit.getScoreboardCriteria("minecraft.custom:minecraft." + statistic.getKey().getKey()); -+ return Bukkit.getScoreboardCriteria(org.bukkit.Bukkit.getUnsafe().getStatisticCriteriaKey(statistic)); // Paper - } - - /** diff --git a/patches/api/0402-Fix-custom-statistic-criteria-creation.patch b/patches/api/0402-Fix-custom-statistic-criteria-creation.patch new file mode 100644 index 0000000000..5e3f26f4f3 --- /dev/null +++ b/patches/api/0402-Fix-custom-statistic-criteria-creation.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Noah van der Aa +Date: Sat, 12 Aug 2023 15:33:55 +0200 +Subject: [PATCH] Fix custom statistic criteria creation + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 4f3e6e2698b28922e7b6448eddd5b166f4631759..334e392800803816cf502c2920c4a85774d6b0b2 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -258,4 +258,6 @@ public interface UnsafeValues { + */ + void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); + // Paper end - namespaced key biome methods ++ ++ String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation + } +diff --git a/src/main/java/org/bukkit/scoreboard/Criteria.java b/src/main/java/org/bukkit/scoreboard/Criteria.java +index 7d79d7fadab19bfbefc4797d7e5bbd3e9d733b53..3bc3abaf093d13e22b6ac2ee59ab584c92b4666a 100644 +--- a/src/main/java/org/bukkit/scoreboard/Criteria.java ++++ b/src/main/java/org/bukkit/scoreboard/Criteria.java +@@ -335,7 +335,7 @@ public interface Criteria { + @NotNull + public static Criteria statistic(@NotNull Statistic statistic) { + Preconditions.checkArgument(statistic != null, "statistic must not be null"); +- return Bukkit.getScoreboardCriteria("minecraft.custom:minecraft." + statistic.getKey().getKey()); ++ return Bukkit.getScoreboardCriteria(org.bukkit.Bukkit.getUnsafe().getStatisticCriteriaKey(statistic)); // Paper + } + + /** diff --git a/patches/api/0402-SculkCatalyst-bloom-API.patch b/patches/api/0402-SculkCatalyst-bloom-API.patch deleted file mode 100644 index 49d8c8c2bd..0000000000 --- a/patches/api/0402-SculkCatalyst-bloom-API.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Oliwier Miodun -Date: Mon, 10 Jul 2023 17:59:42 +0200 -Subject: [PATCH] SculkCatalyst bloom API - - -diff --git a/src/main/java/org/bukkit/block/SculkCatalyst.java b/src/main/java/org/bukkit/block/SculkCatalyst.java -index 46260df8938bb616dd0e26829a123a24736b0a70..7d53b24003d49c5d7623598e92a6b0603c5d3069 100644 ---- a/src/main/java/org/bukkit/block/SculkCatalyst.java -+++ b/src/main/java/org/bukkit/block/SculkCatalyst.java -@@ -24,4 +24,14 @@ public interface SculkCatalyst extends TileState { - * @param charges how much charge to spawn. - */ - void bloom(@NotNull Block block, int charges); -+ -+ // Paper start - SculkCatalyst bloom API -+ /** -+ * Bloom at the specified location as if an entity that drops experience just died there. -+ * -+ * @param position position to bloom at -+ * @param charge charge to bloom with, normally the amount of experience dropped from the dead entity -+ */ -+ void bloom(@org.jetbrains.annotations.NotNull io.papermc.paper.math.Position position, int charge); -+ // Paper end - SculkCatalyst bloom API - } diff --git a/patches/api/0403-API-for-an-entity-s-scoreboard-name.patch b/patches/api/0403-API-for-an-entity-s-scoreboard-name.patch deleted file mode 100644 index 1fb9128be8..0000000000 --- a/patches/api/0403-API-for-an-entity-s-scoreboard-name.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 9 Jul 2023 11:54:54 -0700 -Subject: [PATCH] API for an entity's scoreboard name - -Was obtainable through different methods, but you had to use different -methods depending on the implementation of Entity you were working with. - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 4580c7613fac4f1eeccc2be2d15497cec5868736..efd8108cee65e7b1a227ebb6c33f3c92eb4cea24 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1112,4 +1112,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - @NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler(); - // Paper end - Folia schedulers -+ -+ // Paper start - entity scoreboard name -+ /** -+ * Gets the string name of the entity used to track it in {@link org.bukkit.scoreboard.Scoreboard Scoreboards}. -+ * -+ * @return the scoreboard entry name -+ * @see org.bukkit.scoreboard.Scoreboard#getScores(String) -+ * @see org.bukkit.scoreboard.Scoreboard#getEntries() -+ */ -+ @NotNull String getScoreboardEntryName(); -+ // Paper end - entity scoreboard name - } diff --git a/patches/api/0403-SculkCatalyst-bloom-API.patch b/patches/api/0403-SculkCatalyst-bloom-API.patch new file mode 100644 index 0000000000..49d8c8c2bd --- /dev/null +++ b/patches/api/0403-SculkCatalyst-bloom-API.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Oliwier Miodun +Date: Mon, 10 Jul 2023 17:59:42 +0200 +Subject: [PATCH] SculkCatalyst bloom API + + +diff --git a/src/main/java/org/bukkit/block/SculkCatalyst.java b/src/main/java/org/bukkit/block/SculkCatalyst.java +index 46260df8938bb616dd0e26829a123a24736b0a70..7d53b24003d49c5d7623598e92a6b0603c5d3069 100644 +--- a/src/main/java/org/bukkit/block/SculkCatalyst.java ++++ b/src/main/java/org/bukkit/block/SculkCatalyst.java +@@ -24,4 +24,14 @@ public interface SculkCatalyst extends TileState { + * @param charges how much charge to spawn. + */ + void bloom(@NotNull Block block, int charges); ++ ++ // Paper start - SculkCatalyst bloom API ++ /** ++ * Bloom at the specified location as if an entity that drops experience just died there. ++ * ++ * @param position position to bloom at ++ * @param charge charge to bloom with, normally the amount of experience dropped from the dead entity ++ */ ++ void bloom(@org.jetbrains.annotations.NotNull io.papermc.paper.math.Position position, int charge); ++ // Paper end - SculkCatalyst bloom API + } diff --git a/patches/api/0404-API-for-an-entity-s-scoreboard-name.patch b/patches/api/0404-API-for-an-entity-s-scoreboard-name.patch new file mode 100644 index 0000000000..1fb9128be8 --- /dev/null +++ b/patches/api/0404-API-for-an-entity-s-scoreboard-name.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 9 Jul 2023 11:54:54 -0700 +Subject: [PATCH] API for an entity's scoreboard name + +Was obtainable through different methods, but you had to use different +methods depending on the implementation of Entity you were working with. + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 4580c7613fac4f1eeccc2be2d15497cec5868736..efd8108cee65e7b1a227ebb6c33f3c92eb4cea24 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -1112,4 +1112,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + @NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler(); + // Paper end - Folia schedulers ++ ++ // Paper start - entity scoreboard name ++ /** ++ * Gets the string name of the entity used to track it in {@link org.bukkit.scoreboard.Scoreboard Scoreboards}. ++ * ++ * @return the scoreboard entry name ++ * @see org.bukkit.scoreboard.Scoreboard#getScores(String) ++ * @see org.bukkit.scoreboard.Scoreboard#getEntries() ++ */ ++ @NotNull String getScoreboardEntryName(); ++ // Paper end - entity scoreboard name + } diff --git a/patches/api/0404-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/api/0404-Deprecate-and-replace-methods-with-old-StructureType.patch deleted file mode 100644 index f09ff7714f..0000000000 --- a/patches/api/0404-Deprecate-and-replace-methods-with-old-StructureType.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 10 Dec 2022 17:52:45 -0800 -Subject: [PATCH] Deprecate and replace methods with old StructureType - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 50efe16bb80c618c3dfae03b70c8c165183af8ec..85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -949,9 +949,6 @@ public final class Bukkit { - /** - * Create a new explorer map targeting the closest nearby structure of a - * given {@link StructureType}. -- *
-- * This method uses implementation default values for radius and -- * findUnexplored (usually 100, true). - * - * @param world the world the map will belong to - * @param location the origin location to find the nearest structure -@@ -960,7 +957,9 @@ public final class Bukkit { - * - * @see World#locateNearestStructure(org.bukkit.Location, - * org.bukkit.StructureType, int, boolean) -+ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type)} - */ -+ @Deprecated // Paper - @NotNull - public static ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType) { - return server.createExplorerMap(world, location, structureType); -@@ -983,11 +982,54 @@ public final class Bukkit { - * - * @see World#locateNearestStructure(org.bukkit.Location, - * org.bukkit.StructureType, int, boolean) -+ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type, int, boolean)} - */ -+ @Deprecated // Paper - @NotNull - public static ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType, int radius, boolean findUnexplored) { - return server.createExplorerMap(world, location, structureType, radius, findUnexplored); - } -+ // Paper start -+ /** -+ * Create a new explorer map targeting the closest nearby structure of a -+ * given {@link org.bukkit.generator.structure.StructureType}. -+ *
-+ * This method uses implementation default values for radius and -+ * findUnexplored (usually 100, true). -+ * -+ * @param world the world the map will belong to -+ * @param location the origin location to find the nearest structure -+ * @param structureType the type of structure to find -+ * @param mapIcon the map icon to use on the map -+ * @return a newly created item stack or null if it can't find a location -+ * -+ * @see World#locateNearestStructure(org.bukkit.Location, -+ * org.bukkit.generator.structure.StructureType, int, boolean) -+ */ -+ public static @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon) { -+ return server.createExplorerMap(world, location, structureType, mapIcon); -+ } -+ -+ /** -+ * Create a new explorer map targeting the closest nearby structure of a -+ * given {@link org.bukkit.generator.structure.StructureType}. -+ * -+ * @param world the world the map will belong to -+ * @param location the origin location to find the nearest structure -+ * @param structureType the type of structure to find -+ * @param mapIcon the map icon to use on the map -+ * @param radius radius to search, see World#locateNearestStructure for more -+ * information -+ * @param findUnexplored whether to find unexplored structures -+ * @return the newly created item stack or null if it can't find a location -+ * -+ * @see World#locateNearestStructure(org.bukkit.Location, -+ * org.bukkit.generator.structure.StructureType, int, boolean) -+ */ -+ public static @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon, int radius, boolean findUnexplored) { -+ return server.createExplorerMap(world, location, structureType, mapIcon, radius, findUnexplored); -+ } -+ // Paper end - - /** - * Reloads the server, refreshing settings and plugin information. -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 1b8d6a3333a4fa9155b79644e683e2343c134e12..640ef81d204f480f4af83d420c7e968ce569a38d 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * - * @see World#locateNearestStructure(org.bukkit.Location, - * org.bukkit.StructureType, int, boolean) -+ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type)} - */ -+ @Deprecated // Paper - @NotNull - public ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType); - - /** - * Create a new explorer map targeting the closest nearby structure of a - * given {@link StructureType}. -- *
-- * This method uses implementation default values for radius and -- * findUnexplored (usually 100, true). - * - * @param world the world the map will belong to - * @param location the origin location to find the nearest structure -@@ -838,9 +837,50 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * - * @see World#locateNearestStructure(org.bukkit.Location, - * org.bukkit.StructureType, int, boolean) -+ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type, int, boolean)} - */ -+ @Deprecated // Paper - @NotNull - public ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType, int radius, boolean findUnexplored); -+ // Paper start -+ /** -+ * Create a new explorer map targeting the closest nearby structure of a -+ * given {@link org.bukkit.generator.structure.StructureType}. -+ *
-+ * This method uses implementation default values for radius and -+ * findUnexplored (usually 100, true). -+ * -+ * @param world the world the map will belong to -+ * @param location the origin location to find the nearest structure -+ * @param structureType the type of structure to find -+ * @param mapIcon the map icon to use on the map -+ * @return a newly created item stack or null if it can't find a location -+ * -+ * @see World#locateNearestStructure(org.bukkit.Location, -+ * org.bukkit.generator.structure.StructureType, int, boolean) -+ */ -+ default @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon) { -+ return this.createExplorerMap(world, location, structureType, mapIcon, 100, true); -+ } -+ -+ /** -+ * Create a new explorer map targeting the closest nearby structure of a -+ * given {@link org.bukkit.generator.structure.StructureType}. -+ * -+ * @param world the world the map will belong to -+ * @param location the origin location to find the nearest structure -+ * @param structureType the type of structure to find -+ * @param mapIcon the map icon to use on the map -+ * @param radius radius to search, see World#locateNearestStructure for more -+ * information -+ * @param findUnexplored whether to find unexplored structures -+ * @return the newly created item stack or null if it can't find a location -+ * -+ * @see World#locateNearestStructure(org.bukkit.Location, -+ * org.bukkit.generator.structure.StructureType, int, boolean) -+ */ -+ @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon, int radius, boolean findUnexplored); -+ // Paper end - - /** - * Reloads the server, refreshing settings and plugin information. diff --git a/patches/api/0405-Add-Listing-API-for-Player.patch b/patches/api/0405-Add-Listing-API-for-Player.patch deleted file mode 100644 index 3135969fe0..0000000000 --- a/patches/api/0405-Add-Listing-API-for-Player.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Corey Shupe -Date: Wed, 11 Jan 2023 16:40:31 -0500 -Subject: [PATCH] Add Listing API for Player - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index baf7ff3b23be8dd80d2e59299a6ec8f9ce1053df..e128750b1175ab8bbe9b23fdd931665262c8d75e 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2078,6 +2078,32 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public boolean canSee(@NotNull Entity entity); - -+ // Paper start -+ /** -+ * Returns whether the {@code other} player is listed for {@code this}. -+ * -+ * @param other The other {@link Player} to check for listing. -+ * @return True if the {@code other} player is listed for {@code this}. -+ */ -+ boolean isListed(@NotNull Player other); -+ -+ /** -+ * Unlists the {@code other} player from the tablist. -+ * -+ * @param other The other {@link Player} to de-list. -+ * @return True if the {@code other} player was listed. -+ */ -+ boolean unlistPlayer(@NotNull Player other); -+ -+ /** -+ * Lists the {@code other} player. -+ * -+ * @param other The other {@link Player} to list. -+ * @return True if the {@code other} player was not listed. -+ */ -+ boolean listPlayer(@NotNull Player other); -+ // Paper end -+ - /** - * Checks to see if this player is currently flying or not. - * diff --git a/patches/api/0405-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/api/0405-Deprecate-and-replace-methods-with-old-StructureType.patch new file mode 100644 index 0000000000..a832ca9f1d --- /dev/null +++ b/patches/api/0405-Deprecate-and-replace-methods-with-old-StructureType.patch @@ -0,0 +1,159 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 10 Dec 2022 17:52:45 -0800 +Subject: [PATCH] Deprecate and replace methods with old StructureType + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 52c601328bbf5c1642aa620c8bb466a9d2d231be..c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -949,9 +949,6 @@ public final class Bukkit { + /** + * Create a new explorer map targeting the closest nearby structure of a + * given {@link StructureType}. +- *
+- * This method uses implementation default values for radius and +- * findUnexplored (usually 100, true). + * + * @param world the world the map will belong to + * @param location the origin location to find the nearest structure +@@ -960,7 +957,9 @@ public final class Bukkit { + * + * @see World#locateNearestStructure(org.bukkit.Location, + * org.bukkit.StructureType, int, boolean) ++ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type)} + */ ++ @Deprecated // Paper + @NotNull + public static ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType) { + return server.createExplorerMap(world, location, structureType); +@@ -983,11 +982,54 @@ public final class Bukkit { + * + * @see World#locateNearestStructure(org.bukkit.Location, + * org.bukkit.StructureType, int, boolean) ++ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type, int, boolean)} + */ ++ @Deprecated // Paper + @NotNull + public static ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType, int radius, boolean findUnexplored) { + return server.createExplorerMap(world, location, structureType, radius, findUnexplored); + } ++ // Paper start ++ /** ++ * Create a new explorer map targeting the closest nearby structure of a ++ * given {@link org.bukkit.generator.structure.StructureType}. ++ *
++ * This method uses implementation default values for radius and ++ * findUnexplored (usually 100, true). ++ * ++ * @param world the world the map will belong to ++ * @param location the origin location to find the nearest structure ++ * @param structureType the type of structure to find ++ * @param mapIcon the map icon to use on the map ++ * @return a newly created item stack or null if it can't find a location ++ * ++ * @see World#locateNearestStructure(org.bukkit.Location, ++ * org.bukkit.generator.structure.StructureType, int, boolean) ++ */ ++ public static @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon) { ++ return server.createExplorerMap(world, location, structureType, mapIcon); ++ } ++ ++ /** ++ * Create a new explorer map targeting the closest nearby structure of a ++ * given {@link org.bukkit.generator.structure.StructureType}. ++ * ++ * @param world the world the map will belong to ++ * @param location the origin location to find the nearest structure ++ * @param structureType the type of structure to find ++ * @param mapIcon the map icon to use on the map ++ * @param radius radius to search, see World#locateNearestStructure for more ++ * information ++ * @param findUnexplored whether to find unexplored structures ++ * @return the newly created item stack or null if it can't find a location ++ * ++ * @see World#locateNearestStructure(org.bukkit.Location, ++ * org.bukkit.generator.structure.StructureType, int, boolean) ++ */ ++ public static @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon, int radius, boolean findUnexplored) { ++ return server.createExplorerMap(world, location, structureType, mapIcon, radius, findUnexplored); ++ } ++ // Paper end + + /** + * Reloads the server, refreshing settings and plugin information. +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 8ba2fbaab7428a42b506fd000fbc162f68ddaed1..50ffca9bccfb582d58ccb13f0decf66e5d91aef3 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * + * @see World#locateNearestStructure(org.bukkit.Location, + * org.bukkit.StructureType, int, boolean) ++ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type)} + */ ++ @Deprecated // Paper + @NotNull + public ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType); + + /** + * Create a new explorer map targeting the closest nearby structure of a + * given {@link StructureType}. +- *
+- * This method uses implementation default values for radius and +- * findUnexplored (usually 100, true). + * + * @param world the world the map will belong to + * @param location the origin location to find the nearest structure +@@ -838,9 +837,50 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * + * @see World#locateNearestStructure(org.bukkit.Location, + * org.bukkit.StructureType, int, boolean) ++ * @deprecated use {@link #createExplorerMap(World, Location, org.bukkit.generator.structure.StructureType, org.bukkit.map.MapCursor.Type, int, boolean)} + */ ++ @Deprecated // Paper + @NotNull + public ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType, int radius, boolean findUnexplored); ++ // Paper start ++ /** ++ * Create a new explorer map targeting the closest nearby structure of a ++ * given {@link org.bukkit.generator.structure.StructureType}. ++ *
++ * This method uses implementation default values for radius and ++ * findUnexplored (usually 100, true). ++ * ++ * @param world the world the map will belong to ++ * @param location the origin location to find the nearest structure ++ * @param structureType the type of structure to find ++ * @param mapIcon the map icon to use on the map ++ * @return a newly created item stack or null if it can't find a location ++ * ++ * @see World#locateNearestStructure(org.bukkit.Location, ++ * org.bukkit.generator.structure.StructureType, int, boolean) ++ */ ++ default @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon) { ++ return this.createExplorerMap(world, location, structureType, mapIcon, 100, true); ++ } ++ ++ /** ++ * Create a new explorer map targeting the closest nearby structure of a ++ * given {@link org.bukkit.generator.structure.StructureType}. ++ * ++ * @param world the world the map will belong to ++ * @param location the origin location to find the nearest structure ++ * @param structureType the type of structure to find ++ * @param mapIcon the map icon to use on the map ++ * @param radius radius to search, see World#locateNearestStructure for more ++ * information ++ * @param findUnexplored whether to find unexplored structures ++ * @return the newly created item stack or null if it can't find a location ++ * ++ * @see World#locateNearestStructure(org.bukkit.Location, ++ * org.bukkit.generator.structure.StructureType, int, boolean) ++ */ ++ @Nullable ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull org.bukkit.generator.structure.StructureType structureType, @NotNull org.bukkit.map.MapCursor.Type mapIcon, int radius, boolean findUnexplored); ++ // Paper end + + /** + * Reloads the server, refreshing settings and plugin information. diff --git a/patches/api/0406-Add-Listing-API-for-Player.patch b/patches/api/0406-Add-Listing-API-for-Player.patch new file mode 100644 index 0000000000..3135969fe0 --- /dev/null +++ b/patches/api/0406-Add-Listing-API-for-Player.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Corey Shupe +Date: Wed, 11 Jan 2023 16:40:31 -0500 +Subject: [PATCH] Add Listing API for Player + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index baf7ff3b23be8dd80d2e59299a6ec8f9ce1053df..e128750b1175ab8bbe9b23fdd931665262c8d75e 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -2078,6 +2078,32 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public boolean canSee(@NotNull Entity entity); + ++ // Paper start ++ /** ++ * Returns whether the {@code other} player is listed for {@code this}. ++ * ++ * @param other The other {@link Player} to check for listing. ++ * @return True if the {@code other} player is listed for {@code this}. ++ */ ++ boolean isListed(@NotNull Player other); ++ ++ /** ++ * Unlists the {@code other} player from the tablist. ++ * ++ * @param other The other {@link Player} to de-list. ++ * @return True if the {@code other} player was listed. ++ */ ++ boolean unlistPlayer(@NotNull Player other); ++ ++ /** ++ * Lists the {@code other} player. ++ * ++ * @param other The other {@link Player} to list. ++ * @return True if the {@code other} player was not listed. ++ */ ++ boolean listPlayer(@NotNull Player other); ++ // Paper end ++ + /** + * Checks to see if this player is currently flying or not. + * diff --git a/patches/api/0406-Expose-clicked-BlockFace-during-BlockDamageEvent.patch b/patches/api/0406-Expose-clicked-BlockFace-during-BlockDamageEvent.patch deleted file mode 100644 index 34d1940866..0000000000 --- a/patches/api/0406-Expose-clicked-BlockFace-during-BlockDamageEvent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: aerulion -Date: Mon, 21 Aug 2023 04:36:07 +0200 -Subject: [PATCH] Expose clicked BlockFace during BlockDamageEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java -index cd04a0bd9d232857408b38605787016a217cb8d2..392cde07d578d684423e1bf369af28696eb7e484 100644 ---- a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java -@@ -19,9 +19,20 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable { - private boolean instaBreak; - private boolean cancel; - private final ItemStack itemstack; -+ private final org.bukkit.block.BlockFace blockFace; // Paper - Expose BlockFace - -+ // Paper start - expose blockface -+ @Deprecated(forRemoval = true) -+ @io.papermc.paper.annotation.DoNotUse - public BlockDamageEvent(@NotNull final Player player, @NotNull final Block block, @NotNull final ItemStack itemInHand, final boolean instaBreak) { -+ this(player, block, null, itemInHand, instaBreak); // Some plugin do bad things... -+ } -+ -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public BlockDamageEvent(@NotNull final Player player, @NotNull final Block block, @NotNull final org.bukkit.block.BlockFace blockFace, @NotNull final ItemStack itemInHand, final boolean instaBreak) { // Paper - Expose BlockFace - super(block); -+ this.blockFace = blockFace; -+ // Paper end - expose blockface - this.instaBreak = instaBreak; - this.player = player; - this.itemstack = itemInHand; -@@ -67,6 +78,20 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable { - public ItemStack getItemInHand() { - return itemstack; - } -+ // Paper start - Expose BlockFace -+ /** -+ * Gets the BlockFace the player is interacting with. -+ * -+ * @return The BlockFace clicked to damage the block -+ */ -+ @NotNull -+ public org.bukkit.block.BlockFace getBlockFace() { -+ if (this.blockFace == null) { -+ throw new IllegalStateException("BlockFace is not available for this event, most likely due to a bad constructor call by a plugin"); -+ } -+ return this.blockFace; -+ } -+ //Paper end - - @Override - public boolean isCancelled() { diff --git a/patches/api/0407-Expose-clicked-BlockFace-during-BlockDamageEvent.patch b/patches/api/0407-Expose-clicked-BlockFace-during-BlockDamageEvent.patch new file mode 100644 index 0000000000..34d1940866 --- /dev/null +++ b/patches/api/0407-Expose-clicked-BlockFace-during-BlockDamageEvent.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: aerulion +Date: Mon, 21 Aug 2023 04:36:07 +0200 +Subject: [PATCH] Expose clicked BlockFace during BlockDamageEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java +index cd04a0bd9d232857408b38605787016a217cb8d2..392cde07d578d684423e1bf369af28696eb7e484 100644 +--- a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java +@@ -19,9 +19,20 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable { + private boolean instaBreak; + private boolean cancel; + private final ItemStack itemstack; ++ private final org.bukkit.block.BlockFace blockFace; // Paper - Expose BlockFace + ++ // Paper start - expose blockface ++ @Deprecated(forRemoval = true) ++ @io.papermc.paper.annotation.DoNotUse + public BlockDamageEvent(@NotNull final Player player, @NotNull final Block block, @NotNull final ItemStack itemInHand, final boolean instaBreak) { ++ this(player, block, null, itemInHand, instaBreak); // Some plugin do bad things... ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper ++ public BlockDamageEvent(@NotNull final Player player, @NotNull final Block block, @NotNull final org.bukkit.block.BlockFace blockFace, @NotNull final ItemStack itemInHand, final boolean instaBreak) { // Paper - Expose BlockFace + super(block); ++ this.blockFace = blockFace; ++ // Paper end - expose blockface + this.instaBreak = instaBreak; + this.player = player; + this.itemstack = itemInHand; +@@ -67,6 +78,20 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable { + public ItemStack getItemInHand() { + return itemstack; + } ++ // Paper start - Expose BlockFace ++ /** ++ * Gets the BlockFace the player is interacting with. ++ * ++ * @return The BlockFace clicked to damage the block ++ */ ++ @NotNull ++ public org.bukkit.block.BlockFace getBlockFace() { ++ if (this.blockFace == null) { ++ throw new IllegalStateException("BlockFace is not available for this event, most likely due to a bad constructor call by a plugin"); ++ } ++ return this.blockFace; ++ } ++ //Paper end + + @Override + public boolean isCancelled() { diff --git a/patches/api/0407-Fix-NPE-on-Boat-getStatus.patch b/patches/api/0407-Fix-NPE-on-Boat-getStatus.patch deleted file mode 100644 index 985aab9f2b..0000000000 --- a/patches/api/0407-Fix-NPE-on-Boat-getStatus.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: LemonCaramel -Date: Tue, 11 Apr 2023 04:04:41 +0900 -Subject: [PATCH] Fix NPE on Boat getStatus - - -diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java -index a0fb3c44405f6362f8a1613661d507e448f7ba6b..7076870c1abfa0edef33e00c39514aa413920f59 100644 ---- a/src/main/java/org/bukkit/entity/Boat.java -+++ b/src/main/java/org/bukkit/entity/Boat.java -@@ -175,6 +175,7 @@ public interface Boat extends Vehicle { - */ - public enum Status { - -+ NOT_IN_WORLD, // Paper - IN_WATER, - UNDER_WATER, - UNDER_FLOWING_WATER, diff --git a/patches/api/0408-Expand-Pose-API.patch b/patches/api/0408-Expand-Pose-API.patch deleted file mode 100644 index a7ac9f7567..0000000000 --- a/patches/api/0408-Expand-Pose-API.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 11 Jan 2023 20:59:02 +0200 -Subject: [PATCH] Expand Pose API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index efd8108cee65e7b1a227ebb6c33f3c92eb4cea24..725ef320f929d5e3d141c1ed3246d73a7d741f31 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -840,6 +840,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * @param sneak true if the entity should be sneaking - */ - void setSneaking(boolean sneak); -+ -+ /** -+ * Sets the entity's current {@link Pose}. -+ * -+ *

Note: While poses affect some things like hitboxes, they do not change the entity's state -+ * (e.g. having {@link Pose#SNEAKING} does not guarantee {@link #isSneaking()} being {@code true}). -+ * -+ *

If applied to the {@link Player}, they might see a different pose client-side. -+ * -+ * @param pose a new {@link Pose} -+ * @see #setPose(Pose, boolean) -+ */ -+ default void setPose(@NotNull Pose pose) { -+ setPose(pose, false); -+ } -+ -+ /** -+ * Sets the entity's current {@link Pose}. -+ * -+ *

Note: While poses affect some things like hitboxes, they do not change the entity's state -+ * (e.g. having {@link Pose#SNEAKING} does not guarantee {@link #isSneaking()} being {@code true}). -+ * -+ *

If applied to the {@link Player}, they might see a different pose client-side. -+ * -+ * @param pose a new {@link Pose} -+ * @param fixed whether the new {@link Pose} should stay until manually changed -+ */ -+ void setPose(@NotNull Pose pose, boolean fixed); -+ -+ /** -+ * Checks whether the entity has a fixed {@link Pose} -+ * -+ * @see #setPose(Pose, boolean) -+ * @return whether the entity has a fixed {@link Pose} -+ */ -+ boolean hasFixedPose(); - // Paper end - - /** diff --git a/patches/api/0408-Fix-NPE-on-Boat-getStatus.patch b/patches/api/0408-Fix-NPE-on-Boat-getStatus.patch new file mode 100644 index 0000000000..985aab9f2b --- /dev/null +++ b/patches/api/0408-Fix-NPE-on-Boat-getStatus.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: LemonCaramel +Date: Tue, 11 Apr 2023 04:04:41 +0900 +Subject: [PATCH] Fix NPE on Boat getStatus + + +diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java +index a0fb3c44405f6362f8a1613661d507e448f7ba6b..7076870c1abfa0edef33e00c39514aa413920f59 100644 +--- a/src/main/java/org/bukkit/entity/Boat.java ++++ b/src/main/java/org/bukkit/entity/Boat.java +@@ -175,6 +175,7 @@ public interface Boat extends Vehicle { + */ + public enum Status { + ++ NOT_IN_WORLD, // Paper + IN_WATER, + UNDER_WATER, + UNDER_FLOWING_WATER, diff --git a/patches/api/0409-Expand-Pose-API.patch b/patches/api/0409-Expand-Pose-API.patch new file mode 100644 index 0000000000..a7ac9f7567 --- /dev/null +++ b/patches/api/0409-Expand-Pose-API.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Wed, 11 Jan 2023 20:59:02 +0200 +Subject: [PATCH] Expand Pose API + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index efd8108cee65e7b1a227ebb6c33f3c92eb4cea24..725ef320f929d5e3d141c1ed3246d73a7d741f31 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -840,6 +840,42 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * @param sneak true if the entity should be sneaking + */ + void setSneaking(boolean sneak); ++ ++ /** ++ * Sets the entity's current {@link Pose}. ++ * ++ *

Note: While poses affect some things like hitboxes, they do not change the entity's state ++ * (e.g. having {@link Pose#SNEAKING} does not guarantee {@link #isSneaking()} being {@code true}). ++ * ++ *

If applied to the {@link Player}, they might see a different pose client-side. ++ * ++ * @param pose a new {@link Pose} ++ * @see #setPose(Pose, boolean) ++ */ ++ default void setPose(@NotNull Pose pose) { ++ setPose(pose, false); ++ } ++ ++ /** ++ * Sets the entity's current {@link Pose}. ++ * ++ *

Note: While poses affect some things like hitboxes, they do not change the entity's state ++ * (e.g. having {@link Pose#SNEAKING} does not guarantee {@link #isSneaking()} being {@code true}). ++ * ++ *

If applied to the {@link Player}, they might see a different pose client-side. ++ * ++ * @param pose a new {@link Pose} ++ * @param fixed whether the new {@link Pose} should stay until manually changed ++ */ ++ void setPose(@NotNull Pose pose, boolean fixed); ++ ++ /** ++ * Checks whether the entity has a fixed {@link Pose} ++ * ++ * @see #setPose(Pose, boolean) ++ * @return whether the entity has a fixed {@link Pose} ++ */ ++ boolean hasFixedPose(); + // Paper end + + /** diff --git a/patches/api/0409-MerchantRecipe-add-copy-constructor.patch b/patches/api/0409-MerchantRecipe-add-copy-constructor.patch deleted file mode 100644 index 1c5ba2803c..0000000000 --- a/patches/api/0409-MerchantRecipe-add-copy-constructor.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Joo200 -Date: Tue, 20 Dec 2022 15:26:36 +0100 -Subject: [PATCH] MerchantRecipe: add copy constructor - - -diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java -index afaa21b9347683fa373a938d9b1aa01c2058192a..39f9766a03d420340d79841197f75c8b1dd49f4a 100644 ---- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java -+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java -@@ -91,6 +91,13 @@ public class MerchantRecipe implements Recipe { - this.specialPrice = specialPrice; - } - -+ // Paper start - add copy ctor -+ public MerchantRecipe(@NotNull MerchantRecipe recipe) { -+ this(recipe.result.clone(), recipe.uses, recipe.maxUses, recipe.experienceReward, recipe.villagerExperience, recipe.priceMultiplier, recipe.demand, recipe.specialPrice, recipe.ignoreDiscounts); -+ this.setIngredients(recipe.ingredients); -+ } -+ // Paper end -+ - @NotNull - @Override - public ItemStack getResult() { diff --git a/patches/api/0410-MerchantRecipe-add-copy-constructor.patch b/patches/api/0410-MerchantRecipe-add-copy-constructor.patch new file mode 100644 index 0000000000..1c5ba2803c --- /dev/null +++ b/patches/api/0410-MerchantRecipe-add-copy-constructor.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Joo200 +Date: Tue, 20 Dec 2022 15:26:36 +0100 +Subject: [PATCH] MerchantRecipe: add copy constructor + + +diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java +index afaa21b9347683fa373a938d9b1aa01c2058192a..39f9766a03d420340d79841197f75c8b1dd49f4a 100644 +--- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java ++++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java +@@ -91,6 +91,13 @@ public class MerchantRecipe implements Recipe { + this.specialPrice = specialPrice; + } + ++ // Paper start - add copy ctor ++ public MerchantRecipe(@NotNull MerchantRecipe recipe) { ++ this(recipe.result.clone(), recipe.uses, recipe.maxUses, recipe.experienceReward, recipe.villagerExperience, recipe.priceMultiplier, recipe.demand, recipe.specialPrice, recipe.ignoreDiscounts); ++ this.setIngredients(recipe.ingredients); ++ } ++ // Paper end ++ + @NotNull + @Override + public ItemStack getResult() { diff --git a/patches/api/0410-More-DragonBattle-API.patch b/patches/api/0410-More-DragonBattle-API.patch deleted file mode 100644 index e25208ec19..0000000000 --- a/patches/api/0410-More-DragonBattle-API.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 18 Dec 2022 13:40:17 -0800 -Subject: [PATCH] More DragonBattle API - - -diff --git a/src/main/java/org/bukkit/boss/DragonBattle.java b/src/main/java/org/bukkit/boss/DragonBattle.java -index 6e5fc92243ee63c2a965f8a4905e29a7993588fd..5dbd12a786a66640ce80acafe2a42e35adef41eb 100644 ---- a/src/main/java/org/bukkit/boss/DragonBattle.java -+++ b/src/main/java/org/bukkit/boss/DragonBattle.java -@@ -145,4 +145,44 @@ public interface DragonBattle { - */ - NONE; - } -+ // Paper start -+ /** -+ * Gets the number of gateways tracked by this DragonBattle. -+ * This starts out at 0 and will increase to 20, once for each -+ * kill of the {@link EnderDragon}. -+ * -+ * @return the number of gateways around the end island tracked by this -+ */ -+ int getGatewayCount(); -+ -+ /** -+ * Tries to spawn a new end gateway using default game mechanics. -+ * -+ * @return true if successful, false if there is already the maximum. -+ */ -+ boolean spawnNewGateway(); -+ -+ /** -+ * Spawns a new end gateway at the specified position. This will -+ * spawn regardless of the number of gateways already present. -+ * -+ * @param position position for the new gateway -+ */ -+ void spawnNewGateway(@NotNull io.papermc.paper.math.Position position); -+ -+ /** -+ * Gets the {@link org.bukkit.entity.EnderCrystal}s being used to respawn the dragon. If no respawn -+ * is ongoing, the list will be empty. -+ * -+ * @return the respawn crystals -+ */ -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getRespawnCrystals(); -+ -+ /** -+ * Gets the {@link org.bukkit.entity.EnderCrystal}s on top of the pillars that heal the dragon. -+ * -+ * @return the healing crystals -+ */ -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getHealingCrystals(); -+ // Paper end - } diff --git a/patches/api/0411-Add-PlayerPickItemEvent.patch b/patches/api/0411-Add-PlayerPickItemEvent.patch deleted file mode 100644 index 0532447562..0000000000 --- a/patches/api/0411-Add-PlayerPickItemEvent.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: RodneyMKay <36546810+RodneyMKay@users.noreply.github.com> -Date: Wed, 8 Sep 2021 22:15:43 +0200 -Subject: [PATCH] Add PlayerPickItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d7e10652918e453838a3a983f089ef4727d0bfe2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java -@@ -0,0 +1,93 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Range; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Event that is fired when a player uses the pick item functionality (middle-clicking a block to get the appropriate -+ * item). However, note that this event will only trigger if an item has to be moved from the inventory to the hotbar. -+ * After the handling of this event, the contents of the source and the target slot will be swapped and the currently -+ * selected hotbar slot of the player will be set to the target slot. -+ *

-+ * Note: This event will not be fired for players in creative mode. -+ */ -+@NullMarked -+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private int targetSlot; -+ private int sourceSlot; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot) { -+ super(player); -+ this.targetSlot = targetSlot; -+ this.sourceSlot = sourceSlot; -+ } -+ -+ /** -+ * Returns the slot the item that is being picked goes into. -+ * -+ * @return hotbar slot (0-8 inclusive) -+ */ -+ public @Range(from = 0, to = 8) int getTargetSlot() { -+ return this.targetSlot; -+ } -+ -+ /** -+ * Changes the slot the item that is being picked goes into. -+ * -+ * @param targetSlot hotbar slot (0-8 inclusive) -+ */ -+ public void setTargetSlot(final @Range(from = 0, to = 8) int targetSlot) { -+ Preconditions.checkArgument(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)"); -+ this.targetSlot = targetSlot; -+ } -+ -+ /** -+ * Returns the slot in which the item that will be put into the players hotbar is located. -+ * -+ * @return player inventory slot (0-35 inclusive) -+ */ -+ public @Range(from = 0, to = 35) int getSourceSlot() { -+ return this.sourceSlot; -+ } -+ -+ /** -+ * Change the source slot from which the item that will be put in the players hotbar will be taken. -+ * -+ * @param sourceSlot player inventory slot (0-35 inclusive) -+ */ -+ public void setSourceSlot(final @Range(from = 0, to = 35) int sourceSlot) { -+ Preconditions.checkArgument(sourceSlot >= 0 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot"); -+ this.sourceSlot = sourceSlot; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0411-More-DragonBattle-API.patch b/patches/api/0411-More-DragonBattle-API.patch new file mode 100644 index 0000000000..e25208ec19 --- /dev/null +++ b/patches/api/0411-More-DragonBattle-API.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 18 Dec 2022 13:40:17 -0800 +Subject: [PATCH] More DragonBattle API + + +diff --git a/src/main/java/org/bukkit/boss/DragonBattle.java b/src/main/java/org/bukkit/boss/DragonBattle.java +index 6e5fc92243ee63c2a965f8a4905e29a7993588fd..5dbd12a786a66640ce80acafe2a42e35adef41eb 100644 +--- a/src/main/java/org/bukkit/boss/DragonBattle.java ++++ b/src/main/java/org/bukkit/boss/DragonBattle.java +@@ -145,4 +145,44 @@ public interface DragonBattle { + */ + NONE; + } ++ // Paper start ++ /** ++ * Gets the number of gateways tracked by this DragonBattle. ++ * This starts out at 0 and will increase to 20, once for each ++ * kill of the {@link EnderDragon}. ++ * ++ * @return the number of gateways around the end island tracked by this ++ */ ++ int getGatewayCount(); ++ ++ /** ++ * Tries to spawn a new end gateway using default game mechanics. ++ * ++ * @return true if successful, false if there is already the maximum. ++ */ ++ boolean spawnNewGateway(); ++ ++ /** ++ * Spawns a new end gateway at the specified position. This will ++ * spawn regardless of the number of gateways already present. ++ * ++ * @param position position for the new gateway ++ */ ++ void spawnNewGateway(@NotNull io.papermc.paper.math.Position position); ++ ++ /** ++ * Gets the {@link org.bukkit.entity.EnderCrystal}s being used to respawn the dragon. If no respawn ++ * is ongoing, the list will be empty. ++ * ++ * @return the respawn crystals ++ */ ++ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getRespawnCrystals(); ++ ++ /** ++ * Gets the {@link org.bukkit.entity.EnderCrystal}s on top of the pillars that heal the dragon. ++ * ++ * @return the healing crystals ++ */ ++ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getHealingCrystals(); ++ // Paper end + } diff --git a/patches/api/0412-Add-PlayerPickItemEvent.patch b/patches/api/0412-Add-PlayerPickItemEvent.patch new file mode 100644 index 0000000000..0532447562 --- /dev/null +++ b/patches/api/0412-Add-PlayerPickItemEvent.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: RodneyMKay <36546810+RodneyMKay@users.noreply.github.com> +Date: Wed, 8 Sep 2021 22:15:43 +0200 +Subject: [PATCH] Add PlayerPickItemEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d7e10652918e453838a3a983f089ef4727d0bfe2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java +@@ -0,0 +1,93 @@ ++package io.papermc.paper.event.player; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Event that is fired when a player uses the pick item functionality (middle-clicking a block to get the appropriate ++ * item). However, note that this event will only trigger if an item has to be moved from the inventory to the hotbar. ++ * After the handling of this event, the contents of the source and the target slot will be swapped and the currently ++ * selected hotbar slot of the player will be set to the target slot. ++ *

++ * Note: This event will not be fired for players in creative mode. ++ */ ++@NullMarked ++public class PlayerPickItemEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private int targetSlot; ++ private int sourceSlot; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot) { ++ super(player); ++ this.targetSlot = targetSlot; ++ this.sourceSlot = sourceSlot; ++ } ++ ++ /** ++ * Returns the slot the item that is being picked goes into. ++ * ++ * @return hotbar slot (0-8 inclusive) ++ */ ++ public @Range(from = 0, to = 8) int getTargetSlot() { ++ return this.targetSlot; ++ } ++ ++ /** ++ * Changes the slot the item that is being picked goes into. ++ * ++ * @param targetSlot hotbar slot (0-8 inclusive) ++ */ ++ public void setTargetSlot(final @Range(from = 0, to = 8) int targetSlot) { ++ Preconditions.checkArgument(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)"); ++ this.targetSlot = targetSlot; ++ } ++ ++ /** ++ * Returns the slot in which the item that will be put into the players hotbar is located. ++ * ++ * @return player inventory slot (0-35 inclusive) ++ */ ++ public @Range(from = 0, to = 35) int getSourceSlot() { ++ return this.sourceSlot; ++ } ++ ++ /** ++ * Change the source slot from which the item that will be put in the players hotbar will be taken. ++ * ++ * @param sourceSlot player inventory slot (0-35 inclusive) ++ */ ++ public void setSourceSlot(final @Range(from = 0, to = 35) int sourceSlot) { ++ Preconditions.checkArgument(sourceSlot >= 0 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot"); ++ this.sourceSlot = sourceSlot; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(final boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0412-Allow-trident-custom-damage.patch b/patches/api/0412-Allow-trident-custom-damage.patch deleted file mode 100644 index 870b735548..0000000000 --- a/patches/api/0412-Allow-trident-custom-damage.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Wed, 13 Jul 2022 15:29:53 +0200 -Subject: [PATCH] Allow trident custom damage - - -diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java -index 02584eced96944a551140f8150c65a7c0f4bb55e..d21df39ceef657575f3c2e9070bf6d2671978c7a 100644 ---- a/src/main/java/org/bukkit/entity/Trident.java -+++ b/src/main/java/org/bukkit/entity/Trident.java -@@ -57,5 +57,23 @@ public interface Trident extends AbstractArrow, ThrowableProjectile { - * @param hasDealtDamage has dealt damage or hit the floor - */ - void setHasDealtDamage(boolean hasDealtDamage); -+ -+ /** -+ * Sets the base amount of damage this trident will do. -+ * -+ * @param damage new damage amount -+ */ -+ void setDamage(double damage); -+ -+ /** -+ * Gets the base amount of damage this trident will do. -+ * -+ * Defaults to 8.0 for a normal trident with -+ * 0.5 * (1 + power level) added for trident fired from -+ * damage enchanted bows. -+ * -+ * @return base damage amount -+ */ -+ double getDamage(); - } - // Paper end diff --git a/patches/api/0413-Allow-trident-custom-damage.patch b/patches/api/0413-Allow-trident-custom-damage.patch new file mode 100644 index 0000000000..870b735548 --- /dev/null +++ b/patches/api/0413-Allow-trident-custom-damage.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Wed, 13 Jul 2022 15:29:53 +0200 +Subject: [PATCH] Allow trident custom damage + + +diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java +index 02584eced96944a551140f8150c65a7c0f4bb55e..d21df39ceef657575f3c2e9070bf6d2671978c7a 100644 +--- a/src/main/java/org/bukkit/entity/Trident.java ++++ b/src/main/java/org/bukkit/entity/Trident.java +@@ -57,5 +57,23 @@ public interface Trident extends AbstractArrow, ThrowableProjectile { + * @param hasDealtDamage has dealt damage or hit the floor + */ + void setHasDealtDamage(boolean hasDealtDamage); ++ ++ /** ++ * Sets the base amount of damage this trident will do. ++ * ++ * @param damage new damage amount ++ */ ++ void setDamage(double damage); ++ ++ /** ++ * Gets the base amount of damage this trident will do. ++ * ++ * Defaults to 8.0 for a normal trident with ++ * 0.5 * (1 + power level) added for trident fired from ++ * damage enchanted bows. ++ * ++ * @return base damage amount ++ */ ++ double getDamage(); + } + // Paper end diff --git a/patches/api/0413-Expose-hand-during-BlockCanBuildEvent.patch b/patches/api/0413-Expose-hand-during-BlockCanBuildEvent.patch deleted file mode 100644 index 97d99a40d2..0000000000 --- a/patches/api/0413-Expose-hand-during-BlockCanBuildEvent.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: The456gamer -Date: Mon, 21 Aug 2023 14:13:43 +0100 -Subject: [PATCH] Expose hand during BlockCanBuildEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java -index a1350c0f74d445dca09eea6e10abac050bb06990..08d09c2a92d8aa6adf6610cc05905d58a76fce1f 100644 ---- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java -@@ -25,10 +25,11 @@ public class BlockCanBuildEvent extends BlockEvent { - - protected BlockData blockData; - private final Player player; -+ private final org.bukkit.inventory.EquipmentSlot hand; // Paper - expose hand - - @Deprecated - public BlockCanBuildEvent(@NotNull final Block block, @NotNull final BlockData type, final boolean canBuild) { -- this(block, null, type, canBuild); -+ this(block, null, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper - expose hand - } - - /** -@@ -37,12 +38,30 @@ public class BlockCanBuildEvent extends BlockEvent { - * @param type the id of the block to place - * @param canBuild whether we can build - */ -+ @java.lang.Deprecated // Paper -+ @io.papermc.paper.annotation.DoNotUse // Paper - public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild) { -+ this(block, player, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper start - expose hand -+ } -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild, @NotNull final org.bukkit.inventory.EquipmentSlot hand) { // Paper end - expose hand - super(block); - this.player = player; - this.buildable = canBuild; - this.blockData = type; -+ this.hand = hand; // Paper -+ } -+ // Paper start -+ /** -+ * Gets the hand the player will use to place the block -+ * -+ * @return the EquipmentSlot representing the players hand. -+ */ -+ @NotNull -+ public org.bukkit.inventory.EquipmentSlot getHand() { -+ return hand; - } -+ // Paper end - - /** - * Gets whether or not the block can be built here. diff --git a/patches/api/0414-Expose-hand-during-BlockCanBuildEvent.patch b/patches/api/0414-Expose-hand-during-BlockCanBuildEvent.patch new file mode 100644 index 0000000000..97d99a40d2 --- /dev/null +++ b/patches/api/0414-Expose-hand-during-BlockCanBuildEvent.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: The456gamer +Date: Mon, 21 Aug 2023 14:13:43 +0100 +Subject: [PATCH] Expose hand during BlockCanBuildEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java +index a1350c0f74d445dca09eea6e10abac050bb06990..08d09c2a92d8aa6adf6610cc05905d58a76fce1f 100644 +--- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java +@@ -25,10 +25,11 @@ public class BlockCanBuildEvent extends BlockEvent { + + protected BlockData blockData; + private final Player player; ++ private final org.bukkit.inventory.EquipmentSlot hand; // Paper - expose hand + + @Deprecated + public BlockCanBuildEvent(@NotNull final Block block, @NotNull final BlockData type, final boolean canBuild) { +- this(block, null, type, canBuild); ++ this(block, null, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper - expose hand + } + + /** +@@ -37,12 +38,30 @@ public class BlockCanBuildEvent extends BlockEvent { + * @param type the id of the block to place + * @param canBuild whether we can build + */ ++ @java.lang.Deprecated // Paper ++ @io.papermc.paper.annotation.DoNotUse // Paper + public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild) { ++ this(block, player, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper start - expose hand ++ } ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild, @NotNull final org.bukkit.inventory.EquipmentSlot hand) { // Paper end - expose hand + super(block); + this.player = player; + this.buildable = canBuild; + this.blockData = type; ++ this.hand = hand; // Paper ++ } ++ // Paper start ++ /** ++ * Gets the hand the player will use to place the block ++ * ++ * @return the EquipmentSlot representing the players hand. ++ */ ++ @NotNull ++ public org.bukkit.inventory.EquipmentSlot getHand() { ++ return hand; + } ++ // Paper end + + /** + * Gets whether or not the block can be built here. diff --git a/patches/api/0414-Limit-setBurnTime-to-valid-short-values.patch b/patches/api/0414-Limit-setBurnTime-to-valid-short-values.patch deleted file mode 100644 index 2faac56fd8..0000000000 --- a/patches/api/0414-Limit-setBurnTime-to-valid-short-values.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Warrior <50800980+Warriorrrr@users.noreply.github.com> -Date: Fri, 18 Aug 2023 08:07:38 +0200 -Subject: [PATCH] Limit setBurnTime to valid short values - - -diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java -index ba4dc8aed85169e55cac276bdd51116919305019..2f80910dd23dacb30c41189a07a4e54117110bb8 100644 ---- a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java -@@ -52,8 +52,8 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable { - * - * @param burnTime the burn time for this fuel - */ -- public void setBurnTime(int burnTime) { -- this.burnTime = burnTime; -+ public void setBurnTime(@org.jetbrains.annotations.Range(from = Short.MIN_VALUE, to = Short.MAX_VALUE) int burnTime) { // Paper -+ this.burnTime = Math.max(Short.MIN_VALUE, Math.min(Short.MAX_VALUE, burnTime)); // Paper - } - - /** diff --git a/patches/api/0415-Add-OfflinePlayer-isConnected.patch b/patches/api/0415-Add-OfflinePlayer-isConnected.patch deleted file mode 100644 index 08e2f91095..0000000000 --- a/patches/api/0415-Add-OfflinePlayer-isConnected.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aeltumn -Date: Thu, 24 Aug 2023 13:05:07 +0200 -Subject: [PATCH] Add OfflinePlayer#isConnected - -This adds an alternative to OfflinePlayer#isOnline that returns true only if the same instance of the player is still online. This is generally more useful than isOnline as it allows you to determine if you have an instance of a Player that still exists. If a player relogs an old Player instance becomes unlinked leading to e.g. messages sent to the old player no longer arriving despite isOnline returning true. Checking against isConnected is more useful there to discard invalid instances. - -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index 299d1cc510d24541c6bb47d02db0b6a86fb1d0eb..3993fecec5b4c2bbd77e175a168afcad571ce4d1 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -24,10 +24,26 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - /** - * Checks if this player is currently online - * -+ * It should be noted that this will return true if any instance of this player is -+ * online! This instance may have disconnected. If you wish to check if this specific -+ * instance of the player is still online, see {@link OfflinePlayer#isConnected()}. -+ * - * @return true if they are online - */ - public boolean isOnline(); - -+ // Paper start -+ /** -+ * Checks whether the connection to this player is still valid. This will return -+ * true as long as this specific instance of the player is still connected. This -+ * will return false after this instance has disconnected, even if the same player -+ * has reconnected since. -+ * -+ * @return true if this player instance is connected -+ */ -+ public boolean isConnected(); -+ // Paper end -+ - /** - * Returns the name of this player - *

diff --git a/patches/api/0415-Limit-setBurnTime-to-valid-short-values.patch b/patches/api/0415-Limit-setBurnTime-to-valid-short-values.patch new file mode 100644 index 0000000000..2faac56fd8 --- /dev/null +++ b/patches/api/0415-Limit-setBurnTime-to-valid-short-values.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Warrior <50800980+Warriorrrr@users.noreply.github.com> +Date: Fri, 18 Aug 2023 08:07:38 +0200 +Subject: [PATCH] Limit setBurnTime to valid short values + + +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java +index ba4dc8aed85169e55cac276bdd51116919305019..2f80910dd23dacb30c41189a07a4e54117110bb8 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java +@@ -52,8 +52,8 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable { + * + * @param burnTime the burn time for this fuel + */ +- public void setBurnTime(int burnTime) { +- this.burnTime = burnTime; ++ public void setBurnTime(@org.jetbrains.annotations.Range(from = Short.MIN_VALUE, to = Short.MAX_VALUE) int burnTime) { // Paper ++ this.burnTime = Math.max(Short.MIN_VALUE, Math.min(Short.MAX_VALUE, burnTime)); // Paper + } + + /** diff --git a/patches/api/0416-Add-OfflinePlayer-isConnected.patch b/patches/api/0416-Add-OfflinePlayer-isConnected.patch new file mode 100644 index 0000000000..08e2f91095 --- /dev/null +++ b/patches/api/0416-Add-OfflinePlayer-isConnected.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aeltumn +Date: Thu, 24 Aug 2023 13:05:07 +0200 +Subject: [PATCH] Add OfflinePlayer#isConnected + +This adds an alternative to OfflinePlayer#isOnline that returns true only if the same instance of the player is still online. This is generally more useful than isOnline as it allows you to determine if you have an instance of a Player that still exists. If a player relogs an old Player instance becomes unlinked leading to e.g. messages sent to the old player no longer arriving despite isOnline returning true. Checking against isConnected is more useful there to discard invalid instances. + +diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java +index 299d1cc510d24541c6bb47d02db0b6a86fb1d0eb..3993fecec5b4c2bbd77e175a168afcad571ce4d1 100644 +--- a/src/main/java/org/bukkit/OfflinePlayer.java ++++ b/src/main/java/org/bukkit/OfflinePlayer.java +@@ -24,10 +24,26 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio + /** + * Checks if this player is currently online + * ++ * It should be noted that this will return true if any instance of this player is ++ * online! This instance may have disconnected. If you wish to check if this specific ++ * instance of the player is still online, see {@link OfflinePlayer#isConnected()}. ++ * + * @return true if they are online + */ + public boolean isOnline(); + ++ // Paper start ++ /** ++ * Checks whether the connection to this player is still valid. This will return ++ * true as long as this specific instance of the player is still connected. This ++ * will return false after this instance has disconnected, even if the same player ++ * has reconnected since. ++ * ++ * @return true if this player instance is connected ++ */ ++ public boolean isConnected(); ++ // Paper end ++ + /** + * Returns the name of this player + *

diff --git a/patches/api/0416-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/api/0416-Add-titleOverride-to-InventoryOpenEvent.patch deleted file mode 100644 index 68e755f010..0000000000 --- a/patches/api/0416-Add-titleOverride-to-InventoryOpenEvent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 4 Mar 2022 12:45:21 -0800 -Subject: [PATCH] Add titleOverride to InventoryOpenEvent - - -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java -index ceae092eb782698803c6c3df41267dde20ba62b2..8e2afeab4c62724148e8bb0c83fb7eec569c7a0c 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java -@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull; - public class InventoryOpenEvent extends InventoryEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; -+ private net.kyori.adventure.text.Component titleOverride; // Paper - - public InventoryOpenEvent(@NotNull InventoryView transaction) { - super(transaction); -@@ -56,6 +57,33 @@ public class InventoryOpenEvent extends InventoryEvent implements Cancellable { - cancelled = cancel; - } - -+ // Paper start -+ /** -+ * Gets the title override set by another event or null -+ * if not set. -+ * -+ * @return the title override or null -+ */ -+ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component titleOverride() { -+ return this.titleOverride; -+ } -+ -+ /** -+ * Sets the title override or clears the override. -+ *

-+ * This is only the title sent to the client in the open packet, this doesn't change -+ * the title returned by {@link InventoryView#title()}, hence "override". -+ *

-+ * NOTE: Horse inventories are a special case where setting this will -+ * have no effect. Horse inventory titles are set by the horse display name. -+ * -+ * @param titleOverride the title override or null -+ */ -+ public void titleOverride(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component titleOverride) { -+ this.titleOverride = titleOverride; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/0417-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/api/0417-Add-titleOverride-to-InventoryOpenEvent.patch new file mode 100644 index 0000000000..68e755f010 --- /dev/null +++ b/patches/api/0417-Add-titleOverride-to-InventoryOpenEvent.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 4 Mar 2022 12:45:21 -0800 +Subject: [PATCH] Add titleOverride to InventoryOpenEvent + + +diff --git a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java +index ceae092eb782698803c6c3df41267dde20ba62b2..8e2afeab4c62724148e8bb0c83fb7eec569c7a0c 100644 +--- a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java +@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull; + public class InventoryOpenEvent extends InventoryEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; ++ private net.kyori.adventure.text.Component titleOverride; // Paper + + public InventoryOpenEvent(@NotNull InventoryView transaction) { + super(transaction); +@@ -56,6 +57,33 @@ public class InventoryOpenEvent extends InventoryEvent implements Cancellable { + cancelled = cancel; + } + ++ // Paper start ++ /** ++ * Gets the title override set by another event or null ++ * if not set. ++ * ++ * @return the title override or null ++ */ ++ public net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component titleOverride() { ++ return this.titleOverride; ++ } ++ ++ /** ++ * Sets the title override or clears the override. ++ *

++ * This is only the title sent to the client in the open packet, this doesn't change ++ * the title returned by {@link InventoryView#title()}, hence "override". ++ *

++ * NOTE: Horse inventories are a special case where setting this will ++ * have no effect. Horse inventory titles are set by the horse display name. ++ * ++ * @param titleOverride the title override or null ++ */ ++ public void titleOverride(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component titleOverride) { ++ this.titleOverride = titleOverride; ++ } ++ // Paper end ++ + @NotNull + @Override + public HandlerList getHandlers() { diff --git a/patches/api/0417-Allow-proper-checking-of-empty-item-stacks.patch b/patches/api/0417-Allow-proper-checking-of-empty-item-stacks.patch deleted file mode 100644 index 0fe58e0369..0000000000 --- a/patches/api/0417-Allow-proper-checking-of-empty-item-stacks.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aeltumn -Date: Mon, 28 Aug 2023 13:41:09 +0200 -Subject: [PATCH] Allow proper checking of empty item stacks - -This adds a method to check if an item stack is empty or not. This mirrors vanilla's implementation of the same method. - -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index e39c9167bd66c528c09b256f15cc6c58666f0ca0..773780811a24aa1c1591257a993e30f2d99da436 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -1104,5 +1104,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - public @NotNull ItemStack damage(int amount, @NotNull org.bukkit.entity.LivingEntity livingEntity) { - return livingEntity.damageItemStack(this, amount); - } -+ -+ /** -+ * Returns an empty item stack, consists of an air material and a stack size of 0. -+ * -+ * Any item stack with a material of air or a stack size of 0 is seen -+ * as being empty by {@link ItemStack#isEmpty}. -+ */ -+ @NotNull -+ public static ItemStack empty() { -+ return new ItemStack(); -+ } -+ -+ /** -+ * Returns whether this item stack is empty and contains no item. This means -+ * it is either air or the stack has a size of 0. -+ */ -+ public boolean isEmpty() { -+ return type.isAir() || amount <= 0; -+ } - // Paper end - } diff --git a/patches/api/0418-Allow-proper-checking-of-empty-item-stacks.patch b/patches/api/0418-Allow-proper-checking-of-empty-item-stacks.patch new file mode 100644 index 0000000000..0fe58e0369 --- /dev/null +++ b/patches/api/0418-Allow-proper-checking-of-empty-item-stacks.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aeltumn +Date: Mon, 28 Aug 2023 13:41:09 +0200 +Subject: [PATCH] Allow proper checking of empty item stacks + +This adds a method to check if an item stack is empty or not. This mirrors vanilla's implementation of the same method. + +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index e39c9167bd66c528c09b256f15cc6c58666f0ca0..773780811a24aa1c1591257a993e30f2d99da436 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -1104,5 +1104,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + public @NotNull ItemStack damage(int amount, @NotNull org.bukkit.entity.LivingEntity livingEntity) { + return livingEntity.damageItemStack(this, amount); + } ++ ++ /** ++ * Returns an empty item stack, consists of an air material and a stack size of 0. ++ * ++ * Any item stack with a material of air or a stack size of 0 is seen ++ * as being empty by {@link ItemStack#isEmpty}. ++ */ ++ @NotNull ++ public static ItemStack empty() { ++ return new ItemStack(); ++ } ++ ++ /** ++ * Returns whether this item stack is empty and contains no item. This means ++ * it is either air or the stack has a size of 0. ++ */ ++ public boolean isEmpty() { ++ return type.isAir() || amount <= 0; ++ } + // Paper end + } diff --git a/patches/api/0418-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch b/patches/api/0418-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch deleted file mode 100644 index e72f86be5d..0000000000 --- a/patches/api/0418-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tamion <70228790+notTamion@users.noreply.github.com> -Date: Mon, 25 Sep 2023 19:55:51 +0200 -Subject: [PATCH] Fix PlayerSwapHandItemsEvent throwing exception when mainhand - or offhand set to null - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java -index 9f592317c920589c22a5fb8e916c6ca58ebe5c59..39dd08de71b8b52fe3462c105ecdbfc1cd2cd9a3 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java -@@ -31,7 +31,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable - * - * @return item in the main hand - */ -- @Nullable -+ @NotNull // Paper - public ItemStack getMainHandItem() { - return mainHandItem; - } -@@ -42,7 +42,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable - * @param mainHandItem new item in the main hand - */ - public void setMainHandItem(@Nullable ItemStack mainHandItem) { -- this.mainHandItem = mainHandItem; -+ this.mainHandItem = mainHandItem == null ? ItemStack.empty() : mainHandItem; // Paper - } - - /** -@@ -50,7 +50,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable - * - * @return item in the off hand - */ -- @Nullable -+ @NotNull // Paper - public ItemStack getOffHandItem() { - return offHandItem; - } -@@ -61,7 +61,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable - * @param offHandItem new item in the off hand - */ - public void setOffHandItem(@Nullable ItemStack offHandItem) { -- this.offHandItem = offHandItem; -+ this.offHandItem = offHandItem == null ? ItemStack.empty() : offHandItem; // Paper - } - - @Override diff --git a/patches/api/0419-Add-player-idle-duration-API.patch b/patches/api/0419-Add-player-idle-duration-API.patch deleted file mode 100644 index ac250c0760..0000000000 --- a/patches/api/0419-Add-player-idle-duration-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: booky10 -Date: Sat, 14 Oct 2023 03:11:11 +0200 -Subject: [PATCH] Add player idle duration API - -Implements API for getting and resetting a player's idle duration. - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index e128750b1175ab8bbe9b23fdd931665262c8d75e..4297a893799fe39b80029b97f6b5581d543afa8a 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3782,6 +3782,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void increaseWardenWarningLevel(); - // Paper end - -+ // Paper start -+ /** -+ * The idle duration is reset when the player -+ * sends specific action packets. -+ *

-+ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the -+ * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. -+ * -+ * @return the current idle duration of this player -+ */ -+ @NotNull Duration getIdleDuration(); -+ -+ /** -+ * Resets this player's idle duration. -+ *

-+ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the -+ * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. -+ * -+ * @see #getIdleDuration() -+ */ -+ void resetIdleDuration(); -+ // Paper end -+ - @NotNull - @Override - Spigot spigot(); diff --git a/patches/api/0419-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch b/patches/api/0419-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch new file mode 100644 index 0000000000..e72f86be5d --- /dev/null +++ b/patches/api/0419-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tamion <70228790+notTamion@users.noreply.github.com> +Date: Mon, 25 Sep 2023 19:55:51 +0200 +Subject: [PATCH] Fix PlayerSwapHandItemsEvent throwing exception when mainhand + or offhand set to null + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java +index 9f592317c920589c22a5fb8e916c6ca58ebe5c59..39dd08de71b8b52fe3462c105ecdbfc1cd2cd9a3 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java +@@ -31,7 +31,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable + * + * @return item in the main hand + */ +- @Nullable ++ @NotNull // Paper + public ItemStack getMainHandItem() { + return mainHandItem; + } +@@ -42,7 +42,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable + * @param mainHandItem new item in the main hand + */ + public void setMainHandItem(@Nullable ItemStack mainHandItem) { +- this.mainHandItem = mainHandItem; ++ this.mainHandItem = mainHandItem == null ? ItemStack.empty() : mainHandItem; // Paper + } + + /** +@@ -50,7 +50,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable + * + * @return item in the off hand + */ +- @Nullable ++ @NotNull // Paper + public ItemStack getOffHandItem() { + return offHandItem; + } +@@ -61,7 +61,7 @@ public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable + * @param offHandItem new item in the off hand + */ + public void setOffHandItem(@Nullable ItemStack offHandItem) { +- this.offHandItem = offHandItem; ++ this.offHandItem = offHandItem == null ? ItemStack.empty() : offHandItem; // Paper + } + + @Override diff --git a/patches/api/0420-Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/api/0420-Add-API-to-get-the-collision-shape-of-a-block-before.patch deleted file mode 100644 index 3bb30787dc..0000000000 --- a/patches/api/0420-Add-API-to-get-the-collision-shape-of-a-block-before.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TrollyLoki -Date: Wed, 11 Oct 2023 00:45:54 -0400 -Subject: [PATCH] Add API to get the collision shape of a block before it's - placed - - -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index 54664651f34311e95f6c2dcfd93e58477beda8c2..0ecc54bd810a2805b7209d9433b76743500e45a8 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -205,6 +205,19 @@ public interface BlockData extends Cloneable { - */ - boolean isFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support); - -+ // Paper start -+ /** -+ * Calculates the collision shape this block data would have at a particular location. -+ *

-+ * This does not take into account any block updates that may occur if the block was to be actually placed in the world. -+ * -+ * @param location the location to calculate the collision shape at -+ * -+ * @return a {@link org.bukkit.util.VoxelShape} representing the collision shape of this block data. -+ */ -+ @NotNull org.bukkit.util.VoxelShape getCollisionShape(@NotNull Location location); -+ // Paper end -+ - /** - * Gets the color this block should appear as when rendered on a map. - * diff --git a/patches/api/0420-Add-player-idle-duration-API.patch b/patches/api/0420-Add-player-idle-duration-API.patch new file mode 100644 index 0000000000..ac250c0760 --- /dev/null +++ b/patches/api/0420-Add-player-idle-duration-API.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: booky10 +Date: Sat, 14 Oct 2023 03:11:11 +0200 +Subject: [PATCH] Add player idle duration API + +Implements API for getting and resetting a player's idle duration. + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index e128750b1175ab8bbe9b23fdd931665262c8d75e..4297a893799fe39b80029b97f6b5581d543afa8a 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3782,6 +3782,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + void increaseWardenWarningLevel(); + // Paper end + ++ // Paper start ++ /** ++ * The idle duration is reset when the player ++ * sends specific action packets. ++ *

++ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the ++ * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. ++ * ++ * @return the current idle duration of this player ++ */ ++ @NotNull Duration getIdleDuration(); ++ ++ /** ++ * Resets this player's idle duration. ++ *

++ * After the idle duration exceeds {@link org.bukkit.Bukkit#getIdleTimeout()}, the ++ * player will be kicked for {@link org.bukkit.event.player.PlayerKickEvent.Cause#IDLING}. ++ * ++ * @see #getIdleDuration() ++ */ ++ void resetIdleDuration(); ++ // Paper end ++ + @NotNull + @Override + Spigot spigot(); diff --git a/patches/api/0421-Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/api/0421-Add-API-to-get-the-collision-shape-of-a-block-before.patch new file mode 100644 index 0000000000..3bb30787dc --- /dev/null +++ b/patches/api/0421-Add-API-to-get-the-collision-shape-of-a-block-before.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TrollyLoki +Date: Wed, 11 Oct 2023 00:45:54 -0400 +Subject: [PATCH] Add API to get the collision shape of a block before it's + placed + + +diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java +index 54664651f34311e95f6c2dcfd93e58477beda8c2..0ecc54bd810a2805b7209d9433b76743500e45a8 100644 +--- a/src/main/java/org/bukkit/block/data/BlockData.java ++++ b/src/main/java/org/bukkit/block/data/BlockData.java +@@ -205,6 +205,19 @@ public interface BlockData extends Cloneable { + */ + boolean isFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support); + ++ // Paper start ++ /** ++ * Calculates the collision shape this block data would have at a particular location. ++ *

++ * This does not take into account any block updates that may occur if the block was to be actually placed in the world. ++ * ++ * @param location the location to calculate the collision shape at ++ * ++ * @return a {@link org.bukkit.util.VoxelShape} representing the collision shape of this block data. ++ */ ++ @NotNull org.bukkit.util.VoxelShape getCollisionShape(@NotNull Location location); ++ // Paper end ++ + /** + * Gets the color this block should appear as when rendered on a map. + * diff --git a/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch b/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch deleted file mode 100644 index e24c9fcedf..0000000000 --- a/patches/api/0421-Add-predicate-for-blocks-when-raytracing.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TonytheMacaroni -Date: Wed, 6 Sep 2023 19:24:53 -0400 -Subject: [PATCH] Add predicate for blocks when raytracing - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index f037f46a9c6ce894f24af14c20fb514a58a8aee9..86fd5f3d322b6203f02ca7c427ccd56336b93fc0 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -1649,6 +1649,27 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); - -+ // Paper start -+ /** -+ * Performs a ray trace that checks for entity collisions. -+ *

-+ * This may not consider entities in currently unloaded chunks. Some -+ * implementations may impose artificial restrictions on the maximum -+ * distance. -+ * -+ * @param start the start position -+ * @param direction the ray direction -+ * @param maxDistance the maximum distance -+ * @param raySize entity bounding boxes will be uniformly expanded (or -+ * shrinked) by this value before doing collision checks -+ * @param filter only entities that fulfill this predicate are considered, -+ * or null to consider all entities -+ * @return the closest ray trace hit result, or null if there -+ * is no hit -+ */ -+ @Nullable RayTraceResult rayTraceEntities(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); -+ // Paper end -+ - /** - * Performs a ray trace that checks for block collisions using the blocks' - * precise collision shapes. -@@ -1712,6 +1733,34 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks); - -+ // Paper start -+ /** -+ * Performs a ray trace that checks for block collisions using the blocks' -+ * precise collision shapes. -+ *

-+ * If collisions with passable blocks are ignored, fluid collisions are -+ * ignored as well regardless of the fluid collision mode. -+ *

-+ * Portal blocks are only considered passable if the ray starts within -+ * them. Apart from that collisions with portal blocks will be considered -+ * even if collisions with passable blocks are otherwise ignored. -+ *

-+ * This may cause loading of chunks! Some implementations may impose -+ * artificial restrictions on the maximum distance. -+ * -+ * @param start the start position -+ * @param direction the ray direction -+ * @param maxDistance the maximum distance -+ * @param fluidCollisionMode the fluid collision mode -+ * @param ignorePassableBlocks whether to ignore passable but collidable -+ * blocks (ex. tall grass, signs, fluids, ..) -+ * @param canCollide predicate for blocks the ray can potentially collide -+ * with, or null to consider all blocks -+ * @return the ray trace hit result, or null if there is no hit -+ */ -+ @Nullable RayTraceResult rayTraceBlocks(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, @Nullable Predicate canCollide); -+ // Paper end -+ - /** - * Performs a ray trace that checks for both block and entity collisions. - *

-@@ -1745,6 +1794,42 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter); - -+ // Paper start -+ /** -+ * Performs a ray trace that checks for both block and entity collisions. -+ *

-+ * Block collisions use the blocks' precise collision shapes. The -+ * raySize parameter is only taken into account for entity -+ * collision checks. -+ *

-+ * If collisions with passable blocks are ignored, fluid collisions are -+ * ignored as well regardless of the fluid collision mode. -+ *

-+ * Portal blocks are only considered passable if the ray starts within them. -+ * Apart from that collisions with portal blocks will be considered even if -+ * collisions with passable blocks are otherwise ignored. -+ *

-+ * This may cause loading of chunks! Some implementations may impose -+ * artificial restrictions on the maximum distance. -+ * -+ * @param start the start position -+ * @param direction the ray direction -+ * @param maxDistance the maximum distance -+ * @param fluidCollisionMode the fluid collision mode -+ * @param ignorePassableBlocks whether to ignore passable but collidable -+ * blocks (ex. tall grass, signs, fluids, ..) -+ * @param raySize entity bounding boxes will be uniformly expanded (or -+ * shrinked) by this value before doing collision checks -+ * @param filter only entities that fulfill this predicate are considered, -+ * or null to consider all entities -+ * @param canCollide predicate for blocks the ray can potentially collide -+ * with, or null to consider all blocks -+ * @return the closest ray trace hit result with either a block or an -+ * entity, or null if there is no hit -+ */ -+ @Nullable RayTraceResult rayTrace(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter, @Nullable Predicate canCollide); -+ // Paper end -+ - /** - * Gets the default spawn {@link Location} of this world - * diff --git a/patches/api/0422-Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/api/0422-Add-hand-to-fish-event-for-all-player-interactions.patch deleted file mode 100644 index b431332b9a..0000000000 --- a/patches/api/0422-Add-hand-to-fish-event-for-all-player-interactions.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: booky10 -Date: Mon, 3 Jul 2023 01:55:32 +0200 -Subject: [PATCH] Add hand to fish event for all player interactions - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -index 45342030ad0f46632d3ee9a6d0348251f8ee375f..d4001f64a7ee9d5173e9bafd9c45860cbda1fc85 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java -@@ -94,8 +94,9 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable { - /** - * Get the hand that was used in this event. - *

-- * The hand used is only present when the event state is {@link State#FISHING}. -- * In all other states, the hand is null. -+ * The hand used is only present for player interactions. -+ * This means it will be null if state is set -+ * to {@link State#BITE} or {@link State#FAILED_ATTEMPT}. - * - * @return the hand - */ diff --git a/patches/api/0422-Add-predicate-for-blocks-when-raytracing.patch b/patches/api/0422-Add-predicate-for-blocks-when-raytracing.patch new file mode 100644 index 0000000000..e24c9fcedf --- /dev/null +++ b/patches/api/0422-Add-predicate-for-blocks-when-raytracing.patch @@ -0,0 +1,116 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TonytheMacaroni +Date: Wed, 6 Sep 2023 19:24:53 -0400 +Subject: [PATCH] Add predicate for blocks when raytracing + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index f037f46a9c6ce894f24af14c20fb514a58a8aee9..86fd5f3d322b6203f02ca7c427ccd56336b93fc0 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -1649,6 +1649,27 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @Nullable + public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); + ++ // Paper start ++ /** ++ * Performs a ray trace that checks for entity collisions. ++ *

++ * This may not consider entities in currently unloaded chunks. Some ++ * implementations may impose artificial restrictions on the maximum ++ * distance. ++ * ++ * @param start the start position ++ * @param direction the ray direction ++ * @param maxDistance the maximum distance ++ * @param raySize entity bounding boxes will be uniformly expanded (or ++ * shrinked) by this value before doing collision checks ++ * @param filter only entities that fulfill this predicate are considered, ++ * or null to consider all entities ++ * @return the closest ray trace hit result, or null if there ++ * is no hit ++ */ ++ @Nullable RayTraceResult rayTraceEntities(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); ++ // Paper end ++ + /** + * Performs a ray trace that checks for block collisions using the blocks' + * precise collision shapes. +@@ -1712,6 +1733,34 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @Nullable + public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks); + ++ // Paper start ++ /** ++ * Performs a ray trace that checks for block collisions using the blocks' ++ * precise collision shapes. ++ *

++ * If collisions with passable blocks are ignored, fluid collisions are ++ * ignored as well regardless of the fluid collision mode. ++ *

++ * Portal blocks are only considered passable if the ray starts within ++ * them. Apart from that collisions with portal blocks will be considered ++ * even if collisions with passable blocks are otherwise ignored. ++ *

++ * This may cause loading of chunks! Some implementations may impose ++ * artificial restrictions on the maximum distance. ++ * ++ * @param start the start position ++ * @param direction the ray direction ++ * @param maxDistance the maximum distance ++ * @param fluidCollisionMode the fluid collision mode ++ * @param ignorePassableBlocks whether to ignore passable but collidable ++ * blocks (ex. tall grass, signs, fluids, ..) ++ * @param canCollide predicate for blocks the ray can potentially collide ++ * with, or null to consider all blocks ++ * @return the ray trace hit result, or null if there is no hit ++ */ ++ @Nullable RayTraceResult rayTraceBlocks(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, @Nullable Predicate canCollide); ++ // Paper end ++ + /** + * Performs a ray trace that checks for both block and entity collisions. + *

+@@ -1745,6 +1794,42 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @Nullable + public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter); + ++ // Paper start ++ /** ++ * Performs a ray trace that checks for both block and entity collisions. ++ *

++ * Block collisions use the blocks' precise collision shapes. The ++ * raySize parameter is only taken into account for entity ++ * collision checks. ++ *

++ * If collisions with passable blocks are ignored, fluid collisions are ++ * ignored as well regardless of the fluid collision mode. ++ *

++ * Portal blocks are only considered passable if the ray starts within them. ++ * Apart from that collisions with portal blocks will be considered even if ++ * collisions with passable blocks are otherwise ignored. ++ *

++ * This may cause loading of chunks! Some implementations may impose ++ * artificial restrictions on the maximum distance. ++ * ++ * @param start the start position ++ * @param direction the ray direction ++ * @param maxDistance the maximum distance ++ * @param fluidCollisionMode the fluid collision mode ++ * @param ignorePassableBlocks whether to ignore passable but collidable ++ * blocks (ex. tall grass, signs, fluids, ..) ++ * @param raySize entity bounding boxes will be uniformly expanded (or ++ * shrinked) by this value before doing collision checks ++ * @param filter only entities that fulfill this predicate are considered, ++ * or null to consider all entities ++ * @param canCollide predicate for blocks the ray can potentially collide ++ * with, or null to consider all blocks ++ * @return the closest ray trace hit result with either a block or an ++ * entity, or null if there is no hit ++ */ ++ @Nullable RayTraceResult rayTrace(io.papermc.paper.math.@NotNull Position start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter, @Nullable Predicate canCollide); ++ // Paper end ++ + /** + * Gets the default spawn {@link Location} of this world + * diff --git a/patches/api/0423-Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/api/0423-Add-hand-to-fish-event-for-all-player-interactions.patch new file mode 100644 index 0000000000..b431332b9a --- /dev/null +++ b/patches/api/0423-Add-hand-to-fish-event-for-all-player-interactions.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: booky10 +Date: Mon, 3 Jul 2023 01:55:32 +0200 +Subject: [PATCH] Add hand to fish event for all player interactions + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java +index 45342030ad0f46632d3ee9a6d0348251f8ee375f..d4001f64a7ee9d5173e9bafd9c45860cbda1fc85 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java +@@ -94,8 +94,9 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable { + /** + * Get the hand that was used in this event. + *

+- * The hand used is only present when the event state is {@link State#FISHING}. +- * In all other states, the hand is null. ++ * The hand used is only present for player interactions. ++ * This means it will be null if state is set ++ * to {@link State#BITE} or {@link State#FAILED_ATTEMPT}. + * + * @return the hand + */ diff --git a/patches/api/0423-Attribute-Modifier-API-improvements.patch b/patches/api/0423-Attribute-Modifier-API-improvements.patch deleted file mode 100644 index d4b0442c30..0000000000 --- a/patches/api/0423-Attribute-Modifier-API-improvements.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TonytheMacaroni -Date: Thu, 9 Nov 2023 20:35:35 -0500 -Subject: [PATCH] Attribute Modifier API improvements - -Co-authored-by: Malfrador - -diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java -index f08ee26cc4d479e1bfc5264b8cbe721315de91f2..f1fa86ddf1f50a357c9e94cc61261d8c96a2da6f 100644 ---- a/src/main/java/org/bukkit/attribute/AttributeInstance.java -+++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java -@@ -39,6 +39,42 @@ public interface AttributeInstance { - @NotNull - Collection getModifiers(); - -+ // Paper start -+ /** -+ * Gets the modifier with the corresponding key. -+ * -+ * @param key the jey of the modifier -+ * @return the modifier, if it exists -+ */ -+ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull net.kyori.adventure.key.Key key); -+ -+ /** -+ * Remove a modifier with the corresponding key from this instance. -+ * -+ * @param key the key of the modifier -+ */ -+ void removeModifier(@NotNull net.kyori.adventure.key.Key key); -+ -+ /** -+ * Gets the modifier with the corresponding UUID. -+ * -+ * @param uuid the UUID of the modifier -+ * @return the modifier, if it exists -+ * @deprecated use {@link #getModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID -+ */ -+ @Deprecated(forRemoval = true, since = "1.21") -+ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull java.util.UUID uuid); -+ -+ /** -+ * Remove a modifier with the corresponding UUID from this instance. -+ * -+ * @param uuid the UUID of the modifier -+ * @deprecated use {@link #removeModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID -+ */ -+ @Deprecated(forRemoval = true, since = "1.21") -+ void removeModifier(@NotNull java.util.UUID uuid); -+ // Paper end -+ - /** - * Add a modifier to this instance. - * -@@ -46,6 +82,16 @@ public interface AttributeInstance { - */ - void addModifier(@NotNull AttributeModifier modifier); - -+ // Paper start - Transient modifier API -+ /** -+ * Add a transient modifier to this instance. -+ * Transient modifiers are not persisted (saved with the NBT data) -+ * -+ * @param modifier to add -+ */ -+ void addTransientModifier(@NotNull AttributeModifier modifier); -+ // Paper end -+ - /** - * Remove a modifier from this instance. - * -diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java -index 8c53ac6b4381f3cf8b5e989c8b2a3ba77bd4e475..def473b6424da1e81448bd492b7fef46691eaf8c 100644 ---- a/src/main/java/org/bukkit/attribute/AttributeModifier.java -+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java -@@ -48,6 +48,12 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed { - this(NamespacedKey.fromString(uuid.toString()), amount, operation, slot); - } - -+ // Paper start - Add constructor without EquipmentSlotGroup -+ public AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull Operation operation) { -+ this(key, amount, operation, EquipmentSlotGroup.ANY); -+ } -+ // Paper end -+ - public AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) { - Preconditions.checkArgument(key != null, "Key cannot be null"); - Preconditions.checkArgument(operation != null, "Operation cannot be null"); diff --git a/patches/api/0424-Attribute-Modifier-API-improvements.patch b/patches/api/0424-Attribute-Modifier-API-improvements.patch new file mode 100644 index 0000000000..d4b0442c30 --- /dev/null +++ b/patches/api/0424-Attribute-Modifier-API-improvements.patch @@ -0,0 +1,88 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TonytheMacaroni +Date: Thu, 9 Nov 2023 20:35:35 -0500 +Subject: [PATCH] Attribute Modifier API improvements + +Co-authored-by: Malfrador + +diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java +index f08ee26cc4d479e1bfc5264b8cbe721315de91f2..f1fa86ddf1f50a357c9e94cc61261d8c96a2da6f 100644 +--- a/src/main/java/org/bukkit/attribute/AttributeInstance.java ++++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java +@@ -39,6 +39,42 @@ public interface AttributeInstance { + @NotNull + Collection getModifiers(); + ++ // Paper start ++ /** ++ * Gets the modifier with the corresponding key. ++ * ++ * @param key the jey of the modifier ++ * @return the modifier, if it exists ++ */ ++ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull net.kyori.adventure.key.Key key); ++ ++ /** ++ * Remove a modifier with the corresponding key from this instance. ++ * ++ * @param key the key of the modifier ++ */ ++ void removeModifier(@NotNull net.kyori.adventure.key.Key key); ++ ++ /** ++ * Gets the modifier with the corresponding UUID. ++ * ++ * @param uuid the UUID of the modifier ++ * @return the modifier, if it exists ++ * @deprecated use {@link #getModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID ++ */ ++ @Deprecated(forRemoval = true, since = "1.21") ++ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull java.util.UUID uuid); ++ ++ /** ++ * Remove a modifier with the corresponding UUID from this instance. ++ * ++ * @param uuid the UUID of the modifier ++ * @deprecated use {@link #removeModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID ++ */ ++ @Deprecated(forRemoval = true, since = "1.21") ++ void removeModifier(@NotNull java.util.UUID uuid); ++ // Paper end ++ + /** + * Add a modifier to this instance. + * +@@ -46,6 +82,16 @@ public interface AttributeInstance { + */ + void addModifier(@NotNull AttributeModifier modifier); + ++ // Paper start - Transient modifier API ++ /** ++ * Add a transient modifier to this instance. ++ * Transient modifiers are not persisted (saved with the NBT data) ++ * ++ * @param modifier to add ++ */ ++ void addTransientModifier(@NotNull AttributeModifier modifier); ++ // Paper end ++ + /** + * Remove a modifier from this instance. + * +diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java +index 8c53ac6b4381f3cf8b5e989c8b2a3ba77bd4e475..def473b6424da1e81448bd492b7fef46691eaf8c 100644 +--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java ++++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java +@@ -48,6 +48,12 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed { + this(NamespacedKey.fromString(uuid.toString()), amount, operation, slot); + } + ++ // Paper start - Add constructor without EquipmentSlotGroup ++ public AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull Operation operation) { ++ this(key, amount, operation, EquipmentSlotGroup.ANY); ++ } ++ // Paper end ++ + public AttributeModifier(@NotNull NamespacedKey key, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) { + Preconditions.checkArgument(key != null, "Key cannot be null"); + Preconditions.checkArgument(operation != null, "Operation cannot be null"); diff --git a/patches/api/0424-Expand-LingeringPotion-API.patch b/patches/api/0424-Expand-LingeringPotion-API.patch deleted file mode 100644 index 40b5a5f547..0000000000 --- a/patches/api/0424-Expand-LingeringPotion-API.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tamion <70228790+notTamion@users.noreply.github.com> -Date: Sat, 4 Nov 2023 23:56:23 +0100 -Subject: [PATCH] Expand LingeringPotion API - - -diff --git a/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java -index 1584c6c41c3ca51b8ab7f48efb140b0fe31f535b..34efe59493729449fe1316ab8f2f7211acf679be 100644 ---- a/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java -+++ b/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java -@@ -17,6 +17,7 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - private final AreaEffectCloud entity; -+ private boolean allowEmptyAreaEffectCreation; // Paper - - @Deprecated - public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final AreaEffectCloud entity) { -@@ -44,6 +45,26 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca - return entity; - } - -+ // Paper start -+ /** -+ * Sets if an Empty AreaEffectCloud may be created -+ * -+ * @param allowEmptyAreaEffectCreation If an Empty AreaEffectCloud may be created -+ */ -+ public void allowsEmptyCreation(boolean allowEmptyAreaEffectCreation) { -+ this.allowEmptyAreaEffectCreation = allowEmptyAreaEffectCreation; -+ } -+ -+ /** -+ * Gets if an empty AreaEffectCloud may be created -+ * -+ * @return if an empty AreaEffectCloud may be created -+ */ -+ public boolean allowsEmptyCreation() { -+ return allowEmptyAreaEffectCreation; -+ } -+ // Paper end -+ - @Override - public boolean isCancelled() { - return cancelled; diff --git a/patches/api/0425-Expand-LingeringPotion-API.patch b/patches/api/0425-Expand-LingeringPotion-API.patch new file mode 100644 index 0000000000..40b5a5f547 --- /dev/null +++ b/patches/api/0425-Expand-LingeringPotion-API.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tamion <70228790+notTamion@users.noreply.github.com> +Date: Sat, 4 Nov 2023 23:56:23 +0100 +Subject: [PATCH] Expand LingeringPotion API + + +diff --git a/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java +index 1584c6c41c3ca51b8ab7f48efb140b0fe31f535b..34efe59493729449fe1316ab8f2f7211acf679be 100644 +--- a/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java ++++ b/src/main/java/org/bukkit/event/entity/LingeringPotionSplashEvent.java +@@ -17,6 +17,7 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; + private final AreaEffectCloud entity; ++ private boolean allowEmptyAreaEffectCreation; // Paper + + @Deprecated + public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final AreaEffectCloud entity) { +@@ -44,6 +45,26 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca + return entity; + } + ++ // Paper start ++ /** ++ * Sets if an Empty AreaEffectCloud may be created ++ * ++ * @param allowEmptyAreaEffectCreation If an Empty AreaEffectCloud may be created ++ */ ++ public void allowsEmptyCreation(boolean allowEmptyAreaEffectCreation) { ++ this.allowEmptyAreaEffectCreation = allowEmptyAreaEffectCreation; ++ } ++ ++ /** ++ * Gets if an empty AreaEffectCloud may be created ++ * ++ * @return if an empty AreaEffectCloud may be created ++ */ ++ public boolean allowsEmptyCreation() { ++ return allowEmptyAreaEffectCreation; ++ } ++ // Paper end ++ + @Override + public boolean isCancelled() { + return cancelled; diff --git a/patches/api/0425-Remove-unnecessary-durability-check-in-ItemStack-isS.patch b/patches/api/0425-Remove-unnecessary-durability-check-in-ItemStack-isS.patch deleted file mode 100644 index 88ecd35099..0000000000 --- a/patches/api/0425-Remove-unnecessary-durability-check-in-ItemStack-isS.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MrPowerGamerBR -Date: Sun, 26 Nov 2023 20:00:50 -0300 -Subject: [PATCH] Remove unnecessary durability check in - "ItemStack#isSimilar(...)" - -By removing this check we avoid unnecessarily allocating useless `ItemMeta` objects if we are comparing two items, or one of the two items, that don't have any durability. Don't worry, the durability of the item is checked when it checks if both item metas are equal. - -This is a leftover from when checking for the item's durability was "free" because the durability was stored in the `ItemStack` itself, this [was changed in Minecraft 1.13](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/f8b2086d60942eb2cd7ac25a2a1408cb790c222c#src/main/java/org/bukkit/inventory/ItemStack.java). - -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 773780811a24aa1c1591257a993e30f2d99da436..e6c69a54e0c1dc511fe5769f869dcecb13e04ed3 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -307,7 +307,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return true; - } - Material comparisonType = (this.type.isLegacy()) ? Bukkit.getUnsafe().fromLegacy(this.getData(), true) : this.type; // This may be called from legacy item stacks, try to get the right material -- return comparisonType == stack.getType() && getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); -+ return comparisonType == stack.getType() && /* getDurability() == stack.getDurability() && */hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); // Paper - remove redundant item durability check - } - - @NotNull diff --git a/patches/api/0426-Add-Structure-check-API.patch b/patches/api/0426-Add-Structure-check-API.patch deleted file mode 100644 index 43073fe8f4..0000000000 --- a/patches/api/0426-Add-Structure-check-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 27 Mar 2023 10:20:06 -0700 -Subject: [PATCH] Add Structure check API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 86fd5f3d322b6203f02ca7c427ccd56336b93fc0..16570c3c7ed5e7ad25f20c1034f7b966d6e694da 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -78,6 +78,30 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - */ - int getPlayerCount(); - // Paper end -+ // Paper start - structure check API -+ /** -+ * Check if the naturally-generated structure exists at the position. -+ *

-+ * Note that if the position is not loaded, this may cause chunk loads/generation -+ * to check if a structure is at that position. Use {@link #isPositionLoaded(io.papermc.paper.math.Position)} -+ * to check if a position is loaded -+ * -+ * @param position the position to check at -+ * @param structure the structure to check for -+ * @return true if that structure exists at the position -+ */ -+ boolean hasStructureAt(io.papermc.paper.math.@NotNull Position position, @NotNull Structure structure); -+ -+ /** -+ * Checks if this position is loaded. -+ * -+ * @param position position to check -+ * @return true if loaded -+ */ -+ default boolean isPositionLoaded(io.papermc.paper.math.@NotNull Position position) { -+ return this.isChunkLoaded(position.blockX() >> 4, position.blockZ() >> 4); -+ } -+ // Paper end - - /** - * Gets the {@link Block} at the given coordinates diff --git a/patches/api/0426-Remove-unnecessary-durability-check-in-ItemStack-isS.patch b/patches/api/0426-Remove-unnecessary-durability-check-in-ItemStack-isS.patch new file mode 100644 index 0000000000..88ecd35099 --- /dev/null +++ b/patches/api/0426-Remove-unnecessary-durability-check-in-ItemStack-isS.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MrPowerGamerBR +Date: Sun, 26 Nov 2023 20:00:50 -0300 +Subject: [PATCH] Remove unnecessary durability check in + "ItemStack#isSimilar(...)" + +By removing this check we avoid unnecessarily allocating useless `ItemMeta` objects if we are comparing two items, or one of the two items, that don't have any durability. Don't worry, the durability of the item is checked when it checks if both item metas are equal. + +This is a leftover from when checking for the item's durability was "free" because the durability was stored in the `ItemStack` itself, this [was changed in Minecraft 1.13](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/f8b2086d60942eb2cd7ac25a2a1408cb790c222c#src/main/java/org/bukkit/inventory/ItemStack.java). + +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 773780811a24aa1c1591257a993e30f2d99da436..e6c69a54e0c1dc511fe5769f869dcecb13e04ed3 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -307,7 +307,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return true; + } + Material comparisonType = (this.type.isLegacy()) ? Bukkit.getUnsafe().fromLegacy(this.getData(), true) : this.type; // This may be called from legacy item stacks, try to get the right material +- return comparisonType == stack.getType() && getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); ++ return comparisonType == stack.getType() && /* getDurability() == stack.getDurability() && */hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true); // Paper - remove redundant item durability check + } + + @NotNull diff --git a/patches/api/0427-Add-Structure-check-API.patch b/patches/api/0427-Add-Structure-check-API.patch new file mode 100644 index 0000000000..43073fe8f4 --- /dev/null +++ b/patches/api/0427-Add-Structure-check-API.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 27 Mar 2023 10:20:06 -0700 +Subject: [PATCH] Add Structure check API + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 86fd5f3d322b6203f02ca7c427ccd56336b93fc0..16570c3c7ed5e7ad25f20c1034f7b966d6e694da 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -78,6 +78,30 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + */ + int getPlayerCount(); + // Paper end ++ // Paper start - structure check API ++ /** ++ * Check if the naturally-generated structure exists at the position. ++ *

++ * Note that if the position is not loaded, this may cause chunk loads/generation ++ * to check if a structure is at that position. Use {@link #isPositionLoaded(io.papermc.paper.math.Position)} ++ * to check if a position is loaded ++ * ++ * @param position the position to check at ++ * @param structure the structure to check for ++ * @return true if that structure exists at the position ++ */ ++ boolean hasStructureAt(io.papermc.paper.math.@NotNull Position position, @NotNull Structure structure); ++ ++ /** ++ * Checks if this position is loaded. ++ * ++ * @param position position to check ++ * @return true if loaded ++ */ ++ default boolean isPositionLoaded(io.papermc.paper.math.@NotNull Position position) { ++ return this.isChunkLoaded(position.blockX() >> 4, position.blockZ() >> 4); ++ } ++ // Paper end + + /** + * Gets the {@link Block} at the given coordinates diff --git a/patches/api/0427-Experimental-annotations-change.patch b/patches/api/0427-Experimental-annotations-change.patch deleted file mode 100644 index 5660d684ce..0000000000 --- a/patches/api/0427-Experimental-annotations-change.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 9 Dec 2023 11:47:53 -0800 -Subject: [PATCH] Experimental annotations change - - -diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java -index a96600443a0997c3a696a637422ab66ee1884fb0..20eb27ee041f77f295eb271f878c524ce5592251 100644 ---- a/src/main/java/org/bukkit/FeatureFlag.java -+++ b/src/main/java/org/bukkit/FeatureFlag.java -@@ -29,6 +29,7 @@ public interface FeatureFlag extends Keyed { - @Deprecated - public static final FeatureFlag UPDATE_1_20 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_20")); - -+ @ApiStatus.Experimental // Paper - add missing annotation - public static final FeatureFlag TRADE_REBALANCE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("trade_rebalance")); - - /** -@@ -39,10 +40,13 @@ public interface FeatureFlag extends Keyed { - @Deprecated - public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21")); - -+ @ApiStatus.Experimental // Paper - add missing annotation - public static final FeatureFlag WINTER_DROP = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("winter_drop")); - -+ @ApiStatus.Experimental // Paper - add missing annotation - public static final FeatureFlag REDSTONE_EXPERIMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("redstone_experiments")); - -+ @ApiStatus.Experimental // Paper - add missing annotation - public static final FeatureFlag MINECART_IMPROVEMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("minecart_improvements")); - - } -diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java -index 8b6584fae0a9d5cccbe350d889fa8b4a14c78ca3..89f1820ae94c48f51a44df750904bb285013720c 100644 ---- a/src/main/java/org/bukkit/GameRule.java -+++ b/src/main/java/org/bukkit/GameRule.java -@@ -287,6 +287,8 @@ public final class GameRule implements net.kyori.adventure.translation.Transl - * The maximum speed of minecarts (when the new movement algorithm is - * enabled). - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.MINECART_IMPROVEMENTS) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final GameRule MINECART_MAX_SPEED = new GameRule<>("minecartMaxSpeed", Integer.class); - - /** -diff --git a/src/main/java/org/bukkit/block/Crafter.java b/src/main/java/org/bukkit/block/Crafter.java -index 8d2dd78fc588a6817dfede8040b9909a7d5bde67..f737a2aae3f57a1bfe4cf68ea66f603da4eebd47 100644 ---- a/src/main/java/org/bukkit/block/Crafter.java -+++ b/src/main/java/org/bukkit/block/Crafter.java -@@ -6,7 +6,6 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a captured state of a crafter. - */ --@ApiStatus.Experimental - public interface Crafter extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory { // Paper - LootTable API - - /** -diff --git a/src/main/java/org/bukkit/block/TrialSpawner.java b/src/main/java/org/bukkit/block/TrialSpawner.java -index 2d46d85aff243e9b3c6764f0de041fff6b766853..6fc7b5fe1152f739663a4715a1c93246c3ee6df2 100644 ---- a/src/main/java/org/bukkit/block/TrialSpawner.java -+++ b/src/main/java/org/bukkit/block/TrialSpawner.java -@@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a captured state of a trial spawner. - */ --@ApiStatus.Experimental - public interface TrialSpawner extends TileState { - - /** -diff --git a/src/main/java/org/bukkit/block/Vault.java b/src/main/java/org/bukkit/block/Vault.java -index f0c5d27f6f1ff56ffe4b88dfdce8d0b7f06d19e1..375f41fe4aebdbf140497b5ba1e54e1c72f0cdfc 100644 ---- a/src/main/java/org/bukkit/block/Vault.java -+++ b/src/main/java/org/bukkit/block/Vault.java -@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a captured state of a trial spawner. - */ --@ApiStatus.Experimental - public interface Vault extends TileState { - } -diff --git a/src/main/java/org/bukkit/entity/AbstractWindCharge.java b/src/main/java/org/bukkit/entity/AbstractWindCharge.java -index 60fbacee263e55f91ac977f020e390d46024723a..ecff691c3a0878659fb051926ef769ce1e339c48 100644 ---- a/src/main/java/org/bukkit/entity/AbstractWindCharge.java -+++ b/src/main/java/org/bukkit/entity/AbstractWindCharge.java -@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a Wind Charge. - */ --@ApiStatus.Experimental - public interface AbstractWindCharge extends Fireball { - - /** -diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java -index 6296a6f3f3e794677fd3a626376f357c740ec356..7d993f8bd18ec1d3260d12f0ff8078a86ee4867d 100644 ---- a/src/main/java/org/bukkit/entity/Bogged.java -+++ b/src/main/java/org/bukkit/entity/Bogged.java -@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a Bogged Skeleton. - */ --@ApiStatus.Experimental - public interface Bogged extends AbstractSkeleton, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API - } -diff --git a/src/main/java/org/bukkit/entity/Breeze.java b/src/main/java/org/bukkit/entity/Breeze.java -index a75e725805c193a408683885cba83ca168347165..254bc6e18961a72f471334cc0535e3c7a9d70012 100644 ---- a/src/main/java/org/bukkit/entity/Breeze.java -+++ b/src/main/java/org/bukkit/entity/Breeze.java -@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a Breeze. Whoosh! - */ --@ApiStatus.Experimental - public interface Breeze extends Monster { - } -diff --git a/src/main/java/org/bukkit/entity/BreezeWindCharge.java b/src/main/java/org/bukkit/entity/BreezeWindCharge.java -index 06ca3dc4b0b69cbaefa96464dce484cea93e0717..748e58eb93c7882e15d9cbdd56d11bb14808698b 100644 ---- a/src/main/java/org/bukkit/entity/BreezeWindCharge.java -+++ b/src/main/java/org/bukkit/entity/BreezeWindCharge.java -@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a Wind Charge. - */ --@ApiStatus.Experimental - public interface BreezeWindCharge extends AbstractWindCharge { - - } -diff --git a/src/main/java/org/bukkit/entity/OminousItemSpawner.java b/src/main/java/org/bukkit/entity/OminousItemSpawner.java -index 4aa07d4edb2c81d0ae7999b30ad53ff8bb884ec7..dbd4da4c63b6b1b21c3e638ac4d2c9fdd6716a8e 100644 ---- a/src/main/java/org/bukkit/entity/OminousItemSpawner.java -+++ b/src/main/java/org/bukkit/entity/OminousItemSpawner.java -@@ -7,7 +7,6 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents an ominous item spawner. - */ --@ApiStatus.Experimental - public interface OminousItemSpawner extends Entity { - - /** -diff --git a/src/main/java/org/bukkit/entity/WindCharge.java b/src/main/java/org/bukkit/entity/WindCharge.java -index 4adc91ba3dff00ab44303778e9d4499f7808ad00..beb62426490a361af793fb530106d8547a83ae03 100644 ---- a/src/main/java/org/bukkit/entity/WindCharge.java -+++ b/src/main/java/org/bukkit/entity/WindCharge.java -@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Represents a Wind Charge. - */ --@ApiStatus.Experimental - public interface WindCharge extends AbstractWindCharge { - - } -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java -index ae4ae1fa6d407665ef03edcdef683d741668acf1..b4fe8108e8b36b8ce859cdd4a5b557034f923c85 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryType.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java -@@ -148,7 +148,6 @@ public enum InventoryType { - /** - * A crafter inventory, with 9 CRAFTING slots. - */ -- @ApiStatus.Experimental - CRAFTER(9, "Crafter", MenuType.CRAFTER_3X3), - /** - * The new smithing inventory, with 3 CRAFTING slots and 1 RESULT slot. -diff --git a/src/main/java/org/bukkit/inventory/CrafterInventory.java b/src/main/java/org/bukkit/inventory/CrafterInventory.java -index bb1fb5e0518c6a62ef8b206733ee51d831f1f85b..49d0a37bbeb0b8fa9207164c74245ef05485467c 100644 ---- a/src/main/java/org/bukkit/inventory/CrafterInventory.java -+++ b/src/main/java/org/bukkit/inventory/CrafterInventory.java -@@ -5,5 +5,4 @@ import org.jetbrains.annotations.ApiStatus; - /** - * Interface to the inventory of a Crafter. - */ --@ApiStatus.Experimental - public interface CrafterInventory extends Inventory { } -diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java -index 0899981b9ab1f98dacc617156d12779421e4c275..6c33fbf720a2e11655e254aeb516e08831c2adf4 100644 ---- a/src/main/java/org/bukkit/map/MapCursor.java -+++ b/src/main/java/org/bukkit/map/MapCursor.java -@@ -314,12 +314,26 @@ public final class MapCursor { - Type BANNER_RED = getType("banner_red"); - Type BANNER_BLACK = getType("banner_black"); - Type RED_X = getType("red_x"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type VILLAGE_DESERT = getType("village_desert"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type VILLAGE_PLAINS = getType("village_plains"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type VILLAGE_SAVANNA = getType("village_savanna"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type VILLAGE_SNOWY = getType("village_snowy"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type VILLAGE_TAIGA = getType("village_taiga"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type JUNGLE_TEMPLE = getType("jungle_temple"); -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Type SWAMP_HUT = getType("swamp_hut"); - Type TRIAL_CHAMBERS = getType("trial_chambers"); - diff --git a/patches/api/0428-Add-more-scoreboard-API.patch b/patches/api/0428-Add-more-scoreboard-API.patch deleted file mode 100644 index 201af36b0c..0000000000 --- a/patches/api/0428-Add-more-scoreboard-API.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 16 Dec 2023 14:45:46 -0800 -Subject: [PATCH] Add more scoreboard API - - -diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java -index a193ffabb05160b462dee1ba8f687fdbc84405b6..bd4d84cbf220ab02f09ece97873bbf0bdf7a45ba 100644 ---- a/src/main/java/org/bukkit/scoreboard/Objective.java -+++ b/src/main/java/org/bukkit/scoreboard/Objective.java -@@ -175,4 +175,24 @@ public interface Objective { - */ - @NotNull Score getScoreFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException; - // Paper end - improve scoreboard entries -+ -+ // Paper start - add more score API -+ /** -+ * Gets if this objective will auto update score -+ * displays on changes. -+ * -+ * @return true if auto updating -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ boolean willAutoUpdateDisplay(); -+ -+ /** -+ * Sets if this objective will auto update -+ * score displays on changes. -+ * -+ * @param autoUpdateDisplay true to auto update -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ void setAutoUpdateDisplay(boolean autoUpdateDisplay); -+ // Paper end - add more score API - } -diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java -index 1eaa9a93f8eff5f18a6cce2d74f21eb19db273c8..5b6f243492d55d2db0d6944dc6daca9b181551d6 100644 ---- a/src/main/java/org/bukkit/scoreboard/Score.java -+++ b/src/main/java/org/bukkit/scoreboard/Score.java -@@ -83,4 +83,50 @@ public interface Score { - */ - void resetScore() throws IllegalStateException; - // Paper end -+ -+ // Paper start - add more score API -+ /** -+ * Gets if this score is triggerable and cannot -+ * be used by the {@code /trigger} command executed -+ * by the owner of this score. -+ * -+ * @return true if triggerable, false if not triggerable, score isn't set, or the objective isn't {@link Criteria#TRIGGER} -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ boolean isTriggerable(); -+ -+ /** -+ * Sets if this score is triggerable and can -+ * be used by the {@code /trigger} command -+ * executed by the owner of this score. Can -+ * only be set on {@link Criteria#TRIGGER} objectives. -+ *

-+ * If the score doesn't exist (aka {@link #isScoreSet()} returns false), -+ * this will create the score with a 0 value. -+ * -+ * @param triggerable true to enable trigger, false to disable -+ * @throws IllegalArgumentException if this objective isn't {@link Criteria#TRIGGER} -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ void setTriggerable(boolean triggerable); -+ -+ /** -+ * Get the custom name for this entry. -+ * -+ * @return the custom name or null if not set (or score isn't set) -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ @Nullable net.kyori.adventure.text.Component customName(); -+ -+ /** -+ * Sets the custom name for this entry. -+ *

-+ * If the score doesn't exist (aka {@link #isScoreSet()} returns false), -+ * this will create the score with a 0 value. -+ * -+ * @param customName the custom name or null to reset -+ * @throws IllegalStateException if the associated objective has been unregistered -+ */ -+ void customName(net.kyori.adventure.text.@Nullable Component customName); -+ // Paper end - add more score API - } diff --git a/patches/api/0428-Experimental-annotations-change.patch b/patches/api/0428-Experimental-annotations-change.patch new file mode 100644 index 0000000000..5660d684ce --- /dev/null +++ b/patches/api/0428-Experimental-annotations-change.patch @@ -0,0 +1,203 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 9 Dec 2023 11:47:53 -0800 +Subject: [PATCH] Experimental annotations change + + +diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java +index a96600443a0997c3a696a637422ab66ee1884fb0..20eb27ee041f77f295eb271f878c524ce5592251 100644 +--- a/src/main/java/org/bukkit/FeatureFlag.java ++++ b/src/main/java/org/bukkit/FeatureFlag.java +@@ -29,6 +29,7 @@ public interface FeatureFlag extends Keyed { + @Deprecated + public static final FeatureFlag UPDATE_1_20 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_20")); + ++ @ApiStatus.Experimental // Paper - add missing annotation + public static final FeatureFlag TRADE_REBALANCE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("trade_rebalance")); + + /** +@@ -39,10 +40,13 @@ public interface FeatureFlag extends Keyed { + @Deprecated + public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21")); + ++ @ApiStatus.Experimental // Paper - add missing annotation + public static final FeatureFlag WINTER_DROP = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("winter_drop")); + ++ @ApiStatus.Experimental // Paper - add missing annotation + public static final FeatureFlag REDSTONE_EXPERIMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("redstone_experiments")); + ++ @ApiStatus.Experimental // Paper - add missing annotation + public static final FeatureFlag MINECART_IMPROVEMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("minecart_improvements")); + + } +diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java +index 8b6584fae0a9d5cccbe350d889fa8b4a14c78ca3..89f1820ae94c48f51a44df750904bb285013720c 100644 +--- a/src/main/java/org/bukkit/GameRule.java ++++ b/src/main/java/org/bukkit/GameRule.java +@@ -287,6 +287,8 @@ public final class GameRule implements net.kyori.adventure.translation.Transl + * The maximum speed of minecarts (when the new movement algorithm is + * enabled). + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.MINECART_IMPROVEMENTS) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final GameRule MINECART_MAX_SPEED = new GameRule<>("minecartMaxSpeed", Integer.class); + + /** +diff --git a/src/main/java/org/bukkit/block/Crafter.java b/src/main/java/org/bukkit/block/Crafter.java +index 8d2dd78fc588a6817dfede8040b9909a7d5bde67..f737a2aae3f57a1bfe4cf68ea66f603da4eebd47 100644 +--- a/src/main/java/org/bukkit/block/Crafter.java ++++ b/src/main/java/org/bukkit/block/Crafter.java +@@ -6,7 +6,6 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a captured state of a crafter. + */ +-@ApiStatus.Experimental + public interface Crafter extends Container, com.destroystokyo.paper.loottable.LootableBlockInventory { // Paper - LootTable API + + /** +diff --git a/src/main/java/org/bukkit/block/TrialSpawner.java b/src/main/java/org/bukkit/block/TrialSpawner.java +index 2d46d85aff243e9b3c6764f0de041fff6b766853..6fc7b5fe1152f739663a4715a1c93246c3ee6df2 100644 +--- a/src/main/java/org/bukkit/block/TrialSpawner.java ++++ b/src/main/java/org/bukkit/block/TrialSpawner.java +@@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a captured state of a trial spawner. + */ +-@ApiStatus.Experimental + public interface TrialSpawner extends TileState { + + /** +diff --git a/src/main/java/org/bukkit/block/Vault.java b/src/main/java/org/bukkit/block/Vault.java +index f0c5d27f6f1ff56ffe4b88dfdce8d0b7f06d19e1..375f41fe4aebdbf140497b5ba1e54e1c72f0cdfc 100644 +--- a/src/main/java/org/bukkit/block/Vault.java ++++ b/src/main/java/org/bukkit/block/Vault.java +@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a captured state of a trial spawner. + */ +-@ApiStatus.Experimental + public interface Vault extends TileState { + } +diff --git a/src/main/java/org/bukkit/entity/AbstractWindCharge.java b/src/main/java/org/bukkit/entity/AbstractWindCharge.java +index 60fbacee263e55f91ac977f020e390d46024723a..ecff691c3a0878659fb051926ef769ce1e339c48 100644 +--- a/src/main/java/org/bukkit/entity/AbstractWindCharge.java ++++ b/src/main/java/org/bukkit/entity/AbstractWindCharge.java +@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a Wind Charge. + */ +-@ApiStatus.Experimental + public interface AbstractWindCharge extends Fireball { + + /** +diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java +index 6296a6f3f3e794677fd3a626376f357c740ec356..7d993f8bd18ec1d3260d12f0ff8078a86ee4867d 100644 +--- a/src/main/java/org/bukkit/entity/Bogged.java ++++ b/src/main/java/org/bukkit/entity/Bogged.java +@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a Bogged Skeleton. + */ +-@ApiStatus.Experimental + public interface Bogged extends AbstractSkeleton, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API + } +diff --git a/src/main/java/org/bukkit/entity/Breeze.java b/src/main/java/org/bukkit/entity/Breeze.java +index a75e725805c193a408683885cba83ca168347165..254bc6e18961a72f471334cc0535e3c7a9d70012 100644 +--- a/src/main/java/org/bukkit/entity/Breeze.java ++++ b/src/main/java/org/bukkit/entity/Breeze.java +@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a Breeze. Whoosh! + */ +-@ApiStatus.Experimental + public interface Breeze extends Monster { + } +diff --git a/src/main/java/org/bukkit/entity/BreezeWindCharge.java b/src/main/java/org/bukkit/entity/BreezeWindCharge.java +index 06ca3dc4b0b69cbaefa96464dce484cea93e0717..748e58eb93c7882e15d9cbdd56d11bb14808698b 100644 +--- a/src/main/java/org/bukkit/entity/BreezeWindCharge.java ++++ b/src/main/java/org/bukkit/entity/BreezeWindCharge.java +@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a Wind Charge. + */ +-@ApiStatus.Experimental + public interface BreezeWindCharge extends AbstractWindCharge { + + } +diff --git a/src/main/java/org/bukkit/entity/OminousItemSpawner.java b/src/main/java/org/bukkit/entity/OminousItemSpawner.java +index 4aa07d4edb2c81d0ae7999b30ad53ff8bb884ec7..dbd4da4c63b6b1b21c3e638ac4d2c9fdd6716a8e 100644 +--- a/src/main/java/org/bukkit/entity/OminousItemSpawner.java ++++ b/src/main/java/org/bukkit/entity/OminousItemSpawner.java +@@ -7,7 +7,6 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents an ominous item spawner. + */ +-@ApiStatus.Experimental + public interface OminousItemSpawner extends Entity { + + /** +diff --git a/src/main/java/org/bukkit/entity/WindCharge.java b/src/main/java/org/bukkit/entity/WindCharge.java +index 4adc91ba3dff00ab44303778e9d4499f7808ad00..beb62426490a361af793fb530106d8547a83ae03 100644 +--- a/src/main/java/org/bukkit/entity/WindCharge.java ++++ b/src/main/java/org/bukkit/entity/WindCharge.java +@@ -5,7 +5,6 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Represents a Wind Charge. + */ +-@ApiStatus.Experimental + public interface WindCharge extends AbstractWindCharge { + + } +diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java +index ae4ae1fa6d407665ef03edcdef683d741668acf1..b4fe8108e8b36b8ce859cdd4a5b557034f923c85 100644 +--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java ++++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java +@@ -148,7 +148,6 @@ public enum InventoryType { + /** + * A crafter inventory, with 9 CRAFTING slots. + */ +- @ApiStatus.Experimental + CRAFTER(9, "Crafter", MenuType.CRAFTER_3X3), + /** + * The new smithing inventory, with 3 CRAFTING slots and 1 RESULT slot. +diff --git a/src/main/java/org/bukkit/inventory/CrafterInventory.java b/src/main/java/org/bukkit/inventory/CrafterInventory.java +index bb1fb5e0518c6a62ef8b206733ee51d831f1f85b..49d0a37bbeb0b8fa9207164c74245ef05485467c 100644 +--- a/src/main/java/org/bukkit/inventory/CrafterInventory.java ++++ b/src/main/java/org/bukkit/inventory/CrafterInventory.java +@@ -5,5 +5,4 @@ import org.jetbrains.annotations.ApiStatus; + /** + * Interface to the inventory of a Crafter. + */ +-@ApiStatus.Experimental + public interface CrafterInventory extends Inventory { } +diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java +index 0899981b9ab1f98dacc617156d12779421e4c275..6c33fbf720a2e11655e254aeb516e08831c2adf4 100644 +--- a/src/main/java/org/bukkit/map/MapCursor.java ++++ b/src/main/java/org/bukkit/map/MapCursor.java +@@ -314,12 +314,26 @@ public final class MapCursor { + Type BANNER_RED = getType("banner_red"); + Type BANNER_BLACK = getType("banner_black"); + Type RED_X = getType("red_x"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type VILLAGE_DESERT = getType("village_desert"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type VILLAGE_PLAINS = getType("village_plains"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type VILLAGE_SAVANNA = getType("village_savanna"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type VILLAGE_SNOWY = getType("village_snowy"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type VILLAGE_TAIGA = getType("village_taiga"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type JUNGLE_TEMPLE = getType("jungle_temple"); ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Type SWAMP_HUT = getType("swamp_hut"); + Type TRIAL_CHAMBERS = getType("trial_chambers"); + diff --git a/patches/api/0429-Add-more-scoreboard-API.patch b/patches/api/0429-Add-more-scoreboard-API.patch new file mode 100644 index 0000000000..201af36b0c --- /dev/null +++ b/patches/api/0429-Add-more-scoreboard-API.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 16 Dec 2023 14:45:46 -0800 +Subject: [PATCH] Add more scoreboard API + + +diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java +index a193ffabb05160b462dee1ba8f687fdbc84405b6..bd4d84cbf220ab02f09ece97873bbf0bdf7a45ba 100644 +--- a/src/main/java/org/bukkit/scoreboard/Objective.java ++++ b/src/main/java/org/bukkit/scoreboard/Objective.java +@@ -175,4 +175,24 @@ public interface Objective { + */ + @NotNull Score getScoreFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException; + // Paper end - improve scoreboard entries ++ ++ // Paper start - add more score API ++ /** ++ * Gets if this objective will auto update score ++ * displays on changes. ++ * ++ * @return true if auto updating ++ * @throws IllegalStateException if this objective has been unregistered ++ */ ++ boolean willAutoUpdateDisplay(); ++ ++ /** ++ * Sets if this objective will auto update ++ * score displays on changes. ++ * ++ * @param autoUpdateDisplay true to auto update ++ * @throws IllegalStateException if this objective has been unregistered ++ */ ++ void setAutoUpdateDisplay(boolean autoUpdateDisplay); ++ // Paper end - add more score API + } +diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java +index 1eaa9a93f8eff5f18a6cce2d74f21eb19db273c8..5b6f243492d55d2db0d6944dc6daca9b181551d6 100644 +--- a/src/main/java/org/bukkit/scoreboard/Score.java ++++ b/src/main/java/org/bukkit/scoreboard/Score.java +@@ -83,4 +83,50 @@ public interface Score { + */ + void resetScore() throws IllegalStateException; + // Paper end ++ ++ // Paper start - add more score API ++ /** ++ * Gets if this score is triggerable and cannot ++ * be used by the {@code /trigger} command executed ++ * by the owner of this score. ++ * ++ * @return true if triggerable, false if not triggerable, score isn't set, or the objective isn't {@link Criteria#TRIGGER} ++ * @throws IllegalStateException if the associated objective has been unregistered ++ */ ++ boolean isTriggerable(); ++ ++ /** ++ * Sets if this score is triggerable and can ++ * be used by the {@code /trigger} command ++ * executed by the owner of this score. Can ++ * only be set on {@link Criteria#TRIGGER} objectives. ++ *

++ * If the score doesn't exist (aka {@link #isScoreSet()} returns false), ++ * this will create the score with a 0 value. ++ * ++ * @param triggerable true to enable trigger, false to disable ++ * @throws IllegalArgumentException if this objective isn't {@link Criteria#TRIGGER} ++ * @throws IllegalStateException if the associated objective has been unregistered ++ */ ++ void setTriggerable(boolean triggerable); ++ ++ /** ++ * Get the custom name for this entry. ++ * ++ * @return the custom name or null if not set (or score isn't set) ++ * @throws IllegalStateException if the associated objective has been unregistered ++ */ ++ @Nullable net.kyori.adventure.text.Component customName(); ++ ++ /** ++ * Sets the custom name for this entry. ++ *

++ * If the score doesn't exist (aka {@link #isScoreSet()} returns false), ++ * this will create the score with a 0 value. ++ * ++ * @param customName the custom name or null to reset ++ * @throws IllegalStateException if the associated objective has been unregistered ++ */ ++ void customName(net.kyori.adventure.text.@Nullable Component customName); ++ // Paper end - add more score API + } diff --git a/patches/api/0429-Improve-Registry.patch b/patches/api/0429-Improve-Registry.patch deleted file mode 100644 index 607568bd87..0000000000 --- a/patches/api/0429-Improve-Registry.patch +++ /dev/null @@ -1,239 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 20 Dec 2023 02:03:10 -0800 -Subject: [PATCH] Improve Registry - -Adds Registry#getKey(Object) which should be the -primary way people get the key for an object. Registry -items need to exist without having a key and so -getKey() methods on Keyed objects that have a registry -are marked as Deprecated or Obsolete. - -diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java -index 042d1d932a33022e4fc873652f70dc6ed342d46a..e57e34064262b90221b0621f1d13e9705e68421a 100644 ---- a/src/main/java/org/bukkit/Art.java -+++ b/src/main/java/org/bukkit/Art.java -@@ -103,6 +103,13 @@ public enum Art implements Keyed { - return id; - } - -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, -+ * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key. -+ */ -+ @Deprecated(since = "1.21") -+ // Paper end - deprecate getKey - @NotNull - @Override - public NamespacedKey getKey() { -diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java -index c9f02466a04d20579fe2258bb02acf98e163ca81..bffd4ab2d08e5c3f83a49a31e1e55cc1eab7b319 100644 ---- a/src/main/java/org/bukkit/MusicInstrument.java -+++ b/src/main/java/org/bukkit/MusicInstrument.java -@@ -47,6 +47,16 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran - return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key)); - } - -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments -+ * can exist without a key. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ @Override -+ public abstract @NotNull NamespacedKey getKey(); -+ // Paper end - deprecate getKey -+ - // Paper start - translation key - @Override - public @NotNull String translationKey() { -diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 6112db5d1153d045f2271038bada6b46d1a6a051..67cf3fcad21a8977d6fad172cc776b628ab68f25 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -379,6 +379,79 @@ public interface Registry extends Iterable { - @Nullable - T get(@NotNull NamespacedKey key); - -+ // Paper start - improve Registry -+ /** -+ * Gets the object by its key or throws if it doesn't exist. -+ * -+ * @param key the key to get the object of in this registry -+ * @return the object for the key -+ * @throws java.util.NoSuchElementException if the key doesn't point to an object in the registry -+ */ -+ default @NotNull T getOrThrow(final net.kyori.adventure.key.@NotNull Key key) { -+ final T value = this.get(key); -+ if (value == null) { -+ throw new java.util.NoSuchElementException("No value for " + key + " in " + this); -+ } -+ return value; -+ } -+ -+ /** -+ * Gets the object by its key or throws if it doesn't exist. -+ * -+ * @param key the key to get the object of in this registry -+ * @return the object for the key -+ * @throws java.util.NoSuchElementException if the key doesn't point to an object in the registry -+ */ -+ default @NotNull T getOrThrow(final io.papermc.paper.registry.@NotNull TypedKey key) { -+ final T value = this.get(key); -+ if (value == null) { -+ throw new java.util.NoSuchElementException("No value for " + key + " in " + this); -+ } -+ return value; -+ } -+ -+ /** -+ * Gets the key for this object or throws if it doesn't exist. -+ *

-+ * Some types can exist without being in a registry -+ * and such will have no key associated with them. This -+ * method throw an exception if it isn't in this registry. -+ * -+ * @param value the value to get the key of in this registry -+ * @return the key for the value -+ * @throws java.util.NoSuchElementException if the value doesn't exist in this registry -+ * @see #getKey(Keyed) -+ */ -+ default @NotNull NamespacedKey getKeyOrThrow(final @NotNull T value) { -+ Preconditions.checkArgument(value != null, "value cannot be null"); -+ final NamespacedKey key = this.getKey(value); -+ if (key == null) { -+ throw new java.util.NoSuchElementException(value + " has no key in " + this); -+ } -+ return key; -+ } -+ -+ /** -+ * Get the key for this object. -+ *

-+ * Some types can exist without being in a registry -+ * and such will have no key associated with them. This -+ * method will return null. -+ * -+ * @param value the value to get the key of in this registry -+ * @return the key for the value or null if not in the registry -+ * @see #getKeyOrThrow(Keyed) -+ */ -+ default @Nullable NamespacedKey getKey(final @NotNull T value) { -+ Preconditions.checkArgument(value != null, "value cannot be null"); -+ //noinspection ConstantValue (it might not be in the future...) -+ if (value instanceof Keyed) { -+ return value.getKey(); -+ } -+ return null; -+ } -+ // Paper end - improve Registry -+ - /** - * Get the object by its key. - * -@@ -475,5 +548,12 @@ public interface Registry extends Iterable { - public Class getType() { - return this.type; - } -+ -+ // Paper start - improve Registry -+ @Override -+ public @NotNull NamespacedKey getKey(final @NotNull T value) { -+ return value.getKey(); -+ } -+ // Paper end - improve Registry - } - } -diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java -index cf17af024b1953b6f21f18885411ea6a0baa1d4c..f32a035317f3f8e200bb8076e6a326cb1e87cfe1 100644 ---- a/src/main/java/org/bukkit/Sound.java -+++ b/src/main/java/org/bukkit/Sound.java -@@ -1655,6 +1655,13 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - this.key = NamespacedKey.minecraft(key); - } - -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds -+ * can exist without a key. -+ */ -+ @Deprecated(since = "1.20.5") -+ // Paper end - deprecate getKey - @NotNull - @Override - public NamespacedKey getKey() { -diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java -index eaf6cd758344eeba29f00f822a50c93704af8bda..eb192030832e1741850871bec9bf999f014b6fc1 100644 ---- a/src/main/java/org/bukkit/block/banner/PatternType.java -+++ b/src/main/java/org/bukkit/block/banner/PatternType.java -@@ -56,6 +56,13 @@ public interface PatternType extends OldEnum, Keyed { - PatternType FLOW = getType("flow"); - PatternType GUSTER = getType("guster"); - -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, -+ * and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}. PatternTypes can exist without a key. -+ */ -+ @Deprecated(since = "1.20.5") -+ // Paper end - deprecate getKey - @Override - @NotNull - public NamespacedKey getKey(); -diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java -index 20a7fd27ba3a029d58dd18ad9b470ffaed8c9578..a773550549b4093a5fb4ef47284c438dcddd99ab 100644 ---- a/src/main/java/org/bukkit/generator/structure/Structure.java -+++ b/src/main/java/org/bukkit/generator/structure/Structure.java -@@ -61,4 +61,13 @@ public abstract class Structure implements Keyed { - */ - @NotNull - public abstract StructureType getStructureType(); -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#STRUCTURE}. Structures -+ * can exist without a key. -+ */ -+ @Override -+ @Deprecated(since = "1.20.4") -+ public abstract @NotNull NamespacedKey getKey(); -+ // Paper end - deprecate getKey - } -diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java -index 804cb7162b34225d5dd84aada283de568d7d6592..2a7bedf850896e358213c2a201ca3d611cb9ea67 100644 ---- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java -+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java -@@ -74,4 +74,14 @@ public interface TrimMaterial extends Keyed, Translatable { - @Deprecated(forRemoval = true) - @org.jetbrains.annotations.NotNull String getTranslationKey(); - // Paper end - adventure -+ -+ // Paper start - Registry#getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, -+ * and {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}. TrimMaterials can exist without a key. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.4") -+ @Override -+ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey(); -+ // Paper end - Registry#getKey - } -diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -index 56cfe665daba1754e41f633d7c18172bebf87028..db657206c158e755227e8ef8e102a2ee2cc3bf0a 100644 ---- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -@@ -106,4 +106,14 @@ public interface TrimPattern extends Keyed, Translatable { - @Deprecated(forRemoval = true) - @org.jetbrains.annotations.NotNull String getTranslationKey(); - // Paper end - adventure -+ -+ // Paper start - Registry#getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, -+ * and {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}. TrimPatterns can exist without a key. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.4") -+ @Override -+ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey(); -+ // Paper end - Registry#getKey - } diff --git a/patches/api/0430-Add-experience-points-API.patch b/patches/api/0430-Add-experience-points-API.patch deleted file mode 100644 index 5581883301..0000000000 --- a/patches/api/0430-Add-experience-points-API.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lukas Planz -Date: Tue, 5 Sep 2023 20:33:52 +0200 -Subject: [PATCH] Add experience points API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 4297a893799fe39b80029b97f6b5581d543afa8a..b3b6cdf5491397e0e802ac91f5805d560ed5d88a 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1947,6 +1947,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param exp New total experience points - */ - public void setTotalExperience(int exp); -+ // Paper start -+ /** -+ * Gets the players total amount of experience points he collected to reach the current level and level progress. -+ * -+ *

This method differs from {@link #getTotalExperience()} in that this method always returns an -+ * up-to-date value that reflects the players{@link #getLevel() level} and {@link #getExp() level progress}

-+ * -+ * @return Current total experience points -+ * @see #getLevel() -+ * @see #getExp() -+ * @see #setExperienceLevelAndProgress(int) -+ */ -+ @org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int calculateTotalExperiencePoints(); -+ -+ /** -+ * Updates the players level and level progress to that what would be reached when the total amount of experience -+ * had been collected. -+ * -+ *

This method differs from {@link #setTotalExperience(int)} in that this method actually updates the -+ * {@link #getLevel() level} and {@link #getExp() level progress} so that a subsequent call of -+ * {@link #calculateTotalExperiencePoints()} yields the same amount of points that have been set

-+ * -+ * @param totalExperience New total experience points -+ * @see #setLevel(int) -+ * @see #setExp(float) -+ * @see #calculateTotalExperiencePoints() -+ */ -+ void setExperienceLevelAndProgress(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int totalExperience); -+ -+ /** -+ * Gets the total amount of experience points that are needed to reach the next level from zero progress towards it. -+ * -+ *

Can be used with {@link #getExp()} to calculate the current points for the current level and alike

-+ * -+ * @return The required experience points -+ * @see #getExp() -+ */ -+ int getExperiencePointsNeededForNextLevel(); -+ // Paper end - - /** - * Send an experience change. diff --git a/patches/api/0430-Improve-Registry.patch b/patches/api/0430-Improve-Registry.patch new file mode 100644 index 0000000000..607568bd87 --- /dev/null +++ b/patches/api/0430-Improve-Registry.patch @@ -0,0 +1,239 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 20 Dec 2023 02:03:10 -0800 +Subject: [PATCH] Improve Registry + +Adds Registry#getKey(Object) which should be the +primary way people get the key for an object. Registry +items need to exist without having a key and so +getKey() methods on Keyed objects that have a registry +are marked as Deprecated or Obsolete. + +diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java +index 042d1d932a33022e4fc873652f70dc6ed342d46a..e57e34064262b90221b0621f1d13e9705e68421a 100644 +--- a/src/main/java/org/bukkit/Art.java ++++ b/src/main/java/org/bukkit/Art.java +@@ -103,6 +103,13 @@ public enum Art implements Keyed { + return id; + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, ++ * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key. ++ */ ++ @Deprecated(since = "1.21") ++ // Paper end - deprecate getKey + @NotNull + @Override + public NamespacedKey getKey() { +diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java +index c9f02466a04d20579fe2258bb02acf98e163ca81..bffd4ab2d08e5c3f83a49a31e1e55cc1eab7b319 100644 +--- a/src/main/java/org/bukkit/MusicInstrument.java ++++ b/src/main/java/org/bukkit/MusicInstrument.java +@@ -47,6 +47,16 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran + return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key)); + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments ++ * can exist without a key. ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ @Override ++ public abstract @NotNull NamespacedKey getKey(); ++ // Paper end - deprecate getKey ++ + // Paper start - translation key + @Override + public @NotNull String translationKey() { +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index 6112db5d1153d045f2271038bada6b46d1a6a051..67cf3fcad21a8977d6fad172cc776b628ab68f25 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -379,6 +379,79 @@ public interface Registry extends Iterable { + @Nullable + T get(@NotNull NamespacedKey key); + ++ // Paper start - improve Registry ++ /** ++ * Gets the object by its key or throws if it doesn't exist. ++ * ++ * @param key the key to get the object of in this registry ++ * @return the object for the key ++ * @throws java.util.NoSuchElementException if the key doesn't point to an object in the registry ++ */ ++ default @NotNull T getOrThrow(final net.kyori.adventure.key.@NotNull Key key) { ++ final T value = this.get(key); ++ if (value == null) { ++ throw new java.util.NoSuchElementException("No value for " + key + " in " + this); ++ } ++ return value; ++ } ++ ++ /** ++ * Gets the object by its key or throws if it doesn't exist. ++ * ++ * @param key the key to get the object of in this registry ++ * @return the object for the key ++ * @throws java.util.NoSuchElementException if the key doesn't point to an object in the registry ++ */ ++ default @NotNull T getOrThrow(final io.papermc.paper.registry.@NotNull TypedKey key) { ++ final T value = this.get(key); ++ if (value == null) { ++ throw new java.util.NoSuchElementException("No value for " + key + " in " + this); ++ } ++ return value; ++ } ++ ++ /** ++ * Gets the key for this object or throws if it doesn't exist. ++ *

++ * Some types can exist without being in a registry ++ * and such will have no key associated with them. This ++ * method throw an exception if it isn't in this registry. ++ * ++ * @param value the value to get the key of in this registry ++ * @return the key for the value ++ * @throws java.util.NoSuchElementException if the value doesn't exist in this registry ++ * @see #getKey(Keyed) ++ */ ++ default @NotNull NamespacedKey getKeyOrThrow(final @NotNull T value) { ++ Preconditions.checkArgument(value != null, "value cannot be null"); ++ final NamespacedKey key = this.getKey(value); ++ if (key == null) { ++ throw new java.util.NoSuchElementException(value + " has no key in " + this); ++ } ++ return key; ++ } ++ ++ /** ++ * Get the key for this object. ++ *

++ * Some types can exist without being in a registry ++ * and such will have no key associated with them. This ++ * method will return null. ++ * ++ * @param value the value to get the key of in this registry ++ * @return the key for the value or null if not in the registry ++ * @see #getKeyOrThrow(Keyed) ++ */ ++ default @Nullable NamespacedKey getKey(final @NotNull T value) { ++ Preconditions.checkArgument(value != null, "value cannot be null"); ++ //noinspection ConstantValue (it might not be in the future...) ++ if (value instanceof Keyed) { ++ return value.getKey(); ++ } ++ return null; ++ } ++ // Paper end - improve Registry ++ + /** + * Get the object by its key. + * +@@ -475,5 +548,12 @@ public interface Registry extends Iterable { + public Class getType() { + return this.type; + } ++ ++ // Paper start - improve Registry ++ @Override ++ public @NotNull NamespacedKey getKey(final @NotNull T value) { ++ return value.getKey(); ++ } ++ // Paper end - improve Registry + } + } +diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java +index cf17af024b1953b6f21f18885411ea6a0baa1d4c..f32a035317f3f8e200bb8076e6a326cb1e87cfe1 100644 +--- a/src/main/java/org/bukkit/Sound.java ++++ b/src/main/java/org/bukkit/Sound.java +@@ -1655,6 +1655,13 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + this.key = NamespacedKey.minecraft(key); + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds ++ * can exist without a key. ++ */ ++ @Deprecated(since = "1.20.5") ++ // Paper end - deprecate getKey + @NotNull + @Override + public NamespacedKey getKey() { +diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java +index eaf6cd758344eeba29f00f822a50c93704af8bda..eb192030832e1741850871bec9bf999f014b6fc1 100644 +--- a/src/main/java/org/bukkit/block/banner/PatternType.java ++++ b/src/main/java/org/bukkit/block/banner/PatternType.java +@@ -56,6 +56,13 @@ public interface PatternType extends OldEnum, Keyed { + PatternType FLOW = getType("flow"); + PatternType GUSTER = getType("guster"); + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, ++ * and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}. PatternTypes can exist without a key. ++ */ ++ @Deprecated(since = "1.20.5") ++ // Paper end - deprecate getKey + @Override + @NotNull + public NamespacedKey getKey(); +diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java +index 20a7fd27ba3a029d58dd18ad9b470ffaed8c9578..a773550549b4093a5fb4ef47284c438dcddd99ab 100644 +--- a/src/main/java/org/bukkit/generator/structure/Structure.java ++++ b/src/main/java/org/bukkit/generator/structure/Structure.java +@@ -61,4 +61,13 @@ public abstract class Structure implements Keyed { + */ + @NotNull + public abstract StructureType getStructureType(); ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#STRUCTURE}. Structures ++ * can exist without a key. ++ */ ++ @Override ++ @Deprecated(since = "1.20.4") ++ public abstract @NotNull NamespacedKey getKey(); ++ // Paper end - deprecate getKey + } +diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java +index 804cb7162b34225d5dd84aada283de568d7d6592..2a7bedf850896e358213c2a201ca3d611cb9ea67 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java +@@ -74,4 +74,14 @@ public interface TrimMaterial extends Keyed, Translatable { + @Deprecated(forRemoval = true) + @org.jetbrains.annotations.NotNull String getTranslationKey(); + // Paper end - adventure ++ ++ // Paper start - Registry#getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, ++ * and {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}. TrimMaterials can exist without a key. ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.4") ++ @Override ++ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey(); ++ // Paper end - Registry#getKey + } +diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +index 56cfe665daba1754e41f633d7c18172bebf87028..db657206c158e755227e8ef8e102a2ee2cc3bf0a 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +@@ -106,4 +106,14 @@ public interface TrimPattern extends Keyed, Translatable { + @Deprecated(forRemoval = true) + @org.jetbrains.annotations.NotNull String getTranslationKey(); + // Paper end - adventure ++ ++ // Paper start - Registry#getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)}, ++ * and {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}. TrimPatterns can exist without a key. ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.4") ++ @Override ++ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey(); ++ // Paper end - Registry#getKey + } diff --git a/patches/api/0431-Add-experience-points-API.patch b/patches/api/0431-Add-experience-points-API.patch new file mode 100644 index 0000000000..5581883301 --- /dev/null +++ b/patches/api/0431-Add-experience-points-API.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lukas Planz +Date: Tue, 5 Sep 2023 20:33:52 +0200 +Subject: [PATCH] Add experience points API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 4297a893799fe39b80029b97f6b5581d543afa8a..b3b6cdf5491397e0e802ac91f5805d560ed5d88a 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1947,6 +1947,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * @param exp New total experience points + */ + public void setTotalExperience(int exp); ++ // Paper start ++ /** ++ * Gets the players total amount of experience points he collected to reach the current level and level progress. ++ * ++ *

This method differs from {@link #getTotalExperience()} in that this method always returns an ++ * up-to-date value that reflects the players{@link #getLevel() level} and {@link #getExp() level progress}

++ * ++ * @return Current total experience points ++ * @see #getLevel() ++ * @see #getExp() ++ * @see #setExperienceLevelAndProgress(int) ++ */ ++ @org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int calculateTotalExperiencePoints(); ++ ++ /** ++ * Updates the players level and level progress to that what would be reached when the total amount of experience ++ * had been collected. ++ * ++ *

This method differs from {@link #setTotalExperience(int)} in that this method actually updates the ++ * {@link #getLevel() level} and {@link #getExp() level progress} so that a subsequent call of ++ * {@link #calculateTotalExperiencePoints()} yields the same amount of points that have been set

++ * ++ * @param totalExperience New total experience points ++ * @see #setLevel(int) ++ * @see #setExp(float) ++ * @see #calculateTotalExperiencePoints() ++ */ ++ void setExperienceLevelAndProgress(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int totalExperience); ++ ++ /** ++ * Gets the total amount of experience points that are needed to reach the next level from zero progress towards it. ++ * ++ *

Can be used with {@link #getExp()} to calculate the current points for the current level and alike

++ * ++ * @return The required experience points ++ * @see #getExp() ++ */ ++ int getExperiencePointsNeededForNextLevel(); ++ // Paper end + + /** + * Send an experience change. diff --git a/patches/api/0431-Add-missing-InventoryType.patch b/patches/api/0431-Add-missing-InventoryType.patch deleted file mode 100644 index 3735af5696..0000000000 --- a/patches/api/0431-Add-missing-InventoryType.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 27 Dec 2023 16:46:13 -0800 -Subject: [PATCH] Add missing InventoryType - -Upstream did not add a DECORATED_POT inventory type - -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java -index b4fe8108e8b36b8ce859cdd4a5b557034f923c85..7184f80899206bedeac387e9f8a35482801efd4b 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryType.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java -@@ -145,6 +145,12 @@ public enum InventoryType { - * Pseudo jukebox inventory with 1 slot of undefined type. - */ - JUKEBOX(1, "Jukebox", null, false), -+ // Paper start - add missing type -+ /** -+ * Pseudo decorated pot with 1 slot of undefined type. -+ */ -+ DECORATED_POT(1, "Decorated Pot", null, false), -+ // Paper end - add missing type - /** - * A crafter inventory, with 9 CRAFTING slots. - */ diff --git a/patches/api/0432-Add-drops-to-shear-events.patch b/patches/api/0432-Add-drops-to-shear-events.patch deleted file mode 100644 index c87460e48d..0000000000 --- a/patches/api/0432-Add-drops-to-shear-events.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 18 May 2021 12:31:54 -0700 -Subject: [PATCH] Add drops to shear events - - -diff --git a/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java b/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java -index 71c0af9373069cfaa074e1fbad592eab81025b1c..610768bd329b8612627d361fd9a773a7b91ff108 100644 ---- a/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java -@@ -17,11 +17,14 @@ public class BlockShearEntityEvent extends BlockEvent implements Cancellable { - private final Entity sheared; - private final ItemStack tool; - private boolean cancelled; -+ private java.util.List drops; // Paper - -- public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool) { -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool, final @NotNull java.util.List drops) { // Paper - custom shear drops - super(dispenser); - this.sheared = sheared; - this.tool = tool; -+ this.drops = drops; // Paper - } - - /** -@@ -64,4 +67,24 @@ public class BlockShearEntityEvent extends BlockEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start - custom shear drops -+ /** -+ * Get an immutable list of drops for this shearing. -+ * -+ * @return the shearing drops -+ * @see #setDrops(java.util.List) -+ */ -+ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getDrops() { -+ return java.util.Collections.unmodifiableList(this.drops); -+ } -+ -+ /** -+ * Sets the drops for the shearing. -+ * -+ * @param drops the shear drops -+ */ -+ public void setDrops(final java.util.@NotNull List drops) { -+ this.drops = java.util.List.copyOf(drops); -+ } -+ // Paper end - custom shear drops - } -diff --git a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java -index 04b3dce008edefb045162d0f69f87462ea1f3534..63f6799c2543ba67ce9fe6484002062d7a754fd0 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java -@@ -18,17 +18,20 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable { - private final Entity what; - private final ItemStack item; - private final EquipmentSlot hand; -+ private java.util.List drops; // Paper - custom shear drops - -- public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand) { -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand, final java.util.@NotNull List drops) { // Paper - custom shear drops - super(who); - this.what = what; - this.item = item; - this.hand = hand; -+ this.drops = drops; // Paper - custom shear drops - } - - @Deprecated - public PlayerShearEntityEvent(@NotNull final Player who, @NotNull final Entity what) { -- this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND); -+ this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND, java.util.Collections.emptyList()); // Paper - custom shear drops - } - - @Override -@@ -82,4 +85,24 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable { - return handlers; - } - -+ // Paper start - custom shear drops -+ /** -+ * Get an immutable list of drops for this shearing. -+ * -+ * @return the shearing drops -+ * @see #setDrops(java.util.List) -+ */ -+ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getDrops() { -+ return this.drops; -+ } -+ -+ /** -+ * Sets the drops for the shearing. -+ * -+ * @param drops the shear drops -+ */ -+ public void setDrops(final java.util.@NotNull List drops) { -+ this.drops = java.util.List.copyOf(drops); -+ } -+ // Paper end - custom shear drops - } diff --git a/patches/api/0432-Add-missing-InventoryType.patch b/patches/api/0432-Add-missing-InventoryType.patch new file mode 100644 index 0000000000..3735af5696 --- /dev/null +++ b/patches/api/0432-Add-missing-InventoryType.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 27 Dec 2023 16:46:13 -0800 +Subject: [PATCH] Add missing InventoryType + +Upstream did not add a DECORATED_POT inventory type + +diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java +index b4fe8108e8b36b8ce859cdd4a5b557034f923c85..7184f80899206bedeac387e9f8a35482801efd4b 100644 +--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java ++++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java +@@ -145,6 +145,12 @@ public enum InventoryType { + * Pseudo jukebox inventory with 1 slot of undefined type. + */ + JUKEBOX(1, "Jukebox", null, false), ++ // Paper start - add missing type ++ /** ++ * Pseudo decorated pot with 1 slot of undefined type. ++ */ ++ DECORATED_POT(1, "Decorated Pot", null, false), ++ // Paper end - add missing type + /** + * A crafter inventory, with 9 CRAFTING slots. + */ diff --git a/patches/api/0433-Add-HiddenPotionEffect-API.patch b/patches/api/0433-Add-HiddenPotionEffect-API.patch deleted file mode 100644 index 03c31e4ff8..0000000000 --- a/patches/api/0433-Add-HiddenPotionEffect-API.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tamion <70228790+notTamion@users.noreply.github.com> -Date: Sun, 5 Nov 2023 09:50:48 +0100 -Subject: [PATCH] Add HiddenPotionEffect API - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 4aab0144601788a7902c9fdabb68744d9e33a345..51a428473e702be3ab79bd1e579d1114f747791b 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -591,6 +591,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - - /** - * Adds the given {@link PotionEffect} to the living entity. -+ *

-+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when -+ * adding the effect to the entity. - * - * @param effect PotionEffect to be added - * @return whether the effect could be added -@@ -615,6 +618,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - /** - * Attempts to add all of the given {@link PotionEffect} to the living - * entity. -+ *

-+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when -+ * adding the effect to the entity. - * - * @param effects the effects to add - * @return whether all of the effects could be added -diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java -index 575156c089e45a3d6a43ca6b7adfbc7b473a60ab..704b6d615e7490d433b703f5a6a8d3c40aa6425e 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffect.java -+++ b/src/main/java/org/bukkit/potion/PotionEffect.java -@@ -28,6 +28,7 @@ public class PotionEffect implements ConfigurationSerializable { - */ - public static final int INFINITE_DURATION = -1; - -+ private static final String HIDDEN_EFFECT = "hidden_effect"; // Paper - private static final String AMPLIFIER = "amplifier"; - private static final String DURATION = "duration"; - private static final String TYPE = "effect"; -@@ -40,6 +41,7 @@ public class PotionEffect implements ConfigurationSerializable { - private final boolean ambient; - private final boolean particles; - private final boolean icon; -+ private final PotionEffect hiddenEffect; // Paper - - /** - * Creates a potion effect. -@@ -50,8 +52,11 @@ public class PotionEffect implements ConfigurationSerializable { - * @param ambient the ambient status, see {@link PotionEffect#isAmbient()} - * @param particles the particle status, see {@link PotionEffect#hasParticles()} - * @param icon the icon status, see {@link PotionEffect#hasIcon()} -+ * @param hiddenEffect the hidden PotionEffect -+ * @hidden Internal-- hidden effects are only shown internally - */ -- public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper -+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect) { // Paper - Preconditions.checkArgument(type != null, "effect type cannot be null"); - this.type = type; - this.duration = duration; -@@ -59,6 +64,23 @@ public class PotionEffect implements ConfigurationSerializable { - this.ambient = ambient; - this.particles = particles; - this.icon = icon; -+ // Paper start -+ this.hiddenEffect = hiddenEffect; -+ } -+ -+ /** -+ * Creates a potion effect. -+ * @param type effect type -+ * @param duration measured in ticks, see {@link -+ * PotionEffect#getDuration()} -+ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()} -+ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()} -+ * @param particles the particle status, see {@link PotionEffect#hasParticles()} -+ * @param icon the icon status, see {@link PotionEffect#hasIcon()} -+ */ -+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { -+ this(type, duration, amplifier, ambient, particles, icon, null); -+ // Paper end - } - - /** -@@ -106,7 +128,7 @@ public class PotionEffect implements ConfigurationSerializable { - * @param map the map to deserialize from - */ - public PotionEffect(@NotNull Map map) { -- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true))); -+ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT)); // Paper - } - - // Paper start -@@ -134,6 +156,19 @@ public class PotionEffect implements ConfigurationSerializable { - public PotionEffect withIcon(boolean icon) { - return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon); - } -+ -+ /** -+ * Returns the PotionEffect that will become active -+ * after the current PotionEffect has run out. -+ *

-+ * Note: This value is only applicable to type applied to living entities. -+ * -+ * @return The hidden PotionEffect. -+ */ -+ @Nullable -+ public PotionEffect getHiddenPotionEffect() { -+ return hiddenEffect; -+ } - // Paper end - - @NotNull -@@ -170,19 +205,27 @@ public class PotionEffect implements ConfigurationSerializable { - @Override - @NotNull - public Map serialize() { -- return ImmutableMap.builder() -+ ImmutableMap.Builder builder = ImmutableMap.builder() // Paper - .put(TYPE, type.getKey().toString()) - .put(DURATION, duration) - .put(AMPLIFIER, amplifier) - .put(AMBIENT, ambient) - .put(PARTICLES, particles) -- .put(ICON, icon) -- .build(); -+ .put(ICON, icon); -+ // Paper start -+ if (this.hiddenEffect != null) { -+ builder.put(HIDDEN_EFFECT, this.hiddenEffect); -+ } -+ return builder.build(); -+ // Paper end - } - - /** - * Attempts to add the effect represented by this object to the given - * {@link LivingEntity}. -+ *

-+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when -+ * adding the effect to the entity. - * - * @param entity The entity to add this effect to - * @return Whether the effect could be added -@@ -201,7 +244,7 @@ public class PotionEffect implements ConfigurationSerializable { - return false; - } - PotionEffect that = (PotionEffect) obj; -- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon; -+ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect); // Paper - } - - /** -@@ -306,11 +349,12 @@ public class PotionEffect implements ConfigurationSerializable { - hash ^= 0x22222222 >> (ambient ? 1 : -1); - hash ^= 0x22222222 >> (particles ? 1 : -1); - hash ^= 0x22222222 >> (icon ? 1 : -1); -+ if (hiddenEffect != null) hash = hash * 31 + hiddenEffect.hashCode(); // Paper - return hash; - } - - @Override - public String toString() { -- return type.getName() + (ambient ? ":(" : ":") + duration + "t-x" + amplifier + (ambient ? ")" : ""); -+ return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + '}'; // Paper - } - } diff --git a/patches/api/0433-Add-drops-to-shear-events.patch b/patches/api/0433-Add-drops-to-shear-events.patch new file mode 100644 index 0000000000..c87460e48d --- /dev/null +++ b/patches/api/0433-Add-drops-to-shear-events.patch @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 18 May 2021 12:31:54 -0700 +Subject: [PATCH] Add drops to shear events + + +diff --git a/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java b/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java +index 71c0af9373069cfaa074e1fbad592eab81025b1c..610768bd329b8612627d361fd9a773a7b91ff108 100644 +--- a/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockShearEntityEvent.java +@@ -17,11 +17,14 @@ public class BlockShearEntityEvent extends BlockEvent implements Cancellable { + private final Entity sheared; + private final ItemStack tool; + private boolean cancelled; ++ private java.util.List drops; // Paper + +- public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool) { ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper ++ public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool, final @NotNull java.util.List drops) { // Paper - custom shear drops + super(dispenser); + this.sheared = sheared; + this.tool = tool; ++ this.drops = drops; // Paper + } + + /** +@@ -64,4 +67,24 @@ public class BlockShearEntityEvent extends BlockEvent implements Cancellable { + public static HandlerList getHandlerList() { + return handlers; + } ++ // Paper start - custom shear drops ++ /** ++ * Get an immutable list of drops for this shearing. ++ * ++ * @return the shearing drops ++ * @see #setDrops(java.util.List) ++ */ ++ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getDrops() { ++ return java.util.Collections.unmodifiableList(this.drops); ++ } ++ ++ /** ++ * Sets the drops for the shearing. ++ * ++ * @param drops the shear drops ++ */ ++ public void setDrops(final java.util.@NotNull List drops) { ++ this.drops = java.util.List.copyOf(drops); ++ } ++ // Paper end - custom shear drops + } +diff --git a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java +index 04b3dce008edefb045162d0f69f87462ea1f3534..63f6799c2543ba67ce9fe6484002062d7a754fd0 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerShearEntityEvent.java +@@ -18,17 +18,20 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable { + private final Entity what; + private final ItemStack item; + private final EquipmentSlot hand; ++ private java.util.List drops; // Paper - custom shear drops + +- public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand) { ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper ++ public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand, final java.util.@NotNull List drops) { // Paper - custom shear drops + super(who); + this.what = what; + this.item = item; + this.hand = hand; ++ this.drops = drops; // Paper - custom shear drops + } + + @Deprecated + public PlayerShearEntityEvent(@NotNull final Player who, @NotNull final Entity what) { +- this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND); ++ this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND, java.util.Collections.emptyList()); // Paper - custom shear drops + } + + @Override +@@ -82,4 +85,24 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable { + return handlers; + } + ++ // Paper start - custom shear drops ++ /** ++ * Get an immutable list of drops for this shearing. ++ * ++ * @return the shearing drops ++ * @see #setDrops(java.util.List) ++ */ ++ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getDrops() { ++ return this.drops; ++ } ++ ++ /** ++ * Sets the drops for the shearing. ++ * ++ * @param drops the shear drops ++ */ ++ public void setDrops(final java.util.@NotNull List drops) { ++ this.drops = java.util.List.copyOf(drops); ++ } ++ // Paper end - custom shear drops + } diff --git a/patches/api/0434-Add-HiddenPotionEffect-API.patch b/patches/api/0434-Add-HiddenPotionEffect-API.patch new file mode 100644 index 0000000000..03c31e4ff8 --- /dev/null +++ b/patches/api/0434-Add-HiddenPotionEffect-API.patch @@ -0,0 +1,170 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tamion <70228790+notTamion@users.noreply.github.com> +Date: Sun, 5 Nov 2023 09:50:48 +0100 +Subject: [PATCH] Add HiddenPotionEffect API + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 4aab0144601788a7902c9fdabb68744d9e33a345..51a428473e702be3ab79bd1e579d1114f747791b 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -591,6 +591,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + + /** + * Adds the given {@link PotionEffect} to the living entity. ++ *

++ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when ++ * adding the effect to the entity. + * + * @param effect PotionEffect to be added + * @return whether the effect could be added +@@ -615,6 +618,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + /** + * Attempts to add all of the given {@link PotionEffect} to the living + * entity. ++ *

++ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when ++ * adding the effect to the entity. + * + * @param effects the effects to add + * @return whether all of the effects could be added +diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java +index 575156c089e45a3d6a43ca6b7adfbc7b473a60ab..704b6d615e7490d433b703f5a6a8d3c40aa6425e 100644 +--- a/src/main/java/org/bukkit/potion/PotionEffect.java ++++ b/src/main/java/org/bukkit/potion/PotionEffect.java +@@ -28,6 +28,7 @@ public class PotionEffect implements ConfigurationSerializable { + */ + public static final int INFINITE_DURATION = -1; + ++ private static final String HIDDEN_EFFECT = "hidden_effect"; // Paper + private static final String AMPLIFIER = "amplifier"; + private static final String DURATION = "duration"; + private static final String TYPE = "effect"; +@@ -40,6 +41,7 @@ public class PotionEffect implements ConfigurationSerializable { + private final boolean ambient; + private final boolean particles; + private final boolean icon; ++ private final PotionEffect hiddenEffect; // Paper + + /** + * Creates a potion effect. +@@ -50,8 +52,11 @@ public class PotionEffect implements ConfigurationSerializable { + * @param ambient the ambient status, see {@link PotionEffect#isAmbient()} + * @param particles the particle status, see {@link PotionEffect#hasParticles()} + * @param icon the icon status, see {@link PotionEffect#hasIcon()} ++ * @param hiddenEffect the hidden PotionEffect ++ * @hidden Internal-- hidden effects are only shown internally + */ +- public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper ++ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect) { // Paper + Preconditions.checkArgument(type != null, "effect type cannot be null"); + this.type = type; + this.duration = duration; +@@ -59,6 +64,23 @@ public class PotionEffect implements ConfigurationSerializable { + this.ambient = ambient; + this.particles = particles; + this.icon = icon; ++ // Paper start ++ this.hiddenEffect = hiddenEffect; ++ } ++ ++ /** ++ * Creates a potion effect. ++ * @param type effect type ++ * @param duration measured in ticks, see {@link ++ * PotionEffect#getDuration()} ++ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()} ++ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()} ++ * @param particles the particle status, see {@link PotionEffect#hasParticles()} ++ * @param icon the icon status, see {@link PotionEffect#hasIcon()} ++ */ ++ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { ++ this(type, duration, amplifier, ambient, particles, icon, null); ++ // Paper end + } + + /** +@@ -106,7 +128,7 @@ public class PotionEffect implements ConfigurationSerializable { + * @param map the map to deserialize from + */ + public PotionEffect(@NotNull Map map) { +- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true))); ++ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT)); // Paper + } + + // Paper start +@@ -134,6 +156,19 @@ public class PotionEffect implements ConfigurationSerializable { + public PotionEffect withIcon(boolean icon) { + return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon); + } ++ ++ /** ++ * Returns the PotionEffect that will become active ++ * after the current PotionEffect has run out. ++ *

++ * Note: This value is only applicable to type applied to living entities. ++ * ++ * @return The hidden PotionEffect. ++ */ ++ @Nullable ++ public PotionEffect getHiddenPotionEffect() { ++ return hiddenEffect; ++ } + // Paper end + + @NotNull +@@ -170,19 +205,27 @@ public class PotionEffect implements ConfigurationSerializable { + @Override + @NotNull + public Map serialize() { +- return ImmutableMap.builder() ++ ImmutableMap.Builder builder = ImmutableMap.builder() // Paper + .put(TYPE, type.getKey().toString()) + .put(DURATION, duration) + .put(AMPLIFIER, amplifier) + .put(AMBIENT, ambient) + .put(PARTICLES, particles) +- .put(ICON, icon) +- .build(); ++ .put(ICON, icon); ++ // Paper start ++ if (this.hiddenEffect != null) { ++ builder.put(HIDDEN_EFFECT, this.hiddenEffect); ++ } ++ return builder.build(); ++ // Paper end + } + + /** + * Attempts to add the effect represented by this object to the given + * {@link LivingEntity}. ++ *

++ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when ++ * adding the effect to the entity. + * + * @param entity The entity to add this effect to + * @return Whether the effect could be added +@@ -201,7 +244,7 @@ public class PotionEffect implements ConfigurationSerializable { + return false; + } + PotionEffect that = (PotionEffect) obj; +- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon; ++ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect); // Paper + } + + /** +@@ -306,11 +349,12 @@ public class PotionEffect implements ConfigurationSerializable { + hash ^= 0x22222222 >> (ambient ? 1 : -1); + hash ^= 0x22222222 >> (particles ? 1 : -1); + hash ^= 0x22222222 >> (icon ? 1 : -1); ++ if (hiddenEffect != null) hash = hash * 31 + hiddenEffect.hashCode(); // Paper + return hash; + } + + @Override + public String toString() { +- return type.getName() + (ambient ? ":(" : ":") + duration + "t-x" + amplifier + (ambient ? ")" : ""); ++ return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + '}'; // Paper + } + } diff --git a/patches/api/0434-Add-PlayerShieldDisableEvent.patch b/patches/api/0434-Add-PlayerShieldDisableEvent.patch deleted file mode 100644 index ddc6deadf5..0000000000 --- a/patches/api/0434-Add-PlayerShieldDisableEvent.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cryptite -Date: Mon, 1 May 2023 16:22:43 -0500 -Subject: [PATCH] Add PlayerShieldDisableEvent - -Called whenever a players shield is disabled. This is mainly caused by -attacking players or monsters that carry axes. - -The event, while similar to the PlayerItemCooldownEvent, offers other -behaviour and can hence not be implemented as a childtype of said event. -Specifically, cancelling the event prevents the game events from being -sent to the player. - -Plugins listening to just the PlayerItemCooldownEvent may not want said -sideeffects, meaning the disable event cannot share a handlerlist with -the cooldown event. - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..aa2fb7923b121cda547291d14cff60895361a4dd ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java -@@ -0,0 +1,90 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called whenever a players shield is disabled due to an attack from another entity that was capable of disabling the -+ * shield. This, most commonly, may be another player attacking with an axe. -+ *

-+ * Notably, this even is distinct from a {@link PlayerItemCooldownEvent} and will fire prior to the item going on -+ * cooldown. -+ * It follows that, if this event is cancelled, no {@link PlayerItemCooldownEvent} is called as the shield is never -+ * disabled in the first place. -+ */ -+@NullMarked -+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity damager; -+ private int cooldown; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerShieldDisableEvent(final Player player, final Entity damager, final int cooldown) { -+ super(player); -+ this.damager = damager; -+ this.cooldown = cooldown; -+ } -+ -+ /** -+ * Provides the damager that disabled the shield. -+ * -+ * @return the entity instance that damaged the player in a way that caused the shield to be disabled. -+ */ -+ public Entity getDamager() { -+ return this.damager; -+ } -+ -+ /** -+ * Gets the cooldown the disabled shield will be disabled for in ticks. -+ *

-+ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line, -+ * as said event is called if this event is not cancelled. -+ * -+ * @return cooldown in ticks -+ */ -+ public int getCooldown() { -+ return this.cooldown; -+ } -+ -+ /** -+ * Sets the cooldown of the shield in ticks. -+ *

-+ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line, -+ * as said event is called if this event is not cancelled. -+ * -+ * @param cooldown cooldown in ticks, has to be a positive number -+ */ -+ public void setCooldown(final int cooldown) { -+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!"); -+ this.cooldown = cooldown; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0435-Add-PlayerShieldDisableEvent.patch b/patches/api/0435-Add-PlayerShieldDisableEvent.patch new file mode 100644 index 0000000000..ddc6deadf5 --- /dev/null +++ b/patches/api/0435-Add-PlayerShieldDisableEvent.patch @@ -0,0 +1,113 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 1 May 2023 16:22:43 -0500 +Subject: [PATCH] Add PlayerShieldDisableEvent + +Called whenever a players shield is disabled. This is mainly caused by +attacking players or monsters that carry axes. + +The event, while similar to the PlayerItemCooldownEvent, offers other +behaviour and can hence not be implemented as a childtype of said event. +Specifically, cancelling the event prevents the game events from being +sent to the player. + +Plugins listening to just the PlayerItemCooldownEvent may not want said +sideeffects, meaning the disable event cannot share a handlerlist with +the cooldown event. + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..aa2fb7923b121cda547291d14cff60895361a4dd +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java +@@ -0,0 +1,90 @@ ++package io.papermc.paper.event.player; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Called whenever a players shield is disabled due to an attack from another entity that was capable of disabling the ++ * shield. This, most commonly, may be another player attacking with an axe. ++ *

++ * Notably, this even is distinct from a {@link PlayerItemCooldownEvent} and will fire prior to the item going on ++ * cooldown. ++ * It follows that, if this event is cancelled, no {@link PlayerItemCooldownEvent} is called as the shield is never ++ * disabled in the first place. ++ */ ++@NullMarked ++public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Entity damager; ++ private int cooldown; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerShieldDisableEvent(final Player player, final Entity damager, final int cooldown) { ++ super(player); ++ this.damager = damager; ++ this.cooldown = cooldown; ++ } ++ ++ /** ++ * Provides the damager that disabled the shield. ++ * ++ * @return the entity instance that damaged the player in a way that caused the shield to be disabled. ++ */ ++ public Entity getDamager() { ++ return this.damager; ++ } ++ ++ /** ++ * Gets the cooldown the disabled shield will be disabled for in ticks. ++ *

++ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line, ++ * as said event is called if this event is not cancelled. ++ * ++ * @return cooldown in ticks ++ */ ++ public int getCooldown() { ++ return this.cooldown; ++ } ++ ++ /** ++ * Sets the cooldown of the shield in ticks. ++ *

++ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line, ++ * as said event is called if this event is not cancelled. ++ * ++ * @param cooldown cooldown in ticks, has to be a positive number ++ */ ++ public void setCooldown(final int cooldown) { ++ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!"); ++ this.cooldown = cooldown; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(final boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0435-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch b/patches/api/0435-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch deleted file mode 100644 index 93ba48c77c..0000000000 --- a/patches/api/0435-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sat, 6 Jan 2024 14:18:58 +0100 -Subject: [PATCH] Return null for empty String in NamespacedKey.fromString - - -diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index cbdaa121dbc1876d0cd55f4b7b57f283ecaa8f1a..7ff6d60deb129e23b2a4d772aee123eb6c0b6433 100644 ---- a/src/main/java/org/bukkit/NamespacedKey.java -+++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -90,7 +90,7 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap - this.key = key; - - String string = toString(); -- Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters", string); -+ Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation - } - - /** -@@ -117,7 +117,7 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap - Preconditions.checkArgument(isValidKey(this.key), "Invalid key. Must be [a-z0-9/._-]: %s", this.key); - - String string = toString(); -- Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters (%s)", string); -+ Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation - } - - @NotNull -@@ -205,7 +205,10 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap - */ - @Nullable - public static NamespacedKey fromString(@NotNull String string, @Nullable Plugin defaultNamespace) { -- Preconditions.checkArgument(string != null && !string.isEmpty(), "Input string must not be empty or null"); -+ // Paper - Return null for empty string, check length -+ Preconditions.checkArgument(string != null, "Input string must not be null"); -+ if (string.isEmpty() || string.length() > Short.MAX_VALUE) return null; -+ // Paper end - Return null for empty string, check length - - String[] components = string.split(":", 3); - if (components.length > 2) { -diff --git a/src/test/java/org/bukkit/NamespacedKeyTest.java b/src/test/java/org/bukkit/NamespacedKeyTest.java -index 6317798e43332f34f79970ded0f023beee868fed..d4e9e24b705a7ac3e9f4fc27eefa44ecb16aa35c 100644 ---- a/src/test/java/org/bukkit/NamespacedKeyTest.java -+++ b/src/test/java/org/bukkit/NamespacedKeyTest.java -@@ -29,6 +29,7 @@ public class NamespacedKeyTest { - assertNull(NamespacedKey.fromString("foo:bar:bazz")); - } - -+ @org.junit.jupiter.api.Disabled // Paper - Fixup NamespacedKey handling - @Test - public void testFromStringEmptyInput() { - assertThrows(IllegalArgumentException.class, () -> NamespacedKey.fromString("")); -@@ -75,6 +76,7 @@ public class NamespacedKeyTest { - "loremipsumdolorsitametconsecteturadipiscingelitduisvolutpatvelitsitametmaximusscelerisquemorbiullamcorperexacconsequategestas").toString(); - } - -+ @org.junit.jupiter.api.Disabled // Paper - Fixup NamespacedKey handling - @Test - public void testAboveLength() { - assertThrows(IllegalArgumentException.class, () -> new NamespacedKey("loremipsumdolorsitametconsecteturadipiscingelitduisvolutpatvelitsitametmaximusscelerisquemorbiullamcorperexacconsequategestas", diff --git a/patches/api/0436-Add-BlockStateMeta-clearBlockState.patch b/patches/api/0436-Add-BlockStateMeta-clearBlockState.patch deleted file mode 100644 index 7e8c47a8e2..0000000000 --- a/patches/api/0436-Add-BlockStateMeta-clearBlockState.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 11 Jan 2024 12:41:54 -0800 -Subject: [PATCH] Add BlockStateMeta#clearBlockState - - -diff --git a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java -index c7d3041221742f6655155f19ef2addcaf2401015..dedb33e3d7f99e12fddba438af0874e6973d9372 100644 ---- a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java -@@ -14,6 +14,13 @@ public interface BlockStateMeta extends ItemMeta { - */ - boolean hasBlockState(); - -+ // Paper start - add method to clear block state -+ /** -+ * Clears the block state currently attached to this item. -+ */ -+ void clearBlockState(); -+ // Paper end - add method to clear block state -+ - /** - * Returns the currently attached block state for this - * item or creates a new one if one doesn't exist. diff --git a/patches/api/0436-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch b/patches/api/0436-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch new file mode 100644 index 0000000000..93ba48c77c --- /dev/null +++ b/patches/api/0436-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 6 Jan 2024 14:18:58 +0100 +Subject: [PATCH] Return null for empty String in NamespacedKey.fromString + + +diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java +index cbdaa121dbc1876d0cd55f4b7b57f283ecaa8f1a..7ff6d60deb129e23b2a4d772aee123eb6c0b6433 100644 +--- a/src/main/java/org/bukkit/NamespacedKey.java ++++ b/src/main/java/org/bukkit/NamespacedKey.java +@@ -90,7 +90,7 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap + this.key = key; + + String string = toString(); +- Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters", string); ++ Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation + } + + /** +@@ -117,7 +117,7 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap + Preconditions.checkArgument(isValidKey(this.key), "Invalid key. Must be [a-z0-9/._-]: %s", this.key); + + String string = toString(); +- Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters (%s)", string); ++ Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation + } + + @NotNull +@@ -205,7 +205,10 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap + */ + @Nullable + public static NamespacedKey fromString(@NotNull String string, @Nullable Plugin defaultNamespace) { +- Preconditions.checkArgument(string != null && !string.isEmpty(), "Input string must not be empty or null"); ++ // Paper - Return null for empty string, check length ++ Preconditions.checkArgument(string != null, "Input string must not be null"); ++ if (string.isEmpty() || string.length() > Short.MAX_VALUE) return null; ++ // Paper end - Return null for empty string, check length + + String[] components = string.split(":", 3); + if (components.length > 2) { +diff --git a/src/test/java/org/bukkit/NamespacedKeyTest.java b/src/test/java/org/bukkit/NamespacedKeyTest.java +index 6317798e43332f34f79970ded0f023beee868fed..d4e9e24b705a7ac3e9f4fc27eefa44ecb16aa35c 100644 +--- a/src/test/java/org/bukkit/NamespacedKeyTest.java ++++ b/src/test/java/org/bukkit/NamespacedKeyTest.java +@@ -29,6 +29,7 @@ public class NamespacedKeyTest { + assertNull(NamespacedKey.fromString("foo:bar:bazz")); + } + ++ @org.junit.jupiter.api.Disabled // Paper - Fixup NamespacedKey handling + @Test + public void testFromStringEmptyInput() { + assertThrows(IllegalArgumentException.class, () -> NamespacedKey.fromString("")); +@@ -75,6 +76,7 @@ public class NamespacedKeyTest { + "loremipsumdolorsitametconsecteturadipiscingelitduisvolutpatvelitsitametmaximusscelerisquemorbiullamcorperexacconsequategestas").toString(); + } + ++ @org.junit.jupiter.api.Disabled // Paper - Fixup NamespacedKey handling + @Test + public void testAboveLength() { + assertThrows(IllegalArgumentException.class, () -> new NamespacedKey("loremipsumdolorsitametconsecteturadipiscingelitduisvolutpatvelitsitametmaximusscelerisquemorbiullamcorperexacconsequategestas", diff --git a/patches/api/0437-Add-BlockStateMeta-clearBlockState.patch b/patches/api/0437-Add-BlockStateMeta-clearBlockState.patch new file mode 100644 index 0000000000..7e8c47a8e2 --- /dev/null +++ b/patches/api/0437-Add-BlockStateMeta-clearBlockState.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 11 Jan 2024 12:41:54 -0800 +Subject: [PATCH] Add BlockStateMeta#clearBlockState + + +diff --git a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java +index c7d3041221742f6655155f19ef2addcaf2401015..dedb33e3d7f99e12fddba438af0874e6973d9372 100644 +--- a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java +@@ -14,6 +14,13 @@ public interface BlockStateMeta extends ItemMeta { + */ + boolean hasBlockState(); + ++ // Paper start - add method to clear block state ++ /** ++ * Clears the block state currently attached to this item. ++ */ ++ void clearBlockState(); ++ // Paper end - add method to clear block state ++ + /** + * Returns the currently attached block state for this + * item or creates a new one if one doesn't exist. diff --git a/patches/api/0437-Expose-LootTable-of-DecoratedPot.patch b/patches/api/0437-Expose-LootTable-of-DecoratedPot.patch deleted file mode 100644 index 42a8de4123..0000000000 --- a/patches/api/0437-Expose-LootTable-of-DecoratedPot.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: FireInstall -Date: Sat, 20 Jan 2024 16:20:07 +0100 -Subject: [PATCH] Expose LootTable of DecoratedPot - - -diff --git a/src/main/java/org/bukkit/block/DecoratedPot.java b/src/main/java/org/bukkit/block/DecoratedPot.java -index f76230e0bba49639fc2e70ee32a53e3a9182f217..feae34e459523d17a10b673bbec28abcac9cdadd 100644 ---- a/src/main/java/org/bukkit/block/DecoratedPot.java -+++ b/src/main/java/org/bukkit/block/DecoratedPot.java -@@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a captured state of a decorated pot. - */ --public interface DecoratedPot extends TileState, BlockInventoryHolder { -+public interface DecoratedPot extends TileState, BlockInventoryHolder , org.bukkit.loot.Lootable { // Paper - expose loot table - - /** - * Set the sherd on the provided side. diff --git a/patches/api/0438-Add-ShulkerDuplicateEvent.patch b/patches/api/0438-Add-ShulkerDuplicateEvent.patch deleted file mode 100644 index bed71db255..0000000000 --- a/patches/api/0438-Add-ShulkerDuplicateEvent.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chase Henderson -Date: Fri, 5 Jan 2024 03:50:10 -0500 -Subject: [PATCH] Add ShulkerDuplicateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d427a67a5c7e44aee78d21a7b344b8bb19235dc7 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java -@@ -0,0 +1,68 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Shulker; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired when a shulker duplicates itself by spawning a new shulker. -+ *

-+ * The event is fired prior to the newly created shulker, accessible via {@link #getEntity()}, being added to the world. -+ */ -+@NullMarked -+public class ShulkerDuplicateEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Shulker parent; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public ShulkerDuplicateEvent(final Shulker child, final Shulker parent) { -+ super(child); -+ this.parent = parent; -+ } -+ -+ /** -+ * Provides the newly created shulker, which did not exist prior to the duplication. -+ * At the point of this event, said shulker is not part of the world yet. -+ * -+ * @return the newly duplicated shulker. -+ */ -+ @Override -+ public Shulker getEntity() { -+ return (Shulker) super.getEntity(); -+ } -+ -+ /** -+ * Provides the "parent" of the freshly created shulker. -+ * The parent shulker is the one that initiated the duplication. -+ * -+ * @return the previously existing shulker which duplicated. -+ */ -+ public Shulker getParent() { -+ return this.parent; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0438-Expose-LootTable-of-DecoratedPot.patch b/patches/api/0438-Expose-LootTable-of-DecoratedPot.patch new file mode 100644 index 0000000000..42a8de4123 --- /dev/null +++ b/patches/api/0438-Expose-LootTable-of-DecoratedPot.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: FireInstall +Date: Sat, 20 Jan 2024 16:20:07 +0100 +Subject: [PATCH] Expose LootTable of DecoratedPot + + +diff --git a/src/main/java/org/bukkit/block/DecoratedPot.java b/src/main/java/org/bukkit/block/DecoratedPot.java +index f76230e0bba49639fc2e70ee32a53e3a9182f217..feae34e459523d17a10b673bbec28abcac9cdadd 100644 +--- a/src/main/java/org/bukkit/block/DecoratedPot.java ++++ b/src/main/java/org/bukkit/block/DecoratedPot.java +@@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a captured state of a decorated pot. + */ +-public interface DecoratedPot extends TileState, BlockInventoryHolder { ++public interface DecoratedPot extends TileState, BlockInventoryHolder , org.bukkit.loot.Lootable { // Paper - expose loot table + + /** + * Set the sherd on the provided side. diff --git a/patches/api/0439-Add-ShulkerDuplicateEvent.patch b/patches/api/0439-Add-ShulkerDuplicateEvent.patch new file mode 100644 index 0000000000..bed71db255 --- /dev/null +++ b/patches/api/0439-Add-ShulkerDuplicateEvent.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chase Henderson +Date: Fri, 5 Jan 2024 03:50:10 -0500 +Subject: [PATCH] Add ShulkerDuplicateEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d427a67a5c7e44aee78d21a7b344b8bb19235dc7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java +@@ -0,0 +1,68 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.Shulker; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Fired when a shulker duplicates itself by spawning a new shulker. ++ *

++ * The event is fired prior to the newly created shulker, accessible via {@link #getEntity()}, being added to the world. ++ */ ++@NullMarked ++public class ShulkerDuplicateEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Shulker parent; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public ShulkerDuplicateEvent(final Shulker child, final Shulker parent) { ++ super(child); ++ this.parent = parent; ++ } ++ ++ /** ++ * Provides the newly created shulker, which did not exist prior to the duplication. ++ * At the point of this event, said shulker is not part of the world yet. ++ * ++ * @return the newly duplicated shulker. ++ */ ++ @Override ++ public Shulker getEntity() { ++ return (Shulker) super.getEntity(); ++ } ++ ++ /** ++ * Provides the "parent" of the freshly created shulker. ++ * The parent shulker is the one that initiated the duplication. ++ * ++ * @return the previously existing shulker which duplicated. ++ */ ++ public Shulker getParent() { ++ return this.parent; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(final boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0439-Add-api-for-spawn-egg-texture-colors.patch b/patches/api/0439-Add-api-for-spawn-egg-texture-colors.patch deleted file mode 100644 index 996340cf25..0000000000 --- a/patches/api/0439-Add-api-for-spawn-egg-texture-colors.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Luis -Date: Thu, 11 Jan 2024 19:58:17 +0100 -Subject: [PATCH] Add api for spawn egg texture colors - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 334e392800803816cf502c2920c4a85774d6b0b2..27ac8e80192924eb38e5ceaee575ac418e92b410 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -260,4 +260,17 @@ public interface UnsafeValues { - // Paper end - namespaced key biome methods - - String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation -+ -+ // Paper start - spawn egg color visibility -+ /** -+ * Obtains the underlying color informating for a spawn egg of a given -+ * entity type, or null if the entity passed does not have a spawn egg. -+ * Spawn eggs have two colors - the background layer (0), and the -+ * foreground layer (1) -+ * @param entityType The entity type to get the color for -+ * @param layer The texture layer to get a color for -+ * @return The color of the layer for the entity's spawn egg -+ */ -+ @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); -+ // Paper end - spawn egg color visibility - } diff --git a/patches/api/0440-Add-Lifecycle-Event-system.patch b/patches/api/0440-Add-Lifecycle-Event-system.patch deleted file mode 100644 index 31bfe9a70f..0000000000 --- a/patches/api/0440-Add-Lifecycle-Event-system.patch +++ /dev/null @@ -1,646 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 18 Jul 2023 14:47:02 -0700 -Subject: [PATCH] Add Lifecycle Event system - -This event system is separate from Bukkit's event system and is -meant for managing resources across reloads and from points in the -PluginBootstrap. - -diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -index 4c47414fc08e1183b1e59369bacc4d7f7042f262..577a9d5aeae55a3b8452b6d873b51b30384c1fea 100644 ---- a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -@@ -1,5 +1,7 @@ - package io.papermc.paper.plugin.bootstrap; - -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; - import org.jetbrains.annotations.ApiStatus; - import org.jspecify.annotations.NullMarked; - -@@ -12,5 +14,13 @@ import org.jspecify.annotations.NullMarked; - @ApiStatus.Experimental - @NullMarked - @ApiStatus.NonExtendable --public interface BootstrapContext extends PluginProviderContext { -+public interface BootstrapContext extends PluginProviderContext, LifecycleEventOwner { -+ -+ /** -+ * Get the lifecycle event manager for registering handlers -+ * for lifecycle events allowed on the {@link BootstrapContext}. -+ * -+ * @return the lifecycle event manager -+ */ -+ LifecycleEventManager getLifecycleManager(); - } -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0b8eafd3e79494d4a750cd9182387fbaead24011 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java -@@ -0,0 +1,17 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * Base type for all Lifecycle Events. -+ *

-+ * Lifecycle events are generally fired when the older -+ * event system is not available, like during early -+ * server initialization. -+ * @see LifecycleEvents -+ */ -+@ApiStatus.Experimental -+@ApiStatus.NonExtendable -+public interface LifecycleEvent { -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e05cdb7ab166f92e270ea1b85e75f465878d05f2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java -@@ -0,0 +1,53 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration; -+import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Manages a plugin's lifecycle events. Can be obtained -+ * from {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext}. -+ * -+ * @param the owning type, {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext} -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventManager { -+ -+ /** -+ * Registers an event handler for a specific event type. -+ *

-+ * This is shorthand for creating a new {@link LifecycleEventHandlerConfiguration} and -+ * just passing in the {@link LifecycleEventHandler}. -+ *

{@code
-+     * LifecycleEventHandler> handler = new Handler();
-+     * manager.registerEventHandler(LifecycleEvents.COMMANDS, handler);
-+     * }
-+ * is equivalent to -+ *
{@code
-+     * LifecycleEventHandler> handler = new Handler();
-+     * manager.registerEventHandler(LifecycleEvents.COMMANDS.newHandler(handler));
-+     * }
-+ * -+ * @param eventType the event type to listen to -+ * @param eventHandler the handler for that event -+ * @param the type of the event object -+ */ -+ default void registerEventHandler(final LifecycleEventType eventType, final LifecycleEventHandler eventHandler) { -+ this.registerEventHandler(eventType.newHandler(eventHandler)); -+ } -+ -+ /** -+ * Registers an event handler configuration. -+ *

-+ * Configurations are created via {@link LifecycleEventType#newHandler(LifecycleEventHandler)}. -+ * Event types may have different configurations options available on the builder-like object -+ * returned by {@link LifecycleEventType#newHandler(LifecycleEventHandler)}. -+ * -+ * @param handlerConfiguration the handler configuration to register -+ */ -+ void registerEventHandler(LifecycleEventHandlerConfiguration handlerConfiguration); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ce5891eb110464a1c0cd7416712110851d010a1b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java -@@ -0,0 +1,25 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.configuration.PluginMeta; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Implemented by types that are considered owners -+ * of registered handlers for lifecycle events. Generally -+ * the types that implement this interface also provide -+ * a {@link LifecycleEventManager} where you can register -+ * event handlers. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventOwner { -+ -+ /** -+ * Get the plugin meta for this plugin. -+ * -+ * @return the plugin meta -+ */ -+ PluginMeta getPluginMeta(); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3093ef23dd92f86240854065f7a7bb6c11ecf4fe ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java -@@ -0,0 +1,19 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A handler for a specific event. Can be implemented -+ * in a concrete class or as a lambda. -+ * -+ * @param the event -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@FunctionalInterface -+public interface LifecycleEventHandler { -+ -+ void run(E event); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9b9f4655f222597b4e00519cfe128147bc438367 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java -@@ -0,0 +1,20 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler.configuration; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Base type for constructing configured event handlers for -+ * lifecycle events. Usually created via {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType#newHandler(LifecycleEventHandler)} -+ * from event types in {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents} -+ * -+ * @param -+ */ -+@SuppressWarnings("unused") -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventHandlerConfiguration { -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a2acc6e3867d6805c68e4c630aca3d14aa958a1d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java -@@ -0,0 +1,27 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler.configuration; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Handler configuration for event types that allow "monitor" handlers. -+ * -+ * @param the required owner type -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface MonitorLifecycleEventHandlerConfiguration extends LifecycleEventHandlerConfiguration { -+ -+ /** -+ * Sets this handler configuration to be considered a "monitor". -+ * These handlers will run last and should only be used by plugins -+ * to observe changes from previously run handlers. -+ * -+ * @return this configuration for chaining -+ */ -+ @Contract("-> this") -+ MonitorLifecycleEventHandlerConfiguration monitor(); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java -new file mode 100644 -index 0000000000000000000000000000000000000000..100e5d169f1f644e54a042c697649f08fff1e6de ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java -@@ -0,0 +1,41 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler.configuration; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Handler configuration that allows both "monitor" and prioritized handlers. -+ * The default priority is 0. -+ * -+ * @param the required owner type -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface PrioritizedLifecycleEventHandlerConfiguration extends LifecycleEventHandlerConfiguration { -+ -+ /** -+ * Sets the priority for this handler. Resets -+ * all previous calls to {@link #monitor()}. A -+ * lower numeric value correlates to the handler -+ * being run earlier. -+ * -+ * @param priority the numerical priority -+ * @return this configuration for chaining -+ */ -+ @Contract("_ -> this") -+ PrioritizedLifecycleEventHandlerConfiguration priority(int priority); -+ -+ /** -+ * Sets this handler configuration to be considered a "monitor". -+ * These handlers will run last and should only be used by plugins -+ * to observe any changes from previously ran handlers. -+ * -+ * @return this configuration for chaining -+ */ -+ @Contract("-> this") -+ PrioritizedLifecycleEventHandlerConfiguration monitor(); -+ -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java -new file mode 100644 -index 0000000000000000000000000000000000000000..fd9c3605a8f5e6bdd31e42f18a45154d4074eb67 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java -@@ -0,0 +1,12 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * To be implemented by types that provide ways to register types -+ * either on server start or during a reload -+ */ -+@ApiStatus.Experimental -+@ApiStatus.NonExtendable -+public interface Registrar { -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7dca6be092a8b5deca9c45b152a96ffe72fe2533 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java -@@ -0,0 +1,28 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A lifecycle event that exposes a {@link Registrar} of some kind -+ * to allow management of various things. Look at implementations of -+ * {@link Registrar} for an idea of what uses this event. -+ * -+ * @param registrar type -+ * @see ReloadableRegistrarEvent -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface RegistrarEvent extends LifecycleEvent { -+ -+ /** -+ * Get the registrar related to this event. -+ * -+ * @return the registrar -+ */ -+ @Contract(pure = true) -+ R registrar(); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9bce1c13c8092238939fbbec6b499d1ca85e5b89 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java -@@ -0,0 +1,39 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A lifecycle event that exposes a {@link Registrar} that is -+ * reloadable. -+ * -+ * @param the registrar type -+ * @see RegistrarEvent -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface ReloadableRegistrarEvent extends RegistrarEvent { -+ -+ /** -+ * Get the cause of this reload. -+ * -+ * @return the cause -+ */ -+ @Contract(pure = true) -+ Cause cause(); -+ -+ @ApiStatus.Experimental -+ enum Cause { -+ /** -+ * The initial load of the server. -+ */ -+ INITIAL, -+ /** -+ * A reload, triggered via one of the various mechanisms like -+ * the bukkit or minecraft reload commands. -+ */ -+ RELOAD -+ } -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..75d9e20f53735ead4fa4aec478b4b72b85ca5e1e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java -@@ -0,0 +1,74 @@ -+package io.papermc.paper.plugin.lifecycle.event.types; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.MonitorLifecycleEventHandlerConfiguration; -+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.PrioritizedLifecycleEventHandlerConfiguration; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Base type for all types of lifecycle events. Differs from -+ * {@link LifecycleEvent} which is the actual event object, whereas -+ * this is an object representing the type of the event. Used -+ * to construct subtypes of {@link LifecycleEventHandlerConfiguration} for -+ * use in {@link LifecycleEventManager} -+ * -+ * @param the required owner type -+ * @param the event object type -+ * @param the configuration type -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface LifecycleEventType> { -+ -+ /** -+ * Gets the name of the lifecycle event. -+ * -+ * @return the name -+ */ -+ @Contract(pure = true) -+ String name(); -+ -+ /** -+ * Create a configuration for this event with the specified -+ * handler. -+ * -+ * @param handler the event handler -+ * @return a new configuration -+ * @see LifecycleEventManager#registerEventHandler(LifecycleEventHandlerConfiguration) -+ */ -+ @Contract("_ -> new") -+ C newHandler(LifecycleEventHandler handler); -+ -+ /** -+ * Lifecycle event type that supports separate registration -+ * of handlers as "monitors" that are run last. Useful -+ * if a plugin wants to only observe the changes other handlers -+ * made. -+ * -+ * @param the required owner type -+ * @param the event object type -+ */ -+ @ApiStatus.Experimental -+ @ApiStatus.NonExtendable -+ interface Monitorable extends LifecycleEventType> { -+ } -+ -+ /** -+ * Lifecycle event type that supports both {@link Monitorable "monitors"} and -+ * specific numeric-based priorities. -+ * -+ * @param the required owner type -+ * @param the event object type -+ */ -+ @ApiStatus.Experimental -+ @ApiStatus.NonExtendable -+ interface Prioritizable extends LifecycleEventType> { -+ } -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e15e09c2a4d3f43db6a0159fa8af6179362ea8d6 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java -@@ -0,0 +1,24 @@ -+package io.papermc.paper.plugin.lifecycle.event.types; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import java.util.Optional; -+import java.util.ServiceLoader; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@ApiStatus.Internal -+@NullMarked -+interface LifecycleEventTypeProvider { -+ -+ Optional INSTANCE = ServiceLoader.load(LifecycleEventTypeProvider.class) -+ .findFirst(); -+ -+ static LifecycleEventTypeProvider provider() { -+ return INSTANCE.orElseThrow(); -+ } -+ -+ LifecycleEventType.Monitorable monitor(String name, Class ownerType); -+ -+ LifecycleEventType.Prioritizable prioritized(String name, Class ownerType); -+} -diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f70814de0d6c40b2c1c9921b8abdd1162e1d3995 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java -@@ -0,0 +1,54 @@ -+package io.papermc.paper.plugin.lifecycle.event.types; -+ -+import io.papermc.paper.plugin.bootstrap.BootstrapContext; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Holds various types of lifecycle events for -+ * use when creating event handler configurations -+ * in {@link LifecycleEventManager}. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+public final class LifecycleEvents { -+ -+ // -+ @ApiStatus.Internal -+ static LifecycleEventType.Monitorable plugin(final String name) { -+ return monitor(name, Plugin.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Prioritizable pluginPrioritized(final String name) { -+ return prioritized(name, Plugin.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Monitorable bootstrap(final String name) { -+ return monitor(name, BootstrapContext.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Prioritizable bootstrapPrioritized(final String name) { -+ return prioritized(name, BootstrapContext.class); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Monitorable monitor(final String name, final Class ownerType) { -+ return LifecycleEventTypeProvider.provider().monitor(name, ownerType); -+ } -+ -+ @ApiStatus.Internal -+ static LifecycleEventType.Prioritizable prioritized(final String name, final Class ownerType) { -+ return LifecycleEventTypeProvider.provider().prioritized(name, ownerType); -+ } -+ // -+ -+ private LifecycleEvents() { -+ } -+} -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 27ac8e80192924eb38e5ceaee575ac418e92b410..141d5a964cc299284aecd4d34d57008a32f94247 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -273,4 +273,12 @@ public interface UnsafeValues { - */ - @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); - // Paper end - spawn egg color visibility -+ -+ // Paper start - lifecycle event API -+ /** -+ * @hidden -+ */ -+ @org.jetbrains.annotations.ApiStatus.Internal -+ io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck); -+ // Paper end - lifecycle event API - } -diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java -index 46fc37a36403c8fbc4c0c9f863d4d57eb3896bd4..0ff8b53f900092dc419d61a8ede0a7cd72a2e1e1 100644 ---- a/src/main/java/org/bukkit/plugin/Plugin.java -+++ b/src/main/java/org/bukkit/plugin/Plugin.java -@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; - *

- * The use of {@link PluginBase} is recommended for actual Implementation - */ --public interface Plugin extends TabExecutor { -+public interface Plugin extends TabExecutor, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner { // Paper - /** - * Returns the folder that the plugin data files are located in. The - * folder may not yet exist. -@@ -224,4 +224,14 @@ public interface Plugin extends TabExecutor { - */ - @NotNull - public String getName(); -+ -+ // Paper start - lifecycle events -+ /** -+ * Get the lifecycle event manager for registering handlers -+ * for lifecycle events allowed on the {@link Plugin}. -+ * -+ * @return the lifecycle event manager -+ */ -+ io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager getLifecycleManager(); -+ // Paper end - lifecycle events - } -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -index 2d64fc065d53dcd8c01d05215c3e63aaf4428177..e0203f199700c397961a0667a79792497da7f796 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -48,6 +48,11 @@ public abstract class JavaPlugin extends PluginBase { - private FileConfiguration newConfig = null; - private File configFile = null; - private Logger logger = null; // Paper - PluginLogger -> Logger -+ // Paper start - lifecycle events -+ @SuppressWarnings("deprecation") -+ private final io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager lifecycleEventManager = org.bukkit.Bukkit.getUnsafe().createPluginLifecycleEventManager(this, () -> this.allowsLifecycleRegistration); -+ private boolean allowsLifecycleRegistration = true; -+ // Paper end - - public JavaPlugin() { - // Paper start -@@ -279,7 +284,9 @@ public abstract class JavaPlugin extends PluginBase { - isEnabled = enabled; - - if (isEnabled) { -+ try { // Paper - lifecycle events - onEnable(); -+ } finally { this.allowsLifecycleRegistration = false; } // Paper - lifecycle events - } else { - onDisable(); - } -@@ -457,4 +464,11 @@ public abstract class JavaPlugin extends PluginBase { - } - return plugin; - } -+ -+ // Paper start - lifecycle events -+ @Override -+ public final io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager getLifecycleManager() { -+ return this.lifecycleEventManager; -+ } -+ // Paper end - lifecycle events - } -diff --git a/src/test/java/org/bukkit/plugin/TestPlugin.java b/src/test/java/org/bukkit/plugin/TestPlugin.java -index 43b58e920e739bb949ac0673e9ef73ba7b500dc9..affe88cf8e98a787e197936f5fc443464a2343c6 100644 ---- a/src/test/java/org/bukkit/plugin/TestPlugin.java -+++ b/src/test/java/org/bukkit/plugin/TestPlugin.java -@@ -133,4 +133,11 @@ public class TestPlugin extends PluginBase { - public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { - throw new UnsupportedOperationException("Not supported."); - } -+ -+ // Paper start - lifecycle events -+ @Override -+ public io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager getLifecycleManager() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ // Paper end - lifecycle events - } diff --git a/patches/api/0440-Add-api-for-spawn-egg-texture-colors.patch b/patches/api/0440-Add-api-for-spawn-egg-texture-colors.patch new file mode 100644 index 0000000000..996340cf25 --- /dev/null +++ b/patches/api/0440-Add-api-for-spawn-egg-texture-colors.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luis +Date: Thu, 11 Jan 2024 19:58:17 +0100 +Subject: [PATCH] Add api for spawn egg texture colors + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 334e392800803816cf502c2920c4a85774d6b0b2..27ac8e80192924eb38e5ceaee575ac418e92b410 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -260,4 +260,17 @@ public interface UnsafeValues { + // Paper end - namespaced key biome methods + + String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation ++ ++ // Paper start - spawn egg color visibility ++ /** ++ * Obtains the underlying color informating for a spawn egg of a given ++ * entity type, or null if the entity passed does not have a spawn egg. ++ * Spawn eggs have two colors - the background layer (0), and the ++ * foreground layer (1) ++ * @param entityType The entity type to get the color for ++ * @param layer The texture layer to get a color for ++ * @return The color of the layer for the entity's spawn egg ++ */ ++ @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); ++ // Paper end - spawn egg color visibility + } diff --git a/patches/api/0441-Add-Lifecycle-Event-system.patch b/patches/api/0441-Add-Lifecycle-Event-system.patch new file mode 100644 index 0000000000..31bfe9a70f --- /dev/null +++ b/patches/api/0441-Add-Lifecycle-Event-system.patch @@ -0,0 +1,646 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 18 Jul 2023 14:47:02 -0700 +Subject: [PATCH] Add Lifecycle Event system + +This event system is separate from Bukkit's event system and is +meant for managing resources across reloads and from points in the +PluginBootstrap. + +diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java +index 4c47414fc08e1183b1e59369bacc4d7f7042f262..577a9d5aeae55a3b8452b6d873b51b30384c1fea 100644 +--- a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java ++++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java +@@ -1,5 +1,7 @@ + package io.papermc.paper.plugin.bootstrap; + ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; + import org.jetbrains.annotations.ApiStatus; + import org.jspecify.annotations.NullMarked; + +@@ -12,5 +14,13 @@ import org.jspecify.annotations.NullMarked; + @ApiStatus.Experimental + @NullMarked + @ApiStatus.NonExtendable +-public interface BootstrapContext extends PluginProviderContext { ++public interface BootstrapContext extends PluginProviderContext, LifecycleEventOwner { ++ ++ /** ++ * Get the lifecycle event manager for registering handlers ++ * for lifecycle events allowed on the {@link BootstrapContext}. ++ * ++ * @return the lifecycle event manager ++ */ ++ LifecycleEventManager getLifecycleManager(); + } +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0b8eafd3e79494d4a750cd9182387fbaead24011 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.plugin.lifecycle.event; ++ ++import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * Base type for all Lifecycle Events. ++ *

++ * Lifecycle events are generally fired when the older ++ * event system is not available, like during early ++ * server initialization. ++ * @see LifecycleEvents ++ */ ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface LifecycleEvent { ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e05cdb7ab166f92e270ea1b85e75f465878d05f2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java +@@ -0,0 +1,53 @@ ++package io.papermc.paper.plugin.lifecycle.event; ++ ++import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; ++import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration; ++import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Manages a plugin's lifecycle events. Can be obtained ++ * from {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext}. ++ * ++ * @param the owning type, {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext} ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface LifecycleEventManager { ++ ++ /** ++ * Registers an event handler for a specific event type. ++ *

++ * This is shorthand for creating a new {@link LifecycleEventHandlerConfiguration} and ++ * just passing in the {@link LifecycleEventHandler}. ++ *

{@code
++     * LifecycleEventHandler> handler = new Handler();
++     * manager.registerEventHandler(LifecycleEvents.COMMANDS, handler);
++     * }
++ * is equivalent to ++ *
{@code
++     * LifecycleEventHandler> handler = new Handler();
++     * manager.registerEventHandler(LifecycleEvents.COMMANDS.newHandler(handler));
++     * }
++ * ++ * @param eventType the event type to listen to ++ * @param eventHandler the handler for that event ++ * @param the type of the event object ++ */ ++ default void registerEventHandler(final LifecycleEventType eventType, final LifecycleEventHandler eventHandler) { ++ this.registerEventHandler(eventType.newHandler(eventHandler)); ++ } ++ ++ /** ++ * Registers an event handler configuration. ++ *

++ * Configurations are created via {@link LifecycleEventType#newHandler(LifecycleEventHandler)}. ++ * Event types may have different configurations options available on the builder-like object ++ * returned by {@link LifecycleEventType#newHandler(LifecycleEventHandler)}. ++ * ++ * @param handlerConfiguration the handler configuration to register ++ */ ++ void registerEventHandler(LifecycleEventHandlerConfiguration handlerConfiguration); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ce5891eb110464a1c0cd7416712110851d010a1b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java +@@ -0,0 +1,25 @@ ++package io.papermc.paper.plugin.lifecycle.event; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Implemented by types that are considered owners ++ * of registered handlers for lifecycle events. Generally ++ * the types that implement this interface also provide ++ * a {@link LifecycleEventManager} where you can register ++ * event handlers. ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface LifecycleEventOwner { ++ ++ /** ++ * Get the plugin meta for this plugin. ++ * ++ * @return the plugin meta ++ */ ++ PluginMeta getPluginMeta(); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3093ef23dd92f86240854065f7a7bb6c11ecf4fe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.plugin.lifecycle.event.handler; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A handler for a specific event. Can be implemented ++ * in a concrete class or as a lambda. ++ * ++ * @param the event ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@FunctionalInterface ++public interface LifecycleEventHandler { ++ ++ void run(E event); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9b9f4655f222597b4e00519cfe128147bc438367 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.plugin.lifecycle.event.handler.configuration; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; ++import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Base type for constructing configured event handlers for ++ * lifecycle events. Usually created via {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType#newHandler(LifecycleEventHandler)} ++ * from event types in {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents} ++ * ++ * @param ++ */ ++@SuppressWarnings("unused") ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface LifecycleEventHandlerConfiguration { ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a2acc6e3867d6805c68e4c630aca3d14aa958a1d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java +@@ -0,0 +1,27 @@ ++package io.papermc.paper.plugin.lifecycle.event.handler.configuration; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Handler configuration for event types that allow "monitor" handlers. ++ * ++ * @param the required owner type ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface MonitorLifecycleEventHandlerConfiguration extends LifecycleEventHandlerConfiguration { ++ ++ /** ++ * Sets this handler configuration to be considered a "monitor". ++ * These handlers will run last and should only be used by plugins ++ * to observe changes from previously run handlers. ++ * ++ * @return this configuration for chaining ++ */ ++ @Contract("-> this") ++ MonitorLifecycleEventHandlerConfiguration monitor(); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java +new file mode 100644 +index 0000000000000000000000000000000000000000..100e5d169f1f644e54a042c697649f08fff1e6de +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java +@@ -0,0 +1,41 @@ ++package io.papermc.paper.plugin.lifecycle.event.handler.configuration; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Handler configuration that allows both "monitor" and prioritized handlers. ++ * The default priority is 0. ++ * ++ * @param the required owner type ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface PrioritizedLifecycleEventHandlerConfiguration extends LifecycleEventHandlerConfiguration { ++ ++ /** ++ * Sets the priority for this handler. Resets ++ * all previous calls to {@link #monitor()}. A ++ * lower numeric value correlates to the handler ++ * being run earlier. ++ * ++ * @param priority the numerical priority ++ * @return this configuration for chaining ++ */ ++ @Contract("_ -> this") ++ PrioritizedLifecycleEventHandlerConfiguration priority(int priority); ++ ++ /** ++ * Sets this handler configuration to be considered a "monitor". ++ * These handlers will run last and should only be used by plugins ++ * to observe any changes from previously ran handlers. ++ * ++ * @return this configuration for chaining ++ */ ++ @Contract("-> this") ++ PrioritizedLifecycleEventHandlerConfiguration monitor(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fd9c3605a8f5e6bdd31e42f18a45154d4074eb67 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java +@@ -0,0 +1,12 @@ ++package io.papermc.paper.plugin.lifecycle.event.registrar; ++ ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * To be implemented by types that provide ways to register types ++ * either on server start or during a reload ++ */ ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface Registrar { ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7dca6be092a8b5deca9c45b152a96ffe72fe2533 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java +@@ -0,0 +1,28 @@ ++package io.papermc.paper.plugin.lifecycle.event.registrar; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A lifecycle event that exposes a {@link Registrar} of some kind ++ * to allow management of various things. Look at implementations of ++ * {@link Registrar} for an idea of what uses this event. ++ * ++ * @param registrar type ++ * @see ReloadableRegistrarEvent ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface RegistrarEvent extends LifecycleEvent { ++ ++ /** ++ * Get the registrar related to this event. ++ * ++ * @return the registrar ++ */ ++ @Contract(pure = true) ++ R registrar(); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9bce1c13c8092238939fbbec6b499d1ca85e5b89 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java +@@ -0,0 +1,39 @@ ++package io.papermc.paper.plugin.lifecycle.event.registrar; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A lifecycle event that exposes a {@link Registrar} that is ++ * reloadable. ++ * ++ * @param the registrar type ++ * @see RegistrarEvent ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface ReloadableRegistrarEvent extends RegistrarEvent { ++ ++ /** ++ * Get the cause of this reload. ++ * ++ * @return the cause ++ */ ++ @Contract(pure = true) ++ Cause cause(); ++ ++ @ApiStatus.Experimental ++ enum Cause { ++ /** ++ * The initial load of the server. ++ */ ++ INITIAL, ++ /** ++ * A reload, triggered via one of the various mechanisms like ++ * the bukkit or minecraft reload commands. ++ */ ++ RELOAD ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..75d9e20f53735ead4fa4aec478b4b72b85ca5e1e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java +@@ -0,0 +1,74 @@ ++package io.papermc.paper.plugin.lifecycle.event.types; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; ++import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler; ++import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration; ++import io.papermc.paper.plugin.lifecycle.event.handler.configuration.MonitorLifecycleEventHandlerConfiguration; ++import io.papermc.paper.plugin.lifecycle.event.handler.configuration.PrioritizedLifecycleEventHandlerConfiguration; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Base type for all types of lifecycle events. Differs from ++ * {@link LifecycleEvent} which is the actual event object, whereas ++ * this is an object representing the type of the event. Used ++ * to construct subtypes of {@link LifecycleEventHandlerConfiguration} for ++ * use in {@link LifecycleEventManager} ++ * ++ * @param the required owner type ++ * @param the event object type ++ * @param the configuration type ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface LifecycleEventType> { ++ ++ /** ++ * Gets the name of the lifecycle event. ++ * ++ * @return the name ++ */ ++ @Contract(pure = true) ++ String name(); ++ ++ /** ++ * Create a configuration for this event with the specified ++ * handler. ++ * ++ * @param handler the event handler ++ * @return a new configuration ++ * @see LifecycleEventManager#registerEventHandler(LifecycleEventHandlerConfiguration) ++ */ ++ @Contract("_ -> new") ++ C newHandler(LifecycleEventHandler handler); ++ ++ /** ++ * Lifecycle event type that supports separate registration ++ * of handlers as "monitors" that are run last. Useful ++ * if a plugin wants to only observe the changes other handlers ++ * made. ++ * ++ * @param the required owner type ++ * @param the event object type ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Monitorable extends LifecycleEventType> { ++ } ++ ++ /** ++ * Lifecycle event type that supports both {@link Monitorable "monitors"} and ++ * specific numeric-based priorities. ++ * ++ * @param the required owner type ++ * @param the event object type ++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Prioritizable extends LifecycleEventType> { ++ } ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e15e09c2a4d3f43db6a0159fa8af6179362ea8d6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java +@@ -0,0 +1,24 @@ ++package io.papermc.paper.plugin.lifecycle.event.types; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; ++import java.util.Optional; ++import java.util.ServiceLoader; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++@ApiStatus.Internal ++@NullMarked ++interface LifecycleEventTypeProvider { ++ ++ Optional INSTANCE = ServiceLoader.load(LifecycleEventTypeProvider.class) ++ .findFirst(); ++ ++ static LifecycleEventTypeProvider provider() { ++ return INSTANCE.orElseThrow(); ++ } ++ ++ LifecycleEventType.Monitorable monitor(String name, Class ownerType); ++ ++ LifecycleEventType.Prioritizable prioritized(String name, Class ownerType); ++} +diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f70814de0d6c40b2c1c9921b8abdd1162e1d3995 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java +@@ -0,0 +1,54 @@ ++package io.papermc.paper.plugin.lifecycle.event.types; ++ ++import io.papermc.paper.plugin.bootstrap.BootstrapContext; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner; ++import org.bukkit.plugin.Plugin; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Holds various types of lifecycle events for ++ * use when creating event handler configurations ++ * in {@link LifecycleEventManager}. ++ */ ++@ApiStatus.Experimental ++@NullMarked ++public final class LifecycleEvents { ++ ++ // ++ @ApiStatus.Internal ++ static LifecycleEventType.Monitorable plugin(final String name) { ++ return monitor(name, Plugin.class); ++ } ++ ++ @ApiStatus.Internal ++ static LifecycleEventType.Prioritizable pluginPrioritized(final String name) { ++ return prioritized(name, Plugin.class); ++ } ++ ++ @ApiStatus.Internal ++ static LifecycleEventType.Monitorable bootstrap(final String name) { ++ return monitor(name, BootstrapContext.class); ++ } ++ ++ @ApiStatus.Internal ++ static LifecycleEventType.Prioritizable bootstrapPrioritized(final String name) { ++ return prioritized(name, BootstrapContext.class); ++ } ++ ++ @ApiStatus.Internal ++ static LifecycleEventType.Monitorable monitor(final String name, final Class ownerType) { ++ return LifecycleEventTypeProvider.provider().monitor(name, ownerType); ++ } ++ ++ @ApiStatus.Internal ++ static LifecycleEventType.Prioritizable prioritized(final String name, final Class ownerType) { ++ return LifecycleEventTypeProvider.provider().prioritized(name, ownerType); ++ } ++ // ++ ++ private LifecycleEvents() { ++ } ++} +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 27ac8e80192924eb38e5ceaee575ac418e92b410..141d5a964cc299284aecd4d34d57008a32f94247 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -273,4 +273,12 @@ public interface UnsafeValues { + */ + @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); + // Paper end - spawn egg color visibility ++ ++ // Paper start - lifecycle event API ++ /** ++ * @hidden ++ */ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck); ++ // Paper end - lifecycle event API + } +diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java +index 46fc37a36403c8fbc4c0c9f863d4d57eb3896bd4..0ff8b53f900092dc419d61a8ede0a7cd72a2e1e1 100644 +--- a/src/main/java/org/bukkit/plugin/Plugin.java ++++ b/src/main/java/org/bukkit/plugin/Plugin.java +@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; + *

+ * The use of {@link PluginBase} is recommended for actual Implementation + */ +-public interface Plugin extends TabExecutor { ++public interface Plugin extends TabExecutor, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner { // Paper + /** + * Returns the folder that the plugin data files are located in. The + * folder may not yet exist. +@@ -224,4 +224,14 @@ public interface Plugin extends TabExecutor { + */ + @NotNull + public String getName(); ++ ++ // Paper start - lifecycle events ++ /** ++ * Get the lifecycle event manager for registering handlers ++ * for lifecycle events allowed on the {@link Plugin}. ++ * ++ * @return the lifecycle event manager ++ */ ++ io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager getLifecycleManager(); ++ // Paper end - lifecycle events + } +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +index 2d64fc065d53dcd8c01d05215c3e63aaf4428177..e0203f199700c397961a0667a79792497da7f796 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +@@ -48,6 +48,11 @@ public abstract class JavaPlugin extends PluginBase { + private FileConfiguration newConfig = null; + private File configFile = null; + private Logger logger = null; // Paper - PluginLogger -> Logger ++ // Paper start - lifecycle events ++ @SuppressWarnings("deprecation") ++ private final io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager lifecycleEventManager = org.bukkit.Bukkit.getUnsafe().createPluginLifecycleEventManager(this, () -> this.allowsLifecycleRegistration); ++ private boolean allowsLifecycleRegistration = true; ++ // Paper end + + public JavaPlugin() { + // Paper start +@@ -279,7 +284,9 @@ public abstract class JavaPlugin extends PluginBase { + isEnabled = enabled; + + if (isEnabled) { ++ try { // Paper - lifecycle events + onEnable(); ++ } finally { this.allowsLifecycleRegistration = false; } // Paper - lifecycle events + } else { + onDisable(); + } +@@ -457,4 +464,11 @@ public abstract class JavaPlugin extends PluginBase { + } + return plugin; + } ++ ++ // Paper start - lifecycle events ++ @Override ++ public final io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager getLifecycleManager() { ++ return this.lifecycleEventManager; ++ } ++ // Paper end - lifecycle events + } +diff --git a/src/test/java/org/bukkit/plugin/TestPlugin.java b/src/test/java/org/bukkit/plugin/TestPlugin.java +index 43b58e920e739bb949ac0673e9ef73ba7b500dc9..affe88cf8e98a787e197936f5fc443464a2343c6 100644 +--- a/src/test/java/org/bukkit/plugin/TestPlugin.java ++++ b/src/test/java/org/bukkit/plugin/TestPlugin.java +@@ -133,4 +133,11 @@ public class TestPlugin extends PluginBase { + public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + throw new UnsupportedOperationException("Not supported."); + } ++ ++ // Paper start - lifecycle events ++ @Override ++ public io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager getLifecycleManager() { ++ throw new UnsupportedOperationException("Not supported."); ++ } ++ // Paper end - lifecycle events + } diff --git a/patches/api/0441-ItemStack-Tooltip-API.patch b/patches/api/0441-ItemStack-Tooltip-API.patch deleted file mode 100644 index 4af91c3ade..0000000000 --- a/patches/api/0441-ItemStack-Tooltip-API.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yannick Lamprecht -Date: Mon, 22 Jan 2024 13:27:18 +0100 -Subject: [PATCH] ItemStack Tooltip API - - -diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7e16f2645e956cbac8d0fc75ba8209f67fd1835c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java -@@ -0,0 +1,76 @@ -+package io.papermc.paper.inventory.tooltip; -+ -+import org.bukkit.entity.Player; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Context for computing itemstack tooltips via -+ * {@link org.bukkit.inventory.ItemStack#computeTooltipLines(TooltipContext, Player)} -+ */ -+@NullMarked -+public interface TooltipContext { -+ -+ /** -+ * Creates a new context with the given advanced and creative -+ * mode settings. -+ * -+ * @param advanced whether the context is for advanced tooltips -+ * @param creative whether the context is for the creative inventory -+ * @return a new context -+ */ -+ @Contract("_, _ -> new") -+ static TooltipContext create(final boolean advanced, final boolean creative) { -+ return new TooltipContextImpl(advanced, creative); -+ } -+ -+ /** -+ * Creates a new context that is neither advanced nor creative. -+ * -+ * @return a new context -+ */ -+ @Contract("-> new") -+ static TooltipContext create() { -+ return new TooltipContextImpl(false, false); -+ } -+ -+ /** -+ * Returns whether the context is for advanced -+ * tooltips. -+ *

-+ * Advanced tooltips are shown by default -+ * when a player has {@code F3+H} enabled. -+ * -+ * @return true if for advanced tooltips -+ */ -+ boolean isAdvanced(); -+ -+ /** -+ * Returns whether the context is for the creative -+ * mode inventory. -+ *

-+ * Creative tooltips are shown by default when a player is -+ * in the creative inventory. -+ * -+ * @return true if for creative mode inventory -+ */ -+ boolean isCreative(); -+ -+ /** -+ * Returns a new context with {@link #isAdvanced()} -+ * set to true. -+ * -+ * @return a new context -+ */ -+ @Contract("-> new") -+ TooltipContext asAdvanced(); -+ -+ /** -+ * Returns a new context with {@link #isCreative()} -+ * set to true. -+ * -+ * @return a new context -+ */ -+ @Contract("-> new") -+ TooltipContext asCreative(); -+} -diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a649b90dfac6000c01579a48234a11383c731439 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java -@@ -0,0 +1,17 @@ -+package io.papermc.paper.inventory.tooltip; -+ -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+record TooltipContextImpl(boolean isAdvanced, boolean isCreative) implements TooltipContext { -+ -+ @Override -+ public TooltipContext asCreative() { -+ return new TooltipContextImpl(this.isAdvanced, true); -+ } -+ -+ @Override -+ public TooltipContext asAdvanced() { -+ return new TooltipContextImpl(true, this.isCreative); -+ } -+} -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 141d5a964cc299284aecd4d34d57008a32f94247..31217b38e769f97801fa1afefeb223d1c755cabd 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -281,4 +281,6 @@ public interface UnsafeValues { - @org.jetbrains.annotations.ApiStatus.Internal - io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck); - // Paper end - lifecycle event API -+ -+ @NotNull java.util.List computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index e6c69a54e0c1dc511fe5769f869dcecb13e04ed3..49390979cc0c68b8e719f2a2ce9e7d193c747959 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -1124,4 +1124,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return type.isAir() || amount <= 0; - } - // Paper end -+ // Paper start - expose itemstack tooltip lines -+ /** -+ * Computes the tooltip lines for this stack. -+ *

-+ * Disclaimer: -+ * Tooltip contents are not guaranteed to be consistent across different -+ * Minecraft versions. -+ * -+ * @param tooltipContext the tooltip context -+ * @param player a player for player-specific tooltip lines -+ * @return an immutable list of components (can be empty) -+ */ -+ @SuppressWarnings("deprecation") // abusing unsafe as a bridge -+ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List computeTooltipLines(final @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, final @Nullable org.bukkit.entity.Player player) { -+ return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player); -+ } -+ // Paper end - expose itemstack tooltip lines - } diff --git a/patches/api/0442-Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/api/0442-Add-getChunkSnapshot-includeLightData-parameter.patch deleted file mode 100644 index 9b950f9493..0000000000 --- a/patches/api/0442-Add-getChunkSnapshot-includeLightData-parameter.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Warrior <50800980+Warriorrrr@users.noreply.github.com> -Date: Sat, 10 Feb 2024 10:05:59 +0100 -Subject: [PATCH] Add getChunkSnapshot includeLightData parameter - - -diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index c2eb2edd87b4087bfcdffd98f0f8904fbfd4e657..bc8b5bc17706250b8535b1b309134843d2ce2bb1 100644 ---- a/src/main/java/org/bukkit/Chunk.java -+++ b/src/main/java/org/bukkit/Chunk.java -@@ -103,6 +103,23 @@ public interface Chunk extends PersistentDataHolder { - @NotNull - ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain); - -+ // Paper start - Add getChunkSnapshot includeLightData parameter -+ /** -+ * Capture thread-safe read-only snapshot of chunk data -+ * -+ * @param includeMaxblocky if true, snapshot includes per-coordinate -+ * maximum Y values -+ * @param includeBiome if true, snapshot includes per-coordinate biome -+ * type -+ * @param includeBiomeTempRain if true, snapshot includes per-coordinate -+ * raw biome temperature and rainfall -+ * @param includeLightData Whether to include per-coordinate light emitted by blocks and sky light data -+ * @return ChunkSnapshot -+ */ -+ @NotNull -+ ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain, boolean includeLightData); -+ // Paper end - Add getChunkSnapshot includeLightData parameter -+ - /** - * Checks if entities in this chunk are loaded. - * diff --git a/patches/api/0442-ItemStack-Tooltip-API.patch b/patches/api/0442-ItemStack-Tooltip-API.patch new file mode 100644 index 0000000000..4af91c3ade --- /dev/null +++ b/patches/api/0442-ItemStack-Tooltip-API.patch @@ -0,0 +1,148 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yannick Lamprecht +Date: Mon, 22 Jan 2024 13:27:18 +0100 +Subject: [PATCH] ItemStack Tooltip API + + +diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7e16f2645e956cbac8d0fc75ba8209f67fd1835c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java +@@ -0,0 +1,76 @@ ++package io.papermc.paper.inventory.tooltip; ++ ++import org.bukkit.entity.Player; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Context for computing itemstack tooltips via ++ * {@link org.bukkit.inventory.ItemStack#computeTooltipLines(TooltipContext, Player)} ++ */ ++@NullMarked ++public interface TooltipContext { ++ ++ /** ++ * Creates a new context with the given advanced and creative ++ * mode settings. ++ * ++ * @param advanced whether the context is for advanced tooltips ++ * @param creative whether the context is for the creative inventory ++ * @return a new context ++ */ ++ @Contract("_, _ -> new") ++ static TooltipContext create(final boolean advanced, final boolean creative) { ++ return new TooltipContextImpl(advanced, creative); ++ } ++ ++ /** ++ * Creates a new context that is neither advanced nor creative. ++ * ++ * @return a new context ++ */ ++ @Contract("-> new") ++ static TooltipContext create() { ++ return new TooltipContextImpl(false, false); ++ } ++ ++ /** ++ * Returns whether the context is for advanced ++ * tooltips. ++ *

++ * Advanced tooltips are shown by default ++ * when a player has {@code F3+H} enabled. ++ * ++ * @return true if for advanced tooltips ++ */ ++ boolean isAdvanced(); ++ ++ /** ++ * Returns whether the context is for the creative ++ * mode inventory. ++ *

++ * Creative tooltips are shown by default when a player is ++ * in the creative inventory. ++ * ++ * @return true if for creative mode inventory ++ */ ++ boolean isCreative(); ++ ++ /** ++ * Returns a new context with {@link #isAdvanced()} ++ * set to true. ++ * ++ * @return a new context ++ */ ++ @Contract("-> new") ++ TooltipContext asAdvanced(); ++ ++ /** ++ * Returns a new context with {@link #isCreative()} ++ * set to true. ++ * ++ * @return a new context ++ */ ++ @Contract("-> new") ++ TooltipContext asCreative(); ++} +diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a649b90dfac6000c01579a48234a11383c731439 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.inventory.tooltip; ++ ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++record TooltipContextImpl(boolean isAdvanced, boolean isCreative) implements TooltipContext { ++ ++ @Override ++ public TooltipContext asCreative() { ++ return new TooltipContextImpl(this.isAdvanced, true); ++ } ++ ++ @Override ++ public TooltipContext asAdvanced() { ++ return new TooltipContextImpl(true, this.isCreative); ++ } ++} +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 141d5a964cc299284aecd4d34d57008a32f94247..31217b38e769f97801fa1afefeb223d1c755cabd 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -281,4 +281,6 @@ public interface UnsafeValues { + @org.jetbrains.annotations.ApiStatus.Internal + io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck); + // Paper end - lifecycle event API ++ ++ @NotNull java.util.List computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index e6c69a54e0c1dc511fe5769f869dcecb13e04ed3..49390979cc0c68b8e719f2a2ce9e7d193c747959 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -1124,4 +1124,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return type.isAir() || amount <= 0; + } + // Paper end ++ // Paper start - expose itemstack tooltip lines ++ /** ++ * Computes the tooltip lines for this stack. ++ *

++ * Disclaimer: ++ * Tooltip contents are not guaranteed to be consistent across different ++ * Minecraft versions. ++ * ++ * @param tooltipContext the tooltip context ++ * @param player a player for player-specific tooltip lines ++ * @return an immutable list of components (can be empty) ++ */ ++ @SuppressWarnings("deprecation") // abusing unsafe as a bridge ++ public java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List computeTooltipLines(final @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, final @Nullable org.bukkit.entity.Player player) { ++ return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player); ++ } ++ // Paper end - expose itemstack tooltip lines + } diff --git a/patches/api/0443-Add-FluidState-API.patch b/patches/api/0443-Add-FluidState-API.patch deleted file mode 100644 index 8f786918cb..0000000000 --- a/patches/api/0443-Add-FluidState-API.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: vicisacat -Date: Fri, 17 Nov 2023 20:21:47 +0100 -Subject: [PATCH] Add FluidState API - - -diff --git a/src/main/java/io/papermc/paper/block/fluid/FluidData.java b/src/main/java/io/papermc/paper/block/fluid/FluidData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0750219fc68261e5c396636967e0b633ae17b72e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java -@@ -0,0 +1,69 @@ -+package io.papermc.paper.block.fluid; -+ -+import org.bukkit.Fluid; -+import org.bukkit.Location; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.Range; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A representation of a fluid in a specific state of data. -+ * This type is not linked to a specific location and hence mostly resembles a {@link org.bukkit.block.data.BlockData}. -+ */ -+@NullMarked -+public interface FluidData extends Cloneable { -+ -+ /** -+ * Gets the fluid type of this fluid data. -+ * -+ * @return the fluid type -+ */ -+ Fluid getFluidType(); -+ -+ /** -+ * Returns a copy of this FluidData. -+ * -+ * @return a copy of the fluid data -+ */ -+ FluidData clone(); -+ -+ /** -+ * Computes the direction of the flow of the liquid at the given location as a vector. -+ *

-+ * This method requires the passed location's chunk to be loaded. -+ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation -+ * which leads to a potentially slow sync chunk load. -+ * -+ * @param location - the location to check the liquid flow -+ * @return the flow direction vector at the given location -+ */ -+ Vector computeFlowDirection(Location location); -+ -+ /** -+ * Returns the level of liquid this fluid data holds. -+ * -+ * @return the amount as an integer, between 0 and 8 -+ */ -+ @Range(from = 0, to = 8) -+ int getLevel(); -+ -+ /** -+ * Computes the height of the fluid in the world. -+ *

-+ * This method requires the passed location's chunk to be loaded. -+ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation -+ * which leads to a potentially slow sync chunk load. -+ * -+ * @param location the location at which to check the high of this fluid data. -+ * @return the height as a float value -+ */ -+ @Range(from = 0, to = 1) -+ float computeHeight(Location location); -+ -+ /** -+ * Returns whether this fluid is a source block -+ * -+ * @return true if the fluid is a source block, false otherwise -+ */ -+ boolean isSource(); -+} -diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7bd9f28ba646f09080b5c29b9d3be5af676c912e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java -@@ -0,0 +1,16 @@ -+package io.papermc.paper.block.fluid.type; -+ -+import io.papermc.paper.block.fluid.FluidData; -+ -+/** -+ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids. -+ */ -+public interface FallingFluidData extends FluidData { -+ -+ /** -+ * Get if this liquid is falling. -+ * -+ * @return true if falling -+ */ -+ boolean isFalling(); -+} -diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java -new file mode 100644 -index 0000000000000000000000000000000000000000..fbccdffe8d73e517204081c73bca9154f8c7d69f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java -@@ -0,0 +1,10 @@ -+package io.papermc.paper.block.fluid.type; -+ -+import io.papermc.paper.block.fluid.FluidData; -+ -+/** -+ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids. -+ */ -+public interface FlowingFluidData extends FallingFluidData { -+ -+} -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 43dd6c59cceba12f27e6b265acc3ad97eea37abd..eb33e8e671972aa308ad75a7ce9aa9ac526f470f 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -102,6 +102,41 @@ public interface RegionAccessor extends Keyed { // Paper - @NotNull - BlockState getBlockState(int x, int y, int z); - -+ // Paper start - FluidState API -+ /** -+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the specified position. -+ * -+ * @param x The x-coordinate of the position -+ * @param y The y-coordinate of the position -+ * @param z The z-coordinate of the position -+ * @return The {@link io.papermc.paper.block.fluid.FluidData} at the specified position -+ */ -+ @NotNull -+ io.papermc.paper.block.fluid.FluidData getFluidData(int x, int y, int z); -+ -+ /** -+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position -+ * -+ * @param position The position of the fluid -+ * @return The fluid data at the given position -+ */ -+ @NotNull -+ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull io.papermc.paper.math.Position position) { -+ return getFluidData(position.blockX(), position.blockY(), position.blockZ()); -+ } -+ -+ /** -+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position -+ * -+ * @param location The location of the fluid -+ * @return The fluid data at the given position -+ */ -+ @NotNull -+ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull Location location) { -+ return getFluidData(location.blockX(), location.blockY(), location.blockZ()); -+ } -+ // Paper end -+ - /** - * Gets the {@link BlockData} at the given {@link Location}. - * diff --git a/patches/api/0443-Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/api/0443-Add-getChunkSnapshot-includeLightData-parameter.patch new file mode 100644 index 0000000000..9b950f9493 --- /dev/null +++ b/patches/api/0443-Add-getChunkSnapshot-includeLightData-parameter.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Warrior <50800980+Warriorrrr@users.noreply.github.com> +Date: Sat, 10 Feb 2024 10:05:59 +0100 +Subject: [PATCH] Add getChunkSnapshot includeLightData parameter + + +diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java +index c2eb2edd87b4087bfcdffd98f0f8904fbfd4e657..bc8b5bc17706250b8535b1b309134843d2ce2bb1 100644 +--- a/src/main/java/org/bukkit/Chunk.java ++++ b/src/main/java/org/bukkit/Chunk.java +@@ -103,6 +103,23 @@ public interface Chunk extends PersistentDataHolder { + @NotNull + ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain); + ++ // Paper start - Add getChunkSnapshot includeLightData parameter ++ /** ++ * Capture thread-safe read-only snapshot of chunk data ++ * ++ * @param includeMaxblocky if true, snapshot includes per-coordinate ++ * maximum Y values ++ * @param includeBiome if true, snapshot includes per-coordinate biome ++ * type ++ * @param includeBiomeTempRain if true, snapshot includes per-coordinate ++ * raw biome temperature and rainfall ++ * @param includeLightData Whether to include per-coordinate light emitted by blocks and sky light data ++ * @return ChunkSnapshot ++ */ ++ @NotNull ++ ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain, boolean includeLightData); ++ // Paper end - Add getChunkSnapshot includeLightData parameter ++ + /** + * Checks if entities in this chunk are loaded. + * diff --git a/patches/api/0444-Add-FluidState-API.patch b/patches/api/0444-Add-FluidState-API.patch new file mode 100644 index 0000000000..8f786918cb --- /dev/null +++ b/patches/api/0444-Add-FluidState-API.patch @@ -0,0 +1,165 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: vicisacat +Date: Fri, 17 Nov 2023 20:21:47 +0100 +Subject: [PATCH] Add FluidState API + + +diff --git a/src/main/java/io/papermc/paper/block/fluid/FluidData.java b/src/main/java/io/papermc/paper/block/fluid/FluidData.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0750219fc68261e5c396636967e0b633ae17b72e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java +@@ -0,0 +1,69 @@ ++package io.papermc.paper.block.fluid; ++ ++import org.bukkit.Fluid; ++import org.bukkit.Location; ++import org.bukkit.util.Vector; ++import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A representation of a fluid in a specific state of data. ++ * This type is not linked to a specific location and hence mostly resembles a {@link org.bukkit.block.data.BlockData}. ++ */ ++@NullMarked ++public interface FluidData extends Cloneable { ++ ++ /** ++ * Gets the fluid type of this fluid data. ++ * ++ * @return the fluid type ++ */ ++ Fluid getFluidType(); ++ ++ /** ++ * Returns a copy of this FluidData. ++ * ++ * @return a copy of the fluid data ++ */ ++ FluidData clone(); ++ ++ /** ++ * Computes the direction of the flow of the liquid at the given location as a vector. ++ *

++ * This method requires the passed location's chunk to be loaded. ++ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation ++ * which leads to a potentially slow sync chunk load. ++ * ++ * @param location - the location to check the liquid flow ++ * @return the flow direction vector at the given location ++ */ ++ Vector computeFlowDirection(Location location); ++ ++ /** ++ * Returns the level of liquid this fluid data holds. ++ * ++ * @return the amount as an integer, between 0 and 8 ++ */ ++ @Range(from = 0, to = 8) ++ int getLevel(); ++ ++ /** ++ * Computes the height of the fluid in the world. ++ *

++ * This method requires the passed location's chunk to be loaded. ++ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation ++ * which leads to a potentially slow sync chunk load. ++ * ++ * @param location the location at which to check the high of this fluid data. ++ * @return the height as a float value ++ */ ++ @Range(from = 0, to = 1) ++ float computeHeight(Location location); ++ ++ /** ++ * Returns whether this fluid is a source block ++ * ++ * @return true if the fluid is a source block, false otherwise ++ */ ++ boolean isSource(); ++} +diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7bd9f28ba646f09080b5c29b9d3be5af676c912e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java +@@ -0,0 +1,16 @@ ++package io.papermc.paper.block.fluid.type; ++ ++import io.papermc.paper.block.fluid.FluidData; ++ ++/** ++ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids. ++ */ ++public interface FallingFluidData extends FluidData { ++ ++ /** ++ * Get if this liquid is falling. ++ * ++ * @return true if falling ++ */ ++ boolean isFalling(); ++} +diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fbccdffe8d73e517204081c73bca9154f8c7d69f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java +@@ -0,0 +1,10 @@ ++package io.papermc.paper.block.fluid.type; ++ ++import io.papermc.paper.block.fluid.FluidData; ++ ++/** ++ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids. ++ */ ++public interface FlowingFluidData extends FallingFluidData { ++ ++} +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index 43dd6c59cceba12f27e6b265acc3ad97eea37abd..eb33e8e671972aa308ad75a7ce9aa9ac526f470f 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -102,6 +102,41 @@ public interface RegionAccessor extends Keyed { // Paper + @NotNull + BlockState getBlockState(int x, int y, int z); + ++ // Paper start - FluidState API ++ /** ++ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the specified position. ++ * ++ * @param x The x-coordinate of the position ++ * @param y The y-coordinate of the position ++ * @param z The z-coordinate of the position ++ * @return The {@link io.papermc.paper.block.fluid.FluidData} at the specified position ++ */ ++ @NotNull ++ io.papermc.paper.block.fluid.FluidData getFluidData(int x, int y, int z); ++ ++ /** ++ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position ++ * ++ * @param position The position of the fluid ++ * @return The fluid data at the given position ++ */ ++ @NotNull ++ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull io.papermc.paper.math.Position position) { ++ return getFluidData(position.blockX(), position.blockY(), position.blockZ()); ++ } ++ ++ /** ++ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position ++ * ++ * @param location The location of the fluid ++ * @return The fluid data at the given position ++ */ ++ @NotNull ++ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull Location location) { ++ return getFluidData(location.blockX(), location.blockY(), location.blockZ()); ++ } ++ // Paper end ++ + /** + * Gets the {@link BlockData} at the given {@link Location}. + * diff --git a/patches/api/0444-add-number-format-api.patch b/patches/api/0444-add-number-format-api.patch deleted file mode 100644 index 8d36669b0a..0000000000 --- a/patches/api/0444-add-number-format-api.patch +++ /dev/null @@ -1,234 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: David Mayr -Date: Sat, 16 Dec 2023 10:40:29 +0100 -Subject: [PATCH] add number format api - -Signed-off-by: David Mayr - -diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/BlankFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/BlankFormatImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..486da6ebe0137bb3280e8b33c8e35e309507f118 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/BlankFormatImpl.java -@@ -0,0 +1,5 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+record BlankFormatImpl() implements NumberFormat { -+ public static final BlankFormatImpl INSTANCE = new BlankFormatImpl(); -+} -diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3ef4595b692a13566c5c738050b83b0462094e9b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java -@@ -0,0 +1,20 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.ComponentLike; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A scoreboard number format that replaces the score number with a chat component. -+ */ -+@NullMarked -+public interface FixedFormat extends NumberFormat, ComponentLike { -+ -+ /** -+ * The component shown instead of the number for a score -+ * -+ * @return the chat component -+ */ -+ Component component(); -+ -+} -diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..be47bf438805f9ab84b241e564281ea9c287aa6e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java -@@ -0,0 +1,13 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.Component; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+record FixedFormatImpl(Component component) implements FixedFormat { -+ -+ @Override -+ public Component asComponent() { -+ return this.component(); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7c093e4e9a2a67021da9025631a3c6fa7ac3ef35 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java -@@ -0,0 +1,61 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.ComponentLike; -+import net.kyori.adventure.text.format.Style; -+import net.kyori.adventure.text.format.StyleBuilderApplicable; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Describes a scoreboard number format that applies custom formatting to scoreboard scores. -+ */ -+@NullMarked -+public interface NumberFormat { -+ -+ /** -+ * Creates a blank scoreboard number format that removes the score number entirely. -+ * -+ * @return a blank number format -+ */ -+ static NumberFormat blank() { -+ return BlankFormatImpl.INSTANCE; -+ } -+ -+ /** -+ * Gets an un-styled number format. -+ * -+ * @return an un-styled number format -+ */ -+ static StyledFormat noStyle() { -+ return StyledFormatImpl.NO_STYLE; -+ } -+ -+ /** -+ * Creates a scoreboard number format that applies a custom formatting to the score number. -+ * -+ * @param style the style to apply on the number -+ * @return a styled number format -+ */ -+ static StyledFormat styled(final Style style) { -+ return new StyledFormatImpl(style); -+ } -+ -+ /** -+ * Creates a scoreboard number format that applies a custom formatting to the score number. -+ * -+ * @param styleBuilderApplicables the style to apply on the number -+ * @return a styled number format -+ */ -+ static StyledFormat styled(final StyleBuilderApplicable... styleBuilderApplicables) { -+ return styled(Style.style(styleBuilderApplicables)); -+ } -+ -+ /** -+ * Creates a scoreboard number format that replaces the score number with a chat component. -+ * -+ * @param component the component to replace the number with -+ * @return a fixed number format -+ */ -+ static FixedFormat fixed(final ComponentLike component) { -+ return new FixedFormatImpl(component.asComponent()); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java -new file mode 100644 -index 0000000000000000000000000000000000000000..cfb14bb1b338727a5d9eeaa7a73c40540b04dbed ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java -@@ -0,0 +1,20 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.format.Style; -+import net.kyori.adventure.text.format.StyleBuilderApplicable; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A scoreboard number format that applies a custom formatting to the score number. -+ */ -+@NullMarked -+public interface StyledFormat extends NumberFormat, StyleBuilderApplicable { -+ -+ /** -+ * The style that is being applied to the number in the score -+ * -+ * @return the style to apply -+ */ -+ Style style(); -+ -+} -diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e288beb1596f2d4e7e602364955da4e8bc0de21c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java -@@ -0,0 +1,14 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.format.Style; -+import org.jspecify.annotations.NullMarked; -+ -+@NullMarked -+record StyledFormatImpl(Style style) implements StyledFormat { -+ static final StyledFormat NO_STYLE = new StyledFormatImpl(Style.empty()); -+ -+ @Override -+ public void styleApply(final Style.Builder style) { -+ style.merge(this.style); -+ } -+} -diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java -index bd4d84cbf220ab02f09ece97873bbf0bdf7a45ba..1750f97d2122e6e597b9549df8f6fa74bf5e2e2d 100644 ---- a/src/main/java/org/bukkit/scoreboard/Objective.java -+++ b/src/main/java/org/bukkit/scoreboard/Objective.java -@@ -195,4 +195,22 @@ public interface Objective { - */ - void setAutoUpdateDisplay(boolean autoUpdateDisplay); - // Paper end - add more score API -+ -+ // Paper start - number format api -+ /** -+ * Gets the number format for this objective's scores or null if the client default is used. -+ * -+ * @return this objective's number format, or null if the client default is used -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ @Nullable io.papermc.paper.scoreboard.numbers.NumberFormat numberFormat(); -+ -+ /** -+ * Sets the number format for this objective's scores. -+ * -+ * @param format the number format to set, pass null to reset format to default -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ void numberFormat(@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat format); -+ // Paper end - number format api - } -diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java -index 5b6f243492d55d2db0d6944dc6daca9b181551d6..fba8e475c1f1a410c44a95fcc474cce19e0f515c 100644 ---- a/src/main/java/org/bukkit/scoreboard/Score.java -+++ b/src/main/java/org/bukkit/scoreboard/Score.java -@@ -129,4 +129,26 @@ public interface Score { - */ - void customName(net.kyori.adventure.text.@Nullable Component customName); - // Paper end - add more score API -+ -+ // Paper start - number format api -+ /** -+ * Gets the number format for this score or null if the score has not been set yet -+ * or the objective's default is being used. -+ * -+ * @return this score's number format, or null if the objective's default is used or the score doesn't exist -+ * @throws IllegalStateException if the associated objective has been -+ * unregistered -+ */ -+ @Nullable io.papermc.paper.scoreboard.numbers.NumberFormat numberFormat(); -+ -+ /** -+ * Sets the number format for this score. If this score has not been set yet {@link #isScoreSet()}, it will be created -+ * -+ * @param format the number format to set, pass null to reset format to default -+ * @throws IllegalStateException if the associated objective has been -+ * unregistered -+ */ -+ void numberFormat(@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat format); -+ // Paper end - number format api -+ - } diff --git a/patches/api/0445-add-number-format-api.patch b/patches/api/0445-add-number-format-api.patch new file mode 100644 index 0000000000..8d36669b0a --- /dev/null +++ b/patches/api/0445-add-number-format-api.patch @@ -0,0 +1,234 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Mayr +Date: Sat, 16 Dec 2023 10:40:29 +0100 +Subject: [PATCH] add number format api + +Signed-off-by: David Mayr + +diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/BlankFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/BlankFormatImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..486da6ebe0137bb3280e8b33c8e35e309507f118 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/BlankFormatImpl.java +@@ -0,0 +1,5 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++record BlankFormatImpl() implements NumberFormat { ++ public static final BlankFormatImpl INSTANCE = new BlankFormatImpl(); ++} +diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3ef4595b692a13566c5c738050b83b0462094e9b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.ComponentLike; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A scoreboard number format that replaces the score number with a chat component. ++ */ ++@NullMarked ++public interface FixedFormat extends NumberFormat, ComponentLike { ++ ++ /** ++ * The component shown instead of the number for a score ++ * ++ * @return the chat component ++ */ ++ Component component(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..be47bf438805f9ab84b241e564281ea9c287aa6e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java +@@ -0,0 +1,13 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.Component; ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++record FixedFormatImpl(Component component) implements FixedFormat { ++ ++ @Override ++ public Component asComponent() { ++ return this.component(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7c093e4e9a2a67021da9025631a3c6fa7ac3ef35 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java +@@ -0,0 +1,61 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.ComponentLike; ++import net.kyori.adventure.text.format.Style; ++import net.kyori.adventure.text.format.StyleBuilderApplicable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Describes a scoreboard number format that applies custom formatting to scoreboard scores. ++ */ ++@NullMarked ++public interface NumberFormat { ++ ++ /** ++ * Creates a blank scoreboard number format that removes the score number entirely. ++ * ++ * @return a blank number format ++ */ ++ static NumberFormat blank() { ++ return BlankFormatImpl.INSTANCE; ++ } ++ ++ /** ++ * Gets an un-styled number format. ++ * ++ * @return an un-styled number format ++ */ ++ static StyledFormat noStyle() { ++ return StyledFormatImpl.NO_STYLE; ++ } ++ ++ /** ++ * Creates a scoreboard number format that applies a custom formatting to the score number. ++ * ++ * @param style the style to apply on the number ++ * @return a styled number format ++ */ ++ static StyledFormat styled(final Style style) { ++ return new StyledFormatImpl(style); ++ } ++ ++ /** ++ * Creates a scoreboard number format that applies a custom formatting to the score number. ++ * ++ * @param styleBuilderApplicables the style to apply on the number ++ * @return a styled number format ++ */ ++ static StyledFormat styled(final StyleBuilderApplicable... styleBuilderApplicables) { ++ return styled(Style.style(styleBuilderApplicables)); ++ } ++ ++ /** ++ * Creates a scoreboard number format that replaces the score number with a chat component. ++ * ++ * @param component the component to replace the number with ++ * @return a fixed number format ++ */ ++ static FixedFormat fixed(final ComponentLike component) { ++ return new FixedFormatImpl(component.asComponent()); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cfb14bb1b338727a5d9eeaa7a73c40540b04dbed +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.format.Style; ++import net.kyori.adventure.text.format.StyleBuilderApplicable; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A scoreboard number format that applies a custom formatting to the score number. ++ */ ++@NullMarked ++public interface StyledFormat extends NumberFormat, StyleBuilderApplicable { ++ ++ /** ++ * The style that is being applied to the number in the score ++ * ++ * @return the style to apply ++ */ ++ Style style(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e288beb1596f2d4e7e602364955da4e8bc0de21c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java +@@ -0,0 +1,14 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.format.Style; ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++record StyledFormatImpl(Style style) implements StyledFormat { ++ static final StyledFormat NO_STYLE = new StyledFormatImpl(Style.empty()); ++ ++ @Override ++ public void styleApply(final Style.Builder style) { ++ style.merge(this.style); ++ } ++} +diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java +index bd4d84cbf220ab02f09ece97873bbf0bdf7a45ba..1750f97d2122e6e597b9549df8f6fa74bf5e2e2d 100644 +--- a/src/main/java/org/bukkit/scoreboard/Objective.java ++++ b/src/main/java/org/bukkit/scoreboard/Objective.java +@@ -195,4 +195,22 @@ public interface Objective { + */ + void setAutoUpdateDisplay(boolean autoUpdateDisplay); + // Paper end - add more score API ++ ++ // Paper start - number format api ++ /** ++ * Gets the number format for this objective's scores or null if the client default is used. ++ * ++ * @return this objective's number format, or null if the client default is used ++ * @throws IllegalStateException if this objective has been unregistered ++ */ ++ @Nullable io.papermc.paper.scoreboard.numbers.NumberFormat numberFormat(); ++ ++ /** ++ * Sets the number format for this objective's scores. ++ * ++ * @param format the number format to set, pass null to reset format to default ++ * @throws IllegalStateException if this objective has been unregistered ++ */ ++ void numberFormat(@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat format); ++ // Paper end - number format api + } +diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java +index 5b6f243492d55d2db0d6944dc6daca9b181551d6..fba8e475c1f1a410c44a95fcc474cce19e0f515c 100644 +--- a/src/main/java/org/bukkit/scoreboard/Score.java ++++ b/src/main/java/org/bukkit/scoreboard/Score.java +@@ -129,4 +129,26 @@ public interface Score { + */ + void customName(net.kyori.adventure.text.@Nullable Component customName); + // Paper end - add more score API ++ ++ // Paper start - number format api ++ /** ++ * Gets the number format for this score or null if the score has not been set yet ++ * or the objective's default is being used. ++ * ++ * @return this score's number format, or null if the objective's default is used or the score doesn't exist ++ * @throws IllegalStateException if the associated objective has been ++ * unregistered ++ */ ++ @Nullable io.papermc.paper.scoreboard.numbers.NumberFormat numberFormat(); ++ ++ /** ++ * Sets the number format for this score. If this score has not been set yet {@link #isScoreSet()}, it will be created ++ * ++ * @param format the number format to set, pass null to reset format to default ++ * @throws IllegalStateException if the associated objective has been ++ * unregistered ++ */ ++ void numberFormat(@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat format); ++ // Paper end - number format api ++ + } diff --git a/patches/api/0445-improve-BanList-types.patch b/patches/api/0445-improve-BanList-types.patch deleted file mode 100644 index 0c89e083a6..0000000000 --- a/patches/api/0445-improve-BanList-types.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yannick Lamprecht -Date: Sat, 10 Feb 2024 20:49:47 +0100 -Subject: [PATCH] improve BanList types - - -diff --git a/src/main/java/io/papermc/paper/ban/BanListType.java b/src/main/java/io/papermc/paper/ban/BanListType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..fdd5cfdc8c2c2ba97a3ac3db57be5a0e13dc327d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/ban/BanListType.java -@@ -0,0 +1,30 @@ -+package io.papermc.paper.ban; -+ -+import org.bukkit.BanList; -+import org.bukkit.ban.IpBanList; -+import org.bukkit.ban.ProfileBanList; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents a ban-type that a {@link BanList} may track. -+ * It enforces the correct return value at compile time. -+ */ -+@NullMarked -+public interface BanListType { -+ -+ /** -+ * Banned IP addresses -+ */ -+ BanListType IP = new BanListTypeImpl<>(IpBanList.class); -+ /** -+ * Banned player profiles -+ */ -+ BanListType PROFILE = new BanListTypeImpl<>(ProfileBanList.class); -+ -+ /** -+ * Returns the type class of the ban list used generically -+ * -+ * @return the type class -+ */ -+ Class typeClass(); -+} -diff --git a/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java b/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..26d4df3cbf8d31790218095bb7fb1a1762e2b322 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java -@@ -0,0 +1,9 @@ -+package io.papermc.paper.ban; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@ApiStatus.Internal -+@NullMarked -+record BanListTypeImpl(Class typeClass) implements BanListType { -+} -diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java -index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce447600d5 100644 ---- a/src/main/java/org/bukkit/BanList.java -+++ b/src/main/java/org/bukkit/BanList.java -@@ -16,7 +16,9 @@ public interface BanList { - - /** - * Represents a ban-type that a {@link BanList} may track. -+ * @deprecated use {@link io.papermc.paper.ban.BanListType} to enforce the correct return value at compile time. - */ -+ @Deprecated(since = "1.20.4") // Paper - BanList Type Improvements - public enum Type { - /** - * Banned player names -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 85ad1f7f0de9a6f9048981c3ee509b42ddbeef1a..2d466b308b2f8bd31c50f5d05416eadf20c9cb71 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1611,11 +1611,27 @@ public final class Bukkit { - * @param The ban target - * - * @return a ban list of the specified type -+ * @deprecated use {@link #getBanList(io.papermc.paper.ban.BanListType)} to enforce the correct return value at compile time. - */ - @NotNull -+ @Deprecated(since = "1.20.4") // Paper - add BanListType (which has a generic) - public static > T getBanList(@NotNull BanList.Type type) { - return server.getBanList(type); - } -+ // Paper start - add BanListType (which has a generic) -+ /** -+ * Gets a ban list for the supplied type. -+ * -+ * @param type the type of list to fetch, cannot be null -+ * @param The ban target -+ * -+ * @return a ban list of the specified type -+ */ -+ @NotNull -+ public static , E> B getBanList(final io.papermc.paper.ban.@NotNull BanListType type) { -+ return server.getBanList(type); -+ } -+ // Paper end - add BanListType (which has a generic) - - /** - * Gets a set containing all player operators. -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 640ef81d204f480f4af83d420c7e968ce569a38d..20750c09d819d62f32491db8672936b929e1098e 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -1374,10 +1374,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @param The ban target - * - * @return a ban list of the specified type -+ * @deprecated use {@link #getBanList(io.papermc.paper.ban.BanListType)} to enforce the correct return value at compile time. - */ -+ @Deprecated // Paper - add BanListType (which has a generic) - @NotNull - public > T getBanList(@NotNull BanList.Type type); - -+ // Paper start - add BanListType (which has a generic) -+ /** -+ * Gets a ban list for the supplied type. -+ * -+ * @param type the type of list to fetch, cannot be null -+ * @param The ban target -+ * -+ * @return a ban list of the specified type -+ */ -+ @NotNull -+ , E> B getBanList(@NotNull io.papermc.paper.ban.BanListType type); -+ // Paper end - add BanListType (which has a generic) -+ - /** - * Gets a set containing all player operators. - * diff --git a/patches/api/0446-Suspicious-Effect-Entry-API.patch b/patches/api/0446-Suspicious-Effect-Entry-API.patch deleted file mode 100644 index d591d57ce9..0000000000 --- a/patches/api/0446-Suspicious-Effect-Entry-API.patch +++ /dev/null @@ -1,220 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 3 Mar 2024 19:45:52 +0100 -Subject: [PATCH] Suspicious Effect Entry API - -Exposes a new suspicious effect entry type that properly represents -storable effects in the context of suspicious effects as they only -define the potion effect type and duration. - -This differentiates them from the existing PotionEffect API found in -bukkit and hence clarifies that storable values in the parts of the API -in which it replaces PotionEffect. - -Co-authored-by: Yannick Lamprecht - -diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6311ede3e3812da2ccdbcb19522facd7b2e3bd5c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java -@@ -0,0 +1,39 @@ -+package io.papermc.paper.potion; -+ -+import org.bukkit.potion.PotionEffect; -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents a {@link PotionEffectType} paired with a duration. -+ */ -+@NullMarked -+public sealed interface SuspiciousEffectEntry permits SuspiciousEffectEntryImpl { -+ -+ /** -+ * Gets the effect type. -+ * -+ * @return effect type -+ */ -+ PotionEffectType effect(); -+ -+ /** -+ * Gets the duration for this effect instance. -+ * -+ * @return duration (in ticks) or {@link PotionEffect#INFINITE_DURATION} -+ */ -+ int duration(); -+ -+ /** -+ * Creates a new instance of SuspiciousEffectEntry. -+ * -+ * @param effectType effect type -+ * @param duration duration (in ticks) or {@link PotionEffect#INFINITE_DURATION} -+ * @return new instance of an entry -+ */ -+ @Contract(value = "_, _ -> new", pure = true) -+ static SuspiciousEffectEntry create(final PotionEffectType effectType, final int duration) { -+ return new SuspiciousEffectEntryImpl(effectType, duration); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a91d37ee450944ea779bd6b61d416467948bb55f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java -@@ -0,0 +1,10 @@ -+package io.papermc.paper.potion; -+ -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+@ApiStatus.Internal -+@NullMarked -+record SuspiciousEffectEntryImpl(PotionEffectType effect, int duration) implements SuspiciousEffectEntry { -+} -diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java -index 86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454..3677f19ef1c05b76d946b1b2b491a6c3cec76140 100644 ---- a/src/main/java/org/bukkit/entity/MushroomCow.java -+++ b/src/main/java/org/bukkit/entity/MushroomCow.java -@@ -34,14 +34,30 @@ public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // - * Adds a custom potion effect to be applied to the next suspicious stew - * received from milking this {@link MushroomCow}. - * -+ * @deprecated use {@link #addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry, boolean)} as PotionEffect suggests that all attributes are used. In fact, only the PotionEffectType and the duration are used. - * @param effect the potion effect to add - * @param overwrite true if any existing effect of the same type should be - * overwritten - * @return true if the effects to be applied to the suspicious stew changed - * as a result of this call - */ -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta - boolean addEffectToNextStew(@NotNull PotionEffect effect, boolean overwrite); - -+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta -+ /** -+ * Adds a suspicious effect entry to be applied to the next suspicious stew -+ * received from milking this {@link MushroomCow}. -+ * -+ * @param suspiciousEffectEntry the suspicious effect entry to add -+ * @param overwrite true if any existing effect of the same type should be -+ * overwritten -+ * @return true if the effects to be applied to the suspicious stew changed -+ * as a result of this call -+ */ -+ boolean addEffectToNextStew(@NotNull io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite); -+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta -+ - /** - * Removes a custom potion effect from being applied to the next suspicious - * stew received from milking this {@link MushroomCow}. -@@ -95,4 +111,75 @@ public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // - */ - BROWN; - } -+ // Paper start -+ /** -+ * Gets how long the effect applied to stew -+ * from this mushroom cow is. -+ * -+ * @return duration of the effect (in ticks) -+ * @deprecated Mushroom cows can now hold multiple effects, use {@link #getStewEffects()} -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.2") -+ @org.jetbrains.annotations.Contract("-> fail") -+ default int getStewEffectDuration() { -+ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #getStewEffects"); -+ } -+ -+ /** -+ * Sets how long the effect applied to stew -+ * from this mushroom cow is. -+ * -+ * @param duration duration of the effect (in ticks) -+ * @deprecated Mushroom cows can now hold multiple effects, use {@link #setStewEffects(java.util.List)} -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.2") -+ @org.jetbrains.annotations.Contract("_ -> fail") -+ default void setStewEffectDuration(int duration) { -+ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #setStewEffects"); -+ } -+ -+ /** -+ * Gets the type of effect applied to stew -+ * from this mushroom cow is. -+ * -+ * @return effect type, or null if an effect is currently not set -+ * @deprecated Mushroom cows can now hold multiple effects, use {@link #getStewEffects()} -+ * @throws UnsupportedOperationException -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.2") -+ @org.jetbrains.annotations.Contract("-> fail") -+ default org.bukkit.potion.PotionEffectType getStewEffectType() { -+ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #getStewEffects"); -+ } -+ -+ /** -+ * Sets the type of effect applied to stew -+ * from this mushroom cow is. -+ * -+ * @param type new effect type -+ * or null if this cow does not give effects -+ * @deprecated Mushroom cows can now hold multiple effects, use {@link #setStewEffects(java.util.List)} -+ * @throws UnsupportedOperationException -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.2") -+ @org.jetbrains.annotations.Contract("_ -> fail") -+ default void setStewEffect(@org.jetbrains.annotations.Nullable org.bukkit.potion.PotionEffectType type) { -+ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #setStewEffects"); -+ } -+ -+ /** -+ * Returns an immutable collection of the effects applied to stew -+ * items for this mushroom cow. -+ * -+ * @return immutable effect entry collection -+ */ -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getStewEffects(); -+ -+ /** -+ * Sets effects applied to stew items for this mushroom cow. -+ * -+ * @param effects effect entry list -+ */ -+ void setStewEffects(java.util.@NotNull List effects); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java b/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java -index c2f4282c188e7d8041459cb3acaad674443ba147..c5bfc062fcca56495f44039d83356fc1fd7568d0 100644 ---- a/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java -@@ -32,13 +32,28 @@ public interface SuspiciousStewMeta extends ItemMeta { - /** - * Adds a custom potion effect to this suspicious stew. - * -+ * @deprecated use {@link #addCustomEffect(io.papermc.paper.potion.SuspiciousEffectEntry, boolean)} as PotionEffect suggests that all attributes are used. In fact, only the PotionEffectType and the duration are used. - * @param effect the potion effect to add - * @param overwrite true if any existing effect of the same type should be - * overwritten - * @return true if the suspicious stew meta changed as a result of this call - */ -+ @Deprecated // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta - boolean addCustomEffect(@NotNull PotionEffect effect, boolean overwrite); - -+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta -+ /** -+ * Adds a custom potion effect to this suspicious stew. -+ * -+ * @param suspiciousEffectEntry the suspicious effect entry to add -+ * @param overwrite true if any existing effect of the same type should be -+ * overwritten -+ * @return true if the suspicious stew meta changed as a result of this call -+ * as a result of this call -+ */ -+ boolean addCustomEffect(@NotNull io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite); -+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta -+ - /** - * Removes a custom potion effect from this suspicious stew. - * diff --git a/patches/api/0446-improve-BanList-types.patch b/patches/api/0446-improve-BanList-types.patch new file mode 100644 index 0000000000..bfb2a6a550 --- /dev/null +++ b/patches/api/0446-improve-BanList-types.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yannick Lamprecht +Date: Sat, 10 Feb 2024 20:49:47 +0100 +Subject: [PATCH] improve BanList types + + +diff --git a/src/main/java/io/papermc/paper/ban/BanListType.java b/src/main/java/io/papermc/paper/ban/BanListType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fdd5cfdc8c2c2ba97a3ac3db57be5a0e13dc327d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/ban/BanListType.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.ban; ++ ++import org.bukkit.BanList; ++import org.bukkit.ban.IpBanList; ++import org.bukkit.ban.ProfileBanList; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Represents a ban-type that a {@link BanList} may track. ++ * It enforces the correct return value at compile time. ++ */ ++@NullMarked ++public interface BanListType { ++ ++ /** ++ * Banned IP addresses ++ */ ++ BanListType IP = new BanListTypeImpl<>(IpBanList.class); ++ /** ++ * Banned player profiles ++ */ ++ BanListType PROFILE = new BanListTypeImpl<>(ProfileBanList.class); ++ ++ /** ++ * Returns the type class of the ban list used generically ++ * ++ * @return the type class ++ */ ++ Class typeClass(); ++} +diff --git a/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java b/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..26d4df3cbf8d31790218095bb7fb1a1762e2b322 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java +@@ -0,0 +1,9 @@ ++package io.papermc.paper.ban; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++@ApiStatus.Internal ++@NullMarked ++record BanListTypeImpl(Class typeClass) implements BanListType { ++} +diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java +index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce447600d5 100644 +--- a/src/main/java/org/bukkit/BanList.java ++++ b/src/main/java/org/bukkit/BanList.java +@@ -16,7 +16,9 @@ public interface BanList { + + /** + * Represents a ban-type that a {@link BanList} may track. ++ * @deprecated use {@link io.papermc.paper.ban.BanListType} to enforce the correct return value at compile time. + */ ++ @Deprecated(since = "1.20.4") // Paper - BanList Type Improvements + public enum Type { + /** + * Banned player names +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2..e20e4239a5a1f952e1c70e899549989d5e42f73c 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1663,11 +1663,27 @@ public final class Bukkit { + * @param The ban target + * + * @return a ban list of the specified type ++ * @deprecated use {@link #getBanList(io.papermc.paper.ban.BanListType)} to enforce the correct return value at compile time. + */ + @NotNull ++ @Deprecated(since = "1.20.4") // Paper - add BanListType (which has a generic) + public static > T getBanList(@NotNull BanList.Type type) { + return server.getBanList(type); + } ++ // Paper start - add BanListType (which has a generic) ++ /** ++ * Gets a ban list for the supplied type. ++ * ++ * @param type the type of list to fetch, cannot be null ++ * @param The ban target ++ * ++ * @return a ban list of the specified type ++ */ ++ @NotNull ++ public static , E> B getBanList(final io.papermc.paper.ban.@NotNull BanListType type) { ++ return server.getBanList(type); ++ } ++ // Paper end - add BanListType (which has a generic) + + /** + * Gets a set containing all player operators. +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 50ffca9bccfb582d58ccb13f0decf66e5d91aef3..6246251caf2c6f025c824b8e7a944b8d48751fa1 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * @param The ban target + * + * @return a ban list of the specified type ++ * @deprecated use {@link #getBanList(io.papermc.paper.ban.BanListType)} to enforce the correct return value at compile time. + */ ++ @Deprecated // Paper - add BanListType (which has a generic) + @NotNull + public > T getBanList(@NotNull BanList.Type type); + ++ // Paper start - add BanListType (which has a generic) ++ /** ++ * Gets a ban list for the supplied type. ++ * ++ * @param type the type of list to fetch, cannot be null ++ * @param The ban target ++ * ++ * @return a ban list of the specified type ++ */ ++ @NotNull ++ , E> B getBanList(@NotNull io.papermc.paper.ban.BanListType type); ++ // Paper end - add BanListType (which has a generic) ++ + /** + * Gets a set containing all player operators. + * diff --git a/patches/api/0447-Fix-DamageSource-API.patch b/patches/api/0447-Fix-DamageSource-API.patch deleted file mode 100644 index efe4403e2c..0000000000 --- a/patches/api/0447-Fix-DamageSource-API.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 16 Mar 2024 11:21:14 -0700 -Subject: [PATCH] Fix DamageSource API - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -index 6b24d1281cb8f0253430c9c1a1323e2670bb9c93..8ea4be529400b34df3d31b0f17c2d145345523d9 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -@@ -60,6 +60,20 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent { - } - // Paper end - -+ // Paper start -+ /** -+ * {@inheritDoc} -+ *

-+ * The {@link DamageSource#getDirectEntity()} may be different from the {@link #getDamager()} -+ * if the Minecraft damage source did not originally include an damager entity, but one was included -+ * for this event {@link #getDamager()}. -+ */ -+ @Override -+ public @NotNull DamageSource getDamageSource() { -+ return super.getDamageSource(); -+ } -+ // Paper end -+ - /** - * Returns the entity that damaged the defender. - * diff --git a/patches/api/0447-Suspicious-Effect-Entry-API.patch b/patches/api/0447-Suspicious-Effect-Entry-API.patch new file mode 100644 index 0000000000..d591d57ce9 --- /dev/null +++ b/patches/api/0447-Suspicious-Effect-Entry-API.patch @@ -0,0 +1,220 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 3 Mar 2024 19:45:52 +0100 +Subject: [PATCH] Suspicious Effect Entry API + +Exposes a new suspicious effect entry type that properly represents +storable effects in the context of suspicious effects as they only +define the potion effect type and duration. + +This differentiates them from the existing PotionEffect API found in +bukkit and hence clarifies that storable values in the parts of the API +in which it replaces PotionEffect. + +Co-authored-by: Yannick Lamprecht + +diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6311ede3e3812da2ccdbcb19522facd7b2e3bd5c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java +@@ -0,0 +1,39 @@ ++package io.papermc.paper.potion; ++ ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Represents a {@link PotionEffectType} paired with a duration. ++ */ ++@NullMarked ++public sealed interface SuspiciousEffectEntry permits SuspiciousEffectEntryImpl { ++ ++ /** ++ * Gets the effect type. ++ * ++ * @return effect type ++ */ ++ PotionEffectType effect(); ++ ++ /** ++ * Gets the duration for this effect instance. ++ * ++ * @return duration (in ticks) or {@link PotionEffect#INFINITE_DURATION} ++ */ ++ int duration(); ++ ++ /** ++ * Creates a new instance of SuspiciousEffectEntry. ++ * ++ * @param effectType effect type ++ * @param duration duration (in ticks) or {@link PotionEffect#INFINITE_DURATION} ++ * @return new instance of an entry ++ */ ++ @Contract(value = "_, _ -> new", pure = true) ++ static SuspiciousEffectEntry create(final PotionEffectType effectType, final int duration) { ++ return new SuspiciousEffectEntryImpl(effectType, duration); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a91d37ee450944ea779bd6b61d416467948bb55f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java +@@ -0,0 +1,10 @@ ++package io.papermc.paper.potion; ++ ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++@ApiStatus.Internal ++@NullMarked ++record SuspiciousEffectEntryImpl(PotionEffectType effect, int duration) implements SuspiciousEffectEntry { ++} +diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java +index 86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454..3677f19ef1c05b76d946b1b2b491a6c3cec76140 100644 +--- a/src/main/java/org/bukkit/entity/MushroomCow.java ++++ b/src/main/java/org/bukkit/entity/MushroomCow.java +@@ -34,14 +34,30 @@ public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // + * Adds a custom potion effect to be applied to the next suspicious stew + * received from milking this {@link MushroomCow}. + * ++ * @deprecated use {@link #addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry, boolean)} as PotionEffect suggests that all attributes are used. In fact, only the PotionEffectType and the duration are used. + * @param effect the potion effect to add + * @param overwrite true if any existing effect of the same type should be + * overwritten + * @return true if the effects to be applied to the suspicious stew changed + * as a result of this call + */ ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta + boolean addEffectToNextStew(@NotNull PotionEffect effect, boolean overwrite); + ++ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta ++ /** ++ * Adds a suspicious effect entry to be applied to the next suspicious stew ++ * received from milking this {@link MushroomCow}. ++ * ++ * @param suspiciousEffectEntry the suspicious effect entry to add ++ * @param overwrite true if any existing effect of the same type should be ++ * overwritten ++ * @return true if the effects to be applied to the suspicious stew changed ++ * as a result of this call ++ */ ++ boolean addEffectToNextStew(@NotNull io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite); ++ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta ++ + /** + * Removes a custom potion effect from being applied to the next suspicious + * stew received from milking this {@link MushroomCow}. +@@ -95,4 +111,75 @@ public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // + */ + BROWN; + } ++ // Paper start ++ /** ++ * Gets how long the effect applied to stew ++ * from this mushroom cow is. ++ * ++ * @return duration of the effect (in ticks) ++ * @deprecated Mushroom cows can now hold multiple effects, use {@link #getStewEffects()} ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.2") ++ @org.jetbrains.annotations.Contract("-> fail") ++ default int getStewEffectDuration() { ++ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #getStewEffects"); ++ } ++ ++ /** ++ * Sets how long the effect applied to stew ++ * from this mushroom cow is. ++ * ++ * @param duration duration of the effect (in ticks) ++ * @deprecated Mushroom cows can now hold multiple effects, use {@link #setStewEffects(java.util.List)} ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.2") ++ @org.jetbrains.annotations.Contract("_ -> fail") ++ default void setStewEffectDuration(int duration) { ++ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #setStewEffects"); ++ } ++ ++ /** ++ * Gets the type of effect applied to stew ++ * from this mushroom cow is. ++ * ++ * @return effect type, or null if an effect is currently not set ++ * @deprecated Mushroom cows can now hold multiple effects, use {@link #getStewEffects()} ++ * @throws UnsupportedOperationException ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.2") ++ @org.jetbrains.annotations.Contract("-> fail") ++ default org.bukkit.potion.PotionEffectType getStewEffectType() { ++ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #getStewEffects"); ++ } ++ ++ /** ++ * Sets the type of effect applied to stew ++ * from this mushroom cow is. ++ * ++ * @param type new effect type ++ * or null if this cow does not give effects ++ * @deprecated Mushroom cows can now hold multiple effects, use {@link #setStewEffects(java.util.List)} ++ * @throws UnsupportedOperationException ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.2") ++ @org.jetbrains.annotations.Contract("_ -> fail") ++ default void setStewEffect(@org.jetbrains.annotations.Nullable org.bukkit.potion.PotionEffectType type) { ++ throw new UnsupportedOperationException("Mushroom cows can now hold multiple effects. Use #setStewEffects"); ++ } ++ ++ /** ++ * Returns an immutable collection of the effects applied to stew ++ * items for this mushroom cow. ++ * ++ * @return immutable effect entry collection ++ */ ++ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable List getStewEffects(); ++ ++ /** ++ * Sets effects applied to stew items for this mushroom cow. ++ * ++ * @param effects effect entry list ++ */ ++ void setStewEffects(java.util.@NotNull List effects); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java b/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java +index c2f4282c188e7d8041459cb3acaad674443ba147..c5bfc062fcca56495f44039d83356fc1fd7568d0 100644 +--- a/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/SuspiciousStewMeta.java +@@ -32,13 +32,28 @@ public interface SuspiciousStewMeta extends ItemMeta { + /** + * Adds a custom potion effect to this suspicious stew. + * ++ * @deprecated use {@link #addCustomEffect(io.papermc.paper.potion.SuspiciousEffectEntry, boolean)} as PotionEffect suggests that all attributes are used. In fact, only the PotionEffectType and the duration are used. + * @param effect the potion effect to add + * @param overwrite true if any existing effect of the same type should be + * overwritten + * @return true if the suspicious stew meta changed as a result of this call + */ ++ @Deprecated // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta + boolean addCustomEffect(@NotNull PotionEffect effect, boolean overwrite); + ++ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta ++ /** ++ * Adds a custom potion effect to this suspicious stew. ++ * ++ * @param suspiciousEffectEntry the suspicious effect entry to add ++ * @param overwrite true if any existing effect of the same type should be ++ * overwritten ++ * @return true if the suspicious stew meta changed as a result of this call ++ * as a result of this call ++ */ ++ boolean addCustomEffect(@NotNull io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite); ++ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta ++ + /** + * Removes a custom potion effect from this suspicious stew. + * diff --git a/patches/api/0448-Expanded-Hopper-API.patch b/patches/api/0448-Expanded-Hopper-API.patch deleted file mode 100644 index 51cb6dfee2..0000000000 --- a/patches/api/0448-Expanded-Hopper-API.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: vicisacat -Date: Fri, 15 Mar 2024 17:35:18 +0100 -Subject: [PATCH] Expanded Hopper API - - -diff --git a/src/main/java/org/bukkit/block/Hopper.java b/src/main/java/org/bukkit/block/Hopper.java -index 7ade312f180b7e30871d3a3240c76325cc369c26..61ea33c1f2dbb546a66f945a01feae437b1381e0 100644 ---- a/src/main/java/org/bukkit/block/Hopper.java -+++ b/src/main/java/org/bukkit/block/Hopper.java -@@ -6,4 +6,20 @@ import org.bukkit.loot.Lootable; - /** - * Represents a captured state of a hopper. - */ --public interface Hopper extends Container, LootableBlockInventory { } // Paper -+public interface Hopper extends Container, LootableBlockInventory { // Paper -+ // Paper start - Expanded Hopper API -+ /** -+ * Sets the cooldown before the hopper transfers or sucks in another item -+ * @param cooldown the cooldown in ticks -+ * @throws IllegalArgumentException if the passed cooldown value is negative. -+ */ -+ void setTransferCooldown(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int cooldown); -+ -+ /** -+ * Returns the cooldown before the hopper transfers or sucks in another item -+ * @return the cooldown in ticks -+ */ -+ int getTransferCooldown(); -+ // Paper end - Expanded Hopper API -+} -+ diff --git a/patches/api/0448-Fix-DamageSource-API.patch b/patches/api/0448-Fix-DamageSource-API.patch new file mode 100644 index 0000000000..efe4403e2c --- /dev/null +++ b/patches/api/0448-Fix-DamageSource-API.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 16 Mar 2024 11:21:14 -0700 +Subject: [PATCH] Fix DamageSource API + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java +index 6b24d1281cb8f0253430c9c1a1323e2670bb9c93..8ea4be529400b34df3d31b0f17c2d145345523d9 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java +@@ -60,6 +60,20 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent { + } + // Paper end + ++ // Paper start ++ /** ++ * {@inheritDoc} ++ *

++ * The {@link DamageSource#getDirectEntity()} may be different from the {@link #getDamager()} ++ * if the Minecraft damage source did not originally include an damager entity, but one was included ++ * for this event {@link #getDamager()}. ++ */ ++ @Override ++ public @NotNull DamageSource getDamageSource() { ++ return super.getDamageSource(); ++ } ++ // Paper end ++ + /** + * Returns the entity that damaged the defender. + * diff --git a/patches/api/0449-Clone-mutables-to-prevent-unexpected-issues.patch b/patches/api/0449-Clone-mutables-to-prevent-unexpected-issues.patch deleted file mode 100644 index 86b3ab4bcf..0000000000 --- a/patches/api/0449-Clone-mutables-to-prevent-unexpected-issues.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 16 Mar 2024 11:10:48 -0700 -Subject: [PATCH] Clone mutables to prevent unexpected issues - -There are lots of locations in the API where mutable -types are not cloned, either on return or when passed -as a parameter and assigned to a field, which can cause -unexpected behaviors. Let this be a lesson to use -immutable types for simple things Location, Vector, and -others. - -diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java -index 08d09c2a92d8aa6adf6610cc05905d58a76fce1f..c74ac0cb004aa219ce2f761969a4bb46cb7c9160 100644 ---- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java -@@ -102,7 +102,7 @@ public class BlockCanBuildEvent extends BlockEvent { - */ - @NotNull - public BlockData getBlockData() { -- return blockData; -+ return blockData.clone(); // Paper - clone because mutation isn't used - } - - /** -diff --git a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java -index 1a9575ad4c81aefa5ef0b927f6ac8f7064b55c49..24e1a49e48dd8f9eb2515b2ffe472a0c4d2bc09b 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java -@@ -61,7 +61,7 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable { - */ - @NotNull - public BlockData getBlockData() { -- return to; -+ return to.clone(); // Paper - clone because mutation isn't used - } - - @NotNull -diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java -index 50161d313cfcc9e61441589685c3d0e1f057dd86..e468e55d426b8f81f87c0a08451d02b3866c226f 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java -@@ -72,7 +72,7 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable { - */ - @NotNull - public Location getLocation() { -- return location; -+ return location.clone(); // Paper - clone to avoid changes - } - - /** -diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java -index d3724db0a5a67cde15b05fecd32b2ca370cca998..8b2caf665b9e829ceefc89bf41b192f53f3d5773 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java -@@ -35,7 +35,7 @@ public class EntityPortalEnterEvent extends EntityEvent implements org.bukkit.ev - */ - @NotNull - public Location getLocation() { -- return location; -+ return location.clone(); // Paper - clone to avoid changes - } - - // Paper start -diff --git a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java -index 6fc66197eb2c5d59c70d8d028b7963748371edbe..2bb29fa449cd6c90b52d2786ed15b6154d591607 100644 ---- a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java -+++ b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java -@@ -46,7 +46,7 @@ public class ItemDespawnEvent extends EntityEvent implements Cancellable { - */ - @NotNull - public Location getLocation() { -- return location; -+ return location.clone(); // Paper - clone to avoid changes - } - - @NotNull -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java -index d0a437bd8aeec18f800893f51ece06deb0c8972c..50fad23cf4d9f591b12a9eaebeb4e26f18e8528d 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java -@@ -31,7 +31,7 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { - */ - @NotNull - public org.bukkit.util.Vector getVelocity() { -- return velocity; -+ return velocity.clone(); - } - // Paper end - -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java -index 7bfb84d3948c773e943374316ea25a19288ec7d0..fc4cf7b21b24fe38617fa150f697bc29da76754e 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java -@@ -27,7 +27,7 @@ public class VehicleMoveEvent extends VehicleEvent { - */ - @NotNull - public Location getFrom() { -- return from; -+ return from.clone(); // Paper - clone to avoid changes - } - - /** -@@ -37,7 +37,7 @@ public class VehicleMoveEvent extends VehicleEvent { - */ - @NotNull - public Location getTo() { -- return to; -+ return to.clone(); // Paper - clone to avoid changes - } - - -diff --git a/src/main/java/org/bukkit/event/world/GenericGameEvent.java b/src/main/java/org/bukkit/event/world/GenericGameEvent.java -index 2a2a329877d8da45c2d6afecf78ce88d52635cad..fb975fefc74d8c9746cab4c02860f55654cf92f7 100644 ---- a/src/main/java/org/bukkit/event/world/GenericGameEvent.java -+++ b/src/main/java/org/bukkit/event/world/GenericGameEvent.java -@@ -49,7 +49,7 @@ public class GenericGameEvent extends WorldEvent implements Cancellable { - */ - @NotNull - public Location getLocation() { -- return location; -+ return location.clone(); // Paper - clone to avoid changes - } - - /** -diff --git a/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java b/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java -index 9ce93d00935446589cb2bb970cb540d109616e85..73997ae04ff39ac3984c59de32aaced9eb72ce16 100644 ---- a/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java -+++ b/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java -@@ -25,7 +25,7 @@ public class SpawnChangeEvent extends WorldEvent { - */ - @NotNull - public Location getPreviousLocation() { -- return previousLocation; -+ return previousLocation.clone(); // Paper - clone to avoid changes - } - - @NotNull -diff --git a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java -index 7af8d6e51c824cf0592b722b834f1d4986e3cc08..783e74bc382f0f6d24203fde7b811f588a674731 100644 ---- a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java -+++ b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java -@@ -39,7 +39,7 @@ public class StructureGrowEvent extends WorldEvent implements Cancellable { - */ - @NotNull - public Location getLocation() { -- return location; -+ return location.clone(); // Paper - clone to avoid changes - } - - /** diff --git a/patches/api/0449-Expanded-Hopper-API.patch b/patches/api/0449-Expanded-Hopper-API.patch new file mode 100644 index 0000000000..51cb6dfee2 --- /dev/null +++ b/patches/api/0449-Expanded-Hopper-API.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: vicisacat +Date: Fri, 15 Mar 2024 17:35:18 +0100 +Subject: [PATCH] Expanded Hopper API + + +diff --git a/src/main/java/org/bukkit/block/Hopper.java b/src/main/java/org/bukkit/block/Hopper.java +index 7ade312f180b7e30871d3a3240c76325cc369c26..61ea33c1f2dbb546a66f945a01feae437b1381e0 100644 +--- a/src/main/java/org/bukkit/block/Hopper.java ++++ b/src/main/java/org/bukkit/block/Hopper.java +@@ -6,4 +6,20 @@ import org.bukkit.loot.Lootable; + /** + * Represents a captured state of a hopper. + */ +-public interface Hopper extends Container, LootableBlockInventory { } // Paper ++public interface Hopper extends Container, LootableBlockInventory { // Paper ++ // Paper start - Expanded Hopper API ++ /** ++ * Sets the cooldown before the hopper transfers or sucks in another item ++ * @param cooldown the cooldown in ticks ++ * @throws IllegalArgumentException if the passed cooldown value is negative. ++ */ ++ void setTransferCooldown(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int cooldown); ++ ++ /** ++ * Returns the cooldown before the hopper transfers or sucks in another item ++ * @return the cooldown in ticks ++ */ ++ int getTransferCooldown(); ++ // Paper end - Expanded Hopper API ++} ++ diff --git a/patches/api/0450-Add-BlockBreakProgressUpdateEvent.patch b/patches/api/0450-Add-BlockBreakProgressUpdateEvent.patch deleted file mode 100644 index 9a1913895b..0000000000 --- a/patches/api/0450-Add-BlockBreakProgressUpdateEvent.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Badbird5907 <50347938+Badbird5907@users.noreply.github.com> -Date: Mon, 4 Mar 2024 22:18:33 -0500 -Subject: [PATCH] Add BlockBreakProgressUpdateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..1820e9b12141f3798dac499e19f8337c6f89d671 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java -@@ -0,0 +1,57 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the progress of a block break is updated. -+ */ -+@NullMarked -+public class BlockBreakProgressUpdateEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final float progress; -+ private final Entity entity; -+ -+ @ApiStatus.Internal -+ public BlockBreakProgressUpdateEvent(final Block block, final float progress, final Entity entity) { -+ super(block); -+ this.progress = progress; -+ this.entity = entity; -+ } -+ -+ /** -+ * The progress of the block break -+ *

-+ * The progress ranges from 0.0 - 1.0, where 0 is no damage and -+ * 1.0 is the most damaged -+ * -+ * @return The progress of the block break -+ */ -+ public float getProgress() { -+ return this.progress; -+ } -+ -+ /** -+ * The entity breaking the block. -+ * -+ * @return The entity breaking the block -+ */ -+ public Entity getEntity() { -+ return this.entity; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0450-Clone-mutables-to-prevent-unexpected-issues.patch b/patches/api/0450-Clone-mutables-to-prevent-unexpected-issues.patch new file mode 100644 index 0000000000..86b3ab4bcf --- /dev/null +++ b/patches/api/0450-Clone-mutables-to-prevent-unexpected-issues.patch @@ -0,0 +1,151 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 16 Mar 2024 11:10:48 -0700 +Subject: [PATCH] Clone mutables to prevent unexpected issues + +There are lots of locations in the API where mutable +types are not cloned, either on return or when passed +as a parameter and assigned to a field, which can cause +unexpected behaviors. Let this be a lesson to use +immutable types for simple things Location, Vector, and +others. + +diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java +index 08d09c2a92d8aa6adf6610cc05905d58a76fce1f..c74ac0cb004aa219ce2f761969a4bb46cb7c9160 100644 +--- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java +@@ -102,7 +102,7 @@ public class BlockCanBuildEvent extends BlockEvent { + */ + @NotNull + public BlockData getBlockData() { +- return blockData; ++ return blockData.clone(); // Paper - clone because mutation isn't used + } + + /** +diff --git a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java +index 1a9575ad4c81aefa5ef0b927f6ac8f7064b55c49..24e1a49e48dd8f9eb2515b2ffe472a0c4d2bc09b 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java +@@ -61,7 +61,7 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable { + */ + @NotNull + public BlockData getBlockData() { +- return to; ++ return to.clone(); // Paper - clone because mutation isn't used + } + + @NotNull +diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java +index 50161d313cfcc9e61441589685c3d0e1f057dd86..e468e55d426b8f81f87c0a08451d02b3866c226f 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java +@@ -72,7 +72,7 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable { + */ + @NotNull + public Location getLocation() { +- return location; ++ return location.clone(); // Paper - clone to avoid changes + } + + /** +diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java +index d3724db0a5a67cde15b05fecd32b2ca370cca998..8b2caf665b9e829ceefc89bf41b192f53f3d5773 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java +@@ -35,7 +35,7 @@ public class EntityPortalEnterEvent extends EntityEvent implements org.bukkit.ev + */ + @NotNull + public Location getLocation() { +- return location; ++ return location.clone(); // Paper - clone to avoid changes + } + + // Paper start +diff --git a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java +index 6fc66197eb2c5d59c70d8d028b7963748371edbe..2bb29fa449cd6c90b52d2786ed15b6154d591607 100644 +--- a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java ++++ b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java +@@ -46,7 +46,7 @@ public class ItemDespawnEvent extends EntityEvent implements Cancellable { + */ + @NotNull + public Location getLocation() { +- return location; ++ return location.clone(); // Paper - clone to avoid changes + } + + @NotNull +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java +index d0a437bd8aeec18f800893f51ece06deb0c8972c..50fad23cf4d9f591b12a9eaebeb4e26f18e8528d 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java +@@ -31,7 +31,7 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { + */ + @NotNull + public org.bukkit.util.Vector getVelocity() { +- return velocity; ++ return velocity.clone(); + } + // Paper end + +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java +index 7bfb84d3948c773e943374316ea25a19288ec7d0..fc4cf7b21b24fe38617fa150f697bc29da76754e 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleMoveEvent.java +@@ -27,7 +27,7 @@ public class VehicleMoveEvent extends VehicleEvent { + */ + @NotNull + public Location getFrom() { +- return from; ++ return from.clone(); // Paper - clone to avoid changes + } + + /** +@@ -37,7 +37,7 @@ public class VehicleMoveEvent extends VehicleEvent { + */ + @NotNull + public Location getTo() { +- return to; ++ return to.clone(); // Paper - clone to avoid changes + } + + +diff --git a/src/main/java/org/bukkit/event/world/GenericGameEvent.java b/src/main/java/org/bukkit/event/world/GenericGameEvent.java +index 2a2a329877d8da45c2d6afecf78ce88d52635cad..fb975fefc74d8c9746cab4c02860f55654cf92f7 100644 +--- a/src/main/java/org/bukkit/event/world/GenericGameEvent.java ++++ b/src/main/java/org/bukkit/event/world/GenericGameEvent.java +@@ -49,7 +49,7 @@ public class GenericGameEvent extends WorldEvent implements Cancellable { + */ + @NotNull + public Location getLocation() { +- return location; ++ return location.clone(); // Paper - clone to avoid changes + } + + /** +diff --git a/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java b/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java +index 9ce93d00935446589cb2bb970cb540d109616e85..73997ae04ff39ac3984c59de32aaced9eb72ce16 100644 +--- a/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java ++++ b/src/main/java/org/bukkit/event/world/SpawnChangeEvent.java +@@ -25,7 +25,7 @@ public class SpawnChangeEvent extends WorldEvent { + */ + @NotNull + public Location getPreviousLocation() { +- return previousLocation; ++ return previousLocation.clone(); // Paper - clone to avoid changes + } + + @NotNull +diff --git a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java +index 7af8d6e51c824cf0592b722b834f1d4986e3cc08..783e74bc382f0f6d24203fde7b811f588a674731 100644 +--- a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java ++++ b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java +@@ -39,7 +39,7 @@ public class StructureGrowEvent extends WorldEvent implements Cancellable { + */ + @NotNull + public Location getLocation() { +- return location; ++ return location.clone(); // Paper - clone to avoid changes + } + + /** diff --git a/patches/api/0451-Add-BlockBreakProgressUpdateEvent.patch b/patches/api/0451-Add-BlockBreakProgressUpdateEvent.patch new file mode 100644 index 0000000000..9a1913895b --- /dev/null +++ b/patches/api/0451-Add-BlockBreakProgressUpdateEvent.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Badbird5907 <50347938+Badbird5907@users.noreply.github.com> +Date: Mon, 4 Mar 2024 22:18:33 -0500 +Subject: [PATCH] Add BlockBreakProgressUpdateEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1820e9b12141f3798dac499e19f8337c6f89d671 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java +@@ -0,0 +1,57 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Entity; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Called when the progress of a block break is updated. ++ */ ++@NullMarked ++public class BlockBreakProgressUpdateEvent extends BlockEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final float progress; ++ private final Entity entity; ++ ++ @ApiStatus.Internal ++ public BlockBreakProgressUpdateEvent(final Block block, final float progress, final Entity entity) { ++ super(block); ++ this.progress = progress; ++ this.entity = entity; ++ } ++ ++ /** ++ * The progress of the block break ++ *

++ * The progress ranges from 0.0 - 1.0, where 0 is no damage and ++ * 1.0 is the most damaged ++ * ++ * @return The progress of the block break ++ */ ++ public float getProgress() { ++ return this.progress; ++ } ++ ++ /** ++ * The entity breaking the block. ++ * ++ * @return The entity breaking the block ++ */ ++ public Entity getEntity() { ++ return this.entity; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0451-Deprecate-ItemStack-setType.patch b/patches/api/0451-Deprecate-ItemStack-setType.patch deleted file mode 100644 index 84fbcf3899..0000000000 --- a/patches/api/0451-Deprecate-ItemStack-setType.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Thu, 29 Feb 2024 17:54:26 -0500 -Subject: [PATCH] Deprecate ItemStack#setType - - -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 49390979cc0c68b8e719f2a2ce9e7d193c747959..82a66820311cfd918ea322f57df97e3a56e79c1d 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -143,8 +143,18 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - * {@link Material#isItem()} returns false. - * - * @param type New type to set the items in this stack to -+ * @deprecated Setting the material type of ItemStacks is no longer supported. -+ *

-+ * This method is deprecated due to potential illegal behavior that may occur -+ * during the context of which this ItemStack is being used, allowing for certain item validation to be bypassed. -+ * It is recommended to instead create a new ItemStack object with the desired -+ * Material type, and if possible, set it in the appropriate context. -+ * -+ * Using this method in ItemStacks passed in events will result in undefined behavior. -+ * @see ItemStack#withType(Material) - */ - @Utility -+ @Deprecated // Paper - public void setType(@NotNull Material type) { - Preconditions.checkArgument(type != null, "Material cannot be null"); - this.type = type; -@@ -157,6 +167,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - this.data = null; - } - } -+ // Paper start -+ /** -+ * Creates a new ItemStack with the specified Material type, where the item count and item meta is preserved. -+ * -+ * @param type The Material type of the new ItemStack. -+ * @return A new ItemStack instance with the specified Material type. -+ */ -+ @NotNull -+ @org.jetbrains.annotations.Contract(value = "_ -> new", pure = true) -+ public ItemStack withType(@NotNull Material type) { -+ ItemStack itemStack = new ItemStack(type, this.amount); -+ if (this.hasItemMeta()) { -+ itemStack.setItemMeta(this.getItemMeta()); -+ } -+ -+ return itemStack; -+ } -+ // Paper end - - /** - * Gets the amount of items in this stack diff --git a/patches/api/0452-Deprecate-ItemStack-setType.patch b/patches/api/0452-Deprecate-ItemStack-setType.patch new file mode 100644 index 0000000000..84fbcf3899 --- /dev/null +++ b/patches/api/0452-Deprecate-ItemStack-setType.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Thu, 29 Feb 2024 17:54:26 -0500 +Subject: [PATCH] Deprecate ItemStack#setType + + +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 49390979cc0c68b8e719f2a2ce9e7d193c747959..82a66820311cfd918ea322f57df97e3a56e79c1d 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -143,8 +143,18 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + * {@link Material#isItem()} returns false. + * + * @param type New type to set the items in this stack to ++ * @deprecated Setting the material type of ItemStacks is no longer supported. ++ *

++ * This method is deprecated due to potential illegal behavior that may occur ++ * during the context of which this ItemStack is being used, allowing for certain item validation to be bypassed. ++ * It is recommended to instead create a new ItemStack object with the desired ++ * Material type, and if possible, set it in the appropriate context. ++ * ++ * Using this method in ItemStacks passed in events will result in undefined behavior. ++ * @see ItemStack#withType(Material) + */ + @Utility ++ @Deprecated // Paper + public void setType(@NotNull Material type) { + Preconditions.checkArgument(type != null, "Material cannot be null"); + this.type = type; +@@ -157,6 +167,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + this.data = null; + } + } ++ // Paper start ++ /** ++ * Creates a new ItemStack with the specified Material type, where the item count and item meta is preserved. ++ * ++ * @param type The Material type of the new ItemStack. ++ * @return A new ItemStack instance with the specified Material type. ++ */ ++ @NotNull ++ @org.jetbrains.annotations.Contract(value = "_ -> new", pure = true) ++ public ItemStack withType(@NotNull Material type) { ++ ItemStack itemStack = new ItemStack(type, this.amount); ++ if (this.hasItemMeta()) { ++ itemStack.setItemMeta(this.getItemMeta()); ++ } ++ ++ return itemStack; ++ } ++ // Paper end + + /** + * Gets the amount of items in this stack diff --git a/patches/api/0452-Item-Mutation-Fixes.patch b/patches/api/0452-Item-Mutation-Fixes.patch deleted file mode 100644 index ccd77b7fbc..0000000000 --- a/patches/api/0452-Item-Mutation-Fixes.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 20 Mar 2024 20:42:31 -0400 -Subject: [PATCH] Item Mutation Fixes - - -diff --git a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java -index 1ebd45295a29fbc990a1311a7f0fe7f42ac79275..b70450919e78e869c9f158c4e3e25944bcaa73f2 100644 ---- a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java -@@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull; - public class InventoryBlockStartEvent extends BlockEvent { - - private static final HandlerList handlers = new HandlerList(); -- private final ItemStack source; -+ protected ItemStack source; // Paper - - public InventoryBlockStartEvent(@NotNull final Block block, @NotNull ItemStack source) { - super(block); -diff --git a/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java b/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java -index 1829529c9915937dcdd0e6d1ceba9e64819fb93f..e7c243038b70ca13b7eabdf88ce518b6198c6db9 100644 ---- a/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java -+++ b/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java -@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull; - public class EnchantItemEvent extends InventoryEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private final Block table; -- private final ItemStack item; -+ private ItemStack item; // Paper - private int level; - private boolean cancelled; - private final Map enchants; -@@ -72,6 +72,17 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { - return item; - } - -+ // Paper start -+ /** -+ * Sets the item to be enchanted -+ * -+ * @param item item -+ */ -+ public void setItem(@NotNull final ItemStack item) { -+ this.item = item; -+ } -+ // Paper end -+ - /** - * Gets the cost (minimum level) which is displayed as a number on the right - * hand side of the enchantment offer. diff --git a/patches/api/0453-API-for-checking-sent-chunks.patch b/patches/api/0453-API-for-checking-sent-chunks.patch deleted file mode 100644 index 0c353a8070..0000000000 --- a/patches/api/0453-API-for-checking-sent-chunks.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Flo0 -Date: Mon, 8 Apr 2024 16:22:07 +0200 -Subject: [PATCH] API for checking sent chunks - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b3b6cdf5491397e0e802ac91f5805d560ed5d88a..20db14b3075d70b34eab16ca6332a2e674b34e75 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3844,6 +3844,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void resetIdleDuration(); - // Paper end - -+ // Paper start - Add chunk view API -+ /** -+ * Gets the a set of chunk keys for all chunks that have been sent to the player. -+ * -+ * @return an immutable set of chunk keys -+ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy -+ * vs it potentially being an unmodifiable view of the set chunks. -+ */ -+ @ApiStatus.Experimental -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set getSentChunkKeys(); -+ -+ /** -+ * Gets the set of chunks that have been sent to the player. -+ * -+ * @return an immutable set of chunks -+ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy -+ * vs it potentially being an unmodifiable view of the set chunks. -+ */ -+ @ApiStatus.Experimental -+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set getSentChunks(); -+ -+ /** -+ * Checks if the player has been sent a specific chunk. -+ * -+ * @param chunk the chunk to check -+ * @return true if the player has been sent the chunk, false otherwise -+ */ -+ default boolean isChunkSent(@NotNull org.bukkit.Chunk chunk) { -+ return this.isChunkSent(chunk.getChunkKey()); -+ } -+ -+ /** -+ * Checks if the player has been sent a specific chunk. -+ * -+ * @param chunkKey the chunk key to check -+ * @return true if the player has been sent the chunk, false otherwise -+ * @see org.bukkit.Chunk#getChunkKey() -+ */ -+ boolean isChunkSent(long chunkKey); -+ // Paper end -+ - @NotNull - @Override - Spigot spigot(); diff --git a/patches/api/0453-Item-Mutation-Fixes.patch b/patches/api/0453-Item-Mutation-Fixes.patch new file mode 100644 index 0000000000..ccd77b7fbc --- /dev/null +++ b/patches/api/0453-Item-Mutation-Fixes.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 20 Mar 2024 20:42:31 -0400 +Subject: [PATCH] Item Mutation Fixes + + +diff --git a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java +index 1ebd45295a29fbc990a1311a7f0fe7f42ac79275..b70450919e78e869c9f158c4e3e25944bcaa73f2 100644 +--- a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java +@@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull; + public class InventoryBlockStartEvent extends BlockEvent { + + private static final HandlerList handlers = new HandlerList(); +- private final ItemStack source; ++ protected ItemStack source; // Paper + + public InventoryBlockStartEvent(@NotNull final Block block, @NotNull ItemStack source) { + super(block); +diff --git a/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java b/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java +index 1829529c9915937dcdd0e6d1ceba9e64819fb93f..e7c243038b70ca13b7eabdf88ce518b6198c6db9 100644 +--- a/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java ++++ b/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java +@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull; + public class EnchantItemEvent extends InventoryEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private final Block table; +- private final ItemStack item; ++ private ItemStack item; // Paper + private int level; + private boolean cancelled; + private final Map enchants; +@@ -72,6 +72,17 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { + return item; + } + ++ // Paper start ++ /** ++ * Sets the item to be enchanted ++ * ++ * @param item item ++ */ ++ public void setItem(@NotNull final ItemStack item) { ++ this.item = item; ++ } ++ // Paper end ++ + /** + * Gets the cost (minimum level) which is displayed as a number on the right + * hand side of the enchantment offer. diff --git a/patches/api/0454-API-for-checking-sent-chunks.patch b/patches/api/0454-API-for-checking-sent-chunks.patch new file mode 100644 index 0000000000..0c353a8070 --- /dev/null +++ b/patches/api/0454-API-for-checking-sent-chunks.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Flo0 +Date: Mon, 8 Apr 2024 16:22:07 +0200 +Subject: [PATCH] API for checking sent chunks + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index b3b6cdf5491397e0e802ac91f5805d560ed5d88a..20db14b3075d70b34eab16ca6332a2e674b34e75 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3844,6 +3844,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + void resetIdleDuration(); + // Paper end + ++ // Paper start - Add chunk view API ++ /** ++ * Gets the a set of chunk keys for all chunks that have been sent to the player. ++ * ++ * @return an immutable set of chunk keys ++ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy ++ * vs it potentially being an unmodifiable view of the set chunks. ++ */ ++ @ApiStatus.Experimental ++ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set getSentChunkKeys(); ++ ++ /** ++ * Gets the set of chunks that have been sent to the player. ++ * ++ * @return an immutable set of chunks ++ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy ++ * vs it potentially being an unmodifiable view of the set chunks. ++ */ ++ @ApiStatus.Experimental ++ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set getSentChunks(); ++ ++ /** ++ * Checks if the player has been sent a specific chunk. ++ * ++ * @param chunk the chunk to check ++ * @return true if the player has been sent the chunk, false otherwise ++ */ ++ default boolean isChunkSent(@NotNull org.bukkit.Chunk chunk) { ++ return this.isChunkSent(chunk.getChunkKey()); ++ } ++ ++ /** ++ * Checks if the player has been sent a specific chunk. ++ * ++ * @param chunkKey the chunk key to check ++ * @return true if the player has been sent the chunk, false otherwise ++ * @see org.bukkit.Chunk#getChunkKey() ++ */ ++ boolean isChunkSent(long chunkKey); ++ // Paper end ++ + @NotNull + @Override + Spigot spigot(); diff --git a/patches/api/0454-Add-CartographyItemEvent.patch b/patches/api/0454-Add-CartographyItemEvent.patch deleted file mode 100644 index 8bfd237e0c..0000000000 --- a/patches/api/0454-Add-CartographyItemEvent.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Janet Blackquill -Date: Sun, 7 Apr 2024 16:51:04 -0400 -Subject: [PATCH] Add CartographyItemEvent - -Similar to SmithItemEvent, but for cartography tables. - -diff --git a/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d5c67f5462b9011683ce742a197959f9c4380d40 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java -@@ -0,0 +1,32 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.event.inventory.ClickType; -+import org.bukkit.event.inventory.InventoryAction; -+import org.bukkit.event.inventory.InventoryClickEvent; -+import org.bukkit.event.inventory.InventoryType; -+import org.bukkit.inventory.CartographyInventory; -+import org.bukkit.inventory.InventoryView; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when the recipe of an Item is completed inside a cartography table. -+ */ -+@NullMarked -+public class CartographyItemEvent extends InventoryClickEvent { -+ -+ @ApiStatus.Internal -+ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action) { -+ super(view, type, slot, click, action); -+ } -+ -+ @ApiStatus.Internal -+ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action, final int key) { -+ super(view, type, slot, click, action, key); -+ } -+ -+ @Override -+ public CartographyInventory getInventory() { -+ return (CartographyInventory) super.getInventory(); -+ } -+} diff --git a/patches/api/0455-Add-CartographyItemEvent.patch b/patches/api/0455-Add-CartographyItemEvent.patch new file mode 100644 index 0000000000..8bfd237e0c --- /dev/null +++ b/patches/api/0455-Add-CartographyItemEvent.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Janet Blackquill +Date: Sun, 7 Apr 2024 16:51:04 -0400 +Subject: [PATCH] Add CartographyItemEvent + +Similar to SmithItemEvent, but for cartography tables. + +diff --git a/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d5c67f5462b9011683ce742a197959f9c4380d40 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.event.inventory.ClickType; ++import org.bukkit.event.inventory.InventoryAction; ++import org.bukkit.event.inventory.InventoryClickEvent; ++import org.bukkit.event.inventory.InventoryType; ++import org.bukkit.inventory.CartographyInventory; ++import org.bukkit.inventory.InventoryView; ++import org.jetbrains.annotations.ApiStatus; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * Called when the recipe of an Item is completed inside a cartography table. ++ */ ++@NullMarked ++public class CartographyItemEvent extends InventoryClickEvent { ++ ++ @ApiStatus.Internal ++ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action) { ++ super(view, type, slot, click, action); ++ } ++ ++ @ApiStatus.Internal ++ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action, final int key) { ++ super(view, type, slot, click, action, key); ++ } ++ ++ @Override ++ public CartographyInventory getInventory() { ++ return (CartographyInventory) super.getInventory(); ++ } ++} diff --git a/patches/api/0455-More-Raid-API.patch b/patches/api/0455-More-Raid-API.patch deleted file mode 100644 index 947b51c645..0000000000 --- a/patches/api/0455-More-Raid-API.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 4 Mar 2022 09:46:40 -0800 -Subject: [PATCH] More Raid API - - -diff --git a/src/main/java/org/bukkit/Raid.java b/src/main/java/org/bukkit/Raid.java -index 983a8c20a06d2b509602b27f49c090598b8ecc42..fa98599e3eee37bf68f0e9813497c718f457485c 100644 ---- a/src/main/java/org/bukkit/Raid.java -+++ b/src/main/java/org/bukkit/Raid.java -@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a raid event. - */ --public interface Raid { -+public interface Raid extends org.bukkit.persistence.PersistentDataHolder { // Paper - - /** - * Get whether this raid started. -@@ -131,4 +131,20 @@ public interface Raid { - */ - STOPPED; - } -+ -+ // Paper start -+ /** -+ * Gets the id of this raid. -+ * -+ * @return the raid id -+ */ -+ int getId(); -+ -+ /** -+ * Get the boss bar to be displayed for this raid. -+ * -+ * @return the boss bar -+ */ -+ org.bukkit.boss.@NotNull BossBar getBossBar(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 16570c3c7ed5e7ad25f20c1034f7b966d6e694da..adcd8161846b06fd1a7895750f98b629204a8406 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -4127,6 +4127,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - public Raid locateNearestRaid(@NotNull Location location, int radius); - -+ // Paper start - more Raid API -+ /** -+ * Get a raid with the specific id from {@link Raid#getId} -+ * from this world. -+ * -+ * @param id the id of the raid -+ * @return the raid or null if none with that id -+ */ -+ @Nullable Raid getRaid(int id); -+ // Paper end - more Raid API -+ - /** - * Gets all raids that are going on over this world. - * diff --git a/patches/api/0456-Fix-SpawnerEntry-Equipment-API.patch b/patches/api/0456-Fix-SpawnerEntry-Equipment-API.patch deleted file mode 100644 index e170eabd17..0000000000 --- a/patches/api/0456-Fix-SpawnerEntry-Equipment-API.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 26 Apr 2024 17:00:00 -0700 -Subject: [PATCH] Fix SpawnerEntry$Equipment API - - -diff --git a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java -index fc1c0435dfea121923eb1fe0182880752f321143..bc8ccd139df6072f9744cfb85ad0070369600aa1 100644 ---- a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java -+++ b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java -@@ -120,27 +120,29 @@ public class SpawnerEntry { - private final Map dropChances; - - public Equipment(@NotNull LootTable equipmentLootTable, @NotNull Map dropChances) { -+ Preconditions.checkArgument(equipmentLootTable != null, "table cannot be null"); // Paper - this.equipmentLootTable = equipmentLootTable; - this.dropChances = dropChances; - } - - /** -- * Set the loot table for the entity. -+ * Set the loot table for the spawned entity's equipment slots. - *
-- * To remove a loot table use null. -+ * To remove a loot table use the empty loot table. - * - * @param table this {@link org.bukkit.entity.Mob} will have. - */ - public void setEquipmentLootTable(@NotNull LootTable table) { -+ Preconditions.checkArgument(table != null, "table cannot be null"); // Paper - this.equipmentLootTable = table; - } - - /** -- * Gets the loot table for the entity. -+ * Gets the loot table for the spawned entity's equipment. - *
- * -- * If an entity does not have a loot table, this will return null, NOT -- * an empty loot table. -+ * If an entity does not have a loot table, this will return an -+ * empty loot table. - * - * @return the loot table for this entity. - */ diff --git a/patches/api/0456-More-Raid-API.patch b/patches/api/0456-More-Raid-API.patch new file mode 100644 index 0000000000..947b51c645 --- /dev/null +++ b/patches/api/0456-More-Raid-API.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 4 Mar 2022 09:46:40 -0800 +Subject: [PATCH] More Raid API + + +diff --git a/src/main/java/org/bukkit/Raid.java b/src/main/java/org/bukkit/Raid.java +index 983a8c20a06d2b509602b27f49c090598b8ecc42..fa98599e3eee37bf68f0e9813497c718f457485c 100644 +--- a/src/main/java/org/bukkit/Raid.java ++++ b/src/main/java/org/bukkit/Raid.java +@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a raid event. + */ +-public interface Raid { ++public interface Raid extends org.bukkit.persistence.PersistentDataHolder { // Paper + + /** + * Get whether this raid started. +@@ -131,4 +131,20 @@ public interface Raid { + */ + STOPPED; + } ++ ++ // Paper start ++ /** ++ * Gets the id of this raid. ++ * ++ * @return the raid id ++ */ ++ int getId(); ++ ++ /** ++ * Get the boss bar to be displayed for this raid. ++ * ++ * @return the boss bar ++ */ ++ org.bukkit.boss.@NotNull BossBar getBossBar(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 16570c3c7ed5e7ad25f20c1034f7b966d6e694da..adcd8161846b06fd1a7895750f98b629204a8406 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -4127,6 +4127,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @Nullable + public Raid locateNearestRaid(@NotNull Location location, int radius); + ++ // Paper start - more Raid API ++ /** ++ * Get a raid with the specific id from {@link Raid#getId} ++ * from this world. ++ * ++ * @param id the id of the raid ++ * @return the raid or null if none with that id ++ */ ++ @Nullable Raid getRaid(int id); ++ // Paper end - more Raid API ++ + /** + * Gets all raids that are going on over this world. + * diff --git a/patches/api/0457-Fix-ItemFlags.patch b/patches/api/0457-Fix-ItemFlags.patch deleted file mode 100644 index 3ca141cfa5..0000000000 --- a/patches/api/0457-Fix-ItemFlags.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 27 Apr 2024 13:28:17 -0700 -Subject: [PATCH] Fix ItemFlags - -Adds new flag in HIDE_STORED_ENCHANTS which was split -from HIDE_ADDITIONAL_INFO. Adds a migration to account for -this, adding the new flag if the itemstack is old and had the -old flag. - -diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java -index 5b8dac777bb1640dc00bbe98feb6460c36eebb98..1af15fd327e0613cd1a179bd7fef1e83cbe31761 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFlag.java -+++ b/src/main/java/org/bukkit/inventory/ItemFlag.java -@@ -2,6 +2,8 @@ package org.bukkit.inventory; - - /** - * A ItemFlag can hide some Attributes from ItemStacks -+ * @apiNote Setting these without also setting the data they are hiding -+ * may not result in the item flag being persisted in the ItemMeta/ItemStack. - */ - public enum ItemFlag { - -@@ -27,7 +29,8 @@ public enum ItemFlag { - HIDE_PLACED_ON, - /** - * Setting to show/hide potion effects, book and firework information, map -- * tooltips, patterns of banners, and enchantments of enchanted books. -+ * tooltips, patterns of banners. -+ * @see #HIDE_STORED_ENCHANTS HIDE_STORED_ENCHANTS for hiding stored enchants (like on enchanted books) - */ - HIDE_ADDITIONAL_TOOLTIP, - /** -@@ -37,7 +40,13 @@ public enum ItemFlag { - /** - * Setting to show/hide armor trim from armor. - */ -- HIDE_ARMOR_TRIM; -+ HIDE_ARMOR_TRIM, -+ /** -+ * Setting to show/hide stored enchants on an item, such as enchantments -+ * on an enchanted book. -+ */ -+ HIDE_STORED_ENCHANTS, -+ ; - // Paper start - /** - * Setting to show/hide item-specific information, including, but not limited to: -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 82a66820311cfd918ea322f57df97e3a56e79c1d..77edc2e1c5c865db7e101aaa186657ac85edfed9 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -588,6 +588,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - Object raw = args.get("meta"); - if (raw instanceof ItemMeta) { - ((ItemMeta) raw).setVersion(version); -+ // Paper start - for pre 1.20.5 itemstacks, add HIDE_STORED_ENCHANTS flag if HIDE_ADDITIONAL_TOOLTIP is set -+ if (version < 3837) { // 1.20.5 -+ if (((ItemMeta) raw).hasItemFlag(ItemFlag.HIDE_ADDITIONAL_TOOLTIP)) { -+ ((ItemMeta) raw).addItemFlags(ItemFlag.HIDE_STORED_ENCHANTS); -+ } -+ } -+ // Paper end - result.setItemMeta((ItemMeta) raw); - } - } diff --git a/patches/api/0457-Fix-SpawnerEntry-Equipment-API.patch b/patches/api/0457-Fix-SpawnerEntry-Equipment-API.patch new file mode 100644 index 0000000000..e170eabd17 --- /dev/null +++ b/patches/api/0457-Fix-SpawnerEntry-Equipment-API.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 26 Apr 2024 17:00:00 -0700 +Subject: [PATCH] Fix SpawnerEntry$Equipment API + + +diff --git a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java +index fc1c0435dfea121923eb1fe0182880752f321143..bc8ccd139df6072f9744cfb85ad0070369600aa1 100644 +--- a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java ++++ b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java +@@ -120,27 +120,29 @@ public class SpawnerEntry { + private final Map dropChances; + + public Equipment(@NotNull LootTable equipmentLootTable, @NotNull Map dropChances) { ++ Preconditions.checkArgument(equipmentLootTable != null, "table cannot be null"); // Paper + this.equipmentLootTable = equipmentLootTable; + this.dropChances = dropChances; + } + + /** +- * Set the loot table for the entity. ++ * Set the loot table for the spawned entity's equipment slots. + *
+- * To remove a loot table use null. ++ * To remove a loot table use the empty loot table. + * + * @param table this {@link org.bukkit.entity.Mob} will have. + */ + public void setEquipmentLootTable(@NotNull LootTable table) { ++ Preconditions.checkArgument(table != null, "table cannot be null"); // Paper + this.equipmentLootTable = table; + } + + /** +- * Gets the loot table for the entity. ++ * Gets the loot table for the spawned entity's equipment. + *
+ * +- * If an entity does not have a loot table, this will return null, NOT +- * an empty loot table. ++ * If an entity does not have a loot table, this will return an ++ * empty loot table. + * + * @return the loot table for this entity. + */ diff --git a/patches/api/0458-Allow-modifying-library-loader-jars-bytecode.patch b/patches/api/0458-Allow-modifying-library-loader-jars-bytecode.patch deleted file mode 100644 index 0c0311e790..0000000000 --- a/patches/api/0458-Allow-modifying-library-loader-jars-bytecode.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Sun, 28 Apr 2024 11:11:26 -0700 -Subject: [PATCH] Allow modifying library loader jars bytecode - - -diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -index f4d655a158410039305ac68cebe0d79000f73df8..5b0203e908f84c531886b8ea8faeb591eb045636 100644 ---- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -@@ -46,6 +46,7 @@ public class LibraryLoader - private final RepositorySystem repository; - private final DefaultRepositorySystemSession session; - private final List repositories; -+ public static java.util.function.BiFunction LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries - - public LibraryLoader(@NotNull Logger logger) - { -@@ -130,7 +131,14 @@ public class LibraryLoader - } ); - } - -- URLClassLoader loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() ); -+ // Paper start - rewrite reflection in libraries -+ URLClassLoader loader; -+ if (LIBRARY_LOADER_FACTORY == null) { -+ loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() ); -+ } else { -+ loader = LIBRARY_LOADER_FACTORY.apply(jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader()); -+ } -+ // Paper end - rewrite reflection in libraries - - return loader; - } diff --git a/patches/api/0458-Fix-ItemFlags.patch b/patches/api/0458-Fix-ItemFlags.patch new file mode 100644 index 0000000000..3ca141cfa5 --- /dev/null +++ b/patches/api/0458-Fix-ItemFlags.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 27 Apr 2024 13:28:17 -0700 +Subject: [PATCH] Fix ItemFlags + +Adds new flag in HIDE_STORED_ENCHANTS which was split +from HIDE_ADDITIONAL_INFO. Adds a migration to account for +this, adding the new flag if the itemstack is old and had the +old flag. + +diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java +index 5b8dac777bb1640dc00bbe98feb6460c36eebb98..1af15fd327e0613cd1a179bd7fef1e83cbe31761 100644 +--- a/src/main/java/org/bukkit/inventory/ItemFlag.java ++++ b/src/main/java/org/bukkit/inventory/ItemFlag.java +@@ -2,6 +2,8 @@ package org.bukkit.inventory; + + /** + * A ItemFlag can hide some Attributes from ItemStacks ++ * @apiNote Setting these without also setting the data they are hiding ++ * may not result in the item flag being persisted in the ItemMeta/ItemStack. + */ + public enum ItemFlag { + +@@ -27,7 +29,8 @@ public enum ItemFlag { + HIDE_PLACED_ON, + /** + * Setting to show/hide potion effects, book and firework information, map +- * tooltips, patterns of banners, and enchantments of enchanted books. ++ * tooltips, patterns of banners. ++ * @see #HIDE_STORED_ENCHANTS HIDE_STORED_ENCHANTS for hiding stored enchants (like on enchanted books) + */ + HIDE_ADDITIONAL_TOOLTIP, + /** +@@ -37,7 +40,13 @@ public enum ItemFlag { + /** + * Setting to show/hide armor trim from armor. + */ +- HIDE_ARMOR_TRIM; ++ HIDE_ARMOR_TRIM, ++ /** ++ * Setting to show/hide stored enchants on an item, such as enchantments ++ * on an enchanted book. ++ */ ++ HIDE_STORED_ENCHANTS, ++ ; + // Paper start + /** + * Setting to show/hide item-specific information, including, but not limited to: +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 82a66820311cfd918ea322f57df97e3a56e79c1d..77edc2e1c5c865db7e101aaa186657ac85edfed9 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -588,6 +588,13 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + Object raw = args.get("meta"); + if (raw instanceof ItemMeta) { + ((ItemMeta) raw).setVersion(version); ++ // Paper start - for pre 1.20.5 itemstacks, add HIDE_STORED_ENCHANTS flag if HIDE_ADDITIONAL_TOOLTIP is set ++ if (version < 3837) { // 1.20.5 ++ if (((ItemMeta) raw).hasItemFlag(ItemFlag.HIDE_ADDITIONAL_TOOLTIP)) { ++ ((ItemMeta) raw).addItemFlags(ItemFlag.HIDE_STORED_ENCHANTS); ++ } ++ } ++ // Paper end + result.setItemMeta((ItemMeta) raw); + } + } diff --git a/patches/api/0459-Add-hook-to-remap-library-jars.patch b/patches/api/0459-Add-hook-to-remap-library-jars.patch deleted file mode 100644 index fe1609629e..0000000000 --- a/patches/api/0459-Add-hook-to-remap-library-jars.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Sun, 28 Apr 2024 13:51:08 -0700 -Subject: [PATCH] Add hook to remap library jars - - -diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -index 5b0203e908f84c531886b8ea8faeb591eb045636..8e1b6be2462aaa692efa1f72986921a6dc357196 100644 ---- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java -@@ -47,6 +47,7 @@ public class LibraryLoader - private final DefaultRepositorySystemSession session; - private final List repositories; - public static java.util.function.BiFunction LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries -+ public static java.util.function.Function, List> REMAPPER; // Paper - remap libraries - - public LibraryLoader(@NotNull Logger logger) - { -@@ -111,9 +112,18 @@ public class LibraryLoader - } - - List jarFiles = new ArrayList<>(); -+ List jarPaths = new ArrayList<>(); // Paper - remap libraries - for ( ArtifactResult artifact : result.getArtifactResults() ) - { -- File file = artifact.getArtifact().getFile(); -+ // Paper start - remap libraries -+ jarPaths.add(artifact.getArtifact().getFile().toPath()); -+ } -+ if (REMAPPER != null) { -+ jarPaths = REMAPPER.apply(jarPaths); -+ } -+ for (java.nio.file.Path path : jarPaths) { -+ File file = path.toFile(); -+ // Paper end - remap libraries - - URL url; - try diff --git a/patches/api/0459-Allow-modifying-library-loader-jars-bytecode.patch b/patches/api/0459-Allow-modifying-library-loader-jars-bytecode.patch new file mode 100644 index 0000000000..0c0311e790 --- /dev/null +++ b/patches/api/0459-Allow-modifying-library-loader-jars-bytecode.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Sun, 28 Apr 2024 11:11:26 -0700 +Subject: [PATCH] Allow modifying library loader jars bytecode + + +diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +index f4d655a158410039305ac68cebe0d79000f73df8..5b0203e908f84c531886b8ea8faeb591eb045636 100644 +--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +@@ -46,6 +46,7 @@ public class LibraryLoader + private final RepositorySystem repository; + private final DefaultRepositorySystemSession session; + private final List repositories; ++ public static java.util.function.BiFunction LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries + + public LibraryLoader(@NotNull Logger logger) + { +@@ -130,7 +131,14 @@ public class LibraryLoader + } ); + } + +- URLClassLoader loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() ); ++ // Paper start - rewrite reflection in libraries ++ URLClassLoader loader; ++ if (LIBRARY_LOADER_FACTORY == null) { ++ loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() ); ++ } else { ++ loader = LIBRARY_LOADER_FACTORY.apply(jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader()); ++ } ++ // Paper end - rewrite reflection in libraries + + return loader; + } diff --git a/patches/api/0460-Add-GameMode-isInvulnerable.patch b/patches/api/0460-Add-GameMode-isInvulnerable.patch deleted file mode 100644 index b4b81c5f52..0000000000 --- a/patches/api/0460-Add-GameMode-isInvulnerable.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 1 May 2024 06:56:21 +0300 -Subject: [PATCH] Add GameMode#isInvulnerable - - -diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java -index fdc42a79c5af30fdade41ee99245e6641f353571..ddc56524b3bd2bdebba81c61a5600e6f46a4aaa4 100644 ---- a/src/main/java/org/bukkit/GameMode.java -+++ b/src/main/java/org/bukkit/GameMode.java -@@ -79,4 +79,16 @@ public enum GameMode implements net.kyori.adventure.translation.Translatable { / - BY_ID.put(mode.getValue(), mode); - } - } -+ -+ // Paper start - Add GameMode#isInvulnerable -+ /** -+ * Checks whether this game mode is invulnerable -+ * (i.e. is either {@link #CREATIVE} or {@link #SPECTATOR}) -+ * -+ * @return whether this game mode is invulnerable -+ */ -+ public boolean isInvulnerable() { -+ return this == CREATIVE || this == SPECTATOR; -+ } -+ // Paper end - Add GameMode#isInvulnerable - } diff --git a/patches/api/0460-Add-hook-to-remap-library-jars.patch b/patches/api/0460-Add-hook-to-remap-library-jars.patch new file mode 100644 index 0000000000..fe1609629e --- /dev/null +++ b/patches/api/0460-Add-hook-to-remap-library-jars.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Sun, 28 Apr 2024 13:51:08 -0700 +Subject: [PATCH] Add hook to remap library jars + + +diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +index 5b0203e908f84c531886b8ea8faeb591eb045636..8e1b6be2462aaa692efa1f72986921a6dc357196 100644 +--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java +@@ -47,6 +47,7 @@ public class LibraryLoader + private final DefaultRepositorySystemSession session; + private final List repositories; + public static java.util.function.BiFunction LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries ++ public static java.util.function.Function, List> REMAPPER; // Paper - remap libraries + + public LibraryLoader(@NotNull Logger logger) + { +@@ -111,9 +112,18 @@ public class LibraryLoader + } + + List jarFiles = new ArrayList<>(); ++ List jarPaths = new ArrayList<>(); // Paper - remap libraries + for ( ArtifactResult artifact : result.getArtifactResults() ) + { +- File file = artifact.getArtifact().getFile(); ++ // Paper start - remap libraries ++ jarPaths.add(artifact.getArtifact().getFile().toPath()); ++ } ++ if (REMAPPER != null) { ++ jarPaths = REMAPPER.apply(jarPaths); ++ } ++ for (java.nio.file.Path path : jarPaths) { ++ File file = path.toFile(); ++ // Paper end - remap libraries + + URL url; + try diff --git a/patches/api/0461-Add-GameMode-isInvulnerable.patch b/patches/api/0461-Add-GameMode-isInvulnerable.patch new file mode 100644 index 0000000000..b4b81c5f52 --- /dev/null +++ b/patches/api/0461-Add-GameMode-isInvulnerable.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Wed, 1 May 2024 06:56:21 +0300 +Subject: [PATCH] Add GameMode#isInvulnerable + + +diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java +index fdc42a79c5af30fdade41ee99245e6641f353571..ddc56524b3bd2bdebba81c61a5600e6f46a4aaa4 100644 +--- a/src/main/java/org/bukkit/GameMode.java ++++ b/src/main/java/org/bukkit/GameMode.java +@@ -79,4 +79,16 @@ public enum GameMode implements net.kyori.adventure.translation.Translatable { / + BY_ID.put(mode.getValue(), mode); + } + } ++ ++ // Paper start - Add GameMode#isInvulnerable ++ /** ++ * Checks whether this game mode is invulnerable ++ * (i.e. is either {@link #CREATIVE} or {@link #SPECTATOR}) ++ * ++ * @return whether this game mode is invulnerable ++ */ ++ public boolean isInvulnerable() { ++ return this == CREATIVE || this == SPECTATOR; ++ } ++ // Paper end - Add GameMode#isInvulnerable + } diff --git a/patches/api/0461-Expose-hasColor-to-leather-armor.patch b/patches/api/0461-Expose-hasColor-to-leather-armor.patch deleted file mode 100644 index e2c609b4f0..0000000000 --- a/patches/api/0461-Expose-hasColor-to-leather-armor.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 1 May 2024 10:58:50 +0300 -Subject: [PATCH] Expose #hasColor to leather armor - - -diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java -index c701d5fbc5fef503f18a3a46fa54c983bf96e895..2d68f93c371e4a40638f56e5cd4d39472d4e462b 100644 ---- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java -@@ -36,4 +36,13 @@ public interface LeatherArmorMeta extends ItemMeta { - @Override - @NotNull - LeatherArmorMeta clone(); -+ -+ // Paper start - Expose #hasColor to leather armor -+ /** -+ * Checks whether this leather armor is dyed. -+ * -+ * @return whether this leather armor is dyed -+ */ -+ boolean isDyed(); -+ // Paper end - Expose #hasColor to leather armor - } diff --git a/patches/api/0462-Added-API-to-get-player-ha-proxy-address.patch b/patches/api/0462-Added-API-to-get-player-ha-proxy-address.patch deleted file mode 100644 index 79b1804796..0000000000 --- a/patches/api/0462-Added-API-to-get-player-ha-proxy-address.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: nostalfinals -Date: Mon, 8 Apr 2024 23:24:38 +0800 -Subject: [PATCH] Added API to get player ha proxy address - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 20db14b3075d70b34eab16ca6332a2e674b34e75..82e92579f899ab3b86c748ba01860262b8ffa17f 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -267,6 +267,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - @Nullable - public InetSocketAddress getAddress(); - -+ // Paper start - Add API to get player's proxy address -+ /** -+ * Gets the socket address of this player's proxy -+ * -+ * @return the player's proxy address, null if the server doesn't have Proxy Protocol enabled, or the player didn't connect to an HAProxy instance -+ */ -+ @Nullable -+ public InetSocketAddress getHAProxyAddress(); -+ // Paper end - Add API to get player's proxy address -+ - /** - * Gets if this connection has been transferred from another server. - * diff --git a/patches/api/0462-Expose-hasColor-to-leather-armor.patch b/patches/api/0462-Expose-hasColor-to-leather-armor.patch new file mode 100644 index 0000000000..e2c609b4f0 --- /dev/null +++ b/patches/api/0462-Expose-hasColor-to-leather-armor.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Wed, 1 May 2024 10:58:50 +0300 +Subject: [PATCH] Expose #hasColor to leather armor + + +diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java +index c701d5fbc5fef503f18a3a46fa54c983bf96e895..2d68f93c371e4a40638f56e5cd4d39472d4e462b 100644 +--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java +@@ -36,4 +36,13 @@ public interface LeatherArmorMeta extends ItemMeta { + @Override + @NotNull + LeatherArmorMeta clone(); ++ ++ // Paper start - Expose #hasColor to leather armor ++ /** ++ * Checks whether this leather armor is dyed. ++ * ++ * @return whether this leather armor is dyed ++ */ ++ boolean isDyed(); ++ // Paper end - Expose #hasColor to leather armor + } diff --git a/patches/api/0463-Added-API-to-get-player-ha-proxy-address.patch b/patches/api/0463-Added-API-to-get-player-ha-proxy-address.patch new file mode 100644 index 0000000000..79b1804796 --- /dev/null +++ b/patches/api/0463-Added-API-to-get-player-ha-proxy-address.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nostalfinals +Date: Mon, 8 Apr 2024 23:24:38 +0800 +Subject: [PATCH] Added API to get player ha proxy address + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 20db14b3075d70b34eab16ca6332a2e674b34e75..82e92579f899ab3b86c748ba01860262b8ffa17f 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -267,6 +267,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + @Nullable + public InetSocketAddress getAddress(); + ++ // Paper start - Add API to get player's proxy address ++ /** ++ * Gets the socket address of this player's proxy ++ * ++ * @return the player's proxy address, null if the server doesn't have Proxy Protocol enabled, or the player didn't connect to an HAProxy instance ++ */ ++ @Nullable ++ public InetSocketAddress getHAProxyAddress(); ++ // Paper end - Add API to get player's proxy address ++ + /** + * Gets if this connection has been transferred from another server. + * diff --git a/patches/api/0463-More-Chest-Block-API.patch b/patches/api/0463-More-Chest-Block-API.patch deleted file mode 100644 index 1fc3614c74..0000000000 --- a/patches/api/0463-More-Chest-Block-API.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 1 May 2024 08:22:13 +0300 -Subject: [PATCH] More Chest Block API - - -diff --git a/src/main/java/org/bukkit/block/Chest.java b/src/main/java/org/bukkit/block/Chest.java -index db6affbc78106b2d93b41953b624a0bca0ca1d72..5d02f9c938d0d7d0f4e491ccfaf6beb0a7a61aa4 100644 ---- a/src/main/java/org/bukkit/block/Chest.java -+++ b/src/main/java/org/bukkit/block/Chest.java -@@ -27,4 +27,14 @@ public interface Chest extends Container, LootableBlockInventory, Lidded { // Pa - */ - @NotNull - Inventory getBlockInventory(); -+ -+ // Paper start - More Chest Block API -+ /** -+ * Checks whether this chest is blocked -+ * by either a block above or a sitting cat -+ * -+ * @return whether this chest is blocked -+ */ -+ boolean isBlocked(); -+ // Paper end - More Chest Block API - } -diff --git a/src/main/java/org/bukkit/block/EnderChest.java b/src/main/java/org/bukkit/block/EnderChest.java -index 1150b449a3f5c40fe10136779c2ccc65ab4d884c..6b66f38e5509f90aad5ee1fffca01003dcbe9896 100644 ---- a/src/main/java/org/bukkit/block/EnderChest.java -+++ b/src/main/java/org/bukkit/block/EnderChest.java -@@ -3,4 +3,13 @@ package org.bukkit.block; - /** - * Represents a captured state of an ender chest. - */ --public interface EnderChest extends Lidded, TileState { } -+public interface EnderChest extends Lidded, TileState { -+ // Paper start - More Chest Block API -+ /** -+ * Checks whether this ender chest is blocked by a block above -+ * -+ * @return whether this ender chest is blocked -+ */ -+ boolean isBlocked(); -+ // Paper end - More Chest Block API -+} diff --git a/patches/api/0464-Brigadier-based-command-API.patch b/patches/api/0464-Brigadier-based-command-API.patch deleted file mode 100644 index 2d29373bc2..0000000000 --- a/patches/api/0464-Brigadier-based-command-API.patch +++ /dev/null @@ -1,2073 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Mon, 1 Aug 2022 22:50:29 -0400 -Subject: [PATCH] Brigadier based command API - -Co-authored-by: Jake Potrebic - -diff --git a/build.gradle.kts b/build.gradle.kts -index 6c8464d9e862b1b4dbf7a77e25446aa870803dae..254fd96d3950b4494c7e43547b00b5175ee53c93 100644 ---- a/build.gradle.kts -+++ b/build.gradle.kts -@@ -27,6 +27,7 @@ configurations.api { - } - - dependencies { -+ api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api - // api dependencies are listed transitively to API consumers - api("com.google.guava:guava:32.1.2-jre") - api("com.google.code.gson:gson:2.10.1") -@@ -93,9 +94,33 @@ sourceSets { - } - } - // Paper end -+// Paper start - brigadier API -+val outgoingVariants = arrayOf("runtimeElements", "apiElements", "sourcesElements", "javadocElements") -+val mainCapability = "${project.group}:${project.name}:${project.version}" -+configurations { -+ val outgoing = outgoingVariants.map { named(it) } -+ for (config in outgoing) { -+ config { -+ attributes { -+ attribute(io.papermc.paperweight.util.mainCapabilityAttribute, mainCapability) -+ } -+ outgoing { -+ capability(mainCapability) -+ capability("io.papermc.paper:paper-mojangapi:${project.version}") -+ capability("com.destroystokyo.paper:paper-mojangapi:${project.version}") -+ } -+ } -+ } -+} -+// Paper end - - configure { - publications.create("maven") { -+ // Paper start - brigadier API -+ outgoingVariants.forEach { -+ suppressPomMetadataWarningsFor(it) -+ } -+ // Paper end - from(components["java"]) - } - } -diff --git a/src/main/java/com/destroystokyo/paper/brigadier/BukkitBrigadierCommand.java b/src/main/java/com/destroystokyo/paper/brigadier/BukkitBrigadierCommand.java -new file mode 100644 -index 0000000000000000000000000000000000000000..03a1078446f84b998cd7fe8d64abecb2e36bab0a ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/brigadier/BukkitBrigadierCommand.java -@@ -0,0 +1,16 @@ -+package com.destroystokyo.paper.brigadier; -+ -+import com.mojang.brigadier.Command; -+import com.mojang.brigadier.suggestion.SuggestionProvider; -+ -+import java.util.function.Predicate; -+ -+/** -+ * Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s. -+ * -+ * @param command source type -+ * @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API. -+ */ -+@Deprecated(forRemoval = true, since = "1.20.6") -+public interface BukkitBrigadierCommand extends Command, Predicate, SuggestionProvider { -+} -diff --git a/src/main/java/com/destroystokyo/paper/brigadier/BukkitBrigadierCommandSource.java b/src/main/java/com/destroystokyo/paper/brigadier/BukkitBrigadierCommandSource.java -new file mode 100644 -index 0000000000000000000000000000000000000000..28b44789e3be586c4b680fff56e5d2ff095f9ac2 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/brigadier/BukkitBrigadierCommandSource.java -@@ -0,0 +1,25 @@ -+package com.destroystokyo.paper.brigadier; -+ -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.command.CommandSender; -+import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * @deprecated For removal, see {@link io.papermc.paper.command.brigadier.Commands} on how to use the new Brigadier API. -+ */ -+@Deprecated(forRemoval = true) -+public interface BukkitBrigadierCommandSource { -+ -+ @Nullable -+ Entity getBukkitEntity(); -+ -+ @Nullable -+ World getBukkitWorld(); -+ -+ @Nullable -+ Location getBukkitLocation(); -+ -+ CommandSender getBukkitSender(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java b/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9e1b70d438c4341ec944503b5bbe6b1f08bc0478 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendCommandsEvent.java -@@ -0,0 +1,73 @@ -+package com.destroystokyo.paper.event.brigadier; -+ -+import com.mojang.brigadier.tree.RootCommandNode; -+import io.papermc.paper.command.brigadier.CommandSourceStack; -+import org.bukkit.Bukkit; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands. -+ * You may manipulate this CommandNode to change what the client sees. -+ * -+ *

This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.

-+ * -+ *

This event will fire before {@link org.bukkit.event.player.PlayerCommandSendEvent}, so no filtering has been done by -+ * other plugins yet.

-+ * -+ *

WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync. -+ * It is important that you check event.isAsynchronous() and event.hasFiredAsync() to ensure you only act once. -+ * If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.

-+ * -+ *

Your logic should look like this: -+ * {@code if (event.isAsynchronous() || !event.hasFiredAsync()) { // do stuff }}

-+ * -+ *

If your logic is not safe to run asynchronously, only react to the synchronous version.

-+ * -+ *

This is a draft/experimental API and is subject to change.

-+ */ -+@ApiStatus.Experimental -+@NullMarked -+public class AsyncPlayerSendCommandsEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ private final RootCommandNode node; -+ private final boolean hasFiredAsync; -+ -+ @ApiStatus.Internal -+ public AsyncPlayerSendCommandsEvent(final Player player, final RootCommandNode node, final boolean hasFiredAsync) { -+ super(player, !Bukkit.isPrimaryThread()); -+ this.node = node; -+ this.hasFiredAsync = hasFiredAsync; -+ } -+ -+ /** -+ * Gets the full Root Command Node being sent to the client, which is mutable. -+ * -+ * @return the root command node -+ */ -+ public RootCommandNode getCommandNode() { -+ return this.node; -+ } -+ -+ /** -+ * Gets if this event has already fired asynchronously. -+ * -+ * @return whether this event has already fired asynchronously -+ */ -+ public boolean hasFiredAsync() { -+ return this.hasFiredAsync; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java b/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..faade9d35514687f21a0e8b62fa2e392d4ad238a ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/brigadier/AsyncPlayerSendSuggestionsEvent.java -@@ -0,0 +1,85 @@ -+package com.destroystokyo.paper.event.brigadier; -+ -+import com.mojang.brigadier.suggestion.Suggestions; -+import org.bukkit.Bukkit; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Called when sending {@link Suggestions} to the client. Will be called asynchronously if a plugin -+ * marks the {@link com.destroystokyo.paper.event.server.AsyncTabCompleteEvent} event handled asynchronously, -+ * otherwise called synchronously. -+ */ -+@NullMarked -+public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ private boolean cancelled = false; -+ -+ private Suggestions suggestions; -+ private final String buffer; -+ -+ @ApiStatus.Internal -+ public AsyncPlayerSendSuggestionsEvent(final Player player, final Suggestions suggestions, final String buffer) { -+ super(player, !Bukkit.isPrimaryThread()); -+ this.suggestions = suggestions; -+ this.buffer = buffer; -+ } -+ -+ /** -+ * Gets the input buffer sent to request these suggestions. -+ * -+ * @return the input buffer -+ */ -+ public String getBuffer() { -+ return this.buffer; -+ } -+ -+ /** -+ * Gets the suggestions to be sent to client. -+ * -+ * @return the suggestions -+ */ -+ public Suggestions getSuggestions() { -+ return this.suggestions; -+ } -+ -+ /** -+ * Sets the suggestions to be sent to client. -+ * -+ * @param suggestions suggestions -+ */ -+ public void setSuggestions(final Suggestions suggestions) { -+ this.suggestions = suggestions; -+ } -+ -+ /** -+ * {@inheritDoc} -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Cancels sending suggestions to the client. -+ * {@inheritDoc} -+ */ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java b/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..acc2bd2ec56e64b9d4bd8677d99448a97ecb5201 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/brigadier/CommandRegisteredEvent.java -@@ -0,0 +1,171 @@ -+package com.destroystokyo.paper.event.brigadier; -+ -+import com.destroystokyo.paper.brigadier.BukkitBrigadierCommand; -+import com.mojang.brigadier.tree.ArgumentCommandNode; -+import com.mojang.brigadier.tree.LiteralCommandNode; -+import com.mojang.brigadier.tree.RootCommandNode; -+import org.bukkit.Warning; -+import org.bukkit.command.Command; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.server.ServerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired anytime the server synchronizes Bukkit commands to Brigadier. -+ * -+ *

Allows a plugin to control the command node structure for its commands. -+ * This is done at Plugin Enable time after commands have been registered, but may also -+ * run at a later point in the server lifetime due to plugins, a server reload, etc.

-+ * -+ *

This is a draft/experimental API and is subject to change.

-+ * @deprecated For removal, use the new brigadier api. -+ */ -+@ApiStatus.Experimental -+@Deprecated(since = "1.20.6") -+@Warning(reason = "This event has been superseded by the Commands API and will be removed in a future release. Listen to LifecycleEvents.COMMANDS instead.", value = true) -+public class CommandRegisteredEvent extends ServerEvent implements Cancellable { -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private final String commandLabel; -+ private final Command command; -+ private final com.destroystokyo.paper.brigadier.BukkitBrigadierCommand brigadierCommand; -+ private final RootCommandNode root; -+ private final ArgumentCommandNode defaultArgs; -+ private LiteralCommandNode literal; -+ private boolean rawCommand = false; -+ private boolean cancelled = false; -+ -+ public CommandRegisteredEvent(String commandLabel, com.destroystokyo.paper.brigadier.BukkitBrigadierCommand brigadierCommand, Command command, RootCommandNode root, LiteralCommandNode literal, ArgumentCommandNode defaultArgs) { -+ this.commandLabel = commandLabel; -+ this.brigadierCommand = brigadierCommand; -+ this.command = command; -+ this.root = root; -+ this.literal = literal; -+ this.defaultArgs = defaultArgs; -+ } -+ -+ /** -+ * Gets the command label of the {@link Command} being registered. -+ * -+ * @return the command label -+ */ -+ public String getCommandLabel() { -+ return this.commandLabel; -+ } -+ -+ /** -+ * Gets the {@link BukkitBrigadierCommand} for the {@link Command} being registered. This can be used -+ * as the {@link com.mojang.brigadier.Command command executor} or -+ * {@link com.mojang.brigadier.suggestion.SuggestionProvider} of a {@link com.mojang.brigadier.tree.CommandNode} -+ * to delegate to the {@link Command} being registered. -+ * -+ * @return the {@link BukkitBrigadierCommand} -+ */ -+ public BukkitBrigadierCommand getBrigadierCommand() { -+ return this.brigadierCommand; -+ } -+ -+ /** -+ * Gets the {@link Command} being registered. -+ * -+ * @return the {@link Command} -+ */ -+ public Command getCommand() { -+ return this.command; -+ } -+ -+ /** -+ * Gets the {@link RootCommandNode} which is being registered to. -+ * -+ * @return the {@link RootCommandNode} -+ */ -+ public RootCommandNode getRoot() { -+ return this.root; -+ } -+ -+ /** -+ * Gets the Bukkit APIs default arguments node (greedy string), for if -+ * you wish to reuse it. -+ * -+ * @return default arguments node -+ */ -+ public ArgumentCommandNode getDefaultArgs() { -+ return this.defaultArgs; -+ } -+ -+ /** -+ * Gets the {@link LiteralCommandNode} to be registered for the {@link Command}. -+ * -+ * @return the {@link LiteralCommandNode} -+ */ -+ public LiteralCommandNode getLiteral() { -+ return this.literal; -+ } -+ -+ /** -+ * Sets the {@link LiteralCommandNode} used to register this command. The default literal is mutable, so -+ * this is primarily if you want to completely replace the object. -+ * -+ * @param literal new node -+ */ -+ public void setLiteral(LiteralCommandNode literal) { -+ this.literal = literal; -+ } -+ -+ /** -+ * Gets whether this command should is treated as "raw". -+ * -+ * @see #setRawCommand(boolean) -+ * @return whether this command is treated as "raw" -+ */ -+ public boolean isRawCommand() { -+ return this.rawCommand; -+ } -+ -+ /** -+ * Sets whether this command should be treated as "raw". -+ * -+ *

A "raw" command will only use the node provided by this event for -+ * sending the command tree to the client. For execution purposes, the default -+ * greedy string execution of a standard Bukkit {@link Command} is used.

-+ * -+ *

On older versions of Paper, this was the default and only behavior of this -+ * event.

-+ * -+ * @param rawCommand whether this command should be treated as "raw" -+ */ -+ public void setRawCommand(final boolean rawCommand) { -+ this.rawCommand = rawCommand; -+ } -+ -+ /** -+ * {@inheritDoc} -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Cancels registering this command to Brigadier, but will remain in Bukkit Command Map. Can be used to hide a -+ * command from all players. -+ * -+ * {@inheritDoc} -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/brigadier/PaperBrigadier.java b/src/main/java/io/papermc/paper/brigadier/PaperBrigadier.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9df87708206e26167a2c4934deff7fc6f1657106 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/brigadier/PaperBrigadier.java -@@ -0,0 +1,47 @@ -+package io.papermc.paper.brigadier; -+ -+import com.mojang.brigadier.Message; -+import io.papermc.paper.command.brigadier.MessageComponentSerializer; -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.ComponentLike; -+import net.kyori.adventure.text.TextComponent; -+import org.checkerframework.checker.nullness.qual.NonNull; -+ -+/** -+ * Helper methods to bridge the gaps between Brigadier and Paper-MojangAPI. -+ * @deprecated for removal. See {@link MessageComponentSerializer} for a direct replacement of functionality found in -+ * this class. -+ * As a general entrypoint to brigadier on paper, see {@link io.papermc.paper.command.brigadier.Commands}. -+ */ -+@Deprecated(forRemoval = true, since = "1.20.6") -+public final class PaperBrigadier { -+ private PaperBrigadier() { -+ throw new RuntimeException("PaperBrigadier is not to be instantiated!"); -+ } -+ -+ /** -+ * Create a new Brigadier {@link Message} from a {@link ComponentLike}. -+ * -+ *

Mostly useful for creating rich suggestion tooltips in combination with other Paper-MojangAPI APIs.

-+ * -+ * @param componentLike The {@link ComponentLike} to use for the {@link Message} contents -+ * @return A new Brigadier {@link Message} -+ */ -+ public static @NonNull Message message(final @NonNull ComponentLike componentLike) { -+ return MessageComponentSerializer.message().serialize(componentLike.asComponent()); -+ } -+ -+ /** -+ * Create a new {@link Component} from a Brigadier {@link Message}. -+ * -+ *

If the {@link Message} was created from a {@link Component}, it will simply be -+ * converted back, otherwise a new {@link TextComponent} will be created with the -+ * content of {@link Message#getString()}

-+ * -+ * @param message The {@link Message} to create a {@link Component} from -+ * @return The created {@link Component} -+ */ -+ public static @NonNull Component componentFromMessage(final @NonNull Message message) { -+ return MessageComponentSerializer.message().deserialize(message); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c89d6c4c38e2390cb11ffba182f8741d3726cfd1 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java -@@ -0,0 +1,62 @@ -+package io.papermc.paper.command.brigadier; -+ -+import java.util.Collection; -+import java.util.Collections; -+import org.bukkit.command.CommandSender; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * Implementing this interface allows for easily creating "Bukkit-style" {@code String[] args} commands. -+ * The implementation handles converting the command to a representation compatible with Brigadier on registration, usually in the form of {@literal /commandlabel }. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@FunctionalInterface -+public interface BasicCommand { -+ -+ /** -+ * Executes the command with the given {@link CommandSourceStack} and arguments. -+ * -+ * @param commandSourceStack the commandSourceStack of the command -+ * @param args the arguments of the command ignoring repeated spaces -+ */ -+ @ApiStatus.OverrideOnly -+ void execute(CommandSourceStack commandSourceStack, String[] args); -+ -+ /** -+ * Suggests possible completions for the given command {@link CommandSourceStack} and arguments. -+ * -+ * @param commandSourceStack the commandSourceStack of the command -+ * @param args the arguments of the command including repeated spaces -+ * @return a collection of suggestions -+ */ -+ @ApiStatus.OverrideOnly -+ default Collection suggest(final CommandSourceStack commandSourceStack, final String[] args) { -+ return Collections.emptyList(); -+ } -+ -+ /** -+ * Checks whether a command sender can receive and run the root command. -+ * -+ * @param sender the command sender trying to execute the command -+ * @return whether the command sender fulfills the root command requirement -+ * @see #permission() -+ */ -+ @ApiStatus.OverrideOnly -+ default boolean canUse(final CommandSender sender) { -+ final String permission = this.permission(); -+ return permission == null || sender.hasPermission(permission); -+ } -+ -+ /** -+ * Returns the permission for the root command used in {@link #canUse(CommandSender)} by default. -+ * -+ * @return the permission for the root command used in {@link #canUse(CommandSender)} -+ */ -+ @ApiStatus.OverrideOnly -+ default @Nullable String permission() { -+ return null; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/CommandRegistrationFlag.java b/src/main/java/io/papermc/paper/command/brigadier/CommandRegistrationFlag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7e24babf746de474c8deec4b147e22031e8dadb2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/CommandRegistrationFlag.java -@@ -0,0 +1,14 @@ -+package io.papermc.paper.command.brigadier; -+ -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * A {@link CommandRegistrationFlag} is used in {@link Commands} registration for internal purposes. -+ *

-+ * A command library may use this to achieve more specific customization on how their commands are registered. -+ * @apiNote Stability of these flags is not promised! This api is not intended for public use. -+ */ -+@ApiStatus.Internal -+public enum CommandRegistrationFlag { -+ FLATTEN_ALIASES -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/CommandSourceStack.java b/src/main/java/io/papermc/paper/command/brigadier/CommandSourceStack.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ac6f5b754a15e85ce09de4ed4cdee2044b45022c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/CommandSourceStack.java -@@ -0,0 +1,51 @@ -+package io.papermc.paper.command.brigadier; -+ -+import org.bukkit.Location; -+import org.bukkit.command.CommandSender; -+import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * The command source type for Brigadier commands registered using Paper API. -+ *

-+ * While the general use case for CommandSourceStack is similar to that of {@link CommandSender}, it provides access to -+ * important additional context for the command execution. -+ * Specifically, commands such as {@literal /execute} may alter the location or executor of the source stack before -+ * passing it to another command. -+ *

The {@link CommandSender} returned by {@link #getSender()} may be a "no-op" -+ * instance of {@link CommandSender} in cases where the server either doesn't -+ * exist yet, or no specific sender is available. Methods on such a {@link CommandSender} -+ * will either have no effect or throw an {@link UnsupportedOperationException}.

-+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface CommandSourceStack { -+ -+ /** -+ * Gets the location that this command is being executed at. -+ * -+ * @return a cloned location instance. -+ */ -+ Location getLocation(); -+ -+ /** -+ * Gets the command sender that executed this command. -+ * The sender of a command source stack is the one that initiated/triggered the execution of a command. -+ * It differs to {@link #getExecutor()} as the executor can be changed by a command, e.g. {@literal /execute}. -+ * -+ * @return the command sender instance -+ */ -+ CommandSender getSender(); -+ -+ /** -+ * Gets the entity that executes this command. -+ * May not always be {@link #getSender()} as the executor of a command can be changed to a different entity -+ * than the one that triggered the command. -+ * -+ * @return entity that executes this command -+ */ -+ @Nullable Entity getExecutor(); -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/Commands.java b/src/main/java/io/papermc/paper/command/brigadier/Commands.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e32559772a39af781d89de101b3f7483a339e317 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/Commands.java -@@ -0,0 +1,267 @@ -+package io.papermc.paper.command.brigadier; -+ -+import com.mojang.brigadier.CommandDispatcher; -+import com.mojang.brigadier.arguments.ArgumentType; -+import com.mojang.brigadier.builder.LiteralArgumentBuilder; -+import com.mojang.brigadier.builder.RequiredArgumentBuilder; -+import com.mojang.brigadier.tree.LiteralCommandNode; -+import io.papermc.paper.plugin.bootstrap.BootstrapContext; -+import io.papermc.paper.plugin.bootstrap.PluginBootstrap; -+import io.papermc.paper.plugin.configuration.PluginMeta; -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; -+import io.papermc.paper.plugin.lifecycle.event.registrar.Registrar; -+import java.util.Collection; -+import java.util.Collections; -+import java.util.Set; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Unmodifiable; -+import org.jspecify.annotations.NullMarked; -+import org.jspecify.annotations.Nullable; -+ -+/** -+ * The registrar for custom commands. Supports Brigadier commands and {@link BasicCommand}. -+ *

-+ * An example of a command being registered is below -+ *

{@code
-+ * class YourPluginClass extends JavaPlugin {
-+ *
-+ *     @Override
-+ *     public void onEnable() {
-+ *         LifecycleEventManager manager = this.getLifecycleManager();
-+ *         manager.registerEventHandler(LifecycleEvents.COMMANDS, event -> {
-+ *             final Commands commands = event.registrar();
-+ *             commands.register(
-+ *                 Commands.literal("new-command")
-+ *                     .executes(ctx -> {
-+ *                         ctx.getSource().getSender().sendPlainMessage("some message");
-+ *                         return Command.SINGLE_SUCCESS;
-+ *                     })
-+ *                     .build(),
-+ *                 "some bukkit help description string",
-+ *                 List.of("an-alias")
-+ *             );
-+ *         });
-+ *     }
-+ * }
-+ * }
-+ *

-+ * You can also register commands in {@link PluginBootstrap} by getting the {@link LifecycleEventManager} from -+ * {@link BootstrapContext}. -+ * Commands registered in the {@link PluginBootstrap} will be available for datapack's -+ * command function parsing. -+ * Note that commands registered via {@link PluginBootstrap} with the same literals as a vanilla command will override -+ * that command within all loaded datapacks. -+ *

-+ *

The {@code register} methods that do not have {@link PluginMeta} as a parameter will -+ * implicitly use the {@link PluginMeta} for the plugin that the {@link io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler} -+ * was registered with.

-+ * -+ * @see io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#COMMANDS -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface Commands extends Registrar { -+ -+ /** -+ * Utility to create a literal command node builder with the correct generic. -+ * -+ * @param literal literal name -+ * @return a new builder instance -+ */ -+ static LiteralArgumentBuilder literal(final String literal) { -+ return LiteralArgumentBuilder.literal(literal); -+ } -+ -+ /** -+ * Utility to create a required argument builder with the correct generic. -+ * -+ * @param name the name of the argument -+ * @param argumentType the type of the argument -+ * @param the generic type of the argument value -+ * @return a new required argument builder -+ */ -+ static RequiredArgumentBuilder argument(final String name, final ArgumentType argumentType) { -+ return RequiredArgumentBuilder.argument(name, argumentType); -+ } -+ -+ /** -+ * Gets the underlying {@link CommandDispatcher}. -+ * -+ *

Note: This is a delicate API that must be used with care to ensure a consistent user experience.

-+ * -+ *

When registering commands, it should be preferred to use the {@link #register(PluginMeta, LiteralCommandNode, String, Collection) register methods} -+ * over directly registering to the dispatcher wherever possible. -+ * {@link #register(PluginMeta, LiteralCommandNode, String, Collection) Register methods} automatically handle -+ * command namespacing, command help, plugin association with commands, and more.

-+ * -+ *

Example use cases for this method may include: -+ *

    -+ *
  • Implementing integration between an external command framework and Paper (although {@link #register(PluginMeta, LiteralCommandNode, String, Collection) register methods} should still be preferred where possible)
  • -+ *
  • Registering new child nodes to an existing plugin command (for example an "addon" plugin to another plugin may want to do this)
  • -+ *
  • Retrieving existing command nodes to build redirects
  • -+ *
-+ * -+ * @return the dispatcher instance -+ */ -+ @ApiStatus.Experimental -+ CommandDispatcher getDispatcher(); -+ -+ /** -+ * Registers a command for the current plugin context. -+ * -+ *

Commands have certain overriding behavior: -+ *

    -+ *
  • Aliases will not override already existing commands (excluding namespaced ones)
  • -+ *
  • The main command/namespaced label will override already existing commands
  • -+ *
-+ * -+ * @param node the built literal command node -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ default @Unmodifiable Set register(final LiteralCommandNode node) { -+ return this.register(node, null, Collections.emptyList()); -+ } -+ -+ /** -+ * Registers a command for the current plugin context. -+ * -+ *

Commands have certain overriding behavior: -+ *

    -+ *
  • Aliases will not override already existing commands (excluding namespaced ones)
  • -+ *
  • The main command/namespaced label will override already existing commands
  • -+ *
-+ * -+ * @param node the built literal command node -+ * @param description the help description for the root literal node -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ default @Unmodifiable Set register(final LiteralCommandNode node, final @Nullable String description) { -+ return this.register(node, description, Collections.emptyList()); -+ } -+ -+ /** -+ * Registers a command for the current plugin context. -+ * -+ *

Commands have certain overriding behavior: -+ *

    -+ *
  • Aliases will not override already existing commands (excluding namespaced ones)
  • -+ *
  • The main command/namespaced label will override already existing commands
  • -+ *
-+ * -+ * @param node the built literal command node -+ * @param aliases a collection of aliases to register the literal node's command to -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ default @Unmodifiable Set register(final LiteralCommandNode node, final Collection aliases) { -+ return this.register(node, null, aliases); -+ } -+ -+ /** -+ * Registers a command for the current plugin context. -+ * -+ *

Commands have certain overriding behavior: -+ *

    -+ *
  • Aliases will not override already existing commands (excluding namespaced ones)
  • -+ *
  • The main command/namespaced label will override already existing commands
  • -+ *
-+ * -+ * @param node the built literal command node -+ * @param description the help description for the root literal node -+ * @param aliases a collection of aliases to register the literal node's command to -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ @Unmodifiable Set register(LiteralCommandNode node, @Nullable String description, Collection aliases); -+ -+ /** -+ * Registers a command for a plugin. -+ * -+ *

Commands have certain overriding behavior: -+ *

    -+ *
  • Aliases will not override already existing commands (excluding namespaced ones)
  • -+ *
  • The main command/namespaced label will override already existing commands
  • -+ *
-+ * -+ * @param pluginMeta the owning plugin's meta -+ * @param node the built literal command node -+ * @param description the help description for the root literal node -+ * @param aliases a collection of aliases to register the literal node's command to -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ @Unmodifiable Set register(PluginMeta pluginMeta, LiteralCommandNode node, @Nullable String description, Collection aliases); -+ -+ /** -+ * This allows configuring the registration of your command, which is not intended for public use. -+ * See {@link Commands#register(PluginMeta, LiteralCommandNode, String, Collection)} for more information. -+ * -+ * @param pluginMeta the owning plugin's meta -+ * @param node the built literal command node -+ * @param description the help description for the root literal node -+ * @param aliases a collection of aliases to register the literal node's command to -+ * @param flags a collection of registration flags that control registration behaviour. -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ * -+ * @apiNote This method is not guaranteed to be stable as it is not intended for public use. -+ * See {@link CommandRegistrationFlag} for a more indepth explanation of this method's use-case. -+ */ -+ @ApiStatus.Internal -+ @Unmodifiable Set registerWithFlags(PluginMeta pluginMeta, LiteralCommandNode node, @Nullable String description, Collection aliases, Set flags); -+ -+ /** -+ * Registers a command under the same logic as {@link Commands#register(LiteralCommandNode, String, Collection)}. -+ * -+ * @param label the label of the to-be-registered command -+ * @param basicCommand the basic command instance to register -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ default @Unmodifiable Set register(final String label, final BasicCommand basicCommand) { -+ return this.register(label, null, Collections.emptyList(), basicCommand); -+ } -+ -+ /** -+ * Registers a command under the same logic as {@link Commands#register(LiteralCommandNode, String, Collection)}. -+ * -+ * @param label the label of the to-be-registered command -+ * @param description the help description for the root literal node -+ * @param basicCommand the basic command instance to register -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ default @Unmodifiable Set register(final String label, final @Nullable String description, final BasicCommand basicCommand) { -+ return this.register(label, description, Collections.emptyList(), basicCommand); -+ } -+ -+ /** -+ * Registers a command under the same logic as {@link Commands#register(LiteralCommandNode, String, Collection)}. -+ * -+ * @param label the label of the to-be-registered command -+ * @param aliases a collection of aliases to register the basic command under. -+ * @param basicCommand the basic command instance to register -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ default @Unmodifiable Set register(final String label, final Collection aliases, final BasicCommand basicCommand) { -+ return this.register(label, null, aliases, basicCommand); -+ } -+ -+ /** -+ * Registers a command under the same logic as {@link Commands#register(LiteralCommandNode, String, Collection)}. -+ * -+ * @param label the label of the to-be-registered command -+ * @param description the help description for the root literal node -+ * @param aliases a collection of aliases to register the basic command under. -+ * @param basicCommand the basic command instance to register -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ @Unmodifiable Set register(String label, @Nullable String description, Collection aliases, BasicCommand basicCommand); -+ -+ /** -+ * Registers a command under the same logic as {@link Commands#register(PluginMeta, LiteralCommandNode, String, Collection)}. -+ * -+ * @param pluginMeta the owning plugin's meta -+ * @param label the label of the to-be-registered command -+ * @param description the help description for the root literal node -+ * @param aliases a collection of aliases to register the basic command under. -+ * @param basicCommand the basic command instance to register -+ * @return successfully registered root command labels (including aliases and namespaced variants) -+ */ -+ @Unmodifiable Set register(PluginMeta pluginMeta, String label, @Nullable String description, Collection aliases, BasicCommand basicCommand); -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/MessageComponentSerializer.java b/src/main/java/io/papermc/paper/command/brigadier/MessageComponentSerializer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..19f3dc12426be09613a13b5889f77627a81305f4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/MessageComponentSerializer.java -@@ -0,0 +1,25 @@ -+package io.papermc.paper.command.brigadier; -+ -+import com.mojang.brigadier.Message; -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.serializer.ComponentSerializer; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * A component serializer for converting between {@link Message} and {@link Component}. -+ */ -+@ApiStatus.Experimental -+@NullMarked -+@ApiStatus.NonExtendable -+public interface MessageComponentSerializer extends ComponentSerializer { -+ -+ /** -+ * A component serializer for converting between {@link Message} and {@link Component}. -+ * -+ * @return serializer instance -+ */ -+ static MessageComponentSerializer message() { -+ return MessageComponentSerializerHolder.PROVIDER.orElseThrow(); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/MessageComponentSerializerHolder.java b/src/main/java/io/papermc/paper/command/brigadier/MessageComponentSerializerHolder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2db12952461c92a64505d6646f6f49f824e83050 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/MessageComponentSerializerHolder.java -@@ -0,0 +1,12 @@ -+package io.papermc.paper.command.brigadier; -+ -+import java.util.Optional; -+import java.util.ServiceLoader; -+import org.jetbrains.annotations.ApiStatus; -+ -+@ApiStatus.Internal -+final class MessageComponentSerializerHolder { -+ -+ static final Optional PROVIDER = ServiceLoader.load(MessageComponentSerializer.class) -+ .findFirst(); -+} -diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java b/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9abb9ff33672036bb548c688c5661dc8f237aae2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java -@@ -0,0 +1,371 @@ -+package io.papermc.paper.command.brigadier.argument; -+ -+import com.mojang.brigadier.arguments.ArgumentType; -+import io.papermc.paper.command.brigadier.argument.predicate.ItemStackPredicate; -+import io.papermc.paper.command.brigadier.argument.range.DoubleRangeProvider; -+import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider; -+import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver; -+import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver; -+import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver; -+import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver; -+import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver; -+import io.papermc.paper.entity.LookAnchor; -+import io.papermc.paper.registry.RegistryKey; -+import io.papermc.paper.registry.TypedKey; -+import java.util.UUID; -+import net.kyori.adventure.key.Key; -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.format.NamedTextColor; -+import net.kyori.adventure.text.format.Style; -+import org.bukkit.GameMode; -+import org.bukkit.HeightMap; -+import org.bukkit.NamespacedKey; -+import org.bukkit.World; -+import org.bukkit.block.BlockState; -+import org.bukkit.block.structure.Mirror; -+import org.bukkit.block.structure.StructureRotation; -+import org.bukkit.inventory.ItemStack; -+import org.bukkit.scoreboard.Criteria; -+import org.bukkit.scoreboard.DisplaySlot; -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+import static io.papermc.paper.command.brigadier.argument.VanillaArgumentProvider.provider; -+ -+/** -+ * Vanilla Minecraft includes several custom {@link ArgumentType}s that are recognized by the client. -+ * Many of these argument types include client-side completions and validation, and some include command signing context. -+ * -+ *

This class allows creating instances of these types for use in plugin commands, with friendly API result types.

-+ * -+ *

{@link CustomArgumentType} is provided for customizing parsing or result types server-side, while sending the vanilla argument type to the client.

-+ */ -+@ApiStatus.Experimental -+@NullMarked -+public final class ArgumentTypes { -+ -+ /** -+ * Represents a selector that can capture any -+ * single entity. -+ * -+ * @return argument that takes one entity -+ */ -+ public static ArgumentType entity() { -+ return provider().entity(); -+ } -+ -+ /** -+ * Represents a selector that can capture multiple -+ * entities. -+ * -+ * @return argument that takes multiple entities -+ */ -+ public static ArgumentType entities() { -+ return provider().entities(); -+ } -+ -+ /** -+ * Represents a selector that can capture a -+ * singular player entity. -+ * -+ * @return argument that takes one player -+ */ -+ public static ArgumentType player() { -+ return provider().player(); -+ } -+ -+ /** -+ * Represents a selector that can capture multiple -+ * player entities. -+ * -+ * @return argument that takes multiple players -+ */ -+ public static ArgumentType players() { -+ return provider().players(); -+ } -+ -+ /** -+ * A selector argument that provides a list -+ * of player profiles. -+ * -+ * @return player profile argument -+ */ -+ public static ArgumentType playerProfiles() { -+ return provider().playerProfiles(); -+ } -+ -+ /** -+ * A block position argument. -+ * -+ * @return block position argument -+ */ -+ public static ArgumentType blockPosition() { -+ return provider().blockPosition(); -+ } -+ -+ /** -+ * A fine position argument. -+ * -+ * @return fine position argument -+ * @see #finePosition(boolean) to center whole numbers -+ */ -+ public static ArgumentType finePosition() { -+ return finePosition(false); -+ } -+ -+ /** -+ * A fine position argument. -+ * -+ * @param centerIntegers if whole numbers should be centered (+0.5) -+ * @return fine position argument -+ */ -+ public static ArgumentType finePosition(final boolean centerIntegers) { -+ return provider().finePosition(centerIntegers); -+ } -+ -+ /** -+ * A blockstate argument which will provide rich parsing for specifying -+ * the specific block variant and then the block entity NBT if applicable. -+ * -+ * @return argument -+ */ -+ public static ArgumentType blockState() { -+ return provider().blockState(); -+ } -+ -+ /** -+ * An ItemStack argument which provides rich parsing for -+ * specifying item material and item NBT information. -+ * -+ * @return argument -+ */ -+ public static ArgumentType itemStack() { -+ return provider().itemStack(); -+ } -+ -+ /** -+ * An item predicate argument. -+ * -+ * @return argument -+ */ -+ public static ArgumentType itemPredicate() { -+ return provider().itemStackPredicate(); -+ } -+ -+ /** -+ * An argument for parsing {@link NamedTextColor}s. -+ * -+ * @return argument -+ */ -+ public static ArgumentType namedColor() { -+ return provider().namedColor(); -+ } -+ -+ /** -+ * A component argument. -+ * -+ * @return argument -+ */ -+ public static ArgumentType component() { -+ return provider().component(); -+ } -+ -+ /** -+ * A style argument. -+ * -+ * @return argument -+ */ -+ public static ArgumentType